OS ITO

Cards (81)

  • Cooperating process
    A process that can affect or be affected by other processes executing in the system
  • Cooperating processes
    • Can directly share a logical address space (that is, both code and data)
    • Can share data only through files or messages
  • Operating system with multiple processes
    1. Processes run together independently
    2. Act as a bridge between the user and hardware for sharing information
  • Types of processes in an operating system
    • Independent process: Processes whose task is not dependent on any other processes
    • Cooperating process: Processes that depend on other processes and work together to achieve a common task
  • Advantages of cooperating processes

    • Resource sharing
    • Improved responsiveness
    • Enhanced efficiency
    • Better utilization of hardware
    • Increased throughput
  • Disadvantages of cooperating processes

    • Complexity
    • Resource competition
    • Security risks
    • Overhead
    • Difficulty in debugging
  • Methods of cooperating processes

    • Cooperation by sharing
    • Cooperation by message passing
  • Cooperation by sharing
    1. Processes interact with each other to share resources
    2. Critical section: Allows only one process at a time to enter and access/manipulate the shared resources
  • Cooperation by message passing
    1. Processes communicate by passing messages
    2. Producer process creates a message and transfers it to the kernel
    3. Kernel passes the message to the receiving process
  • Inter-process communication (IPC)

    A cornerstone of modern operating systems, allowing processes to collaborate, share data, and synchronize their activities
  • Options to implement IPC
    • Pipes
    • Message queues
    • Semaphores
    • Shared memory
  • Inter-process communication methods
    1. Shared memory
    2. Message passing
  • Shared memory: Producer-consumer problem

    1. Producer produces items and stores them in a shared buffer
    2. Consumer consumes items from the shared buffer
    3. Unbounded buffer problem: No limit on buffer size
    4. Bounded buffer problem: Buffer has a certain capacity
  • Message passing
    1. Processes communicate without using shared memory
    2. Establish communication link
    3. Exchange messages using send() and receive() primitives
    4. Message can have header and body
  • IPC systems
    • POSIX (Portable Operating System Interface): uses shared memory
    • Mach: uses message passing
    • Windows XP: uses message passing using local procedural calls
  • Direct communication
    Processes explicitly name the recipient or sender of the communication
  • Indirect communication
    Messages are sent to and received from mailboxes
  • Process communication in client-server environment
    • Exchange of data and services among multiple machines or processes
    • One process acts as a client requesting a service or data, and another acts as a server providing those services or data
  • Ways of client-server communication
    • Sockets mechanism
    • Remote procedure call
    • Message passing
    • Inter-process communication
    • Distributed file systems
  • Sockets mechanism
    • End points of communication between two machines
    • Provide a way for processes to communicate, either on the same machine or over the Internet
  • Remote procedure call (RPC)
    Protocol that allows a client to execute a procedure call on a remote server, as if it is a local procedure call
  • Message passing
    Communication method where machines communicate by sending and receiving messages
    This approach is commonly used in Parallel and Distributed System
  • Inter-process communication (IPC)

    • Allows communication between processes within the same machine
    • Enables data sharing and synchronization between different processes
  • Distributed file systems
    • Provide access to files from multiple machines in a network
    • Client can access and manipulate files stored on a remote server through a standard interface
  • Process
    • An instance of a program that is being executed by the operating system
    • Represents an independent unit of work with its own memory space, program counter, and system resources
  • Process control block (PCB)

    • A data structure used by the operating system to store and manage information about a process
    • Acts as a repository for all the necessary information required to manage a process effectively
  • Key components of a PCB
    • Process state
    • Process ID
    • Program counter
    • CPU registers
    • CPU scheduling information
    • Memory management information
    • Accounting information
    • I/O status information
  • Process
    An instance of a program that is being executed by the operating system. It represents an independent unit of work with its own memory space, program counter, and system resources.
  • Process concepts
    Understanding the lifecycle of a process, its states, and the mechanisms used by the operating system to manage and control processes effectively.
  • Process Control Blocks (PCBs)

    A vital component for an operating system to manage processes effectively. It acts like a central hub, storing all essential information regarding a particular process.
  • Process Control Block (PCB)
    A data structure used by the operating system to store and manage information about a process.
  • Key Components of a PCB
    • Process State
    • Process ID
    • Program Counter
    • CPU Registers
    • Memory Information
    • Process Scheduling Information
    • Accounting Information
  • Advantages of Using Process Control Block
    • Lets the operating system execute different tasks like process scheduling, context switching
    • Helps in scheduling the processes and ensures efficient CPU resource allocation
    • Helps in efficient resource utilization and resource sharing
    • Helps the OS to save the process state which helps in Context switching
  • Disadvantages of using Process Control Block
    • Significant usage of memory to store PCB for each process
    • Reduces the scalability of the process in the OS due to added complexity
  • Importance of PCBs
  • Typical Process Creation process
    1. System Call: The existing process (parent process) initiates a system call to request creation of a new process
    2. Process Creation: The operating system allocates resources for the new process (child process)
    3. PCB Creation: A new Process Control Block (PCB) is created to manage the child process
    4. Process State and Resources: The child process inherits a copy of the parent process's memory space and some resources
    5. Process Divergence: After creation, the child process typically starts executing from the same point in the program code as the parent process, but they can diverge
  • Importance of Process Creation
    • Multitasking: Allows the operating system to run multiple programs concurrently
    • Modular Programming: Complex tasks can be broken down into smaller processes
    • Responsiveness: Processes can be created to handle user requests or system events promptly
  • Process State Transitions
    1. New -> Ready: When the OS allocates memory and resources to the new process, it transitions to the ready state
    2. Ready -> Running: The process scheduler selects a process from the ready queue to be assigned the CPU
    3. Running -> Ready: The OS might preempt the running process due to factors like priority or time-sharing algorithms
    4. Running -> Blocked/Waiting: If the running process issues an I/O request or encounters a resource unavailable
    5. Blocked/Waiting -> Ready: Once the awaited event occurs, the process transitions back to the ready state
    6. Running -> Exit/Terminated: A process might directly terminate from the ready or waiting state
  • Advantages and Disadvantages of the five-state process model
    • Advantages: The New and Exit states are very useful components for process management. It is a more efficient implementation of the preceding two-state process concept.
    • Disadvantages: The data of a process that is terminated or exited from the OS is not saved by the OS. When each process enters a blocked state, the processor remains idle until at least one process exits the waiting state, which might cause a performance issue.
  • Process Termination
    1. Process Cleanup: Release any resources held by the process
    2. Update PCB: Update the process state in the PCB to reflect the termination
    3. Release PCB: Remove the PCB from the system's list of active processes
    4. Signal Termination: Notify the parent process or any other interested processes about the termination
    5. Return Exit Status: Provide an exit status or code to the parent process