"Operating System Guide" 5th Edition -Chapter3- synchronous communication deadlock knowledge consolidation

Class A:
 
Deadlock:
*** Definition: a collection of processes within each process is waiting for can only result in the collection of events triggered by other processes to , and indefinite stalemate phenomenon
*** The reason Deadlock:
Improper order to promote the process
PV wrong use
Uneven distribution of resources
Resource use without restriction
 
*** deadlock conditions:
Exclusive
Possession and wait
Do not deprive
Circular wait
 
*** Solution: deadlock, deadlock avoidance, deadlock detection and recovery
 
Deadlock Prevention :
Static allocation - failure condition possession and wait
Sequential allocation, assignment level - the destruction cycle wait
Deadlock Avoidance
Banker's algorithm - circular wait
Deadlock detection and recovery
Deprived of resources
Rollback process
Revocation process
The system is restarted
 
Process synchronization and mutual exclusion solution: semaphores, monitors, message passing
 
*** critical area : the process for accessing critical resources code. Allows only one program access
 
Semaphore PV:
Comprises a signal shaping variable, and P and V are two atomic operations, which guarantee atomicity by the operating system, the only variable shaping operation by P and V operations change.
P means the signal magnitude minus 1, if the signal is reduced after completing a magnitude less than 0, then the resource is not enough, the process is added to the waiting queue.
V means that the signal value plus 1, after completion of the addition, if the signal value is less than or equal to 0, then wait for the queue process there, then wake up a waiting process
 
The tube
分散在各进程中的临界区集中起来进行管理,防止进程有意或无意的违法同步操作,便于用高级语言来书写程序
使用 条件变量wait(), signal()
 
管程的定义:管程是由局部于自己的若干公共变量,及其说明和所有访问这些公共变量的过程所组成的软件模块
管程的属性
共享性
安全性
互斥性
 
***进程通信(IPC,Inter-Process Communication)
信号通信
信号量
 
管道通信
消息传递
共享内存
 
消息传递
两条原语:发送消息和接收信息
间接通信,发送或接收消息通过 共享数据结构—— 信箱
 
管道: 连接读写进程的一个特殊文件。允许进程按先进先出方式传送数据,也能够使进程同步执行操作
 
发布了14 篇原创文章 · 获赞 1 · 访问量 1万+

Guess you like

Origin blog.csdn.net/m0_37302219/article/details/104267799