日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux下进程调度模拟程序,linux认证辅导:linux进程调度模拟怎么做?

發布時間:2024/9/27 linux 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux下进程调度模拟程序,linux认证辅导:linux进程调度模拟怎么做? 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

/*模擬實現LINUX進程調度的靜態優先級算法和時間片輪轉算法引入LINUX調度  */  #include   #include   #include

#include   #include   #define RUN 1  #define SLEEP 0  #define READY 2  #define DEG_SCHEDULE  #define NUM 6  struct OSPCB  {  int PcbName ; /*進程名字*/  int ReqCount; /*進程執行計數*/  int RunTime; /*進程執行時間數*/  int Prority; /*進程優先級*/  int PcbStatus; /*進程狀態*/  int PcbTime; /*進程時間片*/  struct OSPCB* prev;  struct OSPCB *next;  };  struct ProcessQueue /*模擬CPU調度隊列*/  {  struct OSPCB *PointerHead; /*指向進程鏈表頭*/  int PcbNumber; /*CPU每次調度計數器*/  };  //static struct CriticalResource  //{  // int flag;  // char BufferVoice[2000];  //}  static int flag;  void *Function(int *arg);  void InitPcb(struct OSPCB *pcb);  int Schedule(struct ProcessQueue *queue);  void InheritSchedule(struct OSPCB *pcb);  int main(void)  {  int i,ret;  struct OSPCB *pNewPcb,*pNew;  struct ProcessQueue *pNewQueue;  int a[4][4] = {{1,1,0,1},{2,2,0,2},{3,3,0,3},{4,4,0,4}};  pNewQueue = (struct ProcessQueue *)malloc(sizeof(struct ProcessQueue));  pNewQueue->PointerHead = NULL;  pNewQueue->PcbNumber = 0;  for(i = 0; i PcbName = a[i][0];  pNewPcb->ReqCount = a[i][1];  pNewPcb->RunTime = a[i][2];  pNewPcb->Prority = a[i][3];  pNewPcb->PcbStatus = READY;  pNewPcb->PcbTime = 3;  InitPcb(pNewPcb);

全部

總結

以上是生活随笔為你收集整理的linux下进程调度模拟程序,linux认证辅导:linux进程调度模拟怎么做?的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。