Inter-Process Communicationby Xiaolan Liu |
|
Solutions
Demonstration
|
Solutions
Mutual exclusion may be enforced to ensure two processes do not interfere with each other when they run on the same system and want to access their critical sections, or shared resources, at the same time.
Therefore, a process that is about to enter its critial section must check to see if any other processes are in their critical sections first. Busy Waiting: If a process is denied access to its critical section, it will continue to check again and again until it can enter its critical section. This continuous checking of the lock variable is called busy waiting. Busy waiting waste valuable processor time, and in some cases can cause deadlock. Sleep and Wakeup: When a process is not permitted to access its critical section, it uses a system call known as Sleep, which causes that process to block. The process will not be scheduled to run again, until another process uses the Wakeup system call. In most cases, Wakeup is called by a process when it leaves its critical section.
|