91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

西電的操作系統(tǒng)課設(shè)3(優(yōu)先級捐贈方法解決優(yōu)先級翻轉(zhuǎn)問題),含源碼(只放了四個需要修改的c和h文件,都是在課設(shè)2的基礎(chǔ)上做的,課設(shè)2和3的代碼均備注了修改的起末段落,且使用了不盡相同的備注)。該做法參考了【LY】的幫助手冊,我在實驗方案中給了相當(dāng)詳細的說明。代碼結(jié)合說明來做的話,理解這題應(yīng)該沒什么問題。 課設(shè)最終成績90+,不用擔(dān)心質(zhì)量。 最后一個提醒,每個學(xué)校OS課設(shè)不一樣,我這個是用優(yōu)先級捐贈的方法解決優(yōu)先級翻轉(zhuǎn)問題(當(dāng)然是針對Pintos內(nèi)核)。 (總覺得自己想賺點CSDN積分也是蠻拼的= =||。So學(xué)弟學(xué)妹們酷愛來下吧括弧笑~)

資源截圖

代碼片段和文件信息

/*?This?file?is?derived?from?source?code?for?the?Nachos
???instructional?operating?system.??The?Nachos?copyright?notice
???is?reproduced?in?full?below.?*/

/*?Copyright?(c)?1992-1996?The?Regents?of?the?University?of?California.
???All?rights?reserved.

???Permission?to?use?copy?modify?and?distribute?this?software
???and?its?documentation?for?any?purpose?without?fee?and
???without?written?agreement?is?hereby?granted?provided?that?the
???above?copyright?notice?and?the?following?two?paragraphs?appear
???in?all?copies?of?this?software.

???IN?NO?EVENT?SHALL?THE?UNIVERSITY?OF?CALIFORNIA?BE?LIABLE?TO
???ANY?PARTY?FOR?DIRECT?INDIRECT?SPECIAL?INCIDENTAL?OR
???CONSEQUENTIAL?DAMAGES?ARISING?OUT?OF?THE?USE?OF?THIS?SOFTWARE
???AND?ITS?DOCUMENTATION?EVEN?IF?THE?UNIVERSITY?OF?CALIFORNIA
???HAS?BEEN?ADVISED?OF?THE?POSSIBILITY?OF?SUCH?DAMAGE.

???THE?UNIVERSITY?OF?CALIFORNIA?SPECIFICALLY?DISCLAIMS?ANY
???WARRANTIES?INCLUDING?BUT?NOT?LIMITED?TO?THE?IMPLIED
???WARRANTIES?OF?MERCHANTABILITY?AND?FITNESS?FOR?A?PARTICULAR
???PURPOSE.??THE?SOFTWARE?PROVIDED?HEREUNDER?IS?ON?AN?“AS?IS“
???BASIS?AND?THE?UNIVERSITY?OF?CALIFORNIA?HAS?NO?OBLIGATION?TO
???PROVIDE?MAINTENANCE?SUPPORT?UPDATES?ENHANCEMENTS?OR
???MODIFICATIONS.
*/

#include?“threads/synch.h“
#include?
#include?
#include?“threads/interrupt.h“
#include?“threads/thread.h“

/*?Initializes?semaphore?SEMA?to?VALUE.??A?semaphore?is?a
???nonnegative?integer?along?with?two?atomic?operators?for
???manipulating?it:

???-?down?or?“P“:?wait?for?the?value?to?become?positive?then
?????decrement?it.

???-?up?or?“V“:?increment?the?value?(and?wake?up?one?waiting
?????thread?if?any).?*/
void
sema_init?(struct?semaphore?*sema?unsigned?value)?
{
??ASSERT?(sema?!=?NULL);

??sema->value?=?value;
??list_init?(&sema->waiters);
}

/*?Down?or?“P“?operation?on?a?semaphore.??Waits?for?SEMA‘s?value
???to?become?positive?and?then?atomically?decrements?it.

???This?function?may?sleep?so?it?must?not?be?called?within?an
???interrupt?handler.??This?function?may?be?called?with
???interrupts?disabled?but?if?it?sleeps?then?the?next?scheduled
???thread?will?probably?turn?interrupts?back?on.?*/
void
sema_down?(struct?semaphore?*sema)?
{
??enum?intr_level?old_level;

??ASSERT?(sema?!=?NULL);
??ASSERT?(!intr_context?());

??old_level?=?intr_disable?();
??while?(sema->value?==?0)?
????{
/*CC3-----added------*/
thread_current()->block_sema?=?sema;//記錄sema
/*CC-----finish------*/
/*CC2-----deleted-----*/
????//??list_push_back?(&sema->waiters?&thread_current?()->elem);
????/*CC2-----addeded-----*/
????list_insert_ordered(&sema->waiters&thread_current?()->elemthread_lessNULL);
????/*CC-----finish-----*/
??????thread_block?();
????}
??sema->value--;
??intr_set_level?(old_level);
}

/*?Down?or?“P“?operation?on?a?semaphore?but?only?if?the
???semaphore?is?not?already?0.??Returns?true?if?the?semaphore?is
???decremented?false?otherwise.

???This?function?may?be?called?from?an?interrupt?handler.?*/
bool
sema_try_

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????390106??2014-12-18?22:14??OS課設(shè)3.pdf
?????文件??????685228??2011-12-17?19:08??Screenshot?from?2011-12-17?19_08_33.png
?????目錄???????????0??2015-01-18?15:05??代碼\
?????文件???????12031??2014-12-18?21:29??代碼\synch.c
?????文件????????1627??2014-12-17?23:03??代碼\synch.h
?????文件???????18997??2014-12-18?21:29??代碼\thread.c
?????文件????????5976??2014-12-18?20:06??代碼\thread.h

評論

共有 條評論

相關(guān)資源