?? main.cpp
字號:
#include "stdafx.h"
#include <string.h>
#include <stdlib.h>
#include <conio.h>
#include "process.h"
int PrintPrompt(void){
printf("\n ************模擬操作系統進程隊列************");
printf("\n 1.創建進程");
printf("\n 2.撤銷原語");
printf("\n 3.進程調度");
printf("\n 4.堵塞原語");
printf("\n 5.喚醒原語");
printf("\n 0.Exit");
printf("\n Please select==>(0-5):");
printf("\n *****copyright@wujianfei1988@hotmail.com*****\n");
return 0;
}
int main(int argc, char* argv[])
{
Linkpcb *ready,*run,*wait;
ready=InitPCBqueue();
run=InitPCBqueue();
wait=InitPCBqueue();
char cc=' ';
PrintPrompt();
while(cc!='0'){
switch(cc=getch()){
case '1':
printf("\n*****創建進程*****\n");
creat(ready);
printf("\nthe Queue of Ready's informations is:\n");
showqueue(ready);
printf("\n******操作完成*****\n");
break;
case '2':
printf("\n*****撤銷原語*****\n");
printf("\n Before destroy the Queue of Run's informations is:\n");
showqueue(run);
printf("\n The Queue of Ready's informations is:\n");
showqueue(ready);
destroy(run);
scheduling(ready,run);
printf("\n After the Queue of Run's informations is:\n");
showqueue(run);
printf("\n The Queue of Ready's informations is:\n");
showqueue(ready);
printf("\n******操作完成*****\n");
break;
case '3':
printf("\n*****進程調度*****\n");
printf("\nBefore the scheduling:");
printf("\nthe Queue of Ready's informations is:\n");
showqueue(ready);
printf("\nthe Queue of Run's informations is:\n");
showqueue(run);
scheduling(ready,run); // *
printf("\nAfter the scheduling:");
printf("\nthe Queue of Ready's informations is:\n");
showqueue(ready);
printf("\nthe Queue of Run's informations is:\n");
showqueue(run);
printf("\n******操作完成*****\n");
break;
case '4':
printf("\n*****堵塞原語*****\n");
printf("\nBefore the blocking:");
printf("\nthe Queue of Ready's informations is:\n");
showqueue(ready);
printf("\nthe Queue of Run's informations is:\n");
showqueue(run);
printf("\nthe Queue of Wait's informations is:\n");
showqueue(wait);
block(run,wait);
scheduling(ready,run);
printf("\nAfter the blocking:");
printf("\nthe Queue of Ready's informations is:\n");
showqueue(ready);
printf("\nthe Queue of Run's informations is:\n");
showqueue(run);
printf("\nthe Queue of Wait's informations is:\n");
showqueue(wait);
printf("\n******操作完成*****\n");
break;
case '5':
printf("\n*****喚醒原語*****\n");
printf("\nBefore the wakeuping:");
printf("\nthe Queue of wait's informations is:\n");
showqueue(wait);
printf("\nthe Queue of Ready's informations is:\n");
showqueue(ready);
wakeup(wait,ready); // *
printf("\nAfter the wakeuping:");
printf("\nthe Queue of wait's informations is:\n");
showqueue(wait);
printf("\nthe Queue of Ready's informations is:\n");
showqueue(ready);
printf("\n******操作完成*****\n");
break;
case '0':
printf("\n *****ByeBye!!*****\n");
break;
default:
if((cc<'0') || (cc>'5')) PrintPrompt();
}
}
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -