本篇文章主要介绍了" 6-DEADLOCKS",主要涉及到方面的内容,对于系统运维感兴趣的同学可以参考一下:
Please indicate the source: http://blog.csdn.net/gaoxiangnumber1Welcome to my gi...
Please indicate the source: http://blog.csdn.net/gaoxiangnumber1
Welcome to my github: https://github.com/gaoxiangnumber1
- Computer systems are full of resources that can be used only by one process at a time. Consequently, all operating systems have the ability to (temporarily) grant a process exclusive access to certain resources.
- A process may needs exclusive access to several resources. Suppose two processes each want to record a scanned document on a Blu-ray disc.
—Process A requests the scanner and is granted it.
—Process B requests the recorder and is also granted it.
Now
—A asks for the Blu-ray recorder, but the request is suspended until B releases it. —B asks for the scanner.
At this point both processes are blocked and will remain so forever. This situation is called a deadlock. - Deadlocks can also occur across machines. If devices(such as Blu-ray disc) can be reserved remotely (i.e., from the user’s home machine), deadlocks of the same kind can occur as described above.
6.1 RESOURCES
- A resource can be a hardware device (e.g., a Blu-ray drive) or a piece of information (e.g., a record in a database). A computer will normally have many different resources that a process can acquire.
- For some resources, several identical instances may be available, such as three Blu-ray drives. When several copies of a resource are available, any one of them can be used to satisfy any request for the resource. In short, a resource is anything that must be acquired, used, and released over the course of time.
6.1.1 Preemptable(可以抢先取得的) and Nonpreemptable Resources