处理机调度
来源:互联网 发布:库存软件免费版 编辑:程序博客网 时间:2024/05/22 10:47
#include "stdio.h" #include <malloc.h>#define max 100 #define pfree 0 #define running 1 #define aready 2 #define blocking 3 typedef struct node { char name; int status; int precendence; int ax,bx,cx,dx; int pc; int psw; struct node *next;}pcb; pcb *createprocess(pcb *head) { pcb *p,*q; int a,b,c,d,m,n; char ID; int s; q=NULL; printf("\ninput the first seven status pcb:"); scanf("\n%c",&ID); scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&m,&n); while(ID!='*') { p=(pcb*)malloc(sizeof(pcb)); p->name=ID; p->ax=a; p->bx=b; p->cx=c; p->dx=d; p->pc=m; p->psw=n; p->precendence=pre; p->status=aready; if(head==NULL) head=p; else q->next=p; q=p; printf("\ninput the next pcb: "); scanf("\n%c",&ID); scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&m,&n); } if(q!=NULL) q->next=NULL; q=head; while(q) { printf("\n peocess name. status.ax. bx. cx. dx. pc. psw.\n "); printf("%10c%5d%8d%5d%5d%5d%5d%5d%5d",q->name,q->status,q->precendence,q->ax,q->bx,q->cx,q->dx,q->pc,q->psw); q=q->next; } return head;/*createprocess end*/ } void processfifo(pcb *head) { pcb *p; p=head; printf("\n the process use fifo method.\n"); printf("running the frist process:\n"); while(p!=NULL) { p->status=running; printf("\nprocess name status. ax. bx. cx. dx. pc. psw."); printf("\n%10c%5d%8d%5d%5d%5d%5d%5d",p->name,p->status,p->ax,p->bx,p->cx,p->dx,p->pc,p->psw); /*check process running status */ p->status=0; p=p->next; } printf("\ncheck weatherfer the process complete: "); p=head; while(p) { printf("\n%3c%3d",p->name,p->status); p=p->next; } printf("\ngame is over!\n"); } main() { pcb *head; head=NULL; head=createprocess(head); processfifo(head); }
0 0
- 处理机调度
- 处理机调度
- 处理机调度
- 处理机调度
- 处理机调度
- 处理机调度
- 处理机调度
- 处理机调度
- 处理机调度
- 进程和处理机调度
- 处理机调度算法!
- 处理机调度级别
- 处理机调度与死锁
- 处理机调度作业
- 处理机调度与死锁
- 处理机调度与死锁
- 模拟处理机调度
- 处理机调度算法
- appwidget桌面小部件
- poj2492 A Bug's Life (并查集拓展)
- LeetCode 347. Top K Frequent Elements(最频繁的K个元素)
- 双击Eclipse,弹出一个错误窗口: java.lang.IllegalStateException:
- CodeForces 609C Load Balancing
- 处理机调度
- Android属性动画完全解析(中),ValueAnimator和ObjectAnimator的高级用法
- POJ2104 —— K-th number
- Netty
- 四:资讯列表实现(借助PullToRefres实现上拉和下拉刷新)
- C文件的基本知识
- 通过分析 JDK 源代码研究 TreeMap 红黑树算法实现
- 基于OK6410的WIFI四驱小车(上)
- 系统相册访问