-
大小: 1.38MB文件類型: .rar金幣: 1下載: 0 次發(fā)布日期: 2021-01-05
- 語(yǔ)言: 其他
- 標(biāo)簽: 實(shí)驗(yàn)報(bào)告??
資源簡(jiǎn)介
本程序需要用到的數(shù)據(jù)有:5個(gè)哲學(xué)家和一張圓桌子,桌子旁邊有5個(gè)座位,桌子上放著5支筷子,每?jī)蓚€(gè)座位之間放一支,為了吃面,哲學(xué)家必須獲得一雙筷子,且每人只能直接從緊鄰自己的左邊或右邊去取筷子。
①哲學(xué)家是進(jìn)程,有四種狀態(tài),分別是等待任務(wù)、思考、饑餓、就餐,用不同圖片表示哲學(xué)家狀態(tài)。
②筷子是進(jìn)程運(yùn)行所需要的資源,有兩種狀態(tài):被占用和空閑,筷子圖片為空白時(shí),資源被占用。
③進(jìn)程運(yùn)行時(shí)間是由隨機(jī)函數(shù)隨機(jī)產(chǎn)生的,隨機(jī)函數(shù)是以當(dāng)前逝去時(shí)間作為隨機(jī)種子,進(jìn)程運(yùn)行時(shí)間。
代碼片段和文件信息
/*
?*?To?change?this?template?choose?Tools?|?Templates
?*?and?open?the?template?in?the?editor.
?*/
package?experiment;
import?java.util.logging.Level;
import?java.util.logging.Logger;
import?javax.swing.ImageIcon;
import?javax.swing.JLabel;
/**
?*
?*?@author?Administrator
?*/
public?class?Chopstick?{
????private?boolean?chopstickState;//筷子狀態(tài),是否可用
????private?ImageIcon?emptyIcon;//筷子被占用時(shí),圖片為空
????private?ImageIcon?chopstickIcon;//筷子未被占用時(shí),圖片為筷子
????private?JLabel?chopstickLabel;//顯示筷子圖片的標(biāo)簽Label
????public?Chopstick(ImageIcon?chopstickIcon?JLabel?chopstickLabel)?{
????????this.chopstickState?=?true;//可用
????????this.emptyIcon?=?new?ImageIcon();
????????this.chopstickIcon?=?chopstickIcon;
????????this.chopstickLabel?=?chopstickLabel;
????}
????//得到筷子
????public?synchronized?void?getChop
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????3749??2011-11-17?09:23??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build.xm
?????文件?????????85??2011-11-17?09:23??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\manifest.mf
?????文件??????48806??2011-11-17?09:23??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\nbproject\build-impl.xm
?????文件????????475??2011-11-17?09:23??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\nbproject\genfiles.properties
?????文件???????2592??2011-11-26?14:53??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\nbproject\project.properties
?????文件????????526??2011-11-17?09:23??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\nbproject\project.xm
?????文件??????????0??2011-11-17?12:11??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\nbproject\private\config.properties
?????文件????????173??2011-11-17?12:11??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\nbproject\private\private.properties
?????文件????????211??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\nbproject\private\private.xm
?????文件???????1434??2011-11-26?14:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\experiment\Chopstick.java
?????文件??????28439??2011-12-08?10:31??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\experiment\NewJfr
?????文件??????27664??2011-12-08?10:31??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\experiment\NewJfr
?????文件???????6193??2011-12-08?10:32??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\experiment\Philosoper.java
?????文件??????10732??2011-11-18?18:59??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\images\chopstick.gif
?????文件??????28859??2011-11-18?18:59??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\images\desk.jpg
?????文件??????11870??2011-11-18?18:59??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\images\eat.jpg
?????文件????????181??2011-11-25?23:25??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\images\empty.png
?????文件??????12193??2011-11-18?18:59??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\images\hungry.jpg
?????文件??????11189??2011-11-18?18:59??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\images\think.jpg
?????文件??????14469??2011-11-18?18:59??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\src\images\wait.jpg
?????文件????????202??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build\built-jar.properties
?????文件???????1425??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build\classes\experiment\Chopstick.class
?????文件????????766??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build\classes\experiment\NewJfr
?????文件????????757??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build\classes\experiment\NewJfr
?????文件????????757??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build\classes\experiment\NewJfr
?????文件????????757??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build\classes\experiment\NewJfr
?????文件????????757??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build\classes\experiment\NewJfr
?????文件????????622??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build\classes\experiment\NewJfr
?????文件??????13470??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build\classes\experiment\NewJfr
?????文件???????3685??2011-12-08?10:36??操作系統(tǒng)綜合實(shí)驗(yàn)之哲學(xué)家吃面問(wèn)題\源代碼\PhilosopherProblem\build\classes\experiment\Philosoper.class
............此處省略40個(gè)文件信息
評(píng)論
共有 條評(píng)論