Operating Systems: Processes

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

Which of the following best describes a 'process' in the context of operating systems?

  • A set of computer hardware components.
  • A program in execution, with its associated resources. (correct)
  • A section of code within a program that performs a specific task.
  • A type of file that stores data.

In what order must process execution progress?

  • Parallel fashion
  • Concurrent fashion
  • Sequential fashion (correct)
  • Random fashion

Which of the following is NOT typically included within a process?

  • Stack
  • Operating system kernel (correct)
  • Data section
  • Program counter

What condition may cause a 'memory segmentation fault'?

<p>Attempting to write on unallocated memory. (B)</p> Signup and view all the answers

What happens to a process in the 'waiting' state?

<p>It is waiting for an event to occur. (D)</p> Signup and view all the answers

Which of the following is the most accurate description of the 'ready' state of a process?

<p>The process is waiting to be assigned to a processor. (C)</p> Signup and view all the answers

Why is the Process Control Block (PCB) stored in a protected memory area?

<p>To prevent unauthorized access and modification by user processes. (A)</p> Signup and view all the answers

What kind of information is stored in a Process Control Block (PCB)?

<p>Memory and CPU register information. (A)</p> Signup and view all the answers

How does adding more memory affect swapping?

<p>Reduces swapping activity. (B)</p> Signup and view all the answers

If a system has enough RAM, under what condition will it not swap?

<p>When the system uses cache. (B)</p> Signup and view all the answers

What is the primary function of a 'job queue' in process scheduling?

<p>To store all processes in the system. (A)</p> Signup and view all the answers

What is the role of the 'ready queue' in process scheduling?

<p>To store processes that are residing in main memory and are ready to execute. (C)</p> Signup and view all the answers

Which of the following best describes how processes move through queues?

<p>Processes migrate among various queues based on their state. (C)</p> Signup and view all the answers

Which statement is most accurate about processes and memory?

<p>Processes stay in the same place in memory. (A)</p> Signup and view all the answers

What is the primary difference between a 'long-term scheduler' and a 'short-term scheduler'?

<p>Long-term schedulers control the degree of multiprogramming, while short-term schedulers select the next process to execute. (C)</p> Signup and view all the answers

Which of the following best describes the role of the 'medium-term scheduler'?

<p>Swapping processes out of and into memory to manage the degree of multiprogramming. (B)</p> Signup and view all the answers

If a short-term scheduler is invoked very frequently, what is its requirement?

<p>Must be fast (A)</p> Signup and view all the answers

What is the main characteristic of an I/O-bound process?

<p>It spends more time doing I/O than computations. (C)</p> Signup and view all the answers

What does 'context switching' involve?

<p>Saving the state of one process and loading the state of another. (C)</p> Signup and view all the answers

What is a key implication of context-switch time?

<p>It is overhead, as the system does no useful work while switching. (D)</p> Signup and view all the answers

How are processes typically identified and managed by the operating system?

<p>Via a process identifier (pid). (A)</p> Signup and view all the answers

During process creation what resources can a parent and child process share?

<p>Parent and children can share all resources, share a subset, or share no resources. (B)</p> Signup and view all the answers

In the context of process creation in UNIX-like systems, what is the purpose of the fork() system call?

<p>To create a new process. (D)</p> Signup and view all the answers

What happens after a fork() is called?

<p>A new process is created. (D)</p> Signup and view all the answers

In UNIX-like systems, what function replaces the process' memory space with a new program after using a fork()?

<p>exec (B)</p> Signup and view all the answers

Under what circumstances might a parent process terminate a child process?

<p>When the child process has exceeded allocated resources. (B)</p> Signup and view all the answers

What is 'cascading termination'?

<p>A parent process terminates, and its termination causes all its children to terminate as well. (B)</p> Signup and view all the answers

What best describes 'independent' processes?

<p>They cannot affect or be affected by other processes. (A)</p> Signup and view all the answers

What is the main purpose of Interprocess Communication (IPC)?

<p>To enable processes to share information and synchronize their execution. (D)</p> Signup and view all the answers

What are the two models of IPC?

<p>Shared memory and message passing. (C)</p> Signup and view all the answers

In the context of the Producer-Consumer problem, what happens when using a 'bounded-buffer'?

<p>The producer process cannot write to the buffer if it is full. (C)</p> Signup and view all the answers

In message passing, what is required if two processes P and Q, wish to communicate?

<p>Processes P and Q, must establish communication link between them (C)</p> Signup and view all the answers

What is a characteristic of 'direct communication' in message passing?

<p>The sender process must explicitly name the receiving process. (A)</p> Signup and view all the answers

In the context of message passing, how does 'indirect communication' differ from 'direct communication'?

<p>Indirect communication uses mailboxes (or ports) for message transfer. (D)</p> Signup and view all the answers

In Indirect Communication, what happens if P1 sends; P2 and P3 both receive?

<p>The system selects arbitrarily the receiver. (B)</p> Signup and view all the answers

What is blocking in message passing typically referred to as?

<p>Synchronous (A)</p> Signup and view all the answers

What is the result of Non-blocking receive?

<p>Receiver receives a valid message or null (B)</p> Signup and view all the answers

What is the effect of zero capacity?

<p>Sender must wait for receiver. (B)</p> Signup and view all the answers

Which of the following describes how communication is handled in Mach?

<p>Message Passing (B)</p> Signup and view all the answers

Which mechanism is used in Windows XP for message-passing centric interprocess communication?

<p>Local Procedure Call (LPC) Facility (A)</p> Signup and view all the answers

What services listen to well-known ports?

<p>Telnet, FTP, HTTP (B)</p> Signup and view all the answers

In Remote Procedure Calls, what is the purpose of the stubs?

<p>To hide the details of communication (D)</p> Signup and view all the answers

What does marshalling refer to?

<p>Packaging the parameters so they can be transmitted over the network (A)</p> Signup and view all the answers

What is a limitation of ordinary pipes?

<p>They require a parent-child relationship between processes. (C)</p> Signup and view all the answers

Flashcards

What is a Process?

A program in execution; process execution must progress sequentially.

What is Process State?

The different stages a process goes through as it executes.

What are the common process states?

New, running, waiting, ready, and terminated.

What is Process Control Block (PCB)?

Information associated with each process, such as state, program counter, CPU registers, and memory management info.

Signup and view all the flashcards

What is the Job Queue?

The set of all processes in the system.

Signup and view all the flashcards

What is the Ready Queue?

The set of processes residing in main memory, ready and waiting to execute.

Signup and view all the flashcards

What is the Long-Term Scheduler?

Selects which processes should be brought into the ready queue.

Signup and view all the flashcards

What is the Short-Term Scheduler?

Selects which process should be executed next and allocates CPU.

Signup and view all the flashcards

What is a Context Switch?

Saving the state of the old process and loading the saved state for the new process.

Signup and view all the flashcards

What is a Process Identifier (PID)?

A unique identifier used to manage and identify as process.

Signup and view all the flashcards

What does fork() do?

A system call that creates a new process.

Signup and view all the flashcards

What does exec() do?

A system call used after a fork() to replace the process' memory space with a new program.

Signup and view all the flashcards

What is Process Termination?

A process asks the OS to delete it.

Signup and view all the flashcards

What is Interprocess Communication (IPC)?

Processes can communicate to share data

Signup and view all the flashcards

What is an Independent process?

Processes that cannot affect or be affected by other processes.

Signup and view all the flashcards

What is a Cooperating Process?

Processes that can affect or be affected by the execution of other processes.

Signup and view all the flashcards

What is Unbounded-Buffer?

Places no practical limit on the size of the buffer.

Signup and view all the flashcards

What is Bounded-Buffer?

Assumes there is a fixed buffer size.

Signup and view all the flashcards

What is Direct Communication?

Processes directly name each other to communicate.

Signup and view all the flashcards

What is Indirect Communication?

Messages are directed and received from mailboxes (ports).

Signup and view all the flashcards

Define Blocking Send

The sender blocks until the message is received.

Signup and view all the flashcards

Define Blocking Receive

The receiver blocks until a message is available.

Signup and view all the flashcards

Define Non-blocking Send

The sender sends the message and continues.

Signup and view all the flashcards

Define Non-blocking Receive

The receiver receives a valid message or null.

Signup and view all the flashcards

What is zero capacity?

Sender must wait for receiver.

Signup and view all the flashcards

What is Bounded capacity?

Sender must wait if the link is full.

Signup and view all the flashcards

What is Unbounded capacity?

Sender never waits.

Signup and view all the flashcards

What are Sockets?

A pair of processes communicating over a network employ a pair of these.

Signup and view all the flashcards

What is a Remote Procedure Call (RPC)?

A protocol that a program can use to request a service from another program on a network without understanding the network's details.

Signup and view all the flashcards

How do remote procedure calls wrok?

Allow a client to invoke a procedure on a remote system.

Signup and view all the flashcards

What is Marshalling?

Marshalling is packaging the parameters so they can be transmitted over the network

Signup and view all the flashcards

What are pipes?

Act as a conduit allowing two processes to communicate.

Signup and view all the flashcards

What are ordinary pipes?

Allow communication in standard producer-consumer style.

Signup and view all the flashcards

What are named pipes?

More powerful than ordinary pipes

Signup and view all the flashcards

Study Notes

Chapter 3: Processes

  • Explores processes, process scheduling, operations, interprocess communication (IPC), IPC examples, and client-server communication.
  • Introduces processes, their features (scheduling, creation, termination, communication), and client-server system communication.

Process Concept

  • Specifies that an OS runs diverse programs, including:
    • Batch systems running jobs.
    • Time-shared systems running user programs or tasks.
  • "Job" and "process" are used interchangeably.
  • A process embodies a program in execution, progressing sequentially, and includes; a program counter, stack, and data section.

Process Memory

  • Memory for process is segmented into:
    • Stack: Instructions may overflow.
    • Heap: Dynamic data, new parameters can be stored, writing to unallocated memory may cause segmentation faults.
    • Data: Is static
    • Text: Is file text
  • Processes can crash without affecting the entire system.

Process State

  • Processes transition through different states during execution; including
    • New: being created.
    • Running: instructions are executed.
    • Waiting: awaiting an event.
    • Ready: awaiting processor assignment.
    • Terminated: execution is complete.

Process Control Block (PCB)

  • Contains process-specific information such as; state, program counter, CPU registers, scheduling data, and memory management info.
  • Also holds accounting and I/O status.
  • The PCB resides in protected memory, often at the kernel stack's beginning for safety.
    • Swapping slows computers and memory reduces swapping.
    • Caching does not use swapping.
    • Increased RAM increases batter usage, and needs a good configuration.

Process Scheduling Queues

  • Job queue : a set of all processes in the system
  • Ready queue: a set of processes residing in main memory as well as ready and waiting to execute
  • Device queues: a set of processes waiting for an I/O device
  • Processes shift queues but retain their memory location, transitioning between ready and device queues.

Schedulers

  • Long-term (job) scheduler: selects processes for the ready queue.
  • Short-term (CPU) scheduler: selects and allocates the CPU to the next process.
  • The long-term scheduler manages multiprogramming degree.
  • Processes are I/O-bound, spending more time on I/O with brief CPU bursts, or CPU-bound, spending more time on computations with long CPU bursts

CPU Context Switch

  • Involves saving an old process's state and loading a new one, which introduces overhead as the system does no work during the switch.
  • Context is represented in the PCB, and the time for context switching depends on hardware support.

Process Creation

  • Happens when parent processes create child processes, forming a process tree in shared memory space.
  • Processes are identified and managed via a process identifier (pid).
  • Resource Sharing Options
    • Sharing all.
    • Subsets only.
    • No sharing.
  • Execution Options
    • Parent and children execute concurrently.
    • Parent waits for children to terminate.
  • Fork creates a duplicate child process and exec replaces a process’ memory space after a fork in UNIX.

Process Termination

  • Occurs when a process executes its last statement, requesting OS deletion using "exit".
  • The child process can output data to the parent using wait and resources are deallocated by the OS.
  • Parents can terminate child execution using abort for; exceeding resources, task completion, or parent exiting.
    • Some OSs terminate children upon parent exit, referred to as cascading termination.

Interprocess Communication (IPC)

  • Processes include independent or cooperating processes, with cooperation enabling data sharing.
  • IPC involves; sharing data, speeding up computation, modularity, and offering convenience.
  • IPC models use shared memory or message passing.

Cooperating Processes

  • A process that cannot affect or be affected by another is independent.
  • A cooperating processing can be affected by another.
  • Process cooperation brings; information sharing, computation speed-up, modularity, and convenience.

Producer-Consumer Problem

  • Cooperation paradigm where a Producer creates information to be consumed by a Consumer.
  • Unbounded-buffer places no restriction on buffer size, whereas bounded-buffer assumes it.

Bounded-Buffer (Shared Memory)

  • Employs shared data structures like buffer and variables for in/out management
  • A fixed #define BUFFER_SIZE 10 where Solution only used BUFFER_SIZE - 1

Bounded Buffer Producer/Consumer

  • In producer -> wait if no free buffers available, then add item to buffer.
  • In consumer -> waits until an item is available, then removes item fro the buffer

Interprocess Communication - Message Passing

  • Processes use actions to communicate and synchronise without shared variables.
  • Interprocess Communication (IPC) provides operations to send(message) of a fixed or variable size and receive(message).
  • If processes P and Q, seek communication, they must; establish a communication link and then exchange information.
  • Implementation uses physical (shared memory, hardware bus) or logical properties, implementing direct or indirect, synchronous or asynchronous, and automatic or explicit buffering.

Implementation Questions

  • Are links established?
  • Can links be associated with more than two processes?
  • How many links are there between process pars?
  • What link capacity is there?
  • Can the message be fixed or variable?
  • Is the link unidirectional or bi-directional?

Direct Communication

  • Processes explicitly name each other when exchanging messages.
    • send (P, message) sends to process P while receive(Q, message) receives from process Q.
  • Communication links are established automatically between one pair, with links that may unidirection but are usually bi-directional

Indirect Communication

  • Messages move between mailboxes or ports, which are special repositories; each mailbox has a unique id, processes only communicate if they have share a mailbox.
  • send(A, message) sends to mailbox A, and receive(A, message) retrieves from A.
  • Mailboxes link multiple senders and receivers, or one statically associated receiver known as a 'port'.
  • Mailboxes are owned by the system and managed by a service.
  • Links establish only with shared mailbox; links can involve multiple processes sharing several communication links, which can be unidirectional or bidirectional.

Indirect Communication

  • Actions include creating, sending/receiving, and destroying.
  • send(A, message) sends to mailbox A
  • receive(A, message) retrieves from mailbox A
  • To solve the problem of P1 sending, with P2 and P3 receiving, solutions include no more than two processes, one process at a time gets allowed actions, or sender gets notified.

Message Passing - Synchronization

  • Can be Blocking (synchronous) or Non-Blocking(asynchronous)
  • Blocking send: the sender blocks until a message is received
  • Blocking receive : the receiver blocks until a message is available
  • Non-blocking send: the sender sends the message and continue
  • Non-blocking receive: A valid message OR a null message must be received

Buffering

  • Queue of messages, implemented in three ways.
    • Zero capacity: sender waits for 0 messages(rendezvous)
    • Bounded capacity: if finite length N is full, sender must wait
    • Unbounded capacity: Sender never waits

IPC Examples (POSIX)

  • POSIX shared memory actions include:
    • Process creates a shared memory segment.
    • Requester must attach.
    • Process writes to shared memory using sprintf(shared memory, "Writing to shared memory");
    • Process detaches via shmdt(shared memory);

IPC Examples (Mach)

  • Communication is message based, including system calls.
  • Tasks get kernel and notify mailboxes on creation.
  • Three system calls are vital for message transfer: msg_send(), msg_receive(), msg_rpc()
  • Mailboxes, which are created with port_allocate(), are core for general commuication.

IPC Examples (Windows XP)

  • Message-centric passing based on local procedure call (LPC) that works on the same systems through ports.
  • Communication runs by client:
    • Opens the subsystem's handle.
    • Sends request.
  • The server:
  • Creates comm ports.
  • Returns a handle.
  • Comm ports send messages with callbacks.

Communications in Client-Server Systems

  • Client-server systems use; sockets, remote procedure calls, pipes, and remote method invocation (Java).

Sockets

  • Generally used for Client-Server Systems.
  • They are defined as a communication endpoint, and identified by IP address and port to be combined.
  • 161.25.19.8:1625 specifies port 1625 on host 161.25.19.8.

Socket Communication

  • Involves a server listening on a specified port, and a client requesting a connection and the server connects from the client.
  • Well-known services have ports below 1024; Telnet uses 23, FTP uses 21, and HTTP uses 80.
  • New processes accessing port 80 should create new ports with values > 1024.

Remote Procedure Calls (RPC)

  • Protocol to remotely request a service without network configuration.
  • Requires message-based communications between hosts to operate reliably.
  • Every message is sent to a port.
    • RPCDaemon listens to a port and sends a function.
    • A function is code provided by the request on the remote system.
    • After the function, any output in a separate message.

Remote Procedure Calls - Stubs

  • Stubs hide details for client communications.
  • Remote procedures get separate stubs.
  • Stubs look for ports or server using 'marshalling' to transmit.

Remote Procedure Calls - Issues

  • Data rep can use 32-bit, big-endian, and little-endian solutions using External Data Representation (XDR).
  • A network error is fixed when Action (ACK) is done, or messages are endlessly resent.

Pipes

  • Pipes: a conduit for communication with potential issues of unidirectionality, bidirectionality (half or full-duplex), and parental relationship.
  • Can pipes be used over a network?

Ordinary Pipes

  • Ordinary pipes: Communication in standard producer-consumer style.
  • Producers use the write-end and consumers use the read-end, making communication unidirectional and requiring a parent-child relation.

Named Pipes

  • A named pipe uses increased power from ordinary pipes that's useful for two-way communication, without child/parent, for many processes and Windows/UNIX.

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Process Management Concepts Quiz
5 questions
Operating System Concepts: Process Management
24 questions
Use Quizgecko on...
Browser
Browser