deadlock

1. Why does deadlock occur?
  Because concurrent processes have a part of the resources, and want to preempt the resources of other processes. (If there is only one process, there is absolutely no deadlock)

  //Resources include: CPU, I/O channels, various storage, devices and data, files, databases, semaphores (and require resources not to die suddenly)
 

2. Deadlock Model

   P stands for process R stands for resources, and the number of dots in R stands for the number of resources

 

       

               No deadlock will occur, because P3 will release R3 after using it

 

       

            A deadlock will occur.

      

        No deadlocks (although there are loops)

 

 4. Characteristics of deadlock (just a necessary condition for deadlock)

  (1) Mutual exclusion : resources can only be owned by one process at the same time, if they can be owned at the same time, there will be no deadlock

  (2) Hold and wait : The process holds at least one resource and is waiting to acquire additional resources held by other processes

    (3) No preemption : a resource can only be automatically released by the process after completing the task

    (4) Circular waiting: that is, several processes wait for each other

 

5. Deadlock handling

  

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324971553&siteId=291194637