What is a critical section? Explain.

 Ans)     The most synchronization problem confronting cooperating processes, is to control the access between the shared resources. Suppose two processes share access to a file and at least one of these processes can modify the data in this shared area of memory. That part of the code of each program, where one process is reading from or writing to a shared memory area, is a critical section of code; because we must ensure that only one process execute a critical section of code at a time. The critical section problem is to design a protocol that the processes can use to coordinate their activities when one wants to enter its critical section of code.

No comments:

Post a Comment