xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

資源簡(jiǎn)介

c語(yǔ)言實(shí)現(xiàn)的銀行家算法 有界面 基本滿足了要求 是操作系統(tǒng)書(shū)上的大實(shí)驗(yàn)

資源截圖

代碼片段和文件信息

/*
*銀行家算法Bankers?Algorithm
*組員:林麗燕?胡嫄?張燈?賴(lài)彬彬?陳順?lè)?崔北辰?陳阿強(qiáng)
*/
#include?
#include?
#include??
#include“interface_and_cursor.h“

#define?m?50
#define?FALSE?0
#define?TRUE?1

int?process_num;??//進(jìn)程數(shù)
int?resource_num;??//資源數(shù)
int?Allocation[m][m]Need[m][m]Available[m]Max[m][m];?


/*主界面輸入*/?????????????????????????
void?input()
{
view_form(21);
view_form(104);
gotoxy(272);
printf(“??**歡迎進(jìn)入銀行家算法**“);
view_labal(21692“請(qǐng)輸入進(jìn)程總數(shù):“);
view_edit(42662);
????ui_tools_gotoxy(487);
scanf(“%d“&process_num);
view_labal(211092“請(qǐng)輸入資源種類(lèi)數(shù):“);
view_edit(421062);
????view_labal(191572“確定(Enter)“);
view_labal(421572“取消(Esc)“);
????ui_tools_gotoxy(4811);
????scanf(“%d“&resource_num); system(“cls“);
}



/*安全算法函數(shù)*/
void?safety_check()???
{
int?kfv=0ij;
int?work[m]a[m];
bool?Finish[m];
TRUE;
for(i=0;i Finish[i]=false;???//?初始化進(jìn)程均沒(méi)得到足夠資源數(shù)并完成
for(i=0;i work[i]=Available[i];//work[i]表示可提供進(jìn)程繼續(xù)運(yùn)行的各類(lèi)資源數(shù)
k=process_num;
do{
for(i=0;i {
if(Finish[i]==false)
{
f=1;
for(j=0;j if(Need[i][j]>work[j])
f=0;//f=0為false,f=1為true

if(f==1)??????//找到還沒(méi)有完成且需求數(shù)小于可提供進(jìn)程繼續(xù)運(yùn)行的資源數(shù)的進(jìn)程
{
Finish[i]=true;
a[v++]=i;???//記錄安全序列號(hào)
for(j=0;j work[j]+=Allocation[i][j];??//釋放該進(jìn)程已分配的資源
}
}
}
k--;??????//每完成一個(gè)進(jìn)程分配,未完成的進(jìn)程數(shù)就減1
}while(k>0);
f=1;
for(i=0;i {
if(Finish[i]==false)???
{
f=0;
break;
}
}
if(f==0)???????//若有進(jìn)程沒(méi)完成,則為不安全狀態(tài)
{
gotoxy(1315);
printf(“系統(tǒng)處在不安全狀態(tài)!“);
FALSE;
}
else
{
gotoxy(1315);
printf(“系統(tǒng)當(dāng)前為安全狀態(tài),安全序列為:“);
for(i=0;i printf(“p%d??“a[i]);??//輸出安全序列
printf(“\n“);
}
}



/*輸出函數(shù)*/
void?output()?
{
int?ijs=0;
printf(“\n“);
gotoxy(136);
printf(“******************此時(shí)刻資源分配情況*******************\n“);
gotoxy(137);
printf(“進(jìn)程名????|?????Max?????|??Allocation??|?????Need?????|\n“);
????gotoxy(138);
for?(i?=?0;?i? {
????????if(s<5){{
gotoxy(138+s);
}
printf(“??p%d???????“i);
s++;
}
for?(j?=?0;?j? {
printf(“?%d???“Max[i][j]);
}

for?(j?=?0;?j? {
printf(“?%d???“Allocation[i][j]);
}

for?(j?=?0;?j? {
printf(“?%d???“Need[i][j]);
}

printf(“\n“);
}
printf(“\n“);
gotoxy(1314);
printf(“各類(lèi)資源可利用的資源數(shù)為:“);
for?(j?=?0;?j? {
printf(“?%d“Available[j]);
}
}



/*主函數(shù)*/
void?main(){
????void?safety_check();
void?output();
????int?row_index=0;
int?i=0jp=0q=0n=0r=0;
char?c;//為后面的c=getche()服務(wù)
int?Request[m]Allocation1[m][m]Need1[m][m]Available1[m];

input();
view_form(21);
view_form(104);
????gotoxy(203);
????printf(“矩陣輸入時(shí)隔位請(qǐng)用空格鍵,隔行請(qǐng)用Enter鍵!“

?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----

?????文件???????6885??2013-12-23?23:46??Bankers?Algorithm\Bankers?Algorithm.cpp

?????文件???????4570??2013-12-21?04:14??Bankers?Algorithm\Bankers?Algorithm.dsp

?????文件????????542??2013-12-21?04:14??Bankers?Algorithm\Bankers?Algorithm.dsw

?????文件??????50176??2013-12-25?16:56??Bankers?Algorithm\Bankers?Algorithm.ncb

?????文件??????48640??2013-12-25?16:56??Bankers?Algorithm\Bankers?Algorithm.opt

?????文件????????978??2013-12-25?12:33??Bankers?Algorithm\Bankers?Algorithm.plg

?????文件???????3069??2013-12-21?16:06??Bankers?Algorithm\Interface_and_Cursor.cpp

?????文件????????485??2013-12-21?04:15??Bankers?Algorithm\Interface_and_Cursor.h

?????文件?????208980??2013-12-25?12:33??Bankers?Algorithm\Debug\Bankers?Algorithm.exe

?????文件?????318892??2013-12-25?12:33??Bankers?Algorithm\Debug\Bankers?Algorithm.ilk

?????文件??????25366??2013-12-25?12:33??Bankers?Algorithm\Debug\Bankers?Algorithm.obj

?????文件????3574872??2013-12-22?00:40??Bankers?Algorithm\Debug\Bankers?Algorithm.pch

?????文件?????541696??2013-12-23?23:46??Bankers?Algorithm\Debug\Bankers?Algorithm.pdb

?????文件??????16533??2013-12-21?16:12??Bankers?Algorithm\Debug\Interface_and_Cursor.obj

?????文件?????148480??2013-12-25?12:39??Bankers?Algorithm\Debug\vc60.idb

?????文件??????77824??2013-12-23?23:46??Bankers?Algorithm\Debug\vc60.pdb

?????目錄??????????0??2013-12-28?23:38??Bankers?Algorithm\Debug

?????目錄??????????0??2013-12-28?23:38??Bankers?Algorithm

-----------?---------??----------?-----??----

??????????????5027988????????????????????18


評(píng)論

共有 條評(píng)論

相關(guān)資源