資源簡介
操作系統進程調度源代碼,實現先來先服務調度、最短時間調度、最短剩余時間調度、優先級調度算法,此文件為.cpp文件,直接下載可執行
代碼片段和文件信息
#include
#include
#include??
#include???
#include?
using?namespace?std;?
const?int?INF?=?0x7fffffff;??
struct?node?{
int?num;
int?atime;
int?wtime;
int?youxian;
int?timechip;
}
pcb;
int?n;
struct?node?pro[100];
bool?vis[100];?
struct?yunxing{
int?xu;//調度序號
int?num;
int?stime;?
int?etime;??
int?youxian;??
}process;
node?qu[100];//就緒隊列??
int?he;//就緒隊列頭部???
int?ta;//就緒隊列尾部?
void?FCFS();//先來先服務調度算法??
void?SPF_N();//不可剝奪的短作業優先調度算法??
void?SPF_P();//可剝奪的短作業優先調度算法??
void?RR();//時間片輪轉調度算法??
void?PRI();//動態優先級調度算法??
bool?fcfscmp(node?a?node?b);??
//先來先服務算法進程排序規則,先按照到達時間升序,再按照進程號升序排列??
bool?spfcmp(node?a?node?b);??
//短作業優先算法進程排序規則,先按照到達時間升序,再按照運行時間升序,再按進程號升序排列
bool?rrcmp(node?a?node?b);??
//時間片輪轉算法進程排序規則,先按照到達時間升序,再按照進程號升序排列??
bool?pricmp(node?a?node?b);??
//動態優先級算法進程排序規則,先按照進程優先數升序,再按到達時間升序,再按進程號升序排列??
int?main()
{
n=0;
int?suanfa=0;
scanf(“%d“?&suanfa);
while?(scanf(“%d/%d/%d
- 上一篇:net郵件系統(在線收發)源碼
- 下一篇:sm4加解密工具new
評論
共有 條評論