Deadlock:
A deadlock is a situation in which two computer programs sharing the same resource are effectively preventing each other from accessing the resource, resulting in both programs ceasing to function.
Four conditions
must hold for there to be a deadlock:
Mutual exclusion
condition.
Each resource is
either currently assigned to exactly one process or is available.
Hold and wait
condition.
Processes
currently holding resources granted earlier can request new resources.
No preemption
condition.
Resources
previously granted cannot be forcibly taken away from a process. They must be
explicitly released by the process holding them.
Circular wait
condition.
There must be a
circular chain of two or more processes, each of which is waiting for a
resource held by the next member of the chain.
All four of
these conditions must be present for a deadlock to occur. If one of them is
absent, no deadlock is possible.
Explain
Semaphores
Semaphores:
Semaphore is a simply a variable.
This variable is used to solve critical section problem and to achieve process
synchronization in the multi-processing environment.
The two most
common kinds of semaphores are counting semaphores and binary semaphores.
Counting semaphore can take non-negative integer values and Binary semaphore
can take the value 0 & 1. Only.
0 comments:
Post a Comment