Process Synchronization in operating system is related to concurrent access of data by various processes. The access to data should be controlled in order to avoid any erroneous behavior caused by one process on another process. This led to race condition where each process tries to access the shared data and writes its value last so as to preserve the changes. Synchronization is used to prevent the problem of race condition and concurrency related issues in operating system.
The critical section problem states:
Solution to critical section problem:
The semaphore is an integer variable whose value indicates the status of shared resource. It protects the access to the shared resource/data by multiple processes. When one process modifies the semaphore value, no other process can simultaneously modify that same semaphore value. There are two types of semaphores:
A monitor is a programming construct which allows you to support controlled access to shared data. A monitor contains shared data structure, procedures/functions that operated on shared data and synchronization between concurrent processes or threads which invoke these procedures. The data can only accessed within monitor from procedures only.
Download as PDF
Read next: Deadlock ››
« Back to Course page
May – 2020 Edition
April – 2020 Edition
March – 2020 Edition
February – 2020 Edition
January – 2020 Edition
December – 2019 Edition
Punjab Civil Services 2020