⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.2.cpp

📁 LINUX 下的 NACHOS 系统 实现系统调度的算法功能
💻 CPP
字号:
//     Test Preemptive Shortest Job First scheduling #include "system.h"#include "list.h"#include "testcase.h"//----------------------------------------------------------------------// ThreadTest2//      Preemptive SJF scheduling algorithm//      Process  Burst Time  Priority  Arrival//        P1        10          0	120//        P2        29          0	  0//        P3         3          0	200//        P4         7          0	180//        P5        12          0	100//----------------------------------------------------------------------void ThreadTest2(){     int  numThreads = 5;    int  startTime[] = {120,  0,200,180,100 };    int  burstTime[] = { 10, 29,  3,  7, 12 };    int   priority[] = {  0,  0,  0,  0,  0 };    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_SRTN);    printf("Starting at ");    stats->PrintElapsedTicks();    printf("Queuing threads.\n");    TestScheduler( ( int ) procList );}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -