DEADLOCK
BANKER'S ALGORITHM
What is banker’s algorithm ? :
The banker’s algorithm is a resource allocation and deadlock avoidance algorithm that tests for safety by simulating the allocation for predetermined maximum possible amounts of all resources, then makes an “s-state” check to test for possible activities, before deciding whether allocation should be allowed to continue.
CONCURRENCY
TURN VARIABLE
What is turn variable ? :
Turn Variable or Strict Alternation Approach is the software mechanism implemented at user mode. It is a busy waiting solution which can be implemented only for two processes. In this approach, A turn variable is used which is actually a lock.
This approach can only be used for only two processes. In general, let the two processes be Pi and Pj . They share a variable called turn variable.
PETERSON METHOD
Peterson’s solution provides a good algorithmic description of solving the critical-section problem and illustrates some of the complexities involved in designing software that addresses the requirements of mutual exclusion, progress, and bounded waiting.
SEMAPHORE
BINARY SEMAPHORE
A binary semaphore is restricted to values of zero or one, while a counting semaphore can assume any nonnegative integer value. A binary semaphore can be used to control access to a single resource. In particular, it can be used to enforce mutual exclusion for a critical section in user code. In a ‘binary semaphore’, the first task needing to use the resource will find the semaphore in a GO state and will change it to WAIT before starting to use the resource. Any other task in the meantime needing to use the resource will have to enter the blocked state. When the first task has completed accessing the resource, it changes the semaphore back to GO. This leads to the concept of ‘mutual exclusion’; when one task is accessing the resource, all others are excluded.