进程管理模拟系统C语言源代码Word文件下载.docx

上传人:b****6 文档编号:20458087 上传时间:2023-01-23 格式:DOCX 页数:18 大小:17.75KB
下载 相关 举报
进程管理模拟系统C语言源代码Word文件下载.docx_第1页
第1页 / 共18页
进程管理模拟系统C语言源代码Word文件下载.docx_第2页
第2页 / 共18页
进程管理模拟系统C语言源代码Word文件下载.docx_第3页
第3页 / 共18页
进程管理模拟系统C语言源代码Word文件下载.docx_第4页
第4页 / 共18页
进程管理模拟系统C语言源代码Word文件下载.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

进程管理模拟系统C语言源代码Word文件下载.docx

《进程管理模拟系统C语言源代码Word文件下载.docx》由会员分享,可在线阅读,更多相关《进程管理模拟系统C语言源代码Word文件下载.docx(18页珍藏版)》请在冰豆网上搜索。

进程管理模拟系统C语言源代码Word文件下载.docx

0x40,0x0E,0x80,0x04,

charhan5S[]={

0x10,0x10,0x11,0xF8,0x11,0x10,0x11,

0xF0,0xFC,0x04,0x17,0xBE,0x14,0xA4,

0x1F,0xBC,0x30,0x40,0xD0,0x44,0x1F,

0xFE,0x10,0xE0,0x11,0x50,0x12,0x4E,

0x54,0x44,0x20,0x40,

charhan6S[]={

0x09,0x00,0x09,0x00,0x09,0x04,0x11,

0xFE,0x12,0x80,0x32,0x80,0x54,0x90,

0x98,0xF8,0x10,0x80,0x10,0x80,0x10,

0x88,0x10,0xFC,0x10,0x80,0x10,0x80,

0x10,0x80,0x10,0x80,

charhan7S[]={

0x00,0x38,0x7F,0xC0,0x04,0x00,0x04,

0x10,0x08,0x20,0x3F,0xC0,0x01,0x00,

0x02,0x20,0x04,0x10,0x3F,0xF8,0x01,

0x08,0x09,0x20,0x09,0x10,0x11,0x08,

0x25,0x08,0x02,0x00,

charhan8S[]={

0x10,0x80,0x10,0x40,0x20,0x48,0x27,

0xFC,0x48,0x80,0xF9,0x10,0x12,0x08,

0x27,0xFC,0x41,0x24,0xF9,0x20,0x41,

0x20,0x01,0x20,0x1A,0x22,0xE2,0x22,

0x44,0x1E,0x08,0x00,

charhan9S[]={

0x11,0x10,0x11,0x14,0x1F,0xFE,0x11,

0x10,0xFD,0x18,0x13,0xFC,0x32,0x08,

0x3B,0xF8,0x56,0x08,0x53,0xF8,0x90,

0x40,0x1F,0xFE,0x10,0x40,0x10,0xB0,

0x11,0x0E,0x16,0x04,

charhan10S[]={

0x10,0x00,0x10,0x08,0x10,0x88,0x12,

0x48,0xFE,0x68,0x12,0x28,0x16,0x08,

0x1A,0x08,0x32,0x08,0xD2,0x08,0x12,

0x48,0x12,0x88,0x13,0x14,0x12,0x22,

0x50,0x42,0x20,0x80,

charhan11S[]={

charhan12S[]={

0x08,0x04,0x1D,0xFE,0xF1,0x04,0x11,

0x04,0x11,0x04,0xFF,0x04,0x11,0xFC,

0x38,0x00,0x37,0xFE,0x54,0x20,0x50,

0x28,0x91,0xFC,0x10,0x20,0x10,0x24,

0x17,0xFE,0x10,0x00,

charhan13S[]={

0x10,0x40,0x1F,0x7C,0x28,0x90,0x45,

0x08,0x01,0x00,0x7F,0xFE,0x40,0x02,

0x9F,0xF4,0x10,0x10,0x1F,0xF0,0x10,

0x00,0x1F,0xF0,0x10,0x10,0x10,0x10,

0x1F,0xF0,0x10,0x00,

charhan14S[]={

0x00,0x08,0x13,0xFC,0xFA,0x48,0x22,

0x48,0x23,0xF8,0x22,0x48,0xFA,0x48,

0x23,0xF8,0x20,0x40,0x20,0x50,0x23,

0xF8,0x3C,0x40,0xE0,0x40,0x40,0x44,

0x0F,0xFE,0x00,0x00,

charhan15S[]={

0x20,0x00,0x10,0x00,0x10,0x04,0x05,

0xFE,0xFC,0x44,0x08,0x44,0x10,0x44,

0x34,0x44,0x58,0x44,0x94,0x44,0x10,

0x44,0x10,0x84,0x10,0x84,0x11,0x04,

0x12,0x28,0x14,0x10,

charhan16S[]={

0x10,0x40,0x10,0x40,0x10,0x40,0x10,

0x80,0xFC,0x88,0x25,0x04,0x27,0xFE,

0x24,0x02,0x24,0x04,0x49,0xFE,0x29,

0x04,0x11,0x04,0x29,0x04,0x45,0x04,

0x85,0xFC,0x01,0x04,

charhan17S[]={

0x08,0x80,0x08,0x80,0x08,0x80,0x10,

0x88,0x10,0x98,0x30,0xA0,0x50,0xC0,

0x90,0x80,0x11,0x80,0x12,0x80,0x14,

0x80,0x10,0x80,0x10,0x82,0x10,0x82,

0x10,0x7E,0x10,0x00,

charhan18S[]={

0x00,0x80,0x00,0xA0,0x00,0x90,0x3F,

0xFC,0x20,0x80,0x20,0x80,0x20,0x84,

0x3E,0x44,0x22,0x48,0x22,0x48,0x22,

0x30,0x2A,0x20,0x24,0x62,0x40,0x92,

0x81,0x0A,0x00,0x06,

charhan19S[]={

0x00,0x80,0x00,0x80,0x08,0x80,0xFC,

0x80,0x10,0x84,0x17,0xFE,0x10,0x84,

0x10,0x84,0x10,0x84,0x10,0x84,0x1D,

0x04,0xF1,0x04,0x41,0x04,0x02,0x44,

0x04,0x28,0x08,0x10,

charchu1S[]={

0x00,0x08,0x7F,0xFC,0x01,0x00,0x01,

0x00,0x01,0x00,0x01,0x00,0x11,0x10,

0x11,0xF8,0x11,0x00,0x11,0x00,0x11,

0x00,0x11,0x00,0x11,0x00,0x11,0x04,

0xFF,0xFE,0x00,0x00,

charchu2S[]={

0x02,0x00,0x02,0x00,0x02,0x04,0xFF,

0xFE,0x04,0x00,0x04,0x40,0x08,0x40,

0x08,0x50,0x13,0xF8,0x30,0x40,0x50,

0x40,0x90,0x40,0x10,0x40,0x10,0x44,

voiddrawmat(char*mat,intmatsize,intx,inty,intcolor)

{inti,j,k,n;

n=(matsize-1)/8+1;

for(j=0;

j<

matsize;

j++)

for(i=0;

i<

n;

i++)

for(k=0;

k<

8;

k++)

if(mat[j*n+i]&

(0x80>

>

k))

putpixel(x+i*8+k,y+j,color);

}

/*定义结构体*/

typedefstructPCB

{

intPID;

intUID;

structPCB*next;

}PCB;

PCB*really,*excute,*wait;

/*createqueueheader*/

/*queueoperation入队*/

intenqueue(PCB*head,PCB*node)

PCB*p;

p=head;

if(p->

next==NULL)

{

head->

next=node;

return1;

}

while(p)

p->

elsep=p->

next;

}/*enquue*/

/*dequeue出队列*/

PCB*dequeue(PCB*head)

returnNULL;

else

p=p->

next=p->

next=NULL;

returnp;

/*headtonext*/

}/*dequeue*/

/*PCBoperate*/

/*新建进程*/

intcreate()

p=(PCB*)malloc(sizeof(PCB));

printf("

inputPIDandUIDtoanewprocess\n"

);

scanf("

%d%d"

&

p->

PID,&

UID);

if(enqueue(really,p))

createaprocess:

PID=%dUID=%d\n"

p->

PID,p->

createFailed\n"

}/*create*/

/*执行fexcute*/

intfexcute()

PCB*p=dequeue(really);

if(p==NULL)

NOprocessinqueue\n"

return0;

enqueue(excute,p);

addaprocessintoexcutequeueprocess:

PID=%dUID=%d\n"

p->

PID,p->

UID);

}/*excute*/

intwake()

PCB*p=dequeue(wait);

enqueue(really,p);

addaprocessintowaitreallyprocess:

intblock()

PCB*p=dequeue(excute);

enqueue(wait,p);

addaprocessintowaitqueueprocess:

}/*block*/

/*输出队列outputqueue*/

intoutputqueue(PCB*head)

if(head->

{/*队列为空*/

queueisnull\n"

p=head->

{/*打印processidUID*/

PID=%dUID=%d\n"

p->

/*output输出*/

intoutput()

REALLLYQUEUE:

\n"

outputqueue(really);

EXCUTEQUEUE:

\n"

outputqueue(excute);

WAITQUEUE:

outputqueue(wait);

}/*output*/

 

/*init初始化*/

intinit()

{inti;

clrscr();

really=(PCB*)malloc(sizeof(PCB));

really->

next=NULL;

excute=(PCB*)malloc(sizeof(PCB));

excute->

wait=(PCB*)malloc(sizeof(PCB));

wait->

_____________________________PROCESSSECHUDLE__________________________________\n"

WELCOMETOPROCESSSECHUDLE"

18;

."

delay(50000);

\nPleaseinputPIDandUIDasinteger,00asover\n"

while

(1)

PID,&

PID==0&

&

UID==0)

break;

newprocessPID=%dUID=%dadded!

p->

elsereturn0;

}/*init*/

/*运行一个process*/

intrun()

PCB*p=excute;

ints=SEC;

if(excute->

noprocessinexcutequeue\n"

p=excute->

systemwillsleep%dsasprocessrunning\n"

s);

sleep(3);

process:

PID=%dUID=%dexcutesuccessed..\n"

UID);

free(p);

}/*run*/

/*离开*/

intleave()

intCOMMAND;

Areyousuretoleave?

YES-

(1),NO-

(2)\n"

%d"

COMMAND);

if(COMMAND==1)

{clrscr();

exit(0);

if(COMMAND==2)

{printf("

help();

inthelp()

__________________________HELPMENU____________________________\n"

\t-hHELPshowhelpoption\n"

\t-cCREATEcreateanewprocess,andputtoreallyqueue\n"

\t-bBLOCKblockaprocessinexcutequeue\n"

\t-wWAKEwakeaprocessinwaitqueue\n"

\t-eEXCUTEexcuteaprocessinreallyqueue\n"

\t-oOUTPUToutputallprocessesinqueues\n"

\t-rRUNexcuteaprocessinexcutequeue\n"

\t-xEXITexitthisprogram\n"

_______________________________________________________________\n"

\ttype'

H'

willshowthismenu\n"

intmain()

charCOMMAND=NULL;

inti,m;

intgdriver=DETECT,gmode;

initgraph(&

gdriver,&

gmode,"

"

setbkcolor(LIGHTBLUE);

setcolor(21);

for(i=40;

=600;

i+=12)

rectangle(i,40,i+10,49);

rectangle(i,451,i+10,460);

=450;

rectangle(40,i,49,i+10);

rectangle(601,i,610,i+10);

setcolor(14);

rectangle(150,100,475,250);

setcolor(11);

rectangle(145,93,480,258);

line(145,93,150,100);

line(480,258,475,250);

line(150,250,145,258);

line(475,100,480,93);

drawmat(han1S,16,200,150,BLUE);

delay(20000);

drawmat(han2S,16,230,150,BLUE);

drawmat(han3S,16,260,150,BLUE);

drawmat(han4S,16,290,150,BLUE);

drawmat(han5S,16,320,150,BLUE);

drawmat(han6S,16,350,150,BLUE);

drawmat(han7S,16,380,150,BLUE);

drawmat(han8S,16,410,150,BLUE);

drawmat(han9S,16,220,189,BLUE);

drawmat(han10S,16,250,189,BLUE);

drawm

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 小学教育 > 语文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1