背景:在多任务系统中,进程之间的相互影响成为必须解决的重要问题,由于共享资源争抢(间接制约)和进程之间的固有协作关系(直接制约),导致进程之间存在相互制约关系。1965年荷兰学者Dijkstra提出的信号量机制是用于解决进程间同步问题的一种重要机制。
问题描述:在父亲、女儿和儿子面前有一个放置水果的盘子plate,盘子最多可以放6个水果。父亲随机地向盘子里放入水果,可能是苹果也可能是桔子。女儿和儿子从盘 子中拿水果吃,但是女儿只吃桔子orange,儿子只吃苹果apple,并且每次只能有一个人对盘子访问(放水果或者拿水果)。
这是操作系统课上的第三次作业吧,晚上做了一下,只是个模拟程序,还不够完善。
#define RUNNING 0
#define