Processes

States

Running

Running on the processor.

Blocked
Waiting for something.
Ready
Waiting to be allocated CPU time.

State Transitions

Running -> Ready
Preempted by scheduler
Ready -> Running
Scheduler selects process
Running -> Blocked
Process waits for some event.
Blocked -> Ready
IO finishes.

Process Control Block (PCB)

  • A table containing information about each process.
  • Contains enough information to re-start a process if it is stopped.

Context Switch

The process of stopping one process, saving it’s state to the PCB, loading the state of another process from the PCB, and running it.

Threads

  • Multiple flows of controll inside each process.
  • Each thread has it’s own PC, registers and stack.
  • Threads in the same process share the same code, global variables and FDs.

User-Level Threads

This is where threads are implemented as a library in the process, so the OS only sees one process with one thread.

  • Fast thread creation and scheduling.
  • If one thread blocks, the entire process is blocked.
  • Can’t take advavtage of multiple processors.

Native/Kernel Threads

Where threads are scheduled and managed by the kernel.

  • Can take advantage of multiple CPUs.
  • Slow to start because it involves a system call.

Table Of Contents

Previous topic

Concepts

Next topic

Scheduling

This Page