Critical Section
A critical section is a section of code in a program which cannot be executed by more than one thread at the same time.
Possible Solutions to Critical Section
-Disabling Interrupts
-Using a Lock Variable
-Transactions
-Semaphores
Semaphores
A semaphore is OS ADT (Abstract Data Type) that is capable of controlling the use of a limited resource in a multiprogramming environment. The 2 operations are:
-P(x): This blocks the process/thread if the resource is not available.
-V(x): This increment of counter, indication that a process/thread has finished with the critical resource.
Difference between Asynchronous IPC and Synchronous IPC
For Asynchronous IPC, the sending or the receiving operation will not cause the process/thread to block.
While in Synchronous IPC, the operation will cause the process/thread to block in the following situations:
-If the receiving party is not listening, in the case of the sending operation.
-If the sending party is not sending yet, in case the case of the receiving operation.