Concurrency and Mutual Exclusion (Part 1)


Agenda

  • How does the OS provide concurrency through threads
    • Brief discussion of process/thread states and scheduling
    • High-level discussion of how stacks contribute to concurrency
  • Introduce needs for synchronization
  • Discussion of Locks and Semaphores

Processes Multiplexing

The Process Control Block

  • A chunk of memory in the Kernel represents each process as a process control block (PCB)
    • Status (running, ready, blocked, …)
    • Register state (when not running)
    • Process ID (PID), User, Executable, Priority, …
    • Execution time, …
    • Memory space, translation, …
  • Kernel Scheduler maintains a data structure containing the PCBs
    • Give out CPU to different processes (who gets the CPU to run themselves!)
    • This is a Policy Decision
  • Give out non-CPU resources
    • Memory/IO
    • Another policy decision

Context Switch

Resources