操作系统复习五

本文深入探讨了进程同步的重要性,如维护数据一致性,并通过互斥确保操作有序执行。文章介绍了信号量机制,阐述了如何避免竞态条件,并详细说明了PV操作。同时,讨论了死锁和饥饿现象,这两种可能导致进程无限等待的情况。最后,提到了抢占式优先级调度算法作为解决这些问题的一种策略。
摘要由CSDN通过智能技术生成

ch5 Process Synchronisation

Motivation:
1.Maintaining data consistency requires mechanisms to ensure the orderly execution of cooperating processes.
2.Suppose that we want to provide a solution to the consumer-producer problem that fills all buffer slots.

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


A Race Condition:
We need to enclose these operations in a critical section which will guarantee that only one processes can access these variables at any one time: mutual exclusion

在这里插入图片描述


Semaphore Implementation with almost no Busy Waiting:
Each entry in a waiting queue has two data item:
1.int count
2.pointer to next entry in the queue
Two operations:
–block: place the process invoking the operation on the appropriate waiting queue.
–wakeup: remove one of processes in the waiting queue and place in the ready queue

PV操作:
在这里插入图片描述
Deadlock:
two or more processes are waiting indefinitely for an event that can be caused by only one of the waiting processes
Starvation:
indefinite blocking.A process may never be removed from the semaphore queue in which it is suspended.


在这里插入图片描述
Preemptive Priority Scheduling algorithm
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值