文件名称:fivephilosopher
介绍说明--下载内容均来自于网络,请自行研究使用
假如所有的哲学家都同时拿起左侧叉子,看到右侧叉子不可用,又都放下左侧叉子,等一会儿,又同时拿起左侧叉子,如此这般,永远重复。对于这种情况,即所有的程序都在无限期地运行,但是都无法取得任何进展,即出现饥饿,所有哲学家都吃不上饭。所以规定奇数号的哲学家先拿起他左边的叉子,然后再去拿他右边的叉子 而偶数号的哲学家则相反.按此规定,将是0,1号哲学家竞争0号叉子,2,3号哲学家竞争2号叉子.即五个哲学家都竞争奇数号叉子,获得后,再去竞争偶数号叉子,最后总会有一个哲学家能获得两支叉子而进餐。而申请不到的哲学家进入等待,当吃完饭的哲学家放下叉子后其他哲学家便可以拿到叉子,因此不会出现饿死的哲学家。-If all philosophers have also picked up the left fork, the right fork to see is not available, they are both down the left fork, wait a little longer, at the same time, pick up the left fork, and so on, never repeat. In this case, all the procedures that are in operation indefinitely, but are unable to make any progress, there is hunger, all philosophers have not afford enough food. Therefore, the provisions of odd philosopher he first took up the left fork, then plain his right fork, and even philosophers, on the contrary. accordingly, will be 0. philosopher competition on the 1st fork 0, 2, on the 3rd philosopher competition on the 2nd fork. that is five philosophers competition odd, fork, access, even longer competitive, fork, they will eventually have access to a philosopher two fork a
(系统自动生成,下载前可以参看下载内容)
下载文件列表
philosopher.c