静态优先级算法.doc
文本预览下载声明
#include stdio.h
#include stdlib.h
#include windows.h
#include conio.h
#include stdlib.h
#include stdio.h
#include time.h
#include io.h
#include string.h
#define MAX_PHILOSOPHERS 3 //待测试的哲学家数
#define ZERO 48 //数字0的ASCII码
#define DELAY rand()%25
struct PCB
{
char p_name[20];
int p_priority;
int p_needTime;
int p_runTime;
char p_state;
char deadlock();
struct PCB* next;
};
void HighPriority();
void deadlock();
void Information();//形参的改变映射给实参 说白了就是实参传过去不用return 返回就可以把实参改变
char Choice();
struct PCB* SortList(PCB* HL);
int main(int argc,char *argv[])
{
Information();
char choice = Choice();
switch(choice)
{
case 1:
system(cls);
HighPriority();
break;
case 2:
system(cls);
void deadlock();
break;
default:
break;
}
system(pause);
return 0;
}
void Information()
{
printf(\n\n);
printf( ********************************************* \n);
printf( 模拟进程调度算法\n);
printf( ********************************************* \n\n\n);
printf( 静态优先级调度算法);
printf( 死锁问题);
printf( 按回车键进入演示程序);
getchar();
system(cls);
system(cls);
}
char Choice()
{
printf(\n\n);
printf( ********************************************* \n);
printf( 进程调度演示\n);
printf( ********************************************* \n\n\n);
printf( 1.演示最高优先数优先算法。\n);
printf( 2.演示死锁问题。\n);
printf( 3.退出程序。\n\n\n\n);
printf( 选择进程调度方法:);
printf(select a function(1~3):);
char ch = getchar();
return ch;
system(cls);
}
void HighPriority()
{
struct PCB *processes, *pt;
显示全部