Critical Section in Synchronization
Critical Section in Synchronization
Although there are some properties that should be followed if any code
in the critical section
Open In App
2. Progress: If no process is executing in its critical section and some
processes wish to enter their critical sections, then only those processes
that are not executing in their remainder sections can participate in
deciding which will enter its critical section next, and this selection
cannot be postponed indefinitely.
3. Bounded Waiting: There exists a bound, or limit, on the number of
times that other processes are allowed to enter their critical sections
after a process has made a request to enter its critical section and
before that request is granted.
Deadlock: When two or more threads or processes wait for each other
to release a critical section, it can result in a deadlock situation in which
none of the threads or processes can move. Deadlocks can be difficult
to detect and resolve, and they can have a significant impact on a
program's performance and reliability.
Critical section
do{
flag=1;
while(flag); // (entry section)
// critical section
if (!flag)
// remainder section
} while(true);
acquireLock();
Process Critical Section
releaseLock(); Open In App