BCE-O535 Linux and Shell Programming

0 of 30 lessons complete (0%)

Module 5 Processes

Process State and Transitions

Process Creation and Termination

  • Process Creation: A new process is created when an existing process makes a system call to create a new one. This is often done using functions like fork() in C.
  • Process Termination: A process can terminate voluntarily by calling an exit system call or involuntarily due to an error or external signal.

Process State Diagram

  • A process state diagram illustrates the various states a process can go through during its lifecycle. Common states include Running, Ready, Blocked, and Terminate.
  • Example of a simplified process state diagram:

rustCopy code

Start --> Ready --> Running --> Blocked --> Terminate ^ | |_________|

Transitions Between States

  • Start to Ready: A process transitions from the Start state to the Ready state when it is ready to be executed but the CPU is currently allocated to another process.
  • Ready to Running: The scheduler selects a process from the Ready queue to execute, transitioning it to the Running state.
  • Running to Blocked: A process transitions from the Running state to the Blocked state when it must wait for an event (e.g., I/O completion).
  • Blocked to Ready: When the event a process is waiting for occurs, it moves from the Blocked state back to the Ready state.
  • Running to Terminate: A process transitions from the Running state to the Terminate state when it completes its execution.

Process Scheduling

  • Process Scheduling is the technique used by the operating system to manage the execution of processes on the CPU. It involves deciding which process gets to use the CPU and for how long.
  • Scheduling algorithms include First-Come, First-Served (FCFS), Shortest Job Next (SJN), Round Robin, Priority Scheduling, etc.
  • The scheduler selects a process from the Ready queue and allocates the CPU to it, moving it from Ready to Running state.

These concepts provide a fundamental understanding of how processes transition through different states and how the operating system manages their execution. Process scheduling is a crucial aspect of multitasking systems that ensures fair and efficient utilization of system resources.