#include "stdio.h"
#include #include #define getpch(type) (type*)malloc(sizeof(type))
#define null 0
struct pcb *ready=null,*p; //ready ,p 為全域性變數;
typedef struct pcb pcb;
void sort() /* 建立對程序進行優先順序排列函式*/
else /* 程序比較優先順序,插入適當的位置中*/
else /* 若插入程序比當前程序優先數小,則first指標和second指標後移,繼續比較。*/
} if(insert==0) first->link=p; /*插入程序優先數最低,則插入到隊尾*/
} } void input() /* 建立程序控制塊函式*/ }
int space() /*統計就緒佇列長度*/
return(l);
} void disp(pcb * pr) /*建立程序顯示函式,用於顯示當前程序*/
void check() /* 建立程序檢視函式 */ }
void destroy() /*建立程序撤消函式(程序執行結束,撤消程序)*/
void running() /*執行程序後撤銷*/
void main() /*主函式*/
printf("\n\n 所有程序已經完成.\n");
//ch=getchar();
}
動態優先權程序排程演算法
include include define ready 1 define block 2 struct pcb pcb ready queue head null pcb block queue head null 建立了就緒佇列和阻塞佇列,均包含頭結點,以後的節點插入均採取插入排序 void i...
優先權排程演算法
include include include include includeusing namespace std define maxn 100 int time 0 定義時間,為全域性變數,第乙個程序到達時為0 typedef structproducer 程序結構體 float rep pr...
OS 使用動態優先權的程序排程
1實驗目的 通過動態優先權演算法的模擬加深對程序概念和程序排程過程的理解。2實驗內容 1 實現對n個程序採用動態優先權優先演算法的程序排程。2 每個用來標識程序的程序控制塊pcb用結構來描述,包括以下字段 程序標識數 id。程序優先數 priority,並規定優先數越大的程序,其優先權越高。程序已占...