What is Critacal Section Problem and Semaphore in OS.?
The Critical-Section Problem : Critical Section: Each process has a code segment, called a critical section, in which the shared data is accessed. Critical Section Problem: We need to ensure that when one process is executing in its critical section, no other process is allowed to execute in its critical section. It may cause inconsistency outcomes due to race conditions. The general structure of process Pi (other processes Pj) do { entry section critical section exit section reminder section } while (1); Competing Processes may share some common variables to synchronize their actions. Race condition: The situation where several processes access – and manipulate shared data concurrently. The final value of the shared data depends upon which process finishes last. To prevent race conditions, concurrent processes must be synchronized. A solution to the critical section problem must satisfy the following three requirements: 1) Mutual Exclusion: If proce...