Siz-education || Deadlock in Computer|| by @christnenye

in Steem Infinity Zone6 months ago (edited)

Hello everyone, hope you all are doing great. Welcome back to my blog.

Often while using our computer we experience a state of standstill when ever two or more applications are running concurrently in our Computer, "we often make sentence like my computer is hanging ", the correct word for such is deadlock. Today, I will be writing on deadlock, condition for deadlock to occur, and strategies to deal with deadlock problem.

Screenshot_20220329-104338.jpg
Source

INTRODUCTION

Deadlock occurs when two computer programs running concurrently and sharing the same resource are effectively preventing each other from accessing the resource each has. The system is said to be in deadlock state when each process holds a resource being requested by the other process and neither process is willing to release the resource it holds.

N/B: A process is a program in execution

In computer this occur when a process which are programs in execution is waiting for resources that other waiting processes have and the other processes are waiting for the resource it has. These resources may be either physical or logical, the physical resources are tape drivers, memory space, CPU cycle and printers. The logical resources are files, semaphores, and monitors.

Using physical resources to illustrate deadlock, example of deadlock in computer is where process 1 has been allocated non-sharable resources of tape drivers, and process 2 has been allocated non-sharable resource of a printer. If then it turns out that process 1 needs printer to proceed and process 2 also need tape drivers to proceed and these are the only two processes running in the system, each has blocked the other and all useful work in the system stopped.

Natural occurrence of deadlock is seen in traffic where road is blocked because each car refuses to make space for each other to move as seen in the picture below,

Screenshot_20220329-112309.jpg
Source a picture despicting traffic Deadlock

However, in case of traffic deadlock it happens sometimes when two or more vehicles are waiting for the each other and if each vehicle follow a centralized path traffic deadlock will be avoided.

In computing, according to Coffman, in (1971) he identified four condition that must hold simultaneously for deadlock to occur as shown below.

Screenshot_20220329-124520.jpg
Source

In the above conditions stated by Coffman, a process holds resources that is needed by another process and refuses to release it.

Having known the causes/conditions from Coffman there are ways to deal with deadlock problem

Screenshot_20220329-171737.jpg
Source

  • Deadlock Avoidance: This approach to the deadlock problem is that the request for any resource such as printer, tape drivers etc will be granted if the resulting state of the system doesn't cause deadlock in the system. Also, anticipating deadlock before it actually occurs which entails careful resource scheduling of both printers, tape drivers etc.

  • Deadlock prevention Having known the conditions which can also be the causes, preventing therefore comes eliminating hold and wait condition, mutual exclusive, no preemption and circular wait.

  • Deadlock detection and recovery detecting deadlock is when the two processes holding resources required for eachother to proceed and recovering is to carefully schedule resources according to the process with utmost priority.

  • The Ostrich approach this is the least, it entails ignoring the deadlock problem altogether by cancellating and restarting the process.

CONCLUSION
Deadlock occurs when too many programs run concurrently at the same time and the inability to maximize the computing resources effectively. The best way to solve this issue is to prevent, avoid and detect and recover, finally using the Ostrich approach.



Cc: @siz-official
@etainclub

Sort:  

Hello @christnenye, your post has been supported by @cryptogecko using @steemcurator07 curation account, which we are using for #science, #technology, and #computing theme tags.

Thank you for making a post in the #Computing category. We appreciate the work you have put in this post.


  • Follow @steemitblog for all the latest updates, and keep on creating quality content on Steemit.

  • Read our guidelines post here to better understand what we look for in a post.


Regards,
Team #Sevengers

Thanks @cryptogecko, for appreciating me.

Coin Marketplace

STEEM 0.22
TRX 0.06
JST 0.025
BTC 19278.06
ETH 1309.89
USDT 1.00
SBD 2.44