Docsity

process switching and process suspension, Summaries of Computer science

Partial preview of the text

Download process switching and process suspension and more Summaries Computer science in PDF only on Docsity!

Process

Suspension

and Process

Switching

Modern operating systems create the illusion of running multiple programs

simultaneously, but CPUs actually handle one task at a time. They switch

between tasks so rapidly that everything feels concurrent. Two fundamental

mechanisms make this possible: process suspension and process switching.

Process Suspension and Process Switching

When a process has nothing to do, say it is waiting for user input or a file to load, keeping it in RAM is wasteful. The OS handles this by moving idle processes out of RAM and onto disk, freeing up that valuable memory for processes that are actually ready to work. This is called suspension. RAM is fast but limited. Rather than terminating a waiting process, the OS shelves it temporarily and brings it back when needed.

Beyond the familiar Ready, Running, and Blocked states, real operating systems add a Suspended state, and actually two variants of it:

  • (^) Blocked Suspend: means the process is waiting for an event and has been moved to disk.
  • (^) Ready Suspend: means the process is ready to run but has not been loaded back into RAM yet.

Process switching While suspension deals with memory, process switching deals with CPU time. Since only one process can use the CPU at any instant, the OS continuously rotates processes in and out, stopping one and loading another. This is commonly called a context switch. Switching is typically triggered by an interrupt, which is a signal demanding the OS's immediate attention. These can come from hardware like a keyboard or mouse, or from software conditions.

  • (^) Supervisor calls: mean a process requests the OS to perform a privileged action like reading from disk. While the OS handles it, the waiting process steps aside and the CPU moves on.
  • (^) Traps: occur when an error happens mid- execution such as division by zero or illegal memory access. The OS intervenes to decide whether to recover or terminate.
  • (^) Interrupts: are external events that demand attention regardless of what is currently running, such as a timer firing, a network packet arriving, or a key being pressed. What triggers a process switch?

Suspension vs. Switching: The Core Difference

In short, suspension decides where a process lives, while switching decides who gets the CPU right now. Together, they keep a system responsive, fair, and capable of juggling dozens of tasks without breaking a sweat. conclusion Thank you!