📄 test.1.cc
字号:
// Test Nonpreemptive Priority scheduling //#include "system.h"#include "list.h"#include "testcase.h"//----------------------------------------------------------------------// ThreadTest2// Priority scheduling algorithm// Order of arrival: All at same time 0// Process Burst Time Priority// P1 10 7// P2 29 5// P3 3 9// P4 7 8// P5 12 6//----------------------------------------------------------------------void ThreadTest1(){ int numThreads = 5; int startTime[] = { 0, 0, 0, 0, 0 }; int burstTime[] = { 10, 29, 3, 7, 12 }; int priority[] = { 7, 5, 9, 8, 6, }; schedpair * a_pair; List<schedpair *> * procList = new List<schedpair *>(); for( int i = 0; i < numThreads; i++ ) { a_pair = new schedpair; a_pair->burst = burstTime[i]; a_pair->prior = priority[i]; procList->SortedInsert( a_pair, startTime[i] ); } scheduler->SetSchedPolicy(SCHED_PRIO_NP); printf("Starting at "); stats->PrintElapsedTicks(); printf("Queuing threads.\n"); TestScheduler( ( int ) procList );}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -