Operating System Concepts

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 the primary role of the stack within the memory layout of a C program?

  • Storing global variables that are accessible throughout the program.
  • Managing dynamically allocated memory during program execution.
  • Holding temporary data such as function parameters, return addresses, and local variables. (correct)
  • Containing the program's executable code and instructions.

What is the main purpose of the 'Heap' in the memory layout of a C program?

  • To manage memory that is dynamically allocated during the program's runtime. (correct)
  • To store global variables used by the program.
  • To store the program's instructions that are being executed.
  • To keep track of the current instruction being executed.

Which of the following pieces of information is NOT typically stored within a Process Control Block (PCB)?

  • Memory-management information, including memory allocated to the process.
  • The process's current state (e.g., running, waiting).
  • The amount of free disk space available on the system. (correct)
  • CPU scheduling information, such as priority and queue pointers.

In the context of process management, what does the 'program counter' within a Process Control Block (PCB) indicate?

<p>The memory address of the next instruction to be executed by the process. (B)</p> Signup and view all the answers

A process is in the 'waiting' state. What is the MOST likely reason for this?

<p>The process is waiting for a specific event, such as I/O completion. (C)</p> Signup and view all the answers

Which process state signifies that a process has completed its execution?

<p>Terminated (C)</p> Signup and view all the answers

Considering the process states, which transition would occur when a running process's allocated time expires?

<p>From running to ready. (C)</p> Signup and view all the answers

A new process is 'admitted'. According to analogy, what state would that process be in?

<p>New (D)</p> Signup and view all the answers

In a multitasking operating system, what is the key differentiator that distinguishes it from multiprogramming?

<p>Multitasking involves multiple processes belonging to different users, whereas multiprogramming does not necessarily. (A)</p> Signup and view all the answers

When a program is loaded into memory and becomes an active entity, what is it then referred to as?

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

Which of the following scenarios best illustrates the concept of one program being executed as several processes?

<p>Multiple users are concurrently accessing the same web server application. (D)</p> Signup and view all the answers

In the context of operating systems, what is the 'text section' of a process primarily responsible for?

<p>Holding the program's executable code. (B)</p> Signup and view all the answers

Which of the following scenarios accurately describes the concept of multiprocessing?

<p>A computer system using multiple CPUs to execute tasks simultaneously. (C)</p> Signup and view all the answers

What is the primary difference between a program and a process?

<p>A program is a set of instructions, while a process is the execution of those instructions. (D)</p> Signup and view all the answers

Consider a scenario where a user launches two instances of the same text editor application. How are these instances typically represented in the operating system?

<p>Each instance is treated as a separate process. (D)</p> Signup and view all the answers

In the context of process management, what does the term 'job' typically refer to in a batch processing system?

<p>A pre-defined set of commands or programs executed sequentially without user interaction. (D)</p> Signup and view all the answers

In a message passing system, what role does the kernel primarily play during message transfer between processes?

<p>Mediating the message transfer using system calls, involving copying messages between user and kernel spaces. (A)</p> Signup and view all the answers

Which of the following is a key performance consideration when choosing between message passing and shared memory in a multi-core system?

<p>Message passing provides better performance due to reduced contention and overhead. (D)</p> Signup and view all the answers

What are the two fundamental operations provided by an Inter-Process Communication (IPC) facility using message passing?

<p><code>send(message)</code> and <code>receive(message)</code> (D)</p> Signup and view all the answers

Which factor is most likely to influence the suitability of message passing for inter-process communication?

<p>The size of the data being transferred across multiple systems. (C)</p> Signup and view all the answers

When establishing a communication link for message passing between two processes, which consideration is crucial for determining the communication pattern?

<p>Whether the link supports one-way or two-way communication. (A)</p> Signup and view all the answers

What is the primary purpose of a socket in the context of operating systems?

<p>To serve as an endpoint for communication between processes. (B)</p> Signup and view all the answers

If a message is sent to the IP address 192.168.1.1:8080, what does 8080 signify?

<p>A specific port on the host <code>192.168.1.1</code> used for differentiating network services. (B)</p> Signup and view all the answers

Which range of port numbers is typically reserved for well-known services?

<p>0-1023 (C)</p> Signup and view all the answers

What is the significance of the IP address 127.0.0.1?

<p>It refers to the loopback address, pointing back to the system on which the process is running. (B)</p> Signup and view all the answers

In the context of Remote Procedure Calls (RPC), what is the role of a 'stub'?

<p>It acts as a client-side proxy for the actual procedure on the server. (B)</p> Signup and view all the answers

What is the purpose of External Data Representation (XDR) in remote procedure calls?

<p>To handle data representation differences between different computer architectures. (A)</p> Signup and view all the answers

In the context of inter-process communication, what is a primary difference between local procedure calls and remote procedure calls?

<p>Remote calls have more potential failure scenarios due to network issues. (B)</p> Signup and view all the answers

What is the key consideration when determining the nature of communication through a pipe?

<p>Whether the communication is unidirectional or bidirectional. (C)</p> Signup and view all the answers

Which of the following is NOT a typical advantage of using separate processes for browser rendering (one process per website)?

<p>Increased system resource utilization. (A)</p> Signup and view all the answers

Which of the following scenarios exemplifies a situation where cooperating processes would be most beneficial?

<p>A video editing application where one process handles decoding video frames and another applies filters. (B)</p> Signup and view all the answers

A system uses shared memory for interprocess communication. What is the main responsibility of the user processes when accessing the shared memory region?

<p>Ensuring exclusive access to prevent data corruption through synchronization mechanisms. (B)</p> Signup and view all the answers

In the context of interprocess communication (IPC), which of the following is a primary disadvantage of using shared memory compared to message passing?

<p>Increased complexity in setting up and managing synchronization. (C)</p> Signup and view all the answers

Which of the following inter-process communication (IPC) methods does NOT require explicit shared access to memory?

<p>Message passing. (A)</p> Signup and view all the answers

A system is designed such that processes communicate by exchanging messages. What is a key advantage of this approach compared to using shared memory?

<p>Simplified synchronization logic. (A)</p> Signup and view all the answers

Which of the following scenarios is most suitable for using shared memory as an interprocess communication mechanism?

<p>Transferring large multimedia files between processes on the <em>same</em> machine. (A)</p> Signup and view all the answers

Consider two processes, P1 and P2, that need to communicate. P1 produces data that P2 consumes. If message passing is used for IPC, how does the operating system facilitate this interaction?

<p>By copying data from P1's address space to P2's address space via system calls. (D)</p> Signup and view all the answers

What is the most likely consequence of having only CPU-bound processes in a system?

<p>Underutilized I/O devices and an unbalanced system, as I/O waiting queues remain mostly empty. (B)</p> Signup and view all the answers

Why might a time-sharing system, like UNIX or Microsoft Windows, opt not to employ a long-term scheduler?

<p>Because users might abandon the system if performance degrades, acting as a self-regulating mechanism. (A)</p> Signup and view all the answers

In the context of operating systems, what is 'swapping,' often managed by the medium-term scheduler?

<p>Moving a process from main memory to secondary storage (disk) and back to reduce the degree of multiprogramming. (D)</p> Signup and view all the answers

Why is context-switch time considered overhead in an operating system?

<p>It involves saving and loading the state of processes, during which the system performs no useful work. (D)</p> Signup and view all the answers

How does the complexity of the operating system and the process control block (PCB) affect context-switch time?

<p>A more complex OS and PCB generally result in longer context-switch times due to the increased state information that needs to be saved and loaded. (D)</p> Signup and view all the answers

What is the role of the exit() system call in process management?

<p>It terminates the process, signaling to the OS to deallocate resources associated with the process. (D)</p> Signup and view all the answers

What is the significance of the process identifier (PID) in operating systems?

<p>It serves as a unique identifier for each process, facilitating management and tracking by the OS. (D)</p> Signup and view all the answers

When a parent process creates a child process, which of the following resource sharing options is NOT typically available?

<p>The parent shares all resources with some children, but not others. (C)</p> Signup and view all the answers

In terms of execution, what are the typical options available to a parent process after creating a child process?

<p>The parent and children can execute concurrently, or the parent can wait until the children terminate. (A)</p> Signup and view all the answers

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

<p>It creates a new process that is a duplicate of the parent process. (B)</p> Signup and view all the answers

Following a fork() call in UNIX, what is the typical purpose of using the exec() system call?

<p>To replace the child process's memory space with a new program. (D)</p> Signup and view all the answers

In a system utilizing medium-term scheduling, what is the primary motivation for removing a process from memory and storing it on disk?

<p>To decrease the degree of multiprogramming, potentially improving performance for remaining processes. (C)</p> Signup and view all the answers

The init process in Linux, with a PID of 1, serves what critical function?

<p>It serves as the root parent process for all user processes started on the system. (A)</p> Signup and view all the answers

Which of the following scenarios would most likely result in the longest context switch time?

<p>Switching between two processes when the operating system needs to save and load a large amount of state information. (D)</p> Signup and view all the answers

Which operation on processes is essential for an operating system to manage the dynamic creation and termination of applications?

<p>Process creation and termination (A)</p> Signup and view all the answers

Flashcards

Uniprogramming

Only one program resides in RAM at a time.

Multiprogramming

Multiple processes reside in RAM simultaneously.

Multitasking

Multiple processes from different users reside in RAM.

Multiprocessing

Using multiple CPUs or microprocessors.

Signup and view all the flashcards

Multithreading

Multiple threads exist within a single process.

Signup and view all the flashcards

Process

A program in execution; its execution must progress sequentially.

Signup and view all the flashcards

Program

A passive entity stored on disk, like an executable file.

Signup and view all the flashcards

Text Section

The program code section in memory.

Signup and view all the flashcards

Process Image: Stack

Contains program counter, processor registers, and current activity.

Signup and view all the flashcards

Process Image: Data Section

Holds function parameters, return addresses, and local variables.

Signup and view all the flashcards

Process Image: Heap

Memory dynamically allocated during runtime.

Signup and view all the flashcards

PCB (Process Control Block)

Information associated with each process.

Signup and view all the flashcards

Process State

Indicates what the process is currently doing.

Signup and view all the flashcards

Process State: New

The process is being created.

Signup and view all the flashcards

Process State: Running

Instructions are being executed.

Signup and view all the flashcards

Process State: Waiting

Waiting for an event to occur.

Signup and view all the flashcards

Message Passing

Processes communicate without shared variables, using send(message) and receive(message) operations.

Signup and view all the flashcards

Message Passing Steps

Communication means processes must establish a link and then exchange messages.

Signup and view all the flashcards

Message Size

The message size can be either predetermined or allowed to vary.

Signup and view all the flashcards

Message Passing Overhead

Message passing uses system calls for message transfers.

Signup and view all the flashcards

Link Directionality

Determines whether messages can only flow one way, or in both directions between processes.

Signup and view all the flashcards

Website Renderer Isolation

Each website renderer operates independently, improving security.

Signup and view all the flashcards

Cooperating Process

A process that can be affected by other processes.

Signup and view all the flashcards

Why Cooperating Processes?

Sharing information, computation speedup, modularity, convenience.

Signup and view all the flashcards

Two IPC Models?

Shared memory and message passing.

Signup and view all the flashcards

Shared Memory (IPC)

Processes exchange data by reading/writing to a shared memory region.

Signup and view all the flashcards

Shared Memory Characteristics

Difficult to implement, used for larger data, faster

Signup and view all the flashcards

Message Passing (IPC)

Processes exchange messages to communicate.

Signup and view all the flashcards

What is a Socket?

An endpoint for communication between processes, defined by an IP address and port.

Signup and view all the flashcards

What is a Port?

A number included at the start of a message packet to differentiate network services on a host.

Signup and view all the flashcards

Socket Pair

Communication that occurs between two sockets, involving the exchange of data.

Signup and view all the flashcards

Well-known Ports

Ports below 1024, reserved for standard services like HTTP (port 80) or SSH (port 22).

Signup and view all the flashcards

Loopback Address

A special IP address (127.0.0.1) used to refer to the system on which a process is running.

Signup and view all the flashcards

Remote Procedure Call (RPC)

A mechanism that abstracts procedure calls between processes on networked systems.

Signup and view all the flashcards

RPC Stubs

Client-side proxy for the actual procedure on the server in RPC.

Signup and view all the flashcards

What are Pipes?

A conduit allowing two processes to communicate.

Signup and view all the flashcards

Unbalanced System (CPU-Bound)

Occurs when all processes are CPU-bound, leading to empty I/O queues and unused devices.

Signup and view all the flashcards

Medium-Term Scheduling

Involves removing a process from memory and storing it on disk to reduce the degree of multiple programming.

Signup and view all the flashcards

Context Switch

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

Signup and view all the flashcards

Process Context

Representation of a process's state.

Signup and view all the flashcards

Context-Switch Time

Time spent switching processes; the system does no useful work during this time.

Signup and view all the flashcards

Process Identifier (PID)

A unique identifier that is used to manage and identify a process.

Signup and view all the flashcards

Tree of Processes

A hierarchical arrangement where a parent process creates child processes, forming a tree-like structure.

Signup and view all the flashcards

fork() System Call

A system call that creates a new process which is a duplicate of the parent process.

Signup and view all the flashcards

exec() System Call

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

Signup and view all the flashcards

exit() System Call

A system call that is how a process requests the OS to delete it.

Signup and view all the flashcards

Parent Process

A process that creates other processes.

Signup and view all the flashcards

Child Processes

Processes created by a parent process.

Signup and view all the flashcards

init Process

The initial process in Linux, with a PID of 1, serving as the root parent for all user processes.

Signup and view all the flashcards

Resource Sharing Options

Options dictating how parent and child processes access resources.

Signup and view all the flashcards

Execution Options

Options dictating whether parent and child processes run simultaneously or sequentially.

Signup and view all the flashcards

Study Notes

Chapter 3: Processes

  • The text covers process concepts, process scheduling, operations on processes, interprocess communication (IPC), examples of IPC systems, and communication in client-server systems.

Important Terms

  • Uniprogramming: RAM implies a single process.
  • Multiprogramming: RAM implies multiple processes.
  • Multitasking: RAM implies multiple processes that are belonging to different users.
  • Multiprocessing: Implies multiple CPUs or microprocessors.
  • Multithreading: Implies multiple threads inside a process.

Process Concept

  • An operating system executes a variety of programs, including batch systems (jobs) and time-shared systems (user programs/tasks).
  • The textbook uses the terms job and process almost interchangeably.
  • A process is a program in execution, which must progress in a sequential fashion.
  • A program is a passive entity stored on disk like an executable file, while a process is active.
  • A program becomes a process when its executable file is loaded into the system memory.
  • Execution of a program starts via GUI mouse clicks, command line entry of its name, and other methods.
  • One program can have several processes, with multiple users executing the same program.

Process in Memory

  • A process has multiple parts:
    • The text section, known as program code with the current activity, includes the program counter and processor registers.
    • The Stack contains temporary data like function parameters, return addresses, and local variables
    • The Data section contains global variables
    • The Heap contains memory dynamically allocated during run time.

Process Control Block (PCB)

  • The PCB or task control block is associated to each process.
  • Includes the process state (running, waiting, etc.) and the process identification number.
  • Contains the program counter showing the location of instruction to next execute.
  • It keeps CPU registers that contains the contents of all process-centric registers.
  • It has CPU scheduling information like priorities, scheduling queue pointers.
  • The PCB uses memory-management information which is the memory allocated to the process.
  • Other information include accounting which has the CPU used, clock time elapsed since start, or time limits.
  • The PCB stores the I/O status information for I/O devices allocated to process, list of open files

Process State transition

  • As a process executes, it changes through different states.
  • new: The process is being created.
  • running: Instructions are being executed.
  • waiting: The process is waiting for some event to occur.
  • ready: The process is waiting to be assigned to a processor.
  • terminated: The process has finished execution.
  • Analogy for process is a hopsital - New admissions, waiting hall, Dr Checkup , laboratories etc..

Process Representation

  • In Linux, a C structure "task struct" represents a process:
    • includes the PID (process identifier) and the state of the process.
    • contains scheduling information, a pointer to the parent process, and a list of children processes
    • Files shows a list of open files
    • mm struct shows the address space for this process

Threads

  • Up to this poing processes had single threads of execution.
  • Consider having multiple program counters per process.
  • Multiple threads of control allow multiple locations to execute at once.
  • Processes require storage for thread details and multiple program counters in the PCB.

Process Scheduling

  • Process scheduling maximizes CPU use and quickly switches processes onto the CPU for time-sharing.
  • The Process scheduler selects among available processes for next execution on CPU on a scheduling queue.
  • Scheduling queues includes jobs that sets all the processes in the system.
  • Ready queue is set of all processes residing in main memory, ready and waiting to execute.
    • A new process is initially put in the ready queue and waits there dispatch.
  • Device queues are sets of processes waiting for an I/O device.
  • Processes migrate among the various queues.

Schedulers

  • Short-term scheduler (or CPU scheduler) selects which process should be executed next and allocates CPU.
    • Sometimes the only scheduler in a system, and it is invoked frequently in milliseconds, so it must be fast.
  • Long-term scheduler (or job scheduler) selects which processes should be brought into the ready queue.
    • It is invoked infrequently in seconds or minutes, and it may be slow, controlling the degree of multiprogramming.
  • Processes can be described as either I/O-bound that that spend more time doing I/O than computations, or
  • CPU-bound processes spend more time doing computations with few very long CPU bursts.
  • Long-term scheduler benefit good process mix.
  • Time-sharing systems like UNIX and Microsoft Windows often do not have a long-term scheduler.
  • A medium-term scheduler is added if the degree of multiple programming needs to decrease via swapping.

Context Switch

  • When the CPU switches to another process, the system must save the state of the old process and load the saved state for the new process within a context switch.
  • Overhead occurs with context-switch time, and the system does no useful work while switching.
  • The more complex the OS and the PCB, the longer the context switch.
  • Time is dependent on hardware support with some providing multiple sets of registers per CPU to load multiple contexts at once.

Operations on Processes

  • An OS provides mechanisms for process creation and termination.

Process Creation

  • A parent process creates child processes which in turn create other processes, forming a tree.
  • Processes are identified and managed by a process identifier (pid).
  • There are different resource sharing options that can occur.
  • Including Parent and children sharing all resources.
  • or Children share subset of parent's resources.
  • Or Parent and child share no resources.
  • Execution options has the parent and children executing concurrently.
  • Or the parent should waits until children terminate

UNIX examples

  • fork() system calls creates a new process.
  • exec() system call is used after a fork() to replace the process' memory space with a new program.

Process Termination

  • A process executes the last statement causing exit() system call.
  • Then the process will return status data from the terminated child to parent via wait().
  • The OS deallocates the processes resources.
  • A parent may terminate the execution of children processes using the abort() system call for reasons like:
    • Child has exceeded allocated resources.
    • Task assigned to child is no longer required.
    • The parent is exiting, and the operating systems may not allow a child to continue if its parent terminates.
  • Some operating systems do not release to exist child if its parent has been terminated.
  • If a process terminates for cascading termination, then all its children (all the way down) must also be terminated.
  • The parent process may wait for termination of a child process by using the wait() system call to return status information
  • If no parent calling wait() on a terminated child process the program is called a zombie
  • If a parent terminates and does not call wait then the process is an orphan.
  • The init process is the root parent process (always has a pid of 1) for all user processes.

Multiprocess Architecture

  • Chrome is an example of a multiprocess architecture.
  • A design for running multiple processes with the 3 processes:
    • Browser process which will manages user interface, disk, and network I/O.
    • A Renderer process deals with rendering of web pages, HTML and Javascript.
      • new renderer is created for each website opened running in a sandbox to minimize the effect of security exploits.
    • Plug-in process for each type of plug-in

Interprocess Communication

  • Processes within a system are independent or cooperating
  • Independent processes can affect or be affected by the execution of another process.
  • Cooperating processes is reverse.
  • Reason to use:
    • Information sharing
    • Computation speedup
    • Modularity
    • Convenience
  • Cooperating processes require interprocess communication (IPC) using two models: Shared and Message passing
  • Shared Memory creates processes that exchange information by reading and writing data to the shared region. The communications under the control of the users processes.
  • Message Passing takes place by means of messages exchange between the cooperating processes and easier to implement

Message Passing Implementation

  • If processes P and Q communicate, establish communication link and exchange messages via send/receive.
    • Links can be through Direct or indirect communication, Synchronous or asynchronous, or Automatic or explicit buffering

Direct Communication:

  • Proccessess must name or know each ther.
  • use send(P, message) and recieve (Q,message)
  • Links established automatically
  • links associcated with one pair
  • there is usually one link that is bi-directional

Indirect Communication

  • Are directed and received from mailboxes
  • Each has a unique ID
  • Processes can communicate only sharing mailbox
  • Link established with share mailbox
    • operations are send (A, message) and recieve (A,message)
    • is the size is either fixed or variable

###Synchronization during message passing

  • Message passing may be either blocking (synchronous) or non-blocking asynchronous Blocking:
    • sennder is blocked during blocking sedn till message arrives
    • receiver blocked during blocking receive till message is ready

Non Blocking: - sender sends and continue - valid messagw/ or null message -

Buffering

  • Uses queues of messages attached to the link of 3 ways implemented :
    • Has has no queues - zero capacity so must wait for reciever
    • Finite que length - of n messages -sender if full link
    • infinite length - unbounded capacity where sender never waits

Producer-Consumer Problem

  • This focuses on a producer process that consumes information that is consumed by a consumer
  • If is unrestricted like unbounded-buffer there is no limit on size
  • If is constricted like bounded-buffer, it assumes a fixed size

Client-Server Systems

  • These methods are for inter-process communication where processes are on different computers.
  • Shared memory and Message passing can't work for this type of client-server communication. so methods used includes:
    • Sockets, Remote Procedure Calls, Pipes, and Remote Method Invocation (Java)

Sockets

  • Is is endpoint for communication that starts at the message packet.
  • Is between hosts
  • the socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8
  • ports below 1024 are well known
  • special adress is 127.0.0.1

Remote Procedure Calls

  • RPC absstracts process between processes
  • uses ports for service
  • stubs are cleint proxxies
  • calls marhsalls
  • microsofts version called MIDL

Data representations with a EDL

  • big endian and little endian
  • Messages are can only be delivered once
  • OS provides a matchmarker service to contect client and server

Pipes

  • Acts as conduit allowing processes to communicate
  • Communication can be uni/birectional
  • used for parent-child relation
  • Ordinary pipes are used only for within process creating. Parent create pipe to communicate to child.
  • windows calls these anonymous pipes
  • Named pipes are accessed with no parent-child relationship.

Studying That Suits You

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

Quiz Team

Related Documents

More Like This

Operating Systems Process Management
14 questions
Operating Systems Process Management
16 questions
Operating Systems: Process Management
10 questions
Use Quizgecko on...
Browser
Browser