🖥️

Understanding Process States and Scheduling

Aug 5, 2024

Process States and Life Cycle

Introduction

  • Overview of process states and life cycle
  • Importance for competitive exams and university level exams
  • Encouragement to like and subscribe for more content

Understanding Process States

  • Model created to explain the states a process goes through from start to end
  • Kernel does not know process states; it’s a user-level model

Primary Process States

  • New:
    • Created process (e.g., program stored in secondary memory)
  • Ready:
    • Process in RAM, waiting for CPU time
    • Managed by long-term scheduler, part of multi-programming concept
  • Running:
    • Process currently being executed by the CPU
    • Can have multiple processes on multi-processor systems, but typically assumed as uni-processor
  • Terminated:
    • Completed process, resources deallocated
  • Wait/Block:
    • Process waiting for an I/O operation to complete

Process Scheduling

  • Long-Term Scheduler:
    • Responsible for bringing processes into the ready state
    • Facilitates multi-programming by managing processes in RAM
  • Short-Term Scheduler:
    • Dispatches processes from ready state to running state
    • Can implement pre-emptive or non-pre-emptive scheduling:
      • Pre-emptive: Process can be interrupted (e.g., high priority process)
      • Non-Pre-emptive: Process runs to completion without interruption

Process Execution

  • After dispatching, CPU executes instructions
  • If a process requires I/O:
    • Moves to waiting state and CPU handles other processes
  • When I/O is complete, it returns to the ready state

Additional States

  • Suspended Wait/Block:
    • When the wait queue is full, processes are swapped out to secondary memory
    • Managed by medium-term scheduler
  • Suspend Ready:
    • High priority processes can be placed in suspend ready state if the ready queue is full

Task Management in Operating Systems

  • Windows Task Manager:
    • Lists all running processes and their states
  • UNIX/Linux:
    • Use of PS command to get process information

Conclusion

  • Recap of process states: New, Ready, Running, Terminated, Wait/Block
  • Importance of understanding scheduling types: Long-term, Short-term, Medium-term & pre-emptive/non-pre-emptive
  • Encouragement to review linked videos for deeper understanding of multi-tasking and programming concepts

This summary captures the essential points regarding process states, their life cycle, and scheduling mechanisms within operating systems.