举报
2017-09-30 09:05
#include #include #include
#include #include #define RUN 1 #define SLEEP 0 #define READY 2 #define DEG_SCHEDULE #define NUM 6 struct OSPCB { int PcbName ; int ReqCount; int RunTime; int Prority; int PcbStatus; int PcbTime; struct OSPCB* prev; struct OSPCB *next; }; struct ProcessQueue { struct OSPCB *PointerHead; int PcbNumber; }; //static struct CriticalResource //{ // int flag; // char BufferVoice[2000]; //} static int flag; void *Function(int *arg); void InitPcb(struct OSPCB *pcb); int Schedule(struct ProcessQueue *queue); void InheritSchedule(struct OSPCB *pcb); int main(void) { int i,ret; struct OSPCB *pNewPcb,*pNew; struct ProcessQueue *pNewQueue; int a[4][4] = {{1,1,0,1},{2,2,0,2},{3,3,0,3},{4,4,0,4}}; pNewQueue = (struct ProcessQueue *)malloc(sizeof(struct ProcessQueue)); pNewQueue->PointerHead = NULL; pNewQueue->PcbNumber = 0; for(i = 0; i PcbName = a[i][0]; pNewPcb->ReqCount = a[i][1]; pNewPcb->RunTime = a[i][2]; pNewPcb->Prority = a[i][3]; pNewPcb->PcbStatus = READY; pNewPcb->PcbTime = 3; InitPcb(pNewPcb);
|