Roger Fan

Notes

High School Notes
University Notes
Computer Networking
Computer Architecture
Operating System
Chapter 0
Chapter 1: Operating System Introduction
Chapter 2: OS Structure
Chapter 3: Process Concept
Chapter 4: Multithreaded Programming
Chapter 5: Process Scheduling
Chapter 6: Process Synchronization
Chapter 7: Deadlocks
Chapter 8: Memory Management
Chapter 9: Virtual Memory Management
Chapter 10: File System Interface
Chapter 11: File System Implementation
Chapter 12: Mass Storage System
Chapter 13: IO System
Discrete Math
Calculus
Calculus I
Calculus II
Linear Algebra
Probability
General Physics
General Education
Tech Notes
TMUX
SSH
Fail2ban
SSHD
UFW
DNS Bind9
Notes
University Notes
Operating System
Chapter 6: Process Synchronization

Login Required

This note requires login to view the full content (464 lines total). Showing first 20 lines as preview. Please login to view the full content.

Login to unlock

Chapter 6: Process Synchronization

Created: 2025-12-16
Updated: 2025-12-16

Login to unlock full content

Login Now
roger@roger.tw
roger@roger.tw
© 2026 Roger Fan. All rights reserved.
  • background: concurrent access to shared data may result in data inconsistency
  • consumer-producer problem: counter itself will have synchronization issues
  • Race Condition: the outcome depends on which process finished first, which is uncontrollable
  • Solution: 1) non-preemptive scheduling: can be used in kernel mode only. 2) critical section
  • Critical Section
    • N processes are competing to use shared data
    • each process has a code segment, called critical section (CS), in which the shared data is accessed
    • ensure mutual exclusion: only one process can be in its CS at a time
  • Critical Section Requirements
    • Mutual Exclusion: only one process in CS at a time
    • Progress: No deadlock --- It ensures the system doesn't freeze. If the CS is empty, someone must be allowed to enter.
    • Bounded Waiting: No starvation --- It ensures fairness. An individual process cannot be forced to wait forever while others cut in line.
  • Entry Section: code to request permission to enter CS
  • Exit Section: code to release CS

Software Solutions

Peterson's Solution (2 processes only)