資源簡介
操作系統(tǒng)實驗綜合設(shè)計含代碼
操作系統(tǒng)實驗綜合設(shè)計含代碼
操作系統(tǒng)實驗綜合設(shè)計含代碼
代碼片段和文件信息
#include?“stdio.h“
#include?
#include?
#include?“iostream.h“
#define?getjcb(type)??(type*)malloc(sizeof(type))
#define?getsub(type)??(type*)malloc(sizeof(type))
#define?NULL?0
int?numnum2;??//要調(diào)度的作業(yè)數(shù)和要回收的區(qū)域數(shù)
int?m=0;?????//已分配作業(yè)數(shù)
int?flag;?????//分配成功標(biāo)志
int?isupisdown;???//回收區(qū)域存在上鄰和下鄰的標(biāo)志
int?is=0;
struct?jcb{
char?name[10];
char?state;
int?ntime;?//所需時間
?????????int?size;??//所需空間大小
?????????????????int?addr;??//所分配分區(qū)的首地址
struct?jcb?*link;
???????? }?*ready?=NULL?*p*q*as=NULL;
????????????????//作業(yè)隊列ready已分配作業(yè)隊列as
typedef?struct?jcb?JCB;
struct?subarea{?????????//分區(qū)塊
????????char?name[10];
????????int?addr;????//分區(qū)首地址
int?size;????//分區(qū)大小
char?state;
struct?subarea?*link;
??}?*sub=NULL*r*s*cur;
??//空閑分區(qū)隊列sub當(dāng)前分區(qū)指針cur
????????typedef?struct?subarea?SUB;
//--------------------------------------------------------------------------
void?sort_sub()?????/*對空閑分區(qū)按從小到大排序*/
{???SUB?*first*second;
????int?insert=0;
????if((sub==NULL)||((s->size)<(sub->size)))???/*插在隊列之首*/
{s->link=sub;
?sub=s;
}
????else{first=sub;????????/*尋找適當(dāng)?shù)奈恢貌迦?/
??????second=first->link;
??while(second!=NULL)
??{
??if((s->size)<(second->size))
??{
???s->link=second;
???first->link=s;
???second=NULL;
???insert=1;
??}
??else
??{
????????????????????????????first=first->link;
????second=second->link;
??}
??}
??if(insert==0)first->link=s;???/*插在隊尾*/
??}
}?
//--------------------------------------------------------------------------
void?firstsort()?/*?建立對作業(yè)按到達(dá)時間進(jìn)行排列的函數(shù)直接插在隊列之尾?sort*/
{
?JCB?*first;
?if(ready==NULL)??ready=p;
?else{
???first=ready;
???while(first->link!=NULL)
???????first=first->link;
???first->link=p;
???p->link=NULL;
??}
}
//--------------------------------------------------------------------------
void?lastsort()??????/*建立對已分配作業(yè)隊列的排列函數(shù)直接插在隊列之尾sort3*/
{
?JCB?*fir;
?if(as==NULL)?as=q;
?else{
???fir=as;
???while(fir->link!=NULL)
?????fir=fir->link;
???fir->link=q;
???q->link=NULL;
??}
??m++;
}
//--------------------------------------------------------------------------???
void?input()?/*?建立作業(yè)控制塊函數(shù)*/
{
?int?i;
?printf(“\n請輸入要調(diào)度的總作業(yè)數(shù):“);
?scanf(“%d“&num);
?for(i=0;i ??{
???printf(“\n作業(yè)號No.%d:\n“i);
???p=getjcb(JCB);
???printf(“\n輸入作業(yè)名:“);
???scanf(“%s“&p->name);
???printf(“\n輸入作業(yè)的大小:“);
???scanf(“%d“&p->size);
???printf(“\n輸入作業(yè)所需運行時間:“);
???scanf(“%d“&p->ntime);
???p->state=‘w‘;
???p->link=NULL;
???firstsort();?/*?調(diào)用sort函數(shù)*/
??}
?printf(“\n?按任一鍵繼續(xù)......\n“);
?getch();
}
//--------------------------------------------------------------------------
void?input2()?????/*建立要回收區(qū)域的函數(shù)*/
{
?JCB?*k;
?int?has;
?q=getjcb(JCB);
?printf(“\n輸入?yún)^(qū)域名(作業(yè)名):“);
?scanf(“%s“&q->name);
?p=as;
?while(p!=NULL)
??{if(strcmp(p->nameq->name)==0)??/*在已分配作業(yè)隊列中尋找*/
???????{
????????q->addr=p->addr;
????????q->size=p->size;
????????has=1;????/*輸入作業(yè)名存在標(biāo)志
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????192512??2007-11-05?21:37??操作系統(tǒng)實驗綜合設(shè)計\實驗封面.doc
?????文件?????192512??2007-11-05?21:37??操作系統(tǒng)實驗綜合設(shè)計\綜合設(shè)計封面.doc
?????文件???????5673??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\進(jìn)程調(diào)度2\jin.C
?????文件??????22563??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\進(jìn)程調(diào)度2\jin.exe
?????文件?????150016??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\進(jìn)程調(diào)度2\進(jìn)程調(diào)度實驗報告.doc
?????文件?????????64??2008-10-18?20:50??操作系統(tǒng)實驗綜合設(shè)計\進(jìn)程調(diào)度2\更多電子書下載.html
?????文件??????23204??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\文件管理\Filesystem_s.cpp
?????文件?????????33??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\文件管理\LOGIN.exe
?????文件??????27136??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\文件管理\Project1.exe
?????文件?????????14??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\文件管理\xiao.txt
?????文件?????176640??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\文件管理\文件系統(tǒng)實驗報告.doc
?????文件?????????64??2008-10-18?20:50??操作系統(tǒng)實驗綜合設(shè)計\文件管理\更多電子書下載.html
?????文件??????10686??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\存儲管理\cunchuguanli.c
?????文件??????26600??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\存儲管理\cunchuguanli.exe
?????文件?????173056??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\存儲管理\存儲管理實驗報告.doc
?????文件?????????64??2008-10-18?20:50??操作系統(tǒng)實驗綜合設(shè)計\存儲管理\更多電子書下載.html
?????文件???????6228??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\作業(yè)調(diào)度\duodao.c
?????文件??????20917??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\作業(yè)調(diào)度\duodao.exe
?????文件???????7243??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\作業(yè)調(diào)度\zuoye.c
?????文件??????22399??2007-11-05?21:37??操作系統(tǒng)實驗綜合設(shè)計\作業(yè)調(diào)度\zuoye.exe
?????文件?????191488??2007-11-05?21:37??操作系統(tǒng)實驗綜合設(shè)計\作業(yè)調(diào)度\作業(yè)調(diào)度實驗報告.doc
?????文件?????????64??2008-10-18?20:50??操作系統(tǒng)實驗綜合設(shè)計\作業(yè)調(diào)度\更多電子書下載.html
?????文件??????23112??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\主存空間分配與回收\cunchu.cpp
?????文件??????17920??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\主存空間分配與回收\Project1.exe
?????文件?????286720??2007-11-05?21:36??操作系統(tǒng)實驗綜合設(shè)計\主存空間分配與回收\主存空間的分配與回收.doc
?????文件?????????64??2008-10-18?20:50??操作系統(tǒng)實驗綜合設(shè)計\主存空間分配與回收\更多電子書下載.html
?????文件?????????64??2008-10-18?20:50??操作系統(tǒng)實驗綜合設(shè)計\更多電子書下載.html
?????目錄??????????0??2008-04-18?22:30??操作系統(tǒng)實驗綜合設(shè)計\進(jìn)程調(diào)度2
?????目錄??????????0??2008-04-18?22:30??操作系統(tǒng)實驗綜合設(shè)計\文件管理
?????目錄??????????0??2008-04-18?22:30??操作系統(tǒng)實驗綜合設(shè)計\存儲管理
............此處省略6個文件信息
評論
共有 條評論