Lecture notes explaining locking mechanisms for mutual exclusion in multithreaded programs, covering race conditions, critical sections, spinlocks, sleeping mutex, hardware atomic instructions like test-and-set and compare-and-swap, and thread-safe programming guidelines.
Overview of CPU Hardware
This lecture explains low-level OS mechanisms to run processes, handle system calls, and perform context switches. It includes function call stacks, privilege levels (user/kernel), trap instructions, interrupt descriptor tables, and detailed context switching processes in modern CPUs.
Concurrency Bugs
This lecture explains concurrency bugs in multithreaded programming including deadlocks (where threads wait indefinitely), atomicity bugs caused by race conditions, and order-violation bugs where expected execution order flips. It discusses detection, prevention using locks, condition variables, semaphores, and strategies for avoiding deadlocks such as lock ordering.
Semaphores
This lecture covers semaphores as synchronization primitives with counters and their operations (up/post and down/wait). Topics include binary semaphores as mutexes, semaphore usage in producer-consumer problems, and handling deadlocks caused by semaphore misuse.
Mechanism of Process Execution
This lecture covers how the OS runs processes, handles system calls, and performs context switches. It details privilege levels, kernel vs user stacks, trap instructions, interrupt descriptor tables, and saving/restoring context during process switches.