ImageVerifierCode 换一换
格式:DOCX , 页数:18 ,大小:17.78KB ,
资源ID:5853700      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/5853700.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(进程管理模拟系统C语言源代码.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

进程管理模拟系统C语言源代码.docx

1、进程管理模拟系统C语言源代码#include stdio.h#includegraphics.h#include dos.h#include stdlib.h#include conio.h#define SEC 3#define NULL 0char han1S=0x00,0x80,0x00,0x80,0xFC,0x80,0x04,0xFC,0x45,0x04,0x46,0x48,0x28,0x40,0x28,0x40,0x10,0x40,0x28,0x40,0x24,0xA0,0x44,0xA0,0x81,0x10,0x01,0x08,0x02,0x0E,0x0C,0x04,;char h

2、an2S=0x00,0x00,0x41,0x84,0x26,0x7E,0x14,0x44,0x04,0x44,0x04,0x44,0xF4,0x44,0x14,0xC4,0x15,0x44,0x16,0x54,0x14,0x48,0x10,0x40,0x10,0x40,0x28,0x46,0x47,0xFC,0x00,0x00,;char han3S=0x02,0x20,0x42,0x20,0x22,0x28,0x2F,0xFC,0x02,0x20,0x02,0x20,0xE2,0x20,0x22,0x28,0x2F,0xFC,0x22,0x20,0x22,0x20,0x22,0x20,0x2

3、4,0x20,0x50,0x26,0x8F,0xFC,0x00,0x00,;char han4S=0x04,0x00,0x02,0x00,0x01,0x00,0x01,0x00,0x01,0x00,0x02,0x80,0x02,0x80,0x02,0x80,0x04,0x40,0x04,0x40,0x08,0x20,0x08,0x20,0x10,0x10,0x20,0x10,0x40,0x0E,0x80,0x04,;char han5S=0x10,0x10,0x11,0xF8,0x11,0x10,0x11,0xF0,0xFC,0x04,0x17,0xBE,0x14,0xA4,0x1F,0xBC

4、,0x30,0x40,0xD0,0x44,0x1F,0xFE,0x10,0xE0,0x11,0x50,0x12,0x4E,0x54,0x44,0x20,0x40,;char han6S=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,;char han7S=0x00,0x38,0x7F,0xC0,0x04,0x00,0x04,

5、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,;char han8S=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,;ch

6、ar han9S=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,;char han10S=0x10,0x00,0x10,0x08,0x10,0x88,0x12,0x48,0xFE,0x68,0x12,0x28,0x16,0x08,0x1A,0x08,0x32,0x08,0xD2,0x08,0x12,0x48,0x12,0x8

7、8,0x13,0x14,0x12,0x22,0x50,0x42,0x20,0x80,;char han11S=0x02,0x20,0x42,0x20,0x22,0x28,0x2F,0xFC,0x02,0x20,0x02,0x20,0xE2,0x20,0x22,0x28,0x2F,0xFC,0x22,0x20,0x22,0x20,0x22,0x20,0x24,0x20,0x50,0x26,0x8F,0xFC,0x00,0x00,;char han12S=0x08,0x04,0x1D,0xFE,0xF1,0x04,0x11,0x04,0x11,0x04,0xFF,0x04,0x11,0xFC,0x

8、38,0x00,0x37,0xFE,0x54,0x20,0x50,0x28,0x91,0xFC,0x10,0x20,0x10,0x24,0x17,0xFE,0x10,0x00,;char han13S=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,;char han14S=0x00,0x08,0x13,0xFC,0xFA,0

9、x48,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,;char han15S=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,0x1

10、4,0x10,;char han16S=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,;char han17S=0x08,0x80,0x08,0x80,0x08,0x80,0x10,0x88,0x10,0x98,0x30,0xA0,0x50,0xC0,0x90,0x80,0x11,0x80,0x12,0x80,0x14,0x

11、80,0x10,0x80,0x10,0x82,0x10,0x82,0x10,0x7E,0x10,0x00,;char han18S=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,;char han19S=0x00,0x80,0x00,0x80,0x08,0x80,0xFC,0x80,0x10,0x84,0x17,0xFE,0

12、x10,0x84,0x10,0x84,0x10,0x84,0x10,0x84,0x1D,0x04,0xF1,0x04,0x41,0x04,0x02,0x44,0x04,0x28,0x08,0x10,;char chu1S=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,;char chu2S=0x02,0x00,0x02,0x

13、00,0x02,0x04,0xFF,0xFE,0x04,0x00,0x04,0x40,0x08,0x40,0x08,0x50,0x13,0xF8,0x30,0x40,0x50,0x40,0x90,0x40,0x10,0x40,0x10,0x44,0x17,0xFE,0x10,0x00,;void drawmat(char *mat,int matsize,int x,int y,int color)int i,j,k,n;n=(matsize-1)/8+1;for(j=0;jmatsize;j+) for(i=0;in;i+) for(k=0;kk) putpixel(x+i*8+k,y+j,

14、color);/*定义结构体*/typedef struct PCB int PID; int UID; struct PCB * next;PCB;PCB *really , *excute , *wait;/*create queue header */*queue operation 入队*/int enqueue(PCB *head , PCB *node) PCB *p; p = head; if(p - next = NULL) head - next = node; return 1; while(p) if(p - next = NULL) p - next = node; r

15、eturn 1; else p = p - next; /*enquue*/*dequeue 出队列 */PCB * dequeue(PCB *head) PCB *p; p = head; if(p - next = NULL) return NULL; else p = p - next; head - next = p - next; p - next = NULL; return p; /*head to next*/*dequeue*/*PCB operate*/*新建进程*/int create() PCB *p; p = (PCB*)malloc(sizeof(PCB); p -

16、 next = NULL; printf(input PID and UID to a new processn); scanf(%d %d,&p - PID,&p - UID); if(enqueue(really , p) printf(create a process: PID = %d UID = %dn, p - PID , p - UID); else printf(create Failedn);/*create*/*执行 fexcute*/int fexcute() PCB *p = dequeue(really); if(p = NULL) printf(NO process

17、 in queue n); return 0; else enqueue(excute , p); printf(add a process into excute queue process: PID = %d UID= %d n ,p-PID , p-UID); return 1; /*excute*/int wake() PCB *p = dequeue(wait); if(p = NULL) printf(NO process in queue n); return 0; else enqueue(really , p); printf(add a process into wait

18、really process: PID = %d UID= %d n ,p-PID , p-UID); return 1; int block() PCB *p = dequeue(excute); if(p = NULL) printf(NO process in queue n); return 0; else enqueue(wait , p); printf(add a process into wait queue process: PID = %d UID= %d n ,p-PID , p-UID); return 1; /*block*/*输出队列 outputqueue*/in

19、t outputqueue(PCB *head) PCB *p; if(head - next = NULL) /*队列为空*/ printf(queue is null n); return 1; p = head - next; while(p) /*打印process id UID*/ printf(PID = %d UID = %d n , p - PID , p - UID); p = p - next; return 0;/*output输出*/int output() printf(REALLLY QUEUE:n); outputqueue(really); printf(EXC

20、UTE QUEUE: n); outputqueue(excute); printf(WAIT QUEUE: n); outputqueue(wait);/*output*/*init 初始化*/int init() int i; PCB *p; clrscr(); really = (PCB*)malloc(sizeof(PCB); really - next=NULL; excute = (PCB*)malloc(sizeof(PCB); excute - next=NULL; wait = (PCB*)malloc(sizeof(PCB); wait - next = NULL; pri

21、ntf(_PROCESS SECHUDLE_n); printf(WELCOME TO PROCESS SECHUDLE); for(i=0;i next = NULL; scanf(%d %d,&p - PID , &p - UID); if(p - PID = 0 & p - UID = 0) break; else if(enqueue(really , p) printf(new process PID = %d UID = %d added!n,p - PID , p - UID); else return 0; return 1;/*init*/*运行一个process*/int

22、run() PCB *p = excute; int s = SEC; if(excute - next = NULL) printf(no process in excute queue n); return 0; else p = excute - next; printf(system will sleep %ds as process runningn,s); sleep(3); printf(process: PID = %d UID= %d excute successed.n , p - PID , p - UID ); excute - next = p - next; fre

23、e(p); /*run*/*离开*/int leave() int COMMAND; printf(Are you sure to leave? YES-(1), NO-(2)n); scanf(%d,&COMMAND); if(COMMAND=1) clrscr(); exit(0); if(COMMAND=2) printf(n); help(); int help() printf(_HELP MENU_n); printf(t-h HELP show help optionn); printf(t-c CREATE create a new process , and put to r

24、eally queuen); printf(t-b BLOCK block a process in excute queuen); printf(t-w WAKE wake a process in wait queuen); printf(t-e EXCUTE excute a process in really queuen); printf(t-o OUTPUT output all processes in queuesn); printf(t-r RUN excute a process in excute queuen); printf(t-x EXIT exit this pr

25、ogramn); printf(_n); printf(t type H will show this menun);int main() char COMMAND = NULL; int i,m; int gdriver=DETECT,gmode; initgraph(&gdriver,&gmode,); setbkcolor(LIGHTBLUE); setcolor(21); for(i=40;i=600;i+=12) rectangle(i,40,i+10,49); rectangle(i,451,i+10,460); for(i=40;i=450;i+=12) rectangle(40

26、,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(50000); delay(20000); drawmat(han2S,16,230,150,BL

27、UE); delay(50000); delay(20000); drawmat(han3S,16,260,150,BLUE); delay(50000); delay(20000); drawmat(han4S,16,290,150,BLUE); delay(50000); delay(20000); drawmat(han5S,16,320,150,BLUE); delay(50000); delay(20000); drawmat(han6S,16,350,150,BLUE); delay(50000); delay(20000); drawmat(han7S,16,380,150,BLUE); delay(50000); delay(20000); drawmat(han8S,16,410,150,BLUE); delay(50000); delay(50000); delay(50000); drawmat(han9S,16,220,189,BLUE); delay(50000); delay(20000); drawmat(han10S,16,250,189,BLUE); delay(50000); delay(20000); drawmat(han11S,16

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

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