QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 2446|回复: 0
打印 上一主题 下一主题

经典任务调度算法的模拟程序

[复制链接]
字体大小: 正常 放大
杨利霞        

5273

主题

82

听众

17万

积分

  • TA的每日心情
    开心
    2021-8-11 17:59
  • 签到天数: 17 天

    [LV.4]偶尔看看III

    网络挑战赛参赛者

    网络挑战赛参赛者

    自我介绍
    本人女,毕业于内蒙古科技大学,担任文职专业,毕业专业英语。

    群组2018美赛大象算法课程

    群组2018美赛护航培训课程

    群组2019年 数学中国站长建

    群组2019年数据分析师课程

    群组2018年大象老师国赛优

    跳转到指定楼层
    1#
    发表于 2021-4-9 15:15 |只看该作者 |正序浏览
    |招呼Ta 关注Ta
    # _* h# Z0 Z( n) O
    经典任务调度算法的模拟程序. ^1 M$ |8 J. |4 W$ x5 W& {
    本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。
    ; W0 I3 |1 O5 r1 J( B, O8 D8 c! V6 p
    编程平台:VC6.0+EasyX图形库环境。/ t' f$ b( I7 m
    6 z+ r+ @: a" Y4 P7 v# w
    以下截取部分程序运行图::
    9 q: ]* E1 W; B8 n8 m: \+ u, @9 y8 u5 p1 i) |
    源代码:5 q  a- D6 ~) `6 R

    9 ?9 I7 J2 |0 Y/ S#include<stdio.h>6 \) c* o0 |# O1 e3 j7 N  }2 N
    #include<stdlib.h>- K1 h- S0 T/ I# j. n
    #include<easyx.h>
    / Z  I7 G1 n; J4 J9 |#include<time.h>- U; M: s/ `/ ^
    #include<conio.h>8 N2 i5 Z$ v$ P# ^3 F
    #include<graphics.h>
    " D+ }! X& Z2 O- m/ S- f8 [4 n#define initProcessNum 10: r! Y! m2 N3 z" c8 k
    #define initProcessID 1000
    * B- |. F$ a& f" ]& ]#define MAXProcessRunTime 10000
    " k# A6 q* _4 o1 f#define MAX_MEMORY  4000
    3 I/ R9 p; X9 X( \% h0 e#define exchange_IO_Compute 101 L. ]/ g/ i8 ^# z" a6 x2 y/ M
    #define exchange_process 25
    6 L! h# H+ ^3 X& W* s$ b" h#define task_completed 1# h3 L" D5 J6 |, c) s6 R) H
    #define task_not_completed 0
    & A0 _1 D; f! W#define initclocknum 1005 K# \3 |7 Y- [# c- `% L
    enum condition1 c/ x' |9 d" V3 V/ w! t1 S; ^6 Q
    {  I8 i. f+ Y# T
    dead,computing,IO_waiting,ready& }# M1 P' ^/ H3 l$ @" ]
    };8 S3 s( V8 f& s6 U. M
    struct process
      ?* T& c! ~  N1 C1 l% v2 X, L{
    # \! O  P$ r% hint processID;
      e. M  h/ S0 t4 O6 Kint comeingTime;
    $ U7 _4 P3 ^8 h9 kint ioNum;9 v3 j1 y1 p) p( g6 a/ x# v( V; [* `
    int computeNum;5 x1 Q, V- W, C6 ~9 g
    int * ioClock;+ a& C8 W4 r; m
    int * computeClock;
    ( d9 x) y3 X3 ], x2 W) }" q/ |int ioTime;
    7 X$ ~) s3 W+ l% o2 l5 a2 l! Bint computeTime;
    7 K" H6 o, h* R* o5 Cint askMemory;- h" f0 g4 _/ |$ ~. d3 Z0 h
    condition flag;
    # Y5 g; o6 C; R1 L. r- Dint produceTime;  //生成时间,以下三个数据成员用以计算相关性能
    1 ?3 T% E- H8 `/ A! }* l/ wint runningTime;  //第一次占用CPU的时间* K' T( N; K! u) ?# ]; W" A; x
    int completedTime; //进程完成时的时间
    ! c* F' E! h9 {: e4 t};
    6 i% Y9 W+ {7 Qtypedef struct processCmpletedInfo  //保存完成一个作业的相关信息  q! }8 c! p, r3 q2 h$ L
    {
    7 s& [( b  }! Z0 O% M/ q( iint processID,comeingTime,askMemory;: T; P8 J. k! ^
    int compute,waitio,exchange,completedTime,runningTime;
    1 N3 h0 A7 G  }processCmpletedInfo * next;, I8 k4 ]& N' q( V# a. G) n
    }PCI;
    # t5 t, {! W) A  A. |$ \( j! sstruct processPool
    # g! w) r. M) z3 p9 d- Y{
    , T+ G! N4 ?/ I+ m- |process * p;% I2 M: j; |6 @9 B( D; \( u
    int proNum;  l* X1 O1 L. [0 A& h1 H' A* n
    };
    - A4 l8 G1 C* _8 E9 _int MAX_COMING_TIME=0,ID_FIFO=0,systemClock=0,FLAG_FIFO=0,FLAG_TT=0,FLAG_PF=0,FLAG_SJF=0,FLAG_HR=0,FLAG_show=1;! S: n% U- u  A& Y$ {4 X0 F
    int InitPool(processPool * p);6 ^* @' u3 A" |3 Y0 a! Z3 A
    int produce_one_task(processPool * p,int i,int id);
    ; E6 a4 u5 a- C7 |1 yint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);
    , h5 F) @. P/ [1 m6 k7 c8 Jint TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);& F' I( }6 E' b+ }* e
    int TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);
    & d9 J9 A& T* Q* ]: F. R7 Xint FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);) T; K/ S/ S; ?/ l; t  A/ x
    int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);; M- H5 o0 K2 b# O% w: }
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    7 A/ p( Y0 @2 P# Q& I/ wint PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);/ Z: o* J. p+ H
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    % W+ e, z) z+ t+ {( fint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);# W- m5 k& ?1 ^# s# F" h0 a3 f
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);8 ]& ?6 `* o2 m$ d

    & T1 N; L/ z" b2 T# H5 d: [' ?6 L# w$ c7 r# o2 s% v
    int sort_by_comingtime(processPool * p,int pos);
    ; {/ o3 D5 T" oint showProcessInf(processPool p);4 G) @6 p- b( H0 b" G5 j/ s
    int drawPerformance_FIFO(int x,int y,int memorry);
    ; z: z/ W% `, vint drawPerformance_HR(int x,int y,int memorry);. R7 m. T5 z9 T" o, W
    int drawPerformance_PF(int x,int y,int memorry);; N2 Q% t- p# b5 i/ B% ]: w
    int drawPerformance_TT(int x,int y,int memorry);
    ( A: |0 o- l5 {9 Kint drawPerformance_SJF(int x,int y,int memorry);) j2 t/ ]' K2 y' ~
    int MouseListening();- ~1 z: l4 S# t# G
    int MouseListening2(int *flagShow,int * showTime);& |. ]  K1 v5 L
    int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);% k5 j0 p8 }1 Q) {# h

    ' C7 l1 e9 C! V2 Z7 U$ K0 D# S9 D$ c, C. f
    void main()
    6 E- s  t( X1 }0 t+ [1 `9 ?9 {{4 d$ w  G4 R6 [5 U2 s7 X
    PCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,' Y: b. g% a9 A- M
    *Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;. i, F) _, q5 i/ r) X
    int i=0,FIFO_memory=MAX_MEMORY,count=0,Timet_memory=MAX_MEMORY,SJF_memory=MAX_MEMORY,Priority_memory=MAX_MEMORY,HR_memory=MAX_MEMORY,' x$ I! \# c& M: f2 ^3 Y
    flagDraw=0,showTime=100000;/ P" Y6 o7 o& }/ x
    processPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;
    * E. o- @7 X: e9 JFILE *fp=NULL;
    & r" F1 z" T- m2 G. U  z//processPool HR_p,HR_mmy;
    ' x0 V/ h4 r) @2 j$ J
    : ^+ t. H) X' }  }, A) M* U; y" V% ?
    srand((unsigned)time(0));5 {! E. s' |& \/ g: h; |* @0 M
    systemClock=0;! n( r' E2 Z7 d( A+ k
    initgraph( 1200,650,SHOWCONSOLE );
    9 y! n+ Y0 ^8 y  o) \$ hsettextcolor(GREEN);
    7 j8 x: Z) X( P& ^setlinecolor(GREEN);
    , {% i- R! L- W7 a8 {setfillcolor(GREEN);
    ( W1 Y; \* [& O' K# y  y+ X; TInitPool(&FIFO_p);
    : _  [0 E* }. M: A5 |) G3 Fsort_by_comingtime(&FIFO_p,-1);
    9 {4 @3 O" |9 |& a7 lInitPool(&Timeturn_p);
    , U% w6 |5 x# R% |4 P; NInitPool(&SJF_p);1 R6 z- V- U9 E" r$ V; p
    InitPool(&Priority_p);
    $ b$ G+ e; D7 [' k- a& r9 KInitPool(&HR_p);- n& G( n+ F( ]9 E( V0 [9 @
    //showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
      S  N$ C! ^% {: n! w) A& {* G//Sleep(10000);( [4 z6 ^; U1 G/ Z5 a8 ?6 f
    . o" M" R1 L- y4 Q1 J1 B2 c9 M

    $ u5 U9 T1 a7 n0 H  ETimeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    3 x9 i. L1 l5 U0 b' `' y% YSJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));; r2 t' `  T7 H% m8 f, B
    Priority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));; M' W( z) Z1 Y/ e" U
    HR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));, h" }( u$ n9 E7 _- X
    for(i=0; i<initProcessNum ;i++)
    5 W' f2 b0 Y" X{
    . ]6 l& E3 m$ [; t! k* o# eTimeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    1 s1 ], l) J; x  z" x0 v/ YTimeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    ! P" I4 d1 Q5 P; P7 @/ J* D  uSJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));- f, ?8 B. O, E/ g
    SJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    , [& J: ]) [6 S) ePriority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));% u9 x% ?. P" H8 C
    Priority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));) i7 A0 K1 b7 O9 a1 |- x
    HR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));; K  Z- r- R: z, y) a0 `
    HR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    + H' p7 {6 Q8 q6 Z, a}' x. }7 A; f" g7 i/ N5 Z3 s& L" y
    Timeturn_mmy.proNum = 0;
    ) Z  z  y* ^0 m1 |+ \TimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);
    4 R3 ~7 \' `) }1 E; ~  [, e' w0 O. PSJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);
    # w7 [7 x0 t( g% e/ QPriority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);
    ' X1 s4 T2 `, x& v% \% OHigh_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);
    7 s9 F! ]' P& Z7 K7 [8 {//showProcessInf(Timeturn_mmy);6 _- i3 p, K1 Q1 L4 \/ ?; E
    FIFO_pri = &FIFO_save_head;
    ; n" Y9 q6 O' r+ j% H+ CTimet_pri = &Timet_save_head;
    9 D9 _# ^) l* w- C+ n" T% t( qSJF_pri = &SJF_save_head;
    2 W6 \* E% o  R9 k( OPriority_pri = &Priority_save_head;
    0 E4 U. b6 p, }8 X3 @    HR_pri = &HR_save_head;
    9 u$ P( ]9 ?& ~, o; @, dsetbkcolor(WHITE);
      h# c0 ?7 @' V" [1 awhile(1)& g) ?$ g4 u. b
    {: T' x( O: O1 I) u- M7 L/ S
    if(MouseListening()==1)
    3 O$ L5 g$ w, ^  _. V/ a; pflagDraw=1;( p( Q8 s, |$ ?6 O/ L5 O/ J
    if(count==100)
    % }5 R0 T! l/ U# y{9 j* i1 ?/ v: p3 U8 \
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed)5 i4 d% D9 u3 A9 w' S( g
    {
    4 o' P9 `5 y, e6 z1 E" K6 AFIFO_pri = &((*FIFO_pri)->next);
    : i/ d/ v/ R3 f: X# V
    - s" O9 Q0 h5 `( a1 k//printf("hello");
    : l' V2 M4 W  I; v$ _# a- l  z}' e( h' }$ C/ S. O
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed)
    & u( b$ X% p( F2 F{' I( r( _, f- V4 f9 F
        Timet_pri = &((*Timet_pri)->next);, W2 R/ b7 `3 H* i  f' U
    //printf("hello");
    3 L( a( H) }( C$ ~6 @5 R! |1 F2 }! I}* S+ W( }& A+ z# R0 Y  O8 L) i* G7 B3 x+ W
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)4 s( g/ c/ y" L4 D. z# P8 d! v
    {
    " w8 K  X6 z+ C% T. o/ r4 V9 `SJF_pri = &((*SJF_pri)->next);& D' c/ S9 f3 {
    //printf("hello\n");
    ; L# e$ S" {' j' Y6 j! D- u}+ ~5 \0 t5 \0 K# d, c& w# U2 g
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed)
    0 _4 J5 B$ H2 T$ E{8 u3 Z# D$ O6 L' `
    Priority_pri = &((*Priority_pri)->next);
    % d! m" ]3 b0 S* P0 i2 u' [//printf("hello\n");# I6 m/ E; @+ a
    }
    " }& S. M2 Q3 A/ d$ cif(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed). |$ n6 p' m+ Q( i# v: G
    {
    4 ?* {! s' g1 K" U  CHR_pri = &((*HR_pri)->next);0 d/ e& v! ^- _' D
    //printf("hello");( L7 u/ X; L( X2 b+ p3 g2 Q8 i8 s
    }
    ' ^& |; U( r; m2 E7 N4 tcount=0;
    * l8 Y' z7 l. q4 i/ Y}4 b) i  p$ n0 D9 ?  O1 z0 I( t1 J! H+ B
    else( W1 V$ S# Z' E+ P+ p% u
    {
    9 b$ Q6 S& C$ {) D8 O' eif(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)3 ?- U" g8 \/ H( f$ E; w
    {: |- U+ @; ]5 c9 e: W2 \' s% V' Q1 V
    FIFO_pri = &((*FIFO_pri)->next);1 I6 W) J9 F$ M% d& ^. u6 h
    // printf("hello");4 G- y! @" j. `% ]
    }4 S- J8 a6 c9 B0 Q- j1 C* g
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)
    9 Z, d* b; s& Q{4 ^! J# J6 n5 }4 B/ B
    Timet_pri = &((*Timet_pri)->next);
    3 z* ~8 v% u! k- N: Y8 D# A// printf("hello");1 j; h4 J/ F- L8 H! q& Z! s2 p
    }
    ( K+ \  m& J. q6 gif(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)
    % m8 k4 V' O; h! d  q{5 T0 h0 {) T; Y7 p. _7 p, `
       SJF_pri = &((*SJF_pri)->next);% B5 G; Y! b& V/ ~% g; E! q
    // printf("hello\n");) R+ q' P( ^$ H
    }
    ( h7 q1 G- P6 u5 j6 [if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed)
    6 u8 x* u5 ^2 ~2 I% E* J& y( ^{
    5 O3 X8 |+ G; j* F& r% ePriority_pri = &((*Priority_pri)->next);
    0 m9 x% V  t; l! J) T* ?1 O/ f//printf("hello\n");
      \% N) V# I& [7 q2 ]- x}( K# e& w6 d- I) V4 @; k0 l: O
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed)5 q' o  |( Y: [! m
    {: K. O2 G' x! H. j/ O
    HR_pri = &((*HR_pri)->next);7 c! E5 z* O0 t: I) D5 s
    //printf("hello");
    / B0 |$ f6 b- g% s( m1 X+ b) [//Sleep(1000);
    , ], b" e+ Q8 Y}
    2 \! M% f  d. u0 j/ _& }0 }count++;
    1 Q9 y* q8 v) Y' O! |}" h0 x) N+ m" S* |6 f$ x
    if(systemClock==showTime)0 i/ D4 D* b3 L3 v  I. I
    {5 S5 L) Q  w; _& e
    /*PCI * p=FIFO_save_head;4 i% r: U$ A4 \. }- o  p
    int i=0;2 F: L- K& l2 j# B4 f! D0 D
    for( ;p!=NULL;p=p->next)2 W( Y7 V, E$ v& ]
    {' [- P. e  A5 p8 c3 x7 R
    printf("Id %d\n",p->processID);
    # n: |5 m- R0 l! Y" Q9 r7 R: [printf("comeingtime %d\n",p->comeingTime);) b& |0 Y& X7 ~+ x' I! G7 Q/ \6 v/ X
    printf("runningtime %d\n",p->runningTime);
    ) T5 [6 ]$ X, e, i- @; Wprintf("asdmemory %d\n",p->askMemory);1 f3 v$ F) {' U# ~# X  l! u; f
    printf("completedtime %d\n",p->completedTime);
    1 c( Z5 L. S  i8 `" ~% V: Hprintf("compute %d\n",p->compute);
    0 P/ c! z* E: X( q- f. wprintf("exchange %d\n",p->exchange);' `/ x' T4 ]0 m  |
    printf("waitio %d\n",p->waitio);
    - L. X9 r: M+ e$ L& s& b! Mi++;
    2 N: v, w# g$ l* A7 ]) m
    ' @& \/ ^5 n$ ^( {2 e
    1 f& {& N1 c) S# H( J}& v) y' W' S$ p; Y, `! V! X
    printf("%d\n",i);*/
    & k3 v* Y* t" j4 J" U) x! hif( (fp  = fopen( "data.txt", "a" )) == NULL )" M* H  ^0 r% n& N; n1 D% H
    {0 q1 v- X$ Y, R8 J
    printf( "The file 'data.txt' was not opened\n" );
    & V/ R" c$ x4 P//return 1;* w% C5 [. R6 B1 _& l. V  D
    }
    8 R3 O& L- _8 x; e- T5 `0 l! v0 Delse
    . O' ?5 e' \4 K$ W# \2 p+ B7 a{
    & |) W$ B  d  X9 q) Dfprintf(fp,"FCFS \n");
    & K" a! l$ z9 U8 S$ ufor(p=FIFO_save_head;p!=NULL;p=p->next)' t6 i# f5 M2 B  |) u
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,1 d: d! A! ]  \8 ]* j) q" z
    p->exchange,p->waitio,p->runningTime);, d$ H3 j4 i2 `' @" O
    fprintf(fp,"\nTime turn \n");
    # O+ U% y' W3 k  k: E: w1 a7 Nfor(p=Timet_save_head;p!=NULL;p=p->next)7 y) U+ n7 V+ `7 P: k8 n! h' Y8 M
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    " L! {$ R1 D  m! z" hp->exchange,p->waitio,p->runningTime);" V5 A& ~6 X. T. T) a1 a9 z& b6 ?7 q
    fprintf(fp,"\nShort Job First \n");5 y/ C. V. F: q$ g6 b8 M: O
    for(p=SJF_save_head;p!=NULL;p=p->next)2 A6 x3 ?! Z- f2 ]8 t- N
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,. \, y+ t( e( t0 y
    p->exchange,p->waitio,p->runningTime);3 C  q- Y) t1 H2 r2 I* ~
    fprintf(fp,"\nPriority  \n");
    & z# R, ^" T! R, J" s2 U0 z7 Dfor(p=Priority_save_head;p!=NULL;p=p->next)
    $ _# _# N$ Q/ T+ [: N4 ffprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    2 v9 M! i. L* v1 }) s$ |p->exchange,p->waitio,p->runningTime);7 l. z2 @( B' X) j. y* m" P
    fprintf(fp,"\nHigh response \n");, n6 F3 N9 t- N
    for(p=HR_save_head;p!=NULL;p=p->next)1 I0 M8 y8 F4 s+ }" |7 a
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    . Y# K  Z) \. ^& J# z& Tp->exchange,p->waitio,p->runningTime);0 e  `+ r# O1 r, w$ U" t
    fclose(fp);
    3 [$ h' q" g" O2 @1 D, U}6 I& K. U, [: d8 n  I
    showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
    # f. M2 w3 s$ y& V  n2 B- DMouseListening2(&flagDraw,&showTime);) i! _( [+ ?! A% _# e. v
    }$ G+ U  P. ?& C5 J
    systemClock++;
      S' {3 ^9 v/ y9 B8 G$ qif(flagDraw==0)3 D' k  K  }# r# k1 m5 u
      Sleep(10);
    2 @, V4 H7 V- i6 ]8 k, p}
    / l$ A1 u# p, ~& a' G
    6 T; q) \6 o" S' J% S4 n) M& K; v  Q* A1 y
    }$ q! s3 B4 ~. [# x& i+ ?1 v
    int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR)+ d( G) g) N/ c/ k
    {$ K0 ]) s8 Y) L
    PCI * p=NULL,* name[5];
    3 R$ A! r: a, x% o! W7 ?  Sint count=0,i=0;& l1 F+ u5 l" u0 ?5 h! m9 Q
    char ch[5][10]={"FCFS","timet","SJF","PR","HR"};6 V  q! V; ~2 n) |% D1 p* S
    double turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};- Z. ]$ r* H# @5 e5 A3 b  n
    struct info1 N4 ?( q: Z! }1 f3 V9 O4 s5 P
    {. o! T7 ^( q5 z0 g, G: i7 i( P
    char name[10];
    * Q7 @/ Y! G& ^7 r7 ~  f$ Rdouble throughput,turnover,wait,CPU_rate;
    $ j  `2 Q( J5 t/ L& u7 L+ y8 b2 I! T$ R7 G}inf[5];- Z- d, d/ v4 x7 g- j
    name[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;( q9 A/ {6 Y0 s4 s4 ^9 w6 V
    printf("调度算法..........A\n");" a3 _/ C* R3 _/ {: d
    printf("吞吐量............B\n");
    9 s6 e. a& b$ v1 y2 nprintf("平均周转时间......C\n");" S4 F: c9 Z1 @1 V9 v* }7 E. g& [
    printf("等待时间..........D\n");
    - ?6 G& T( d6 r1 vprintf("CPU利用率.........E\n");# @9 Y% H5 e9 v8 W- I9 L7 c9 G
    printf("A\tB\tC\t\tD\t\tE\n");3 S: x6 v& U% a; L
    for(i=0;i<5;i++)( h7 K. x$ f' j9 C6 R: f0 x
    {% R( y/ l" t* O( V9 A4 P0 h: J
    count=0,turnover=0,wait=0,c=0,w=0,change=0;
    7 }, t, }2 U. vfor(p=name; p!=NULL; p=p->next)# P/ w9 w; i7 a* T6 Y1 C
    {
    8 z2 U4 ^% q3 Q6 Hcount++;$ z7 e$ W1 {: e5 v* x# }
    turnover += p->completedTime - p->comeingTime;
    " |& T4 g- j! ~& `* B0 |wait += p->runningTime - p->comeingTime;& z+ n$ D- ^  z0 \& E
    c += p->compute;
    9 A" \5 }; |: K6 l% o! u! l4 Aw += p->waitio;3 {2 B* c- {+ _
    change += p->exchange;  T. K- a/ w- K: U$ B* `
    }
    " f& X/ _0 y, c9 l; X) ?% n( Bturnover = turnover/count;6 l8 `4 q- M5 p& w
    printf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));  i, c% `% R. K
    strcpy(inf.name,ch);3 M# [! C( C8 P
    inf.throughput=count;
    : b9 B& y2 X/ N) h$ D1 `inf.turnover=turnover;( o* z4 Y' h: v/ `2 h5 x
    inf.wait=wait;
    - B$ \7 g% Y9 ~  Q$ xinf.CPU_rate=c/(c+w+change);$ z; R8 h3 U" {# P9 ]: V* q" z
    }2 t" G& _) u9 W0 a5 K
    //画图1 p$ `0 c5 c. N6 ?" d, i: B
    //cleardevice();7 N# k; ~9 u% [7 Y! D) {' R
    line(0,600,1200,600);
    * u4 h, D. N" C3 U" Oline(10,600,10,200);' T! h  i) L; i3 j1 a2 E$ z) h
    line(10,200,5,205);
    ' L" q5 C2 g2 m' tline(10,200,15,205);+ z' h+ A6 c3 t. r5 v+ V9 K4 Z
    line(310,600,310,200);
    3 C$ F' @! r6 w* D* j6 Z4 `line(310,200,305,205);' U# g6 |' E" n6 M& \2 T
    line(310,200,315,205);5 H  S, S% j4 }7 @/ m. H
    line(610,600,610,200);
    : j) [6 c2 V* aline(610,200,605,205);
    ; M' F5 x6 S  ?; \/ q: xline(610,200,615,205);
    9 e) d' d" o; b% x  i3 i% Sline(910,600,910,200);% K  C( H, G1 |* |0 ]: O
    line(910,200,905,205);
    * w  f4 j0 W( f  N% Uline(910,200,915,205);//最高的长度400,宽度均为409 V5 N* y3 B% X  E1 s
    for(i=0;i<5;i++)$ O1 t$ N! D8 l( r* b: c
    {* y/ R" E( }. L. @$ W
    if(inf.throughput>pos[0])4 E6 b% g' x6 u) ]4 g
    pos[0]=inf.throughput;
    4 V4 {  q" p6 Aif(inf.turnover>pos[1])
    * N% H* f# o& z- k# ]8 t/ Ipos[1]=inf.turnover;  x" k+ L  U# L
    if(inf.wait>pos[2])* t; W4 J( ?4 P$ y9 O( d
    pos[2]=inf.wait;
    4 r5 U$ h+ _1 s- a/ cif(inf.CPU_rate>pos[3])$ C) z1 G5 s. _; ]' R
    pos[3]=inf.CPU_rate;5 M8 ^* F. g, ~9 q7 |8 U# s
    }  w1 C1 O, r" s/ A; `. J3 w2 q( \
    settextstyle(30, 15, _T("楷体"));
    7 r- z; L0 {1 V) {for(i=0;i<5;i++)* z/ \9 v! l. H6 r
    {5 E' Q& c+ t; r
    switch (i)
    / T4 c1 b6 v, s  H: B{$ x7 {; I, D$ O# l2 t3 f
    case 0:
    / B7 t& j# D1 x' x, W% osetfillcolor(BLUE);
    4 A' n7 D( i9 Xfillrectangle(100,50,150,100);
    ( W0 E  i$ a7 s9 r5 aouttextxy(160,50,"FCFS");2 s9 U' p; J( [% L9 {( w- X
    break;2 v. L8 Q6 F1 o9 b* X" ^! F7 J8 T/ u$ p0 W
    case 1:6 p& S+ Y( K- _) V. f9 `
    setfillcolor(RED);& e% U, s0 d% A' I. M
    fillrectangle(250,50,300,100);% R8 z+ C3 _5 U$ U$ f) H* v
    outtextxy(310,50,"timeTurn");7 ^, D- Q$ l0 M! i
    break;# N( J' P' f1 n: e
    case 2:6 a0 o3 g5 {- Z! g6 O$ T
    setfillcolor(YELLOW);% F: a- {  M4 @
    fillrectangle(450,50,500,100);
    ) F5 Q0 [1 f7 C( fouttextxy(510,50,"SJf");+ _, U$ c8 e) `5 H$ }& j( ]* R
    break;
    + N( r8 D5 g" r3 ?" I5 K' Rcase 3:: ?7 f- P& S, t( m6 g8 W8 x
    setfillcolor(BROWN);
    2 n0 \) q; l# ?% D4 ~fillrectangle(580,50,630,100);" M- {( e# [$ H" V' H; Q
    outtextxy(640,50,"PR");
    2 O0 T; ]6 C, M7 M# x4 h/ H% {break;
    & h1 D, j6 \; Acase 4:
    7 @1 {0 V# B& e5 ]6 w6 F. Psetfillcolor(GREEN);1 F  O" |8 J  n6 l0 {0 q6 a* i
    fillrectangle(690,50,740,100);
    . D% C1 r" ~' B! B1 N5 p3 }+ j1 Youttextxy(750,50,"HR");
    ) Y, B6 q3 }& Q  ~, V/ q" Zbreak;
    ( w7 v6 R7 v1 L( |. J}
    / @$ g0 T, j& X" y$ n* Y- lfillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);- S4 Z' Z2 R6 ?: S' v  P0 z3 ]
    fillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);
    & E# v! m+ \# G+ U1 G+ }+ vfillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);
    2 ]' V& u8 ~4 _" x1 ufillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);9 ~+ s+ [! ~9 o  `# S1 L: ]& w- B2 G' Q

    + C( X, G! n; q: u
    . a* v" }0 r3 b9 H# g}
    ' t" g5 X* E0 [    outtextxy(100,150,"吞吐量");4 F- n' a9 K. {2 [- M
    outtextxy(350,150,"平均周转时间");3 Q8 z6 Y, H+ _. X0 C. [$ Z, D
    outtextxy(650,150,"平均等待时间");5 n! l& p; t/ G2 i+ C) b
    outtextxy(950,150,"CPU利用率");
    $ }% ?. Z( y; D) ?return 0;: ]5 ]) D1 ^) M7 l
    }0 h7 z8 M  Z( [- ]4 X
    int MouseListening()0 s) Z: z' a4 g$ E: [& h% `% h  T
    {
    ' z, ^2 R/ H- b" v* k6 |& KMOUSEMSG p;7 L; w/ ~2 A0 b1 Z! Q
    if(MouseHit())
    ( s8 n& z- ^, M6 W, X{2 u& k6 b. V3 {( A6 w7 I% w
    p=GetMouseMsg();
    & f2 V& G1 n, H1 Eif(p.mkLButton==true)
    4 Q$ h$ e# U$ B9 z8 f6 X9 F{  ?  i. v' @5 t- a
    if(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    5 j; e* B5 I+ S! M  Y; `FLAG_FIFO = 1;" \% D- d2 J: @: L6 x
    else if(p.x>400 && p.y>0 && p.x<800 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)' S- @+ N, U4 A/ }4 n
    FLAG_TT = 1;
    ( n2 n) ]& R- |; E) }! felse if(p.x>800 && p.y>0 && p.x<1200 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    * {8 h: E' a0 Y( R! z( U+ oFLAG_PF = 1;' f* x' B  o8 x; w: N
    else if(p.x>0 && p.y>325 && p.x<400 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)- z4 I9 a, J2 @+ s! `0 ]
    FLAG_SJF = 1;
    7 V! G+ O/ ?) Z. N2 aelse if(p.x>400 && p.y>325 && p.x<800 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)1 C9 ^, ^$ {4 S6 B( C3 O% h* k
    FLAG_HR=1;) @6 M& z' |& q$ Y
    else if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)) j$ J7 ^8 x$ ?7 n4 u
    {& n: v5 l/ j/ o  B
    FLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;
    / X  ~7 z" H/ i) {+ V0 r) Vclearrectangle(800,325,1200,650);
    8 o5 b- |4 X' T6 ^}' [1 R9 O& @, N7 z" s2 G" H
    else if((FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0 && p.x>890 && p.y>455 && p.x<1110 && p.y<510 )- `' J3 n7 C* @+ I% f+ p
    {
    9 z  x5 O6 X+ V/ h8 Y" Q6 pFLAG_show=0;6 c7 x0 i, M& P0 D, V
    cleardevice();. E; ?, G- g0 p& y, x; ?- ?
    return 1;9 Q* I# B) \8 }1 m$ b# V
    }
    6 b3 O3 [: z, ^% o$ w; C9 m}
    # q2 V% P' Q6 c- m5 E* H& \2 k}
    * M" I+ b& X- K1 v$ K; ?, ]8 v" G1 X' o) jreturn 0;; }( T8 S2 A; e/ o( {: w
    }2 Q0 G, k5 |2 E
    int MouseListening2(int *flagShow,int * showTime)
    5 k! P) K4 F6 b! r5 \{  }# }; G. @+ d3 p+ t+ c
    MOUSEMSG p;
    4 U# L" F! O2 |; A" K* B% H1 Z4 Nrectangle(1150,0,1200,50);1 e( _# L7 i- u6 ~+ S: G2 X% g
    outtextxy(1160,10,"X");
    5 I( ~* |) q6 K! \) h. J- [) u  ?while(1)
    7 z  Z' m% |- A{
    2 m( s+ L3 E& t  _. h$ Zif(MouseHit())
    ) y# V0 `. |- R( h{7 a1 w+ `1 B, M7 e$ \
    p=GetMouseMsg();
    " J# d! t& }' l  n8 E2 cif(p.mkLButton==true)
    , E  O( _- c) p3 T( P{4 |' X  ?0 u0 D' l5 H1 v6 C# e1 Q
    if(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 )9 m# i. H9 s- D4 h$ Q+ k
    {
    - ]4 s! v/ \7 L3 I. H5 M! m(*flagShow) = 0;
    6 W0 b2 l1 v3 g. X(*showTime) += (*showTime);
    & j0 c0 a" _& q6 V1 _" q9 R0 YFLAG_show=1;
    - Q" _7 M* a+ o, _7 Qbreak;; W' \: N( O8 Q; \& v6 r
    }
    , C. J. a. e' Q; J: T8 b2 r  S. k9 p6 E# s8 h: F0 d
    }
    , e4 D- W4 m$ c. K}. Q" k: t, L% ^: M- O8 o2 H
    Sleep(20);
    + x7 `6 y0 r: w/ G" [; Q}4 G7 O. r/ w$ _+ H1 i1 l
    cleardevice();( t' p; K" r- M  w$ N' a- Z
    return 0;3 |' l7 p' E% G2 U) e3 R0 e* c
    }# G# t4 t6 D0 ~' v9 B
    int drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha). N/ G( b# T# D( W6 K  l" q
    {8 Q" Q$ c6 z. o7 P5 S
    static int info[11][3],num=0;  O$ v( D8 U' U0 I
    int i=0,j=0,pos[10][3][2];
    : T! s# I9 \3 N0 v0 o/ Pfloat temp,t;7 D- l/ f' _* v5 }& I8 G
    //画按钮,不属于FIFO图的范围
    $ u0 k% \' k: B! s9 q9 P/ Iif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)
    % ?: Y- P: D9 f3 l2 t/ j3 H8 V{7 ]' R  x1 C3 g
    settextstyle(30, 15, _T("楷体"));+ c7 Q. t( N, l1 ~: x9 z4 H
    rectangle(890,455,1110,510);
    - F! k0 W/ l5 r5 Y; h3 T) {rectangle(900,465,1100,500);# [% U, y4 R. Q1 ]+ B2 t# D
    outtextxy(910,468,"查看运行结果");- k" |& R2 s: L) q
    }* ]( c5 w4 K9 _
    //结束画按钮
    % H- e5 z/ B  ^info[num][0] = com;, H: H8 H9 A6 ^. `# {
    info[num][1] = wai;3 M. b( k: o1 e1 ^$ @  U% t8 }
    info[num++][2] = cha;1 x, ^* K, M6 d/ ?+ T
    if(num>10)  //存储10个点
    6 x: w, ?. C2 x3 C7 a{
    2 |/ v- Y! p- Mfor(i=0 ;i<10;i++)7 \) m, `8 o( P! \/ u2 I  A
    {
    1 n# l9 a( e5 Z5 Minfo[0] = info[i+1][0];
    * c  _  t/ @6 ?) l1 E. H1 Ainfo[1] = info[i+1][1];$ h' l: P5 B2 O* r
    info[2] = info[i+1][2];3 X  W# X+ Q( q9 k6 v  ~, ^/ Z4 e4 C
    }3 A2 k( t9 }0 F8 K9 V
    num--;
    ) B  N: t: i6 ~* J3 o, K- u}6 y) F: w! b, q5 g, J0 H: U
    if(FLAG_show==0)$ N- F1 T+ g  C+ r! ?7 K
    return 0;
    " `/ t8 k5 e" [! G0 j8 qfor(i=0; i<num; i++)% X6 n* j& z9 ^- V
    {
      |$ L& R4 l; J; |. G% F- bt = (float)info[0];
    2 M# J; W$ s% i6 l0 l3 etemp = (t/101)*90;
    / C' e1 d# E4 Wpos[0][0] = (10-num+i)*25+x+100;/ Y: F# y' H. Y8 n
    pos[0][1] = y+110-(int)temp;
    1 |) Q+ U2 {2 S. G% bt = (float)info[1];9 s/ |/ z5 ]0 P: p2 K
    temp = (t/101)*90;
    ! {- P' K; X  Z) T1 Tpos[1][0] = (10-num+i)*25+x+100;! z7 m+ W! d+ p' H8 j! T' ]. }
    pos[1][1] = y+210-(int)temp;
    4 q5 z  U' J* Vt = (float)info[2];
    ! n4 L6 L) z; o3 |( dtemp = (t/101)*90;) F1 \  X; }6 I9 s7 R  T, p8 t! h' W/ G
    pos[2][0] = (10-num+i)*25+x+100;
    7 i+ S, \8 \2 T- X# N; lpos[2][1] = y+310-(int)temp;
    ! }2 D  }# f6 [# y+ X$ i5 B}# H- Y; A" }  L: b8 g6 X* L
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0); V% Y( A! r1 N1 |( d6 j0 [
    {
    4 o+ t& W& J  Rclearrectangle(x,y,x+400,y+315);
    : X* s$ ^7 Z: b$ fsettextstyle(20, 10, _T("楷体"));
    ( |5 m& ~1 v4 a8 B3 A5 n# Qrectangle(x,y,x+400,y+325);
    1 N6 h, _2 X8 o7 zouttextxy(x+40,y+10,"CPU");       //画柱状图( g+ t. B8 L! `2 u
    outtextxy(x+45,y+10+100,"IO");/ O/ p5 K9 p% R1 M8 R! B
    outtextxy(x+40-15,y+10+200,"change");
    ! s& _9 |, w  _( r0 K* i  nrectangle(x+35,y+30,x+75,y+110);
    # p6 B. x. {" r; c# u2 N( S$ A, arectangle(x+35,y+130,x+75,y+210);
    2 l% n" P0 Y# }' a4 b! erectangle(x+35,y+230,x+75,y+310);; j3 |7 a0 q- Y0 w4 ^" F! l
    outtextxy(x+180,y+310,"FCFS");
    4 U. L) ?) p$ xt = (float)com;
    9 G$ a5 K8 B, [temp=(t/101)*80;7 L/ b3 i# k3 Z; c; E: u; P
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    - n" V) H4 \2 j- ut = (float)wai;5 g; L( K( [# A2 X0 U' d0 Q9 ]. e
    temp=(t/101)*80;+ G- ]6 S# \; D9 Q
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    6 {; R  ^' m3 o$ d; qt = (float)cha;
    1 ?/ v3 u0 z3 D3 r- V0 Ktemp=(t/101)*80;
    : a4 D2 z; }0 S2 l6 Q; F' N" bfillrectangle(x+35,y+310-(int)temp,x+75,y+310);0 H1 R9 f( B+ W
    for(i=0; i<3; i++)   //画坐标   high=90,length=250: q; o  T- A7 b! J, T9 b) O
    {
    # o0 Y" f; O/ iline(x+100,y+110+100*i,x+350,y+110+100*i);/ Z* g% n7 V# ~: l/ [1 v: g
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);8 S4 D; o- o0 N0 x# v+ K0 S7 E
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);" B, r6 E3 X2 G* v) P, m

    & y4 B& z6 |- iline(x+100,y+110+100*i,x+100,y+20+100*i);
    : T, G, s6 a) |5 Z( aline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);0 s$ `6 {& g+ _" y. W
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);! |) ^, N4 |8 q5 X( U% S) w/ ?6 @: L
    for(j=0;j<num-1;j++)
    ) O: X# i5 M( {{
    $ T# o# t  K: G; U. `1 M$ `line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    - H/ ]$ t8 J2 p, Rline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    # V- t, E3 u% Sline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    - Z0 G! |8 ]  U2 f) E# j}
    - a1 W" q  G* N. s- |( q}, K; L# T; V. W- Y) S
    }
    ; ^6 l/ a( R- u$ D( N4 selse if(FLAG_FIFO==1), x# J2 ?: {2 Q: a  ~8 D: g
    {
    9 I" A1 R- x) r& P$ ux=0,y=0;
      T5 O( ^1 B4 [, T+ g% z9 Tfor(i=0; i<num; i++), A4 J1 T/ {' ~' _6 O* [3 o
    {! B4 o: b; \; q
    t = (float)info[0];: p. |: d) j. e; @* }3 R
    temp = (t/101)*180;* ]9 h  M# `/ }; ~& @9 W; X+ k
    pos[0][0] = (10-num+i)*50+x+650;
    4 _" w. O" E2 D- Y" f) Upos[0][1] = y+210-(int)temp;0 w5 u2 E0 K, n
    t = (float)info[1];
    % }. x- \# w5 U" O" z; ftemp = (t/101)*180;
    8 _) V+ L: h% o) h, @! Q4 m; }% apos[1][0] = (10-num+i)*50+x+650;# i" d- V) U4 Z5 X5 u: k
    pos[1][1] = y+420-(int)temp;
    " k6 n2 E# r* E5 g8 q0 z, F/ ~5 r; Yt = (float)info[2];
    5 g1 V/ {! o/ Y& s$ jtemp = (float)(t/101)*180;
    ; I& Q2 o6 H# |; K/ opos[2][0] = (10-num+i)*50+x+650;
    # W" M; o( V& C' rpos[2][1] = y+630-(int)temp;. ?  }9 |5 H. E& Y
    }0 ?2 t* m$ R: o
    clearrectangle(x,y,x+1200,y+650);
    & _; a1 ~: i3 i7 _( a* Rsettextstyle(40, 20, _T("楷体"));! |# t- |6 E( t' i- T
    outtextxy(x+50,y+50,"FCFS");' [/ x" v6 n% l5 {- }0 Y
    outtextxy(x+280,y+20,"CPU");       //画柱状图, s7 {2 X- i- ]6 a% E. }" B
    outtextxy(x+285,y+20+200,"IO");4 y5 z: l4 Q/ I% i; I
    outtextxy(x+250,y+20+400,"change");
    ( U' Z% k/ m5 }$ X; p: Drectangle(x+270,y+65,x+330,y+215);% }) v) O# c! Z0 D# o6 E) k
    rectangle(x+270,y+265,x+330,y+415);) Q8 x2 a& `( q" s  T' Y: g
    rectangle(x+270,y+465,x+330,y+615);
    4 \: R- @. h# e" wouttextxy(x+290,y+620,"TT");6 U5 y4 m, z% y4 r& |; v( t% x
    t = (float)com;
    4 G7 y5 J* Y! |7 p" V7 c/ Qtemp=(t/101)*150;
    5 t0 |+ |" z% i; G* t( X/ G& [fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    8 j! f% d" ^$ G$ F6 ~$ ~- j3 a" it = (float)wai;. O0 ]! M, l* P7 m0 E' e
    temp=(t/101)*150;$ h& L* I- l+ M# N
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);5 a8 @! w0 Q& \6 f9 a' K
    t = (float)cha;' c( n, e, k% F: A9 T
    temp=(t/101)*150;% n* G' Z* A0 l! W9 l- }& R
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    # }2 b8 |8 \9 @+ e8 Bfor(i=0; i<3; i++)   //画坐标   high=90,length=250! e% m) k5 J8 t/ g6 H# |
    {% A& ?% T6 t& n; P
    line(x+650,y+210+210*i,x+1150,y+210+210*i);9 T" Y- t% s# Q& Z, B7 ~& E
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    ) q4 I: V  ^/ \' Zline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    ! Z" ^' \8 M* K# w# g% ~4 z! U' e: D% I+ X
    line(x+650,y+210+210*i,x+650,y+20+210*i);7 ?# U- h: n! e7 _  ?
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);* X! d0 [! ?( w/ y5 @/ s$ t7 @7 v
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    . P" b7 r% }* N4 L" ~; l: Cfor(j=0;j<num-1;j++)# p; E) C7 S- N6 Y, e1 {
    {
    % [; ~# Y$ `8 o) Kline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    : l) R/ R6 A& dline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    ) I$ u4 d. B1 A: f; _9 _; \line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ' k' h9 K0 ^/ ?7 e# e
    }' b% w* z$ f1 `. A! g+ T0 \* V
    }$ }  K" [% l' @) p
    }; c& a9 |6 `0 C6 E

    ; G! l+ j- P& q2 v4 B. O7 T3 t+ x6 J& e: O0 F  ]7 k5 M
    return 0;
    7 r, `+ L1 c) K}, V/ C- d% b. ~0 c5 d" Z' N
    int drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)( t1 z. a4 M1 F0 z1 _0 ~
    {
    8 E( B, Q0 o9 @; W! |0 f  L9 `static int info[11][3],num=0;9 `/ K% P5 {( o" {# n4 {9 r
    int i=0,j=0,pos[10][3][2];
    7 Y0 p- B7 c# S1 g2 S* ^3 U% gfloat temp,t;
    3 E& m7 }% n) f- Sinfo[num][0] = com;' r2 ^3 G: ~/ v( X
    info[num][1] = wai;: d4 H$ s- r# D& ~: F/ R9 A
    info[num++][2] = cha;
    - l; G" e! e/ o. m' k3 S& e! l: xif(num>10)  //存储10个点5 p4 ?& q2 g* p; S& G5 d& E
    {% y3 P9 H2 ?) R; G' z, p8 z
    for(i=0 ;i<10;i++)
    ! X' V0 T( ]7 x4 N{
    9 a# }/ i! z7 u+ Q' ?0 X* n# ^info[0] = info[i+1][0];
    " u6 M8 t1 ^, w- v+ ~/ J6 }info[1] = info[i+1][1];1 G# O. ~1 n7 J9 T& y- A' @
    info[2] = info[i+1][2];
    5 Y! T  Y8 L' Z/ q" u( ^7 t}
      J* L, ]# u% s& g  t8 vnum--;
    ' \9 d- c/ I/ j3 D/ t}
    5 Q5 ?# c5 g, e5 s7 {1 Sif(FLAG_show==0)$ ^7 d4 Y5 _* {0 }" t- _* G' `, U
    return 0;
    # o$ [6 G  ]# W5 ifor(i=0; i<num; i++)3 B8 W' h7 L5 h. X4 d( |
    {
    9 C( w5 [! D' b0 ^0 Q$ \9 Wt = (float)info[0];+ A% V) M( s" P1 ]) C7 Z; G, O
    temp = (t/101)*90;8 Y/ s9 ]4 c7 G; K
    pos[0][0] = (10-num+i)*25+x+100;
    * b8 y' X2 {: Z- G$ spos[0][1] = y+110-(int)temp;
    0 H- J/ G; D' \! v; Y  Tt = (float)info[1];
    ' j: A; ^5 {9 a8 Stemp = (t/101)*90;; K. @$ S* v. v5 _9 {  u  T8 i
    pos[1][0] = (10-num+i)*25+x+100;3 E& T# r/ U- @5 o/ n5 e
    pos[1][1] = y+210-(int)temp;' D; R/ d6 h0 D5 N3 D
    t = (float)info[2];4 v- V7 h7 G# Q& t5 j. M0 O9 g
    temp = (float)(t/101)*90;/ M! n  K4 O$ N6 P
    pos[2][0] = (10-num+i)*25+x+100;
    2 g8 @% \: S7 x+ g3 I  Ypos[2][1] = y+310-(int)temp;5 D' l4 A1 r6 R& n$ p' z4 H1 D
    }8 [- r1 f0 [) B2 P# }: ]+ x' R* w, M
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)9 K7 h9 a* t( U
    {
    - l8 @( ^, I: p7 Q" l, R2 cclearrectangle(x,y,x+400,y+315);
    - D. m% k" Y0 _% Zsettextstyle(20, 10, _T("楷体"));
    % U, j3 w, u& ~  q% j3 nrectangle(x,y,x+400,y+325);
    7 h; |* b% Y7 l  f9 `0 i& |! t. aouttextxy(x+40,y+10,"CPU");       //画柱状图; H% ?* F+ Q! v
    outtextxy(x+45,y+10+100,"IO");9 I/ M, [7 b* x" p3 u$ i" a9 x
    outtextxy(x+40-15,y+10+200,"change");4 ]8 a- e9 _2 h. l* L+ T9 @
    rectangle(x+35,y+30,x+75,y+110);3 f1 y$ Q+ i6 A: Q
    rectangle(x+35,y+130,x+75,y+210);, a! j7 Y) n: A8 k8 Q4 ~+ C8 U
    rectangle(x+35,y+230,x+75,y+310);
    3 y; L8 Z8 j$ x4 S9 M- `outtextxy(x+180,y+310,"HR");
    0 M  O5 H  ~9 K. ^& rt = (float)com;
    / a+ [4 V5 t- qtemp=(t/101)*80;8 V, O" V. K" }7 @
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    / l+ B& d" s2 |% e- u& Zt = (float)wai;
    0 N- J) y4 l/ m& M5 xtemp=(t/101)*80;+ |- V) l$ v5 i: A" Z4 S3 K  K
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    7 ], e0 z8 ?0 l' {7 k+ D0 J$ jt = (float)cha;. v/ q. E+ Y3 q* x) G1 q+ S8 p
    temp=(t/101)*80;
    * B- N1 K8 L. N: cfillrectangle(x+35,y+310-(int)temp,x+75,y+310);- v$ K, G* h" o: Z
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    " Y* w( ^/ U2 y: Z1 J8 |! `{# `/ c% F; q$ y" @% ?+ E4 l
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    # V6 U+ o- o* S! P4 y5 j8 Kline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    9 H) A9 O: z* Y7 f, E- Mline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    ' |) l) B: a& h7 Z, F
    : z: r3 Z, q$ k9 I- Gline(x+100,y+110+100*i,x+100,y+20+100*i);
    7 _- P$ d: O* P9 X* Vline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    : G% ?1 u7 V( f8 W3 U: N: Xline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    0 d' H- I; [  G5 N$ Z2 bfor(j=0;j<num-1;j++)
    ) x) K$ B) |! j: n% k8 L4 o{2 l9 p& F4 J4 {  q1 |* _( b: V
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    % h5 ^" A! ^% k/ z$ `6 wline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    + @0 r6 E& W, d9 E: Dline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    6 m  ^0 L4 }0 D}
    ( V" m6 h0 z% V8 @& i- V& K! [}
    . |8 F) g. H- Q6 q& a  V, r7 L}
    . l' q8 v# U# ]else if(FLAG_HR==1)0 E# R9 N: J! Q, i# O, ^8 a; H3 o/ V9 H
    {& b- u" i$ q  c
    x=0,y=0;
    " L" {$ d6 `0 c& m( Ifor(i=0; i<num; i++)9 g- K$ ?2 o5 i- s! q4 f8 }& m
    {  t0 s; F6 b9 O' @) H5 D
    t = (float)info[0];4 l9 {3 ]) S* c6 }  W" }5 K
    temp = (t/101)*180;
    % J, }* b& K# @" @/ P' P4 f- B2 R' @  Epos[0][0] = (10-num+i)*50+x+650;/ E% `0 z; e$ _2 O3 y4 |
    pos[0][1] = y+210-(int)temp;
    7 C. L$ c4 l! c; Pt = (float)info[1];
    " t7 _' {2 t/ ]0 [) I7 ^) ?temp = (t/101)*180;" J$ G) [/ x: P/ S  y2 ?
    pos[1][0] = (10-num+i)*50+x+650;) ]5 N8 i3 H- }7 z& l
    pos[1][1] = y+420-(int)temp;
      G. h( |- f! z8 it = (float)info[2];5 d- p9 e( U1 K5 O/ R0 S( M
    temp = (float)(t/101)*180;' e2 w  R9 ]' _- j
    pos[2][0] = (10-num+i)*50+x+650;! f1 E; M! G8 }. C+ F4 U
    pos[2][1] = y+630-(int)temp;/ N9 M) a$ S2 [: b4 D: b8 t/ q
    }" e% b3 q# T  ^# K' Q# Z, ^
    clearrectangle(x,y,x+1200,y+650);
    $ R) O! H$ s) W7 ssettextstyle(40, 20, _T("楷体"));
    / @% M1 p# z. V' uouttextxy(x+50,y+50,"HR");, t( {; y+ A1 ^- e2 a
    outtextxy(x+280,y+20,"CPU");       //画柱状图' w% j1 ?4 E, z' Z$ d: W# U' G
    outtextxy(x+285,y+20+200,"IO");
    0 F0 p3 b* a: C; V0 B4 b/ t0 gouttextxy(x+250,y+20+400,"change");
    # H) _- P+ e: b2 \/ _) @rectangle(x+270,y+65,x+330,y+215);
    , U- x* H2 O0 w4 Urectangle(x+270,y+265,x+330,y+415);! K. O4 k& q; t- ^2 A1 o( F
    rectangle(x+270,y+465,x+330,y+615);( k; W9 r: {1 e
    outtextxy(x+290,y+620,"TT");
    6 X) T- y* @' M) r* O2 h( Tt = (float)com;
    8 r4 ^/ U( p. I, I& o2 `temp=(t/101)*150;
    $ B' B4 c  g3 x7 t3 }fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    . X% P+ U% S8 k/ u7 H+ ft = (float)wai;% l( _# @. D1 u3 N0 G
    temp=(t/101)*150;* b+ q4 `$ O3 U* S  u
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);3 o  h0 r9 z& H$ G2 Z) a: l, A: v
    t = (float)cha;' X( E; o7 R1 L# i6 d2 J5 m3 R! P
    temp=(t/101)*150;
    * k" }' M& Q8 G) d) G0 [$ yfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    6 ?# O3 Q$ [# ^for(i=0; i<3; i++)   //画坐标   high=90,length=2504 R, E# K  P9 L8 d" U: l6 c
    {7 f& q6 y: n8 s
    line(x+650,y+210+210*i,x+1150,y+210+210*i);
    - V# Q  P) x/ d& R$ U$ o" cline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    2 @" h) J' C1 j( V" G4 fline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    8 m* m: A% e4 r% n
    ' E1 c; y# ?/ z) H! {line(x+650,y+210+210*i,x+650,y+20+210*i);
    2 z; f; ^  h; u7 F  z0 B0 S+ yline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    8 w! t# g* n0 i% d& U0 o, k5 pline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);. v/ R8 q3 X: f( Q) W9 a
    for(j=0;j<num-1;j++)0 h+ Q# _- c; Q8 T0 g' f
    {- p8 _7 u( P, w) ^2 |! S
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);* T6 g7 F; L9 N, |8 n6 ]! B
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);. F. _  c; F" X5 u6 d
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); # A8 c9 u$ Z( B* m  ~' R
    }2 X9 ^( y0 I8 |4 n! e) u
    }
    & B& L( b. p7 K: v; I. c1 d7 S}
    ( Z, f/ ^0 ^3 b8 p; B3 M4 N
    ' I+ |& N: C3 b0 [0 l
    ) V1 O6 b; F- j0 k) N1 I7 x# xreturn 0;
    + [1 v: K5 S6 q9 b}% q  f, \3 s$ g, M
    int drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)
    % M' {% v1 K3 _; s  Q" i/ k( p{( W1 ]. E, `5 R9 E7 E$ p2 T
    static int info[11][3],num=0;( r6 Z0 K. A1 l- r
    int i=0,j=0,pos[10][3][2];
    1 i0 W9 S' @: v2 G4 c) u* Efloat temp,t;
    % m0 n- n- [/ c4 ninfo[num][0] = com;0 K) G8 @6 Q. o: M/ K: v
    info[num][1] = wai;
    9 V3 K8 k. o, Hinfo[num++][2] = cha;
    ! A) m. G  z3 z  m7 I7 ?5 O5 j- Lif(num>10)  //存储10个点
      U4 @2 e  g5 `; `{
    ! L: p- O. b! x5 yfor(i=0 ;i<10;i++): W+ l$ _, U- ]) S
    {
    1 i& [+ T& j0 minfo[0] = info[i+1][0];
    - {1 \8 M$ @/ b) `5 Oinfo[1] = info[i+1][1];$ z" D$ F" T2 l: w0 [
    info[2] = info[i+1][2];
    ! ^! Q0 a: i) ?2 J}( }- I- f1 a2 n' K. ?- ^9 T
    num--;6 N, w2 \) f* f  A
    }# u$ E; y8 t% f3 Z4 v0 ^6 u
    if(FLAG_show==0)* K9 Y% ?0 a7 i( k
    return 0;* M$ T# l2 T6 `
    for(i=0; i<num; i++)! C, q* d4 ~5 d; r# B8 m
    {  {% `, L- r: _7 ]
    t = (float)info[0];: M+ j0 J" C" c" ]2 t* c. D# |
    temp = (t/101)*90;$ W2 F; R5 d' h5 O$ g0 g5 O6 x
    pos[0][0] = (10-num+i)*25+x+100;: R9 Q4 O: ?8 n1 q8 D2 Y
    pos[0][1] = y+110-(int)temp;. H' r  ]: T( `3 }& k" j8 ~% `0 c& T
    t = (float)info[1];, p/ V+ q3 t' U% Q5 _
    temp = (t/101)*90;
    ; `! \0 |8 x/ F5 I. |6 Qpos[1][0] = (10-num+i)*25+x+100;- T" Y, v& [3 f' n' W- \" u
    pos[1][1] = y+210-(int)temp;1 B7 Y. u' n- N- o4 B1 |+ ]
    t = (float)info[2];2 @6 e9 q5 I1 @- E. f7 M8 p- @
    temp = (float)(t/101)*90;, z4 x7 X& u" ^
    pos[2][0] = (10-num+i)*25+x+100;. [9 }% B, n$ v9 C: I
    pos[2][1] = y+310-(int)temp;
    * X" o+ b: B0 w- v( n9 S}  n" G* K% x  x3 y' t
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)- ?; G$ }: c4 K/ Z1 P6 r
    {
    4 w4 T0 V+ |" U3 R2 Hclearrectangle(x,y,x+400,y+315);
    * i/ R4 i5 \% J; x: Rsettextstyle(20, 10, _T("楷体"));
    3 c5 ], p  L8 e9 s% k. w6 jrectangle(x,y,x+400,y+325);
    : B0 W8 A; u) e% {) x! xouttextxy(x+40,y+10,"CPU");       //画柱状图
    / v5 t/ k9 L1 wouttextxy(x+45,y+10+100,"IO");
    5 ?4 V0 P7 M; F0 S* e# Fouttextxy(x+40-15,y+10+200,"change");- Q1 q5 Z) i8 N: m. Z
    rectangle(x+35,y+30,x+75,y+110);
    ) S* H5 w) _$ N" C( T0 N$ r$ zrectangle(x+35,y+130,x+75,y+210);
    7 a: Q) Z7 b9 l- A* c. i. c1 \8 F( }rectangle(x+35,y+230,x+75,y+310);
    " N% k2 `' w1 w) l: _+ G% Souttextxy(x+180,y+310,"TT");- W; ~1 \4 \" e" p$ R7 y
    t = (float)com;( l% k% g, j& ?1 p
    temp=(t/101)*80;7 L3 u. S- c4 l4 T) u" t
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    % |' o9 n8 g4 i' ?0 h8 d) jt = (float)wai;9 g. ?! L- z5 Z1 i# v- @6 |  N
    temp=(t/101)*80;
    # u. O4 l! [2 W( Afillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    7 j- n% o% _% n+ g7 n; Z( lt = (float)cha;8 F$ v: C2 m, v, U
    temp=(t/101)*80;' `3 y4 d) n8 q5 i
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);, k9 @7 i& W/ h/ }4 K
    for(i=0; i<3; i++)   //画坐标   high=90,length=250( y  O  @. q: m* z5 F
    {
      T4 _0 y4 J, aline(x+100,y+110+100*i,x+350,y+110+100*i);8 F4 {4 p1 |3 m0 ~' r+ \$ l# R
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);9 a) u, o) c: x& ?2 Z& `* Z
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    ) z4 G1 Y0 R4 H, x" F2 ?/ |6 v2 j& n: c1 e+ J; ?+ d7 M
    line(x+100,y+110+100*i,x+100,y+20+100*i);* s! Q2 r& ?& Y# j. D
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    / ~0 \* k3 x- X" p0 xline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    * ~( Y2 K+ Q( d3 Y$ d7 S- R. hfor(j=0;j<num-1;j++)
    ( j  G/ C* C* o# A6 u{# e2 x1 l% Y9 |1 ], C# Q2 E
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);4 S$ W' C9 Y1 m
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);# v9 [, Y* O. O! U4 o6 d6 R
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    - a7 q, _" g8 V% X! G$ J( S}
    $ k4 i( F: X6 ]8 b6 i3 e}5 w* w' S" d$ H  }1 b
    }% @9 {1 b4 y' Q9 E7 n4 A
    else if(FLAG_TT==1)
    9 x, @3 e2 p4 |0 p9 k* _+ P+ M{
    ) u/ N- ]) i0 D5 Y5 w9 Q3 b; Y4 n4 dx=0,y=0;+ x, e. ]+ \8 Q. c9 }: G
    for(i=0; i<num; i++)
    , D! O& q3 N  A& V; ^" r{  J6 \0 N$ n, |( a
    t = (float)info[0];
    * k$ Q) x" f7 jtemp = (t/101)*180;
    / L7 X; l% p& k: }. g2 E2 t- U! R9 npos[0][0] = (10-num+i)*50+x+650;5 [$ t, l  f% y3 R* o! S
    pos[0][1] = y+210-(int)temp;- d' ~' `& m( @( V
    t = (float)info[1];/ S5 s( j" o; F! a; _( L# o3 m
    temp = (t/101)*180;, u# a1 H% G/ c2 T
    pos[1][0] = (10-num+i)*50+x+650;
      m* _8 C* \# W% Y! Y0 {$ g( }1 |pos[1][1] = y+420-(int)temp;
    ; d: c* U* l( Y! N' _t = (float)info[2];# `& @# l8 t8 t6 P! Z+ Y7 ]2 Z
    temp = (float)(t/101)*180;) Y/ z4 i$ ^; w4 |# v* N# H
    pos[2][0] = (10-num+i)*50+x+650;
    ) y7 Z: J. T7 t8 tpos[2][1] = y+630-(int)temp;3 y* Z# Q% S* p% y
    }
      `4 A; g$ J- {! h/ A; Wclearrectangle(x,y,x+1200,y+650);0 H8 f- b3 l; B& e  _
    settextstyle(40, 20, _T("楷体"));
    $ E& v. {* L, _! Routtextxy(x+50,y+50,"TT");
    4 R: ^! f# S; `/ O5 q4 _outtextxy(x+280,y+20,"CPU");       //画柱状图7 v* _1 ?6 |5 g% ^$ n/ J7 G
    outtextxy(x+285,y+20+200,"IO");9 V% t% ~( T0 b, U3 I$ b
    outtextxy(x+250,y+20+400,"change");
    ) ?1 L) F1 @! Jrectangle(x+270,y+65,x+330,y+215);
    9 U8 |2 `4 D3 J* x4 F. D. L: i5 _rectangle(x+270,y+265,x+330,y+415);2 f. g9 X) w( J5 p
    rectangle(x+270,y+465,x+330,y+615);& e% J' x3 ~' {- T0 V
    outtextxy(x+290,y+620,"TT");3 d2 G4 K0 m! z
    t = (float)com;, a7 w8 T  y6 n
    temp=(t/101)*150;
    , _/ h8 f0 P0 Q9 p% {" Rfillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    ' E# T. e% i+ g. h: \6 ^t = (float)wai;
    ' F, b5 N5 y2 M9 j* V$ R9 Ptemp=(t/101)*150;
    7 `5 H& c/ S4 B3 Pfillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    , _7 c# m3 v: l! [t = (float)cha;
    ; ?  {6 v5 ?# e+ e+ Ytemp=(t/101)*150;6 l! I1 J0 i: U" O7 ?( G
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    ! u0 _9 Y( P( V+ Xfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    # Z6 B. m& L7 @  X! O' d7 {{- ~( K4 a& e/ ^- h& y
    line(x+650,y+210+210*i,x+1150,y+210+210*i);
    ! e1 q0 g' W+ kline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    : b: s! i0 r$ S1 ?: ^5 ^9 A' ]line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    0 f& h% R9 E, B, w8 ~6 [) ^- w3 e4 A5 F0 t
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    / w& h, O* _" `9 I+ Q% p( Pline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);8 k. ^- M' c0 Z  j- N2 v
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
      Q& `+ n9 X. D; Qfor(j=0;j<num-1;j++)
    " C& h; a9 j: ]{5 S  |" O! L% v" b; k
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);( I" v4 |  h% I: I# ]
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    , L1 u0 f: h$ @% `5 cline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    9 F+ a% n0 Y* F  x* R& z}
    ! M- M0 G* a% t" k2 @; A7 `}
    7 J; u5 R# a+ W3 g2 L* C& D}
    4 |* F0 @! y. z4 Z+ m, T3 |- F  h' M* P  m+ d( Z9 @8 }4 ]
    ; u; ?0 N6 E4 ?+ C  c  J
    return 0;) Z) U; K7 x) o( Y! Q. A/ ?
    }2 Z' e, e! r& s. T6 ]
    int drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)
    $ `' Z: g8 N. Q3 b" i. k6 C8 ~5 y' P3 t{
    ! i0 |& |9 q  S0 |# I; ^# A- G: [7 nstatic int info[11][3],num=0;0 K& ?1 m1 ?. n% x0 D
    int i=0,j=0,pos[10][3][2];: K( V& ^, ~2 s5 `
    float temp,t;6 v7 q$ {0 @0 q0 n/ w
    info[num][0] = com;; Q1 Z% W: s, w% G0 V+ |
    info[num][1] = wai;
    ; c! h4 P; K$ m+ D7 o. [info[num++][2] = cha;0 Q+ M$ F+ U) |2 J2 o
    if(num>10)  //存储10个点, C/ J: U- b: y# T! v8 p
    {( n( K9 N; H4 E6 ]" f, Y
    for(i=0 ;i<10;i++)( r4 n3 _8 K/ }$ Z( ~3 J5 s$ }
    {( q& i4 z- K9 O1 I/ x, B
    info[0] = info[i+1][0];0 v. }, |( G* W, ^7 K, ]* j3 N
    info[1] = info[i+1][1];
    ; @6 R8 s# [) ^: s' }  [: \; @info[2] = info[i+1][2];# M, F; u2 T0 e+ G1 i% f6 b
    }7 w/ p! H0 m& x! P# E. B
    num--;
    9 L$ C3 y$ i5 T3 e+ r1 F( L}0 w6 C; s& n; `; A7 T
    if(FLAG_show==0)
    - Z. c6 ]; g6 Kreturn 0;3 u6 P) ~2 u. \7 u# A" Q; j
    for(i=0; i<num; i++)1 p5 q. P/ a: _! c6 X, D1 ]
    {
    * d* F. \- I, V0 G* @$ d) ?9 Jt = (float)info[0];
    * R6 \0 a# ]/ M5 f6 y1 jtemp = (t/101)*90;3 b! a- q# L7 s0 o
    pos[0][0] = (10-num+i)*25+x+100;
    / X3 M7 }; \6 F6 b+ h/ F. t  Hpos[0][1] = y+110-(int)temp;( t( g: k' ^: a+ w! I. c6 }* I
    t = (float)info[1];
    % d+ n+ i4 K9 r' ]temp = (t/101)*90;- g+ O) n5 l4 W4 ]5 d
    pos[1][0] = (10-num+i)*25+x+100;
    ! S7 L7 t3 c  k0 A6 @pos[1][1] = y+210-(int)temp;
    8 _: s6 M0 u5 d$ }t = (float)info[2];! n; B* g- ~# [6 |/ i/ H' z
    temp = (float)(t/101)*90;, a3 A" Q) W) B# g$ p: O* A( o
    pos[2][0] = (10-num+i)*25+x+100;, l7 q$ a' Z! d5 U0 F, Y3 I7 T
    pos[2][1] = y+310-(int)temp;! y: l& v# e3 ^
    }
      b( \3 l1 W1 R. x, w7 ~( ]if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    ; s/ Y7 g$ Q% C$ y" S5 u5 f, U6 B{
    & z$ u2 v1 v3 u9 l3 c: e( Fclearrectangle(x,y,x+400,y+315);. q; \! N2 f9 G+ d7 H7 ]7 M0 f8 w8 H
    settextstyle(20, 10, _T("楷体"));8 E: q0 ?5 o( R* L( O; c) K
    rectangle(x,y,x+400,y+325);6 \9 Z6 G2 C: z, o0 J; w% j
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    % }$ ?2 R2 C2 k( `& K3 Youttextxy(x+45,y+10+100,"IO");
      X& ]- J. M9 Y, xouttextxy(x+40-15,y+10+200,"change");
    ! T5 Y  m- H" O( X& {rectangle(x+35,y+30,x+75,y+110);6 m3 s3 y5 A8 g" F# [) l
    rectangle(x+35,y+130,x+75,y+210);
    4 b& p. ~+ J9 y' l$ Zrectangle(x+35,y+230,x+75,y+310);
    8 ^! G$ V% V4 eouttextxy(x+180,y+310,"PF");
    ! U# s" h+ u8 y( l9 A7 J, tt = (float)com;
    2 \& U8 y/ W0 a+ N1 @4 n/ \temp=(t/101)*80;
    3 [0 L; ~$ Y  T' s  L6 G" yfillrectangle(x+35,y+110-(int)temp,x+75,y+110);* Q% ]& L$ r& p# y
    t = (float)wai;5 l2 O3 M4 t% J; F2 w: ^
    temp=(t/101)*80;
    , ~0 _6 w, R" w4 Y* Tfillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    , W; c: v' e  Q1 g( k% rt = (float)cha;
    $ A. i% F' ]2 e2 ftemp=(t/101)*80;4 C: e* I) n" G+ e# f
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    + J! O; u+ J8 f5 X1 T6 Q; Wfor(i=0; i<3; i++)   //画坐标   high=90,length=250. A* M, Y. u- @
    {( u3 ?8 h+ k1 C+ Y
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    : V9 W( @' Y6 y6 `, Y/ c4 q+ Wline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);2 E9 f; N" g; f1 u8 L& w( }( N
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    " S0 v- m4 ]& f; ~. o  |" A% b4 W6 v/ G3 G
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    9 l6 A3 O: z+ a& n0 x9 N  L4 sline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    & T9 Y& b9 E7 k6 }5 a* v/ o0 gline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);2 _- H7 p/ G9 {. P9 s: F$ S
    for(j=0;j<num-1;j++)5 z4 \, ?% X/ `) w
    {
    # ]/ W" p+ l/ v+ Mline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);- Y, X# B2 |6 e  `% t
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);; N6 R4 x# H/ X! B$ l7 q
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); " L" L) T. B& G- n2 x
    }: N# P2 B$ A7 T+ f
    }
    3 M% g9 x7 K9 r& T}6 ?7 p6 Y0 `8 @% [+ p) [$ J
    else if(FLAG_PF==1)( t6 r$ N& f7 Z5 I
    {" k5 J) R4 N4 a9 n- n
    x=0,y=0;
    ; o; \3 T' d) U& A5 \# Ffor(i=0; i<num; i++)& l5 G+ c% a4 S! r- _6 Q+ Y7 N
    {
    / I  g2 U# ^9 [t = (float)info[0];
    8 B" }" l/ Y8 btemp = (t/101)*180;# M0 O+ g) Q# h* V6 ?
    pos[0][0] = (10-num+i)*50+x+650;$ C  W% \4 x) m4 N+ k4 X
    pos[0][1] = y+210-(int)temp;
    , h# [0 w, v+ D: i) St = (float)info[1];
    % ]; \* }5 L& o* Stemp = (t/101)*180;
    5 z+ ^) H  Y7 S* {$ [1 {pos[1][0] = (10-num+i)*50+x+650;9 Q4 B3 E) R1 b# }6 u" e; B
    pos[1][1] = y+420-(int)temp;
    * ^& p* N/ |( G* o) ?( At = (float)info[2];9 o4 d$ ^  n5 h4 S
    temp = (float)(t/101)*180;8 ?+ I0 ~/ R) C, }, }
    pos[2][0] = (10-num+i)*50+x+650;' Q% I- n; e. q3 _1 H) z
    pos[2][1] = y+630-(int)temp;
    5 N7 G$ @1 M7 A5 \4 ?$ O  g  q}
    1 J8 C; Z+ T1 i6 p3 F* a/ }7 ~clearrectangle(x,y,x+1200,y+650);) h" p; I1 |* A( o/ ]
    settextstyle(40, 20, _T("楷体"));
    . _2 U0 ?0 N: R5 q5 q. {+ ~, ?outtextxy(x+50,y+50,"PF");
    0 g2 p* U# g) M& I- ]( ?  p" Routtextxy(x+280,y+20,"CPU");       //画柱状图
    ( \, k- g4 z7 u3 G$ }, K5 houttextxy(x+285,y+20+200,"IO");
    6 Q: T0 {" e' |% _5 F/ youttextxy(x+250,y+20+400,"change");
    3 P3 `4 `: i4 }, W# H0 Crectangle(x+270,y+65,x+330,y+215);
    7 j- Q/ ^8 ~, H9 m: xrectangle(x+270,y+265,x+330,y+415);' y$ c' {6 S" W4 a; A
    rectangle(x+270,y+465,x+330,y+615);
    6 ]# n  Q, \) H5 B% _8 h/ b( J0 kouttextxy(x+290,y+620,"TT");
    8 Z2 s; i6 Z: D; ]  Vt = (float)com;/ k: F0 {0 x5 M0 Z6 b6 x
    temp=(t/101)*150;
    5 {  u# d+ N5 Pfillrectangle(x+270,y+215-(int)temp,x+330,y+215);* x, R; n" ^' \: L, e9 M
    t = (float)wai;, A- x/ F+ j* B$ ^# p# |$ y& K
    temp=(t/101)*150;
    4 u8 d8 h  B. `8 ofillrectangle(x+270,y+415-(int)temp,x+330,y+415);( {1 i' R* I# r
    t = (float)cha;
    ( Y5 Q9 w4 T2 _4 m2 [: itemp=(t/101)*150;
    ; X. N0 Y" S" B. Tfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    7 B8 g2 O8 N1 g+ o1 Y$ w: O- y) Dfor(i=0; i<3; i++)   //画坐标   high=90,length=250. H7 f, d1 h6 z* x
    {
    2 I4 l+ J" D3 T# |2 Y0 Aline(x+650,y+210+210*i,x+1150,y+210+210*i);
    / H; h7 c% h& T3 K2 z0 ?line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);- S6 _' ~( N+ V  N
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    + k" \+ y% G1 {3 w
    ; T1 g8 F7 C; M5 J0 lline(x+650,y+210+210*i,x+650,y+20+210*i);
    " r' O  I. b. @! c; b8 yline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);2 M# D; Y# \( }) c6 n
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    " n) O: s% p$ mfor(j=0;j<num-1;j++)
    5 J+ f$ w, o$ _$ ^1 D$ X/ }{) s" @' c8 Q3 I$ w# B! Q8 m4 `" Y
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    # m' a! y/ x0 o! Fline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);% `4 H# E# G. r: J3 W) _' r
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    4 O* X, o$ U* Y# F1 O}
    : F+ ]& T! J7 T! C}
    / _5 b) }$ z, x1 D+ O) m}
    * y2 u( ~7 b9 j5 _( preturn 0;
      l& w6 j+ z7 X- \, M$ I3 g( e}* e& A, ]! e& s  e& c
    int drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha)# r' H# ^& n$ }4 _+ J1 m8 K3 S
    {- a4 |0 M4 S/ f" v; `( T/ r
    static int info[11][3],num=0;
    ' `3 M4 ~! L0 i2 N" Qint i=0,j=0,pos[10][3][2];. h6 [" e" x2 G3 V% ]! b; t
    float temp,t;8 P! |+ y( z9 Z! b4 {- G/ c: w9 s
    info[num][0] = com;
    9 q; J5 [. @% o7 {! ?info[num][1] = wai;
    - u+ D) s! w8 q  X( Y% tinfo[num++][2] = cha;" x+ Z) ^& g/ ]' L' P5 N  l6 k/ p
    if(num>10)  //存储10个点2 o2 s9 x' p  I( c
    {
    * f" ~2 q5 \: d# C( K" O( P6 G. i$ pfor(i=0 ;i<10;i++)
    ' i# T6 t( x: {6 f+ t- o{
    - T9 i0 v% g' o& h. h; Q  Einfo[0] = info[i+1][0];$ W: W3 s, v( `( J+ U1 b1 A! q
    info[1] = info[i+1][1];
    % i% B) u1 p; T2 P( w- K& I( cinfo[2] = info[i+1][2];: Y; S+ A& R9 E# n8 B! _
    }% b& A" Q! H3 z
    num--;
    1 U5 W8 A* j# W$ W& W}; {* W9 I  `; d, N6 u1 e
    if(FLAG_show==0)
    9 V# v/ d0 t) ~4 O6 D# D# greturn 0;
    ! n* I* W8 G. G6 |4 g6 v* l  \for(i=0; i<num; i++)0 `* i8 ~" f" L' w9 r% y
    {& D% P1 G' s3 [4 y
    t = (float)info[0];
    ' u/ ]7 n6 o' Z1 W: j: w( ytemp = (t/101)*90;
    8 s9 D) \0 E! Z4 J- b8 P) `pos[0][0] = (10-num+i)*25+x+100;8 S, u' x: L) r% U
    pos[0][1] = y+110-(int)temp;
    ( ^6 Q) x+ f+ n; B  ^t = (float)info[1];
    1 ?. u4 d( o1 E1 o4 {+ E, ztemp = (t/101)*90;
    ; X- P8 d7 Z, _pos[1][0] = (10-num+i)*25+x+100;" C# U8 H9 d' F( E6 Z- p2 z
    pos[1][1] = y+210-(int)temp;
    ' I( ?/ k  E/ I$ Z+ g) U) `t = (float)info[2];7 {1 m+ f- |% G. V' l  i& h
    temp = (float)(t/101)*90;7 T& E' }& G+ K/ Z9 ?
    pos[2][0] = (10-num+i)*25+x+100;
    ( m/ q- L( L/ qpos[2][1] = y+310-(int)temp;
    ! I. R8 R- \1 }3 }3 ?}
    & C, r8 R6 [) C9 J8 ~7 Fif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0), r# R5 R7 S  e8 ]
    {
    8 c3 E5 f( v+ x/ e" X; @clearrectangle(x,y,x+400,y+315);
    - \6 |- k2 i* k. a* p6 tsettextstyle(20, 10, _T("楷体"));" T, Z$ B  B6 D2 k
    rectangle(x,y,x+400,y+325);
    ) g  g& o, _, iouttextxy(x+40,y+10,"CPU");       //画柱状图0 w4 S- \! @5 R( L, V& y! u- t: P
    outtextxy(x+45,y+10+100,"IO");
      T  x6 L" b5 Mouttextxy(x+40-15,y+10+200,"change");
    ' x- f9 t- Q* A* q/ k- E3 n# rrectangle(x+35,y+30,x+75,y+110);" t" @" d& X& Y0 M
    rectangle(x+35,y+130,x+75,y+210);
    + j4 q% E3 Z, s& \3 s  i. w' Nrectangle(x+35,y+230,x+75,y+310);3 K- ~8 @5 D* x$ E5 U# }6 _+ ]
    outtextxy(x+180,y+310,"SJF");
    ' u( S; @8 I# B( [8 B8 W" ^t = (float)com;
    ' e* ?9 H$ m2 {5 S% Etemp=(t/101)*80;, D& ?9 V. G) C3 G+ y% U) a
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);, e/ h, U+ c6 j' _+ r" c0 i# l& _" Q% q
    t = (float)wai;
    + ^7 W2 P6 @1 p5 I& btemp=(t/101)*80;: l3 e8 g' y/ j0 J0 o1 _
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    # Y  T1 z. \+ b" d) vt = (float)cha;
    0 u! s( ]2 {% \) V3 [3 ]; _temp=(t/101)*80;
    * W/ c4 a9 H' gfillrectangle(x+35,y+310-(int)temp,x+75,y+310);
      I, x* S2 u* M/ J) e. M# \for(i=0; i<3; i++)   //画坐标   high=90,length=2507 L- F' z8 S3 x/ S0 w
    {
    6 u- t* [* {% S7 u$ P' F$ eline(x+100,y+110+100*i,x+350,y+110+100*i);& N& [$ e0 _8 |+ _
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    / e; u. f1 D- M' yline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    " V, d/ w- s9 V: H$ B( L  h
    2 b) o4 z2 ?6 W/ [( c2 |line(x+100,y+110+100*i,x+100,y+20+100*i);! A* ~1 j# z) F# h7 [9 X. r! T
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    ! y% g# ]( L% }; Kline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);/ e. Z2 m3 j" i* w
    for(j=0;j<num-1;j++)
    * p7 z3 d! w! o# d( P{7 B. t$ |3 B) k% g
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);3 e# k  a/ ^  B) d
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    0 M7 D2 _; R7 }* r! C/ vline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); $ H6 `2 y0 X! j3 r' \
    }
    ! u5 J5 {* O& j" ^1 u% Q5 b}
    / ~+ o" J/ n2 w' j$ x5 E}0 @- q  s9 J2 Q' L5 q2 V) x4 c. G
    else if(FLAG_SJF==1)5 I1 ]) e# r& M$ [& b8 q7 y
    {9 [- P( q% k0 T: D
    x=0,y=0;
    , s, Y: X; o0 D/ \6 X; F# Dfor(i=0; i<num; i++)9 j5 d$ U; u/ b! g
    {1 i% o, @" D0 G
    t = (float)info[0];5 v5 U' c& L1 [6 z- P% ~
    temp = (t/101)*180;
    ' ?1 C6 \" d( M7 _pos[0][0] = (10-num+i)*50+x+650;
    ; z3 q$ \5 A/ q3 b/ n: o+ `: bpos[0][1] = y+210-(int)temp;% u; |  ]7 G1 d/ G8 ?# D6 C
    t = (float)info[1];  j" o% Y  k8 ^
    temp = (t/101)*180;
    & X9 K9 }5 [" {# @* a7 Hpos[1][0] = (10-num+i)*50+x+650;7 e. o9 x  f* H9 M1 [6 h8 b. V
    pos[1][1] = y+420-(int)temp;3 }  Y' E9 B! d9 Q+ r( T0 \4 [
    t = (float)info[2];
    ' T( V3 [. @9 U) @1 g6 Htemp = (float)(t/101)*180;
    ; E% f2 W3 T$ K5 A1 M" B9 fpos[2][0] = (10-num+i)*50+x+650;
    ) x& y1 q6 M1 Z. {( M' R; f! j) ]pos[2][1] = y+630-(int)temp;
    ! c7 O; i% |. s! ]0 J}- ^7 B% l1 R' n# y
    clearrectangle(x,y,x+1200,y+650);8 T$ k# ]# E' P/ H! F
    settextstyle(40, 20, _T("楷体"));
    5 @' H9 ~5 L; T; a  f! ?  c: ]outtextxy(x+50,y+50,"SJF");% t- H7 _- J  @" I, n
    outtextxy(x+280,y+20,"CPU");       //画柱状图: K. _. ]! N. x$ b" ~7 x5 T# V
    outtextxy(x+285,y+20+200,"IO");+ k1 ~# N' P4 [/ u
    outtextxy(x+250,y+20+400,"change");
    ! l- R6 }) T0 {- srectangle(x+270,y+65,x+330,y+215);1 T" A% e) s- L( s0 U$ \0 q
    rectangle(x+270,y+265,x+330,y+415);4 ^) S/ _- b; H& p* l
    rectangle(x+270,y+465,x+330,y+615);
    / l5 Z3 L5 _/ x, Z5 Nouttextxy(x+290,y+620,"TT");
    ) y# e5 C2 C% s- X1 Tt = (float)com;
    . j0 x) i. b: ?3 Gtemp=(t/101)*150;
    ; Y4 b) X. w9 {3 zfillrectangle(x+270,y+215-(int)temp,x+330,y+215);5 q, H- |  o5 b$ h+ `
    t = (float)wai;) d0 Q* F5 \5 j3 h. ?
    temp=(t/101)*150;- ~0 H( s- P; E4 y' H5 e
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    ; u# g/ B. F  }t = (float)cha;! S. B' [- o; n( g6 B: Y
    temp=(t/101)*150;
    # b* d- i( n4 O# j' h0 dfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    9 V4 {- s+ B' u& R7 K! `for(i=0; i<3; i++)   //画坐标   high=90,length=250) g, @. _+ k/ k. g. O3 m1 v
    {
    7 N6 H5 W- x) k+ Nline(x+650,y+210+210*i,x+1150,y+210+210*i);
    8 }* j$ s2 w% p# x: U3 G  Tline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    ' y+ H, N7 P. k7 m/ v! l: L3 g5 dline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);" ]7 t/ t/ i( h$ e3 C* M) e
    ( B- S2 J6 T5 D7 X
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    9 j5 {: s9 ?8 L. P. oline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    2 G7 t/ Y: ]) }7 Bline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);- k( P: }/ v. m/ T1 d
    for(j=0;j<num-1;j++)1 U7 w6 ~& i* E
    {
      h8 I' B1 r  y: p' D8 M  T$ mline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);, |% A; X6 c% b. T
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);. t2 e2 F& m' g' v- R0 q* d6 f
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ' z9 v; g. r$ i' q' u. L2 S
    }- u; r) }9 _# a/ |9 v; w
    }3 N, I; t) d6 u3 s. G; _
    }
    2 \! A5 c* h9 R; l1 [( a' \! mreturn 0;
    1 x0 N4 T4 U" K' R+ f; o# e}# o. c0 R" u/ K, ?
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    2 _6 D/ p$ Y2 J- K9 ?) O3 }6 h. q- F{
    4 k6 n) U  r" zstatic int compute=0,waitio=0,change=0;
    9 ~. ]' f6 e3 v9 }* Sstatic int computeLast=0,waitioLast=0,changeLast=0;% J9 L, P4 F6 }  j
    int i=0;" ~/ E  |9 T9 D# q3 m) u8 [
    if(draw==1)
    * W8 f$ b' c2 B/ ~0 W* R{3 z5 Z& W" S4 q2 I
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);1 Z3 N/ {4 i; T" K: Y( Z: h
    drawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    ) {$ L! d7 E1 X( Q4 GcomputeLast=compute;
    : b1 x& C# `" [waitioLast=waitio;/ I, i; i% S0 P: f) i0 k
    changeLast=change;
    : X/ e0 s6 W- I}2 C- x' p' Q9 b) R3 r
    if((* memory).p[0].flag==ready)9 ?! u; C2 p) r
    (* memory).p[0].flag=computing;
    9 G" r2 v8 b+ e7 {# r. R+ ?if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    4 J0 ~$ e* M9 C' y{
    4 b8 @7 u! Q5 C, m" [' bi=(*memory).p[0].computeNum;( u0 M7 N, q" y% }) T5 V* ]7 d; u
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed3 H+ J# M. ]% v8 y7 \- ]
    {  r3 X" ^" D( f# ?
    (*memory).p[0].flag=IO_waiting;; L" E: K/ u/ S/ k6 V
    (*memory).p[0].computeNum--;* p& B6 _1 N0 U7 v1 Z  L
    change += exchange_IO_Compute;. a/ k5 [" o, L
    compute++;# |8 v: c& A( _! i
    }% T$ d: N5 C! L3 e/ ?6 N
    else
    4 L# f# Q$ S. N4 T6 V{
    3 d& N! h5 S* [$ zcompute++;7 y+ @* [8 R/ X* C" _
    }
    * }' ^0 ?$ Y. C# F9 W+ {  `$ _1 q* h}  i  D( ~' D3 ?/ {1 l
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)4 K7 I0 L7 ?$ v' p' E, R
    {$ t/ M/ ]8 \9 G. m
    8 P5 r* _. ]* {5 b. I% d
    i=(*memory).p[0].ioNum;6 Z) B% X. p. ]) ~7 C) s) I
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed. J( b) n6 K  M2 l
    {7 E( b1 d6 ^1 @- O
    (*memory).p[0].flag=computing;
    0 @$ R/ u) |0 L4 X; M(*memory).p[0].ioNum--;0 K0 H  L& v& v% a
    change += exchange_IO_Compute;4 c* L7 t: J3 [. h
    waitio++;! v; e& r! c1 N+ @( T
    }& Q( f1 O. I2 I; E9 Z1 p
    else" H$ E  ?3 |, v0 `
    {
      _( p; u/ `6 ?" t/ [; j$ jwaitio++;2 B0 k/ G+ c; P& @' j  q, @- _: b. y
    }, H' B' V' J7 }: h1 d
    }4 J2 T: K* D4 N
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)% I5 G; O* T6 G' b
    {
    8 A7 Z! u4 }( K. B9 Y1 ^(* memory).p[0].flag=IO_waiting;: y6 g8 @/ s. D* N
    change += exchange_IO_Compute;
    # Z8 `. z& R# \}& p  o; }' p/ V' i" Q- ^7 L" N1 k% d6 U
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)9 p+ U4 d1 [6 B, Z& T; i! i
    {
    % h% Y* v$ U3 R(* memory).p[0].flag=computing;/ r1 w) M4 K' ^: q2 v0 B
    change += exchange_IO_Compute;
    . T" Y. ^" K5 z7 G. s}
    2 {$ H. P. w$ x# x4 p' Xif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    : w# H, `2 {3 M; @- N( J& `{! p. u6 O9 A9 E. u
    (*save) = (PCI*)malloc(sizeof(PCI));  s3 d" T. Q, o! k- e0 {  m
    (*save)->next = NULL;% d3 Y% t" ?; l( P# u& D4 E2 `
    (*save)->processID = (*memory).p[0].processID;
    ) r* m: E; S- {8 \0 d3 ](*save)->comeingTime = (*memory).p[0].produceTime;
    ; y+ @% M2 ?* O% ]9 Q(*save)->askMemory = (*memory).p[0].askMemory;
    - f% N3 l+ f) W# b(*save)->compute = compute;
    0 p+ r* p! [, ]% C" q(*save)->waitio = waitio;
    # s% p' \5 N) s% ^. j3 a, {) T' n7 `* i(*save)->exchange = change;" z+ S$ \$ h$ [; L
    (*save)->completedTime = systemClock;6 g: w  _) Z+ k
    (*save)->runningTime = (*memory).p[0].runningTime;
    - |+ W  n' Y# G8 a*spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;1 p2 M8 f5 V0 B) p  A
    compute=waitio=change=0;
    ( p6 ^! m& D9 n5 c/ ?9 L( rcomputeLast=waitioLast=changeLast=0;1 m6 Q/ m/ _( l* E4 [& |% R& f
    High_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);; c& A) S5 J% j$ P8 F) l* w$ [
    change += exchange_process;
    ' q# p3 o- x: ?( `0 Yreturn task_completed;
    2 _: v- o% {7 a# a) C7 _3 _}
    . f' r1 Y' w8 R+ G1 L# n& Relse: |0 |% v. A2 O, R* [& s! q
    return task_not_completed;
    / l/ z/ Q; {! b- o7 e$ f1 q, _}
    . C0 X, h5 H# h/ ]1 Iint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch)
    , d4 g9 @5 \4 J9 `2 i3 N8 q" `{
    - Q. C8 L7 n# |0 T2 Vstatic int waitTime[initProcessNum],i=0,j=0;/ p# ]& h) q1 n' O' C  n- g
    static double HR_ratio[initProcessNum];
    # e! p: a8 c# E& H. oif(flag==0)                    //初始化数组+ m7 g5 t# @) C* d0 y
    {( W7 L4 C6 R, [
    for(i=0; i<initProcessNum; i++)
    $ {8 R5 l* n' T) W( m{( u" L6 O0 K1 d) }( I
    waitTime=0;$ c1 v8 a8 z) s
    HR_ratio=1;
    , C5 d. d# w0 G( X}) y  F! C3 I4 h0 @; I; @3 Z$ S3 \" Y
    }0 u) X8 |- W* ^$ A) I5 s; ~
    for(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比
    $ I, \1 _* H3 h! _{! u" h* @  X8 h: @, S+ ~$ v
    waitTime++;, l" g% U% U3 W# k' P0 X8 r, Z% F2 j
    HR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);. l/ i& N. u# Q% M) S- I
    if(HR_ratio > HR_ratio[j])
    ) Q- D  p" f8 p7 A4 Y: @. i8 I! Ij = i;5 ]7 s$ @1 K6 J0 K
    }5 H& t6 |7 i9 h+ S( |4 \
    if(dispatch==1)                    //需要调度一个进程到内存中执行& C4 `0 O3 Z5 A
    {) L! p0 ~$ C$ b0 o
    if((*storage).p[j].askMemory < *spareMemory)# p% c: i+ E! d
    {
    ' p9 ?  y% c4 C0 j9 A: F(*memory).p[0].askMemory = (*storage).p[j].askMemory;
    * O* g1 i) j( h! S/ n, I! V(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    ' e1 J+ A3 V, U* c6 H# N) R(*memory).p[0].computeNum = (*storage).p[j].computeNum;; X: R! m9 ]2 K$ [4 S- J
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;  J9 \; S7 D9 t8 F! s
    (*memory).p[0].processID = (*storage).p[j].processID;
    0 D; C6 k. P6 Q" s; m(*memory).p[0].flag = (*storage).p[j].flag;
    * v! J; R; P1 ?) D: P(*memory).p[0].ioTime = (*storage).p[j].ioTime;
    $ ~+ y! f* s. [$ O9 V  C( S(*memory).p[0].computeTime = (*storage).p[j].computeTime;
    * B$ Q7 X, i7 s7 D9 c/ A/ W* j(*memory).p[0].runningTime = systemClock;
    - w, c$ m: h/ M! ^* g2 T) S1 n(*memory).p[0].produceTime = (*storage).p[j].produceTime;
    $ B( J5 v) \# v6 I1 Xfor(i=0; i<(*memory).p[0].ioNum; i++)
    / n. m& d5 }6 n- F- t- ](*memory).p[0].ioClock = (*storage).p[j].ioClock;& {! b' N) j  j
    for(i=0; i<(*memory).p[0].computeNum; i++)# |9 A5 V, i9 e: K1 B1 _0 y$ W3 u
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    0 A$ m5 O; F% Z1 b) p(*memory).proNum=1;- v% }1 x- d4 f% `: S- V
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;' u  m, K5 h. s( J
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程/ p1 {+ O, B. c" ?6 [/ d( R
    (*storage).p[j].produceTime = systemClock;9 I  I2 _. J* w- I# p& K9 \
    MAX_COMING_TIME = (*storage).p[j].comeingTime;/ m$ S: [! R) M, _* |
    waitTime[j] = 0;
    " H" w7 |. j0 |* B7 P( }2 OHR_ratio[j] = 1;0 X6 q9 h, Q5 f; M
    }
    * J( z0 r& D1 }7 Ielse
    : P/ T( [3 ]/ Y2 @  l$ Z{3 `; w7 G7 A5 v
    printf("A process ask for a memory overed the system capacity\n ");4 Y2 F+ {7 [  K, Z
    exit(1);" d& \+ I8 v  Y4 U; I4 i
    }* H) Z9 L8 @; W* i/ V0 h" Y5 ?- g
    }% K9 `4 \5 c+ H6 ]+ H
    return 0;/ G6 T1 `, p9 H; e8 F: t! b) F
    }0 F1 w* Q) _3 E' L
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)' U, W' X! f+ n! n
    {
      v' _6 Q' |( H8 O0 s5 Lstatic int compute=0,waitio=0,change=0;' V; [7 f+ |4 V0 E3 m
    static int computeLast=0,waitioLast=0,changeLast=0;- }& W7 Z: B* j$ g5 x
    int i=0;/ u' ]' L# s( l! `* a0 J
    if(draw==1)
    / b7 G+ c1 j, b! `8 Z{5 z' a: D9 p, J/ p
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);3 V3 E5 J- y- k% U. O& H+ P
    drawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);: c0 A) i, N8 X5 ~$ L
    6 b1 K8 Y2 u6 {( q' m% r
    ; ~% i6 d. y; v- D8 o' P" Y1 \8 s9 Y8 W
    computeLast=compute;, ]  j+ `; P* ^" v; P
    waitioLast=waitio;9 @5 ~$ m: C' T8 Q+ X$ n* E' }
    changeLast=change;; t+ Q( ]7 j" T4 w+ H1 L- n1 @
    }9 ^  a" ?6 y8 }* p. `
    if((* memory).p[0].flag==ready)  w. o& k, k3 ^! O" `) L
    (* memory).p[0].flag=computing;
    * \) n! z1 U5 i( g0 mif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    ) W0 m, F% n1 }/ T. h{
    ) W9 e; j' ?- I. g! ~. }6 P  W* wi=(*memory).p[0].computeNum;
    * @0 @0 O  d1 o5 M* gif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed; C% W7 H" I  R6 |
    {( I, X  f6 N2 b
    (*memory).p[0].flag=IO_waiting;
    1 A6 |/ O/ z- I* M" W(*memory).p[0].computeNum--;8 `% @: c# C" B4 ?' V- b
    change += exchange_IO_Compute;4 \$ {6 E6 f/ Q7 u6 H7 I  ~5 I
    compute++;
    . W2 N. w3 z  h/ T8 T}
    6 Y% e7 Z0 [( X( F) @5 f% e2 helse) Z$ @. G. X7 [* l
    {$ y6 W0 I, v: m* b
    compute++;
    . o5 A8 ?1 ~( i8 h5 B$ v& N# b/ v}
    7 ^# n; S: h  I0 B0 d}$ X* J( N- C. E. W5 B
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    / j5 w8 L6 h5 t9 R. Q4 `' o{' [# l5 V0 p5 O( u
    ) T% ~) n  d& a9 y- T
    i=(*memory).p[0].ioNum;
    / e" Y8 x* p& X0 n# C/ aif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    4 o( t# E: u9 s2 ^{+ o, B* b( y) h
    (*memory).p[0].flag=computing;- c9 H+ Y! G  O$ a  E+ b- `7 ]
    (*memory).p[0].ioNum--;
    . X. z. }. N+ w: Cchange += exchange_IO_Compute;
    ; r. Q- M5 Z: r. c3 zwaitio++;4 O. |3 d) r0 x, I
    }- B8 [: H# H+ t
    else: @$ F% B' E) I8 L, f
    {
      s$ Q' u/ L% e% lwaitio++;
    / o$ a$ O+ {! S5 m, L}
    ( X  `4 [3 _- r" |}# I2 m  {5 R$ {
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    3 m% l: q% h& Q{
    6 O! z3 J, ~4 @8 k. U- e5 R(* memory).p[0].flag=IO_waiting;- M! Q" v9 Q) k4 z9 b* ]$ p  W
    change += exchange_IO_Compute;
    8 m  z/ d: V) ~6 w7 |  k7 I}
    5 x% u5 b3 f9 ?" S2 }; O! N0 c! Qelse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    5 n0 ~6 X$ w# V{- E5 d6 P- c# K+ C/ G7 a% c9 R
    (* memory).p[0].flag=computing;
    : \+ Y- a+ T  \4 }  Z4 W  w/ Ochange += exchange_IO_Compute;) b. v% K/ a. x' U* T, i- c& w. P
    }" }  {. S4 _' m2 E* J
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成4 `( ?1 X0 h7 Q' Y' m) k, ~: \1 `
    {1 I2 `* n- d$ Q6 y& q
    (*save) = (PCI*)malloc(sizeof(PCI));
    7 P. ?, Y3 u; N' d(*save)->next = NULL;5 _8 @3 H% M9 S! Y
    (*save)->processID = (*memory).p[0].processID;2 E+ k- h. p# N
    (*save)->comeingTime = (*memory).p[0].produceTime;
    3 U& X: @+ ]. \9 _! n0 L5 P8 F(*save)->askMemory = (*memory).p[0].askMemory;, R- v, B# B% e$ K; f( O7 U
    (*save)->compute = compute;
    : g! a3 p( G; U/ T5 n; h- f# ~1 g(*save)->waitio = waitio;
    % ~2 r9 G) ]- b3 s/ O- H(*save)->exchange = change;
    . W) |3 N* X6 M(*save)->completedTime = systemClock;/ A9 ^/ L/ _8 b' J1 ?8 r
    (*save)->runningTime = (*memory).p[0].runningTime;
    ( C' V& W2 N1 X) Z( o*spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;
    $ y6 h3 p9 j! Qcompute=waitio=change=0;
    ) u/ e! I6 b' R7 }  ocomputeLast=waitioLast=changeLast=0;" t) n2 ?" n9 L' L" t0 {8 t8 R- w
    Priority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));$ J* O0 q: M+ U( ?
    change += exchange_process;
    , H7 `% ]4 @$ }& L/ y. c' z7 Z* vreturn task_completed;$ q, x. b$ V: l; j4 o
    }
    $ _% Z% T2 I# L/ }+ Lelse
    * }, ^( T3 `- G4 X2 T0 h( W7 {* W* preturn task_not_completed;
    * G& |1 @  P: t, D3 B% M3 R}7 }; W5 b% a; G
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)1 e5 Z. Y3 V+ J
    {
    * r/ {* v5 J% S2 Q0 N. U" |( l% \int priorityNum[initProcessNum],i=0,j=0;
    : Z6 p& X2 j9 R4 a) mdouble temp=0;0 L  e/ P; g: ]; |  D- B
    for(i=0; i<(*storage).proNum; i++)    // setting priority to each process2 {* }8 M8 p5 n
    {
    ) r/ m6 E5 n& Ytemp = (*storage).p.computeTime/(*storage).p.ioTime;0 O) f$ z; F; e2 k% H& F& U0 W4 c
    if(temp > 0.8)# \" r/ R+ d8 g0 n  h
    priorityNum = 6;
    8 T; @5 t' e% _; X. b( Oelse if(temp > 0.7)  Q  M% \2 m1 c( e% Y* F
    priorityNum = 5;" a: I( v* o% s0 {
    else if(temp > 0.6)
    : [  J4 R- N; O# Y. {- MpriorityNum = 4;
    , Y/ V1 z' z, velse if(temp > 0.5)
    7 Q8 w3 T+ ]. o8 A2 S" n" o. s% NpriorityNum = 3;' E/ k4 e5 [8 A! r7 s5 [4 ?! o) a% \; M
    else if(temp > 0.4)* x% j" ?' @- _1 [1 Y7 k0 g5 I: \
    priorityNum = 2;1 |7 ]; t" ^/ b
    else
    1 N$ j* M1 }3 W/ tpriorityNum = 1;( V7 }* R) V4 l% f' w& d
    if(priorityNum[j] < priorityNum)# `9 g3 S/ x  E5 W+ R) X8 O3 a$ g
    j = i;; a7 o0 ?; l: |6 k* [8 \: d
    }  T9 {# N6 D5 l2 {
    if((*storage).p[j].askMemory < *spareMemory)
    " G7 k& v( S! j( \{* \2 H3 A6 p; Q* z0 V# b0 H
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;+ {% Q  f1 @; l
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    7 C3 G$ q, @0 [9 M' F0 i$ G(*memory).p[0].computeNum = (*storage).p[j].computeNum;6 I$ g  \# H2 _  X' G. A
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;' T3 D3 n5 H/ `9 d# N, h( y
    (*memory).p[0].processID = (*storage).p[j].processID;- u6 ?* W( J+ c" G8 A
    (*memory).p[0].flag = (*storage).p[j].flag;
    0 d2 N# b* q) b7 o7 B6 y(*memory).p[0].ioTime = (*storage).p[j].ioTime;. f+ b  [: o( `7 Q
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;! R# |5 k1 B  M
    (*memory).p[0].runningTime = systemClock;
    & ^" v9 M2 S* Q(*memory).p[0].produceTime = (*storage).p[j].produceTime;. j4 k1 u( B4 @$ F4 u* h
    for(i=0; i<(*memory).p[0].ioNum; i++)3 F0 S, j! {9 X- u7 K9 H& g
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;( v$ v$ a2 h; ^$ p3 a
    for(i=0; i<(*memory).p[0].computeNum; i++)
    - P) N1 j$ [8 \. C(*memory).p[0].computeClock = (*storage).p[j].computeClock;
    " [# O0 X; B! w(*memory).proNum=1;- G) l4 W) Z: N8 ]3 ^: I
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    ) S, d  o4 F8 ^" r: wproduce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程- P' ]% ^5 _) H
    MAX_COMING_TIME = (*storage).p[j].comeingTime;4 c* M- h+ `1 T% v3 N$ m
    }& X3 i* }3 o2 z! [3 C/ z! }0 P
    else+ W; l" w4 D) V4 T( ]( v- b
    {% w- U+ J8 B6 C; W
    printf("A process ask for a memory overed the system capacity\n ");
    6 N6 j/ Q9 V# t& R+ K% mexit(1);" ~# x' w' J" k, W' P3 K
    }
    : f3 _/ F! Q8 r% p. T6 Lreturn 0;4 Z+ W' i; p" t( M5 e
    }
    4 p: _6 o2 o* u, bint ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    ! g! F' g; R% s+ f{
    " f' ?1 @" D1 T1 x* |; R4 Tstatic int compute=0,waitio=0,change=0;
    / r# @2 v7 x) j7 x/ o2 l/ Z8 C; ostatic int computeLast=0,waitioLast=0,changeLast=0;) N% h* {; v  j' q
    int i=0;7 u2 |0 W8 M( i1 e- `
    if(draw==1)3 x. W* u) j. g# V
    {5 V& g7 C1 F3 I* r" M) h, r/ U( O
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    + q" j) T! Q8 X/ T3 j% TdrawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    ) x( x4 S' x" r% [2 _( S
    + D# w6 P8 d* P9 ^
    5 v1 m$ Q5 R' f# F5 ccomputeLast=compute;( q+ ~, V- ^# P; j
    waitioLast=waitio;
    / z& R  w3 o" q; wchangeLast=change;6 S/ F* H2 w# B* u$ m, {1 ]! Z
    }
    : H6 ]" x5 T, e9 x2 Gif((* memory).p[0].flag==ready)
    2 s6 g; ]) p5 ~! d# o8 \3 h$ D(* memory).p[0].flag=computing;
    3 t1 M) W5 f$ n3 P0 ?, d& s; rif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    " z% O) u! E% f7 M8 A- T! ]{
    5 {4 N0 W/ n- X# Fi=(*memory).p[0].computeNum;0 R) R7 c8 b$ W6 `0 d, K
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed* Q7 l1 @" n- x
    {, e) g- S6 O" X0 T$ R
    (*memory).p[0].flag=IO_waiting;# i3 X$ O4 N( Y
    (*memory).p[0].computeNum--;
    - d* d) X: y! J0 X# G' v! Hchange += exchange_IO_Compute;
    & s# R% Z; S0 p$ \4 V% wcompute++;* D) s- H9 Z0 f+ b1 u7 Y
    }
    0 E1 H, D& M% Y, q- `else6 U' U: X/ ?) U
    {- f; P2 t5 a+ T9 C
    compute++;
    ; C- s" {' N. Q, ?% h: W}
    ; Y$ t5 g$ W0 c4 m( }3 ~4 R}
    ) x, n3 b' r  B2 L: Eelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)+ O. i9 |% v0 u% a% P
    {) W$ e# V5 c" v& `6 W0 ?$ L3 ~
    7 `, \* Y+ Q. U
    i=(*memory).p[0].ioNum;
    - {$ x6 x0 I0 z6 vif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed7 V) c2 `$ C: M. s1 X
    {
    ; \3 y1 m' M; U4 T(*memory).p[0].flag=computing;
    * c# e: g9 `% a( a: Z7 [& f(*memory).p[0].ioNum--;
    8 t& V# l5 T% m1 Ichange += exchange_IO_Compute;% b2 L* h4 B) Q' A/ L1 c
    waitio++;
    ) g+ X  @+ Z" U0 J2 x- i}
    & T) }% g6 ~# A: oelse2 ]& D1 _. g( \
    {5 {+ s% M0 q/ {* T, T/ I( o
    waitio++;! i# X1 ?1 d) B5 ~5 J9 m1 ]7 x
    }
    ! r1 i* a$ j$ P8 p$ P/ X}& u7 |- {# |' z* {
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    , i# O7 k: |; V0 W1 t5 ~" e7 o# v{
    ' d% L! Z0 q2 Q+ w+ f(* memory).p[0].flag=IO_waiting;
    5 m2 q9 L6 b6 _" X1 Wchange += exchange_IO_Compute;: X% c0 v$ z: b) P+ ^
    }
    , m! @% {0 w) X) N4 q: y) delse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    6 y: r$ s+ Q4 ]& [6 A, l{
    4 _. N6 g. L: `- m(* memory).p[0].flag=computing;
    % f% L5 d% t& {: [3 hchange += exchange_IO_Compute;1 v. K4 C% o) U8 w! B% Z
    }
    $ j4 M! T# K! p; `if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成) S8 w( D5 {- y
    {$ s: L! q) S! M- j% O
    (*save) = (PCI*)malloc(sizeof(PCI));
    + ~# V& M) k, G1 y! {; u4 ^+ i(*save)->next = NULL;
    3 w5 [2 i& v+ t# E0 {) I(*save)->processID = (*memory).p[0].processID;; Z$ c8 H- u4 J( M* B
    (*save)->comeingTime = (*memory).p[0].produceTime;
    % _3 x* x- C& _1 N- M( K(*save)->askMemory = (*memory).p[0].askMemory;
      N( S' X' _' F: H. @(*save)->compute = compute;
    : _, k- H/ a  V" ~, u(*save)->waitio = waitio;
    9 v+ I( Y( b, p(*save)->exchange = change;6 }% C' s0 O3 [1 G5 b: x5 E5 U
    (*save)->completedTime = systemClock;$ i  _/ ^: u$ H- q4 k  H8 J
    (*save)->runningTime = (*memory).p[0].runningTime;
    ) {3 ?9 J3 ^. c7 ]# U3 w*spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;
    + h$ _5 D( i, X" y5 ^' q( Icompute=waitio=change=0;7 y0 R  Q: D+ k$ I5 m
    computeLast=waitioLast=changeLast=0;
    / f3 n4 k0 l( \  I, ]& H; MSJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));
    ; G  j4 Q& Y2 e' mchange += exchange_process;2 c% o6 V' R: r1 G& J2 ~
    return task_completed;
    " G, M2 f  ~% ~6 u2 n}1 Y4 `( Y+ }" ^- P2 y
    else: t2 A6 S; o/ j: D2 |. G
    return task_not_completed;. j: J) K4 F) D) S0 N+ t3 L0 q: C
    }, f( S! F6 {! ]0 j+ F
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)
    5 a) Y" H, [& L9 F" x( t{
    ! c; [$ `8 Y# `$ u* w  aint i=0,j=0;
    : M" e. {- X4 ^  w- i- W, Ofor(i=1; i<(*storage).proNum; i++)
    ( q+ [) G1 D  n! T0 p9 V{' u5 J+ m$ u8 Y8 Y
    if(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime))
    ! W  I0 v1 u7 J  qj=i;; L1 Z  s6 q  G7 p
    }' s  I; T" I; R0 h! l: T3 L& U( p
    if((*storage).p[j].askMemory > *spareMemory)
    $ c- I" S' i" R# _{* r: H& x: M9 J# R6 f! V
    printf("The memory asked is overflowed than the system memory.\n");
    1 ~' r7 ~7 s; k9 @. c# U4 L/ zexit(0);
    0 S! }8 t  B) s% K4 J}- i1 w+ r$ E) l7 @. ]( K
    else
    3 A0 x6 F* ~6 J6 a{3 X& d+ t& k8 O# S0 f5 |
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;
    ( G! b* U( ]$ g! C/ `' e/ x4 M3 T(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;) b2 |. @9 [  X; \' p
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;) B) ~3 ?1 P7 J: I) Y" N/ U) _
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
    " o5 Y/ @& P# U; ^; z6 c0 q, U(*memory).p[0].processID = (*storage).p[j].processID;# r1 ]% ~( P5 E' P$ A& V2 j
    (*memory).p[0].flag = (*storage).p[j].flag;
    % D) Y9 j7 S5 X. y; d7 ]7 J(*memory).p[0].ioTime = (*storage).p[j].ioTime;
    3 D+ }. l- O' s4 I/ B, M(*memory).p[0].computeTime = (*storage).p[j].computeTime;" F( j2 l! m8 F5 x! M0 ?& @
    (*memory).p[0].runningTime = systemClock;9 f' I* W8 T+ \1 R2 X
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;
    2 Q) O$ j1 e" t( hfor(i=0; i<(*memory).p[0].ioNum; i++); L" v" w, W+ L, t; Q* u
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;! |) ]1 `: U* {4 a/ j7 p8 X
    for(i=0; i<(*memory).p[0].computeNum; i++), E" ]9 i# k: N
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    2 E( W- q8 d, F% S(*memory).proNum=1;
    / `6 G) J, i  m8 b9 d9 Z+ W*spareMemory = *spareMemory - (*memory).p[j].askMemory;$ q! W5 f* r: p8 j, H
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    2 X, G* N( ^4 I$ r. H. H' k! U5 VMAX_COMING_TIME = (*storage).p[j].comeingTime;3 @6 p/ ]& m7 t# A1 S! v% `
    }" M! s& e, N, ]; _+ r
    return 0;
    9 t& v! J: W% H8 g3 g}
    & x1 R! Z2 c0 R8 u$ Sint TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)& ?5 S, @  v4 B1 a" m
    {
    $ t2 R1 ~4 T/ J# Astatic int compute=0,waitio=0,change=0,clockSegment=100,poi=0;; h% N8 P, L$ A. W% b
    static int computeLast=0,waitioLast=0,changeLast=0;
    6 Z  S# y3 t6 j2 y4 F* K# uint i=0,j=0,k=0;
    * e- q5 k! [6 I8 Z1 Qif((*memory).proNum<=0)
    1 }  S) c9 ~7 Y' S% f. ZTimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);
    1 O+ W- T& E- ?  qif(draw==1)
    4 U6 I( N4 e* T" b3 G4 j2 a9 k& z0 B{% ?8 T) E7 W! C& Y3 g1 k
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    7 U% P8 j- M* K0 m' E' W3 IdrawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);3 n6 ?$ S$ v' C  D! g- z, ^$ d
    " c6 x& S- g4 B
    - S* F1 J2 g# S8 A$ I" h
    computeLast=compute;% c! i  L2 d: K, p. O8 N3 B% S0 @8 x
    waitioLast=waitio;. J/ h5 k2 ?9 {# R7 ?% \) B
    changeLast=change;
    3 D. l; [5 z: c* ]; n1 V}- j$ X* }8 y7 t9 _
    if(poi>=(* memory).proNum). q- {6 X1 y, J
    poi = 0;
    9 M  j' A1 C6 }0 n" X8 h0 w  ~if((* memory).p[poi].flag==ready)
    7 j. _4 L( s& O(* memory).p[poi].flag=computing;- d8 e, M4 @( b) @* u' `% U
    if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing)
    9 s. r" B, i& A; K* j2 r7 s% n{
    3 C& k6 V. s, s# yi=(*memory).p[poi].computeNum;) k9 V( q, d' X. D8 B" ^# `
    if(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed# t* ?- U2 A/ G* P, K# P
    {
    ( @9 w' W( g3 ~2 n! ?(*memory).p[poi].flag=IO_waiting;
    $ J/ r8 ?  }0 u0 ?- }) ?0 D& b% o(*memory).p[poi].computeNum--;9 U9 q  v* ~2 P' Y& a* v1 t  }
    change += exchange_IO_Compute;
    , I& K: d+ j# u; f6 E$ icompute++;
    3 s! U# ^2 D+ ^$ }}
    % F1 d3 e4 z( U% b4 H: {. j- velse  K  N* m$ a0 D& J* \$ s1 e% b
    {: Q& m. d+ m* I8 k/ a9 R
    compute++;8 ?- s( ^5 T5 q$ B8 ^3 f: Y
    }8 B! t6 ?3 g$ G8 {& O* u
    }
    8 |0 S$ Z* u& y: [7 s- ~- O/ Zelse if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)
    5 x8 \! m2 e3 t6 S{
    ' F% N$ K7 E% v& Q
    ( b" f, s# S$ d5 H' E) ^i=(*memory).p[poi].ioNum;
    # V+ k6 ?4 }. Y6 K* o) N: k# \if(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed
    . r/ `$ l3 w' D+ F7 p) i{+ Z0 |: \3 `, v  ?1 d9 K2 M/ Q
    (*memory).p[poi].flag=computing;0 J' t( p: q6 |* h1 X! E) R
    (*memory).p[poi].ioNum--;
    " e$ j/ j, f7 R6 F+ Z0 F5 v/ lchange += exchange_IO_Compute;9 x9 ]. M/ K, E5 ]* U9 d
    waitio++;
    % D, E% `4 |" b0 F8 P+ `}: m* t# I  m4 A$ U" l4 F
    else
    5 J$ O( W' j+ \7 s5 }{2 X% B! T; I' f+ H( T7 i1 h" |
    waitio++;/ S- Z: q, w' X( G) d( u3 p
    }. {$ B7 D/ Z. T5 y/ y- P3 g
    }
    9 l: _! s6 `2 h: z7 H* C, Celse if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)
    4 a( W) h) k) y# b7 p- e$ C+ f+ p{
    ! V- Y. P) V1 m8 v; ~(* memory).p[poi].flag=IO_waiting;
    $ X$ {0 Y5 |3 a# g0 H9 C$ {' a$ Pchange += exchange_IO_Compute;
    9 \1 a5 u( o. m* @& N}8 _% f# ?" V( j7 v' R( I8 A$ E1 Y
    else if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting)
    : L7 x4 f* O" P& m! |{7 h$ G0 L. U8 T6 j9 P1 `6 z4 P1 \
    (* memory).p[poi].flag=computing;* h, {* I; S& |% Q0 N  i2 K: o1 N
    change += exchange_IO_Compute;
    1 r* S" U$ ~3 G, T! [! d6 f! @0 A2 X}, \: S, Q8 r5 G2 x8 F( S
    for(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进8 M0 {+ d- D! x  U3 [9 m
    {
    1 o; n* e7 W5 X% Dif(i!=poi && (*memory).p.flag==IO_waiting)' a- l7 w5 E5 b% P# ~, V6 }
    {
    / V  U! ?2 W4 r2 K' ^1 _- e$ X* bj=(*memory).p.ioNum;
    ( l, ?2 w4 i5 h( ~if(j>0)
    ' ?; c: P/ N. O$ v6 b  l! h2 e* {) H{
    & I9 v' X$ D2 rif(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed9 j! l2 N, X" q1 o3 t
    {
    # \2 s! B& E2 m  k7 x- D. `(*memory).p.flag=computing;1 Y/ ?( B" _: W5 V7 \( A4 d
    (*memory).p.ioNum--;
    ! a5 t) s$ r( @& ]" _' qchange += exchange_IO_Compute;* @- K4 e8 S! m' ]* s$ \) |
    }/ U7 M* S3 b0 Q
    }
    ) J- z: [4 c, {$ \. w4 d}- [. O0 U& ?) T- H! Y+ H% J
    }
    3 o* Y" j: p* P. s% v, H( jfor(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程5 |+ t7 m4 \$ w- K9 P. |
    {6 b  l8 Z0 o, N: E
    if((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed; x9 R# l7 X4 m. N; T; N) @8 b0 h
    {# @/ H% L4 s+ M" [! j) u' ]6 w. {
    (*save) = (PCI*)malloc(sizeof(PCI));* v. J* s7 l& M$ T/ P, B) _2 t( g* c
    (*save)->next = NULL;
    5 Y7 Z2 [' X2 T8 d/ Z       (*save)->processID = (*memory).p.processID;+ m/ M9 {" @( g. q- i
    (*save)->comeingTime = (*memory).p.produceTime;3 t/ D# U. C' p2 r8 H+ z
    (*save)->askMemory = (*memory).p.askMemory;
    2 c9 N2 t, R$ Q9 D8 e* S, Q/ T) R9 f(*save)->compute = compute;  x. v  z" L- {/ j3 I( t8 F$ D
    (*save)->waitio = waitio;
    ) [* s9 v) Z+ ~1 R- w3 ~) K4 ]: r( W(*save)->exchange = change;
    + J* _* _1 U0 t8 r(*save)->completedTime = systemClock-(*save)->comeingTime;7 G  U, Z) ^1 i
    (*save)->runningTime = (*memory).p.runningTime;
      e* d1 E7 r. H4 b; L) Z1 b3 m: O) a(*save)->completedTime = systemClock;3 c6 d4 o5 v$ J' h8 O! ]
    *spareMemory = *spareMemory + (*memory).p.askMemory;8 J+ w( c. S  e9 l1 q
    compute=waitio=change=0;& D/ A5 N  s9 o- g0 ?+ P, \* l
    computeLast=waitioLast=changeLast=0;+ f& m' |$ Y4 P) H) Z
    if(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入) q$ [: h" ]6 W% J  S
    {
    # Q, e4 O! t* J, r( rif(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程/ e7 ^* Y2 P0 f# k5 O0 \$ T0 y
    {2 F6 @0 `: \2 G2 G: B* G; H4 `
    poi++;
    . h# I- L+ V/ j* m  R   clockSegment=2000;* m7 P, ?- A. J! J- F! G3 F& y
    }
    1 h% t# m* h( e- n0 {}
    ! q6 z5 u+ Y; K& j4 a$ welse  //没有足够内存调入新进程
    1 Z. K, r7 N3 d0 A" ^) Y" a{
    0 c2 o8 A) _3 N& S/ jif(i < (*memory).proNum-1)
    6 U: z& X& C% b9 _6 O{
    3 O( r8 z7 b% f) ?4 k8 W# f1 U- C% Jfor(j=i; j+1<(*memory).proNum; j++)" k4 @  I9 i: M! L
    {/ Z% t& U- d3 }: S" f
    (*memory).p[j].askMemory = (*memory).p[j+1].askMemory;6 Z! k  T! n8 b" V- m! C! t, y. s4 }
    (*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;
    / D8 S7 C5 d+ H6 n+ ^(*memory).p[j].computeNum = (*memory).p[j+1].computeNum;; j7 C& I6 V2 j$ h0 x# j
    (*memory).p[j].ioNum = (*memory).p[j+1].ioNum;
    * k! W; _) d( X& ?& m% ^1 A, U(*memory).p[j].processID = (*memory).p[j+1].processID;* H# i! s8 F8 ^" p4 p- D* Q
    (*memory).p[j].flag = (*memory).p[j+1].flag;
    ' Y% m  b( V7 I1 u: J3 H(*memory).p[j].ioTime = (*memory).p[j+1].ioTime;
    7 r$ N+ g9 ?5 b5 L5 g(*memory).p[j].computeTime = (*memory).p[j+1].computeTime;; d; Z4 _$ S; u
    (*memory).p[j].runningTime = (*memory).p[j+1].runningTime;9 e7 {+ S; z1 n" [, J9 z/ j5 U9 o
    (*memory).p[j].produceTime = (*memory).p[j+1].produceTime;/ ^0 R3 }$ }  N& F4 ?
    (*memory).p[j].completedTime = (*memory).p[j+1].completedTime;
    8 v4 J& ^8 G( B9 ?for(k=0; k<(*memory).p[j].computeNum; k++)  F, ^! T$ y  F, e
    (*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];  J* z$ t- F3 ~' ^8 `7 M
    for(k=0; k<(*memory).p[j].ioNum; k++)- u$ m  q9 g) j5 j, M: F
    (*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];% P0 P! }9 H+ Y& V: Z; h! V: b* g
    }
    7 i5 F: q3 k+ aif(i<poi). E4 ]: Y2 l" F- D3 e8 a4 O
    poi--;
    ! X/ |+ d0 S% o1 }- Welse if(i==poi)& w+ W! {% z( Y) T( F
    clockSegment=2000;! |) A; B# ]& i+ J3 {
    }8 t) l- `; V4 G( g( k6 Y5 p1 d
    i--;# }& m& @% y2 ~, \! u) B* ^
    (*memory).proNum--;
    3 j3 X5 y4 ?% `}
    ; Y( i7 T$ r9 `7 q$ Preturn task_completed;
    9 J8 n3 J8 {2 _9 q9 ^% k* S}6 k- A, E6 P& D: v
    }6 V$ ]/ t. z. V
    --clockSegment;& I7 H; p; ?& p( I# X
    if(clockSegment<=0)
    2 [  u- t! `) `8 I5 Q# c2 ~! v4 h6 {{" K) J1 U  ^* m
    poi=poi+1;
    : C5 Q1 `4 |: L5 ^if(poi>=(*memory).proNum)
    % c, V; ^% w7 Q! k) l- f0 @poi=0;
    & W+ n+ D' X2 C& {( Z& U/ a& {clockSegment=100;
    * f% l6 ]& c! i! y" l}- N6 v1 x3 f. Z# P) [- H. Z/ n
    return task_not_completed;9 d+ v* s" Z* n+ A
    }
    , I& r, Z: F+ ^/ L+ o* \/ r- rint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos); D" I7 _; q4 d/ H' a& ?- y( g
    {
    * e: u- j  `; J, d" p- |/ ?7 \/ ?int i=0,j=0,k=0,flag=0,translation=0;
    ) C. a: ^6 V/ }6 P6 r: @+ Ofor(i=0; i<(*storage).proNum; i++)% F+ c' f* h! q, h9 C
    {
    8 f9 Q& }: \6 Y' \; ?if((*storage).p.comeingTime>MAX_COMING_TIME)
    ; W9 [" y- j1 B; L% TMAX_COMING_TIME = (*storage).p.comeingTime;* V7 Q. V) S& {% H) ~" N7 x+ T
    }3 `6 K$ H0 X) h; B
    if(pos>=0)
    & f8 `6 s, x: O# H- t$ y4 g! \4 h{" Z- h4 U3 u- |* W
    for(i=0; i<(*storage).proNum; i++)/ @2 b" m2 m1 T6 ~) ?$ p
    {9 m, X8 g* F, R
    if((*storage).p.askMemory <= *spareMemory)
    6 g7 Q; _  G) a{
    ' l& k# ~! Q9 ~$ d2 ^j=pos;
    9 g' h/ K, A. I' m(*memory).p[j].askMemory = (*storage).p.askMemory;) b$ w/ J2 J, J" r- i' r
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;, r. y: [3 M) ^2 J8 r" S# u
    (*memory).p[j].computeNum = (*storage).p.computeNum;$ _8 V7 p+ Q8 k! J
    (*memory).p[j].ioNum = (*storage).p.ioNum;* W- o/ N; T0 i% v
    (*memory).p[j].processID = (*storage).p.processID;; z7 F( {% G: c8 r) {
    (*memory).p[j].flag = (*storage).p.flag;
    : q! Y& j8 o7 T- m' E% _(*memory).p[j].ioTime = (*storage).p.ioTime;( d! \' B: c% m" M
    (*memory).p[j].computeTime = (*storage).p.computeTime;
    / W6 }* z6 E4 l% N  L* v$ t5 Q(*memory).p[j].runningTime = systemClock;, Y/ C2 b6 ?+ ], H& @
    (*memory).p[j].produceTime = (*storage).p.produceTime;5 v+ [, [, Z6 n2 p% D4 e
    for(k=0; k<(*memory).p[j].ioNum; k++)* H  S) G- O! w8 u; t
    (*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    1 V0 m5 _4 h0 `4 J; C* Bfor(k=0; k<(*memory).p[j].computeNum; k++)
    - k% v# ~1 `3 Q* o# |( C; W6 }(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];1 J) |6 m8 ?2 u( U( F4 {* H1 ~% d& k& X
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    1 R$ S2 c1 U; f4 t( @6 i+ [( l# C7 dproduce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    6 Z8 o' Q0 _/ t7 h1 GMAX_COMING_TIME = (*storage).p.comeingTime;) d& |! M) Y6 Z6 I9 `
    translation=1;
    ; l* L( Y! v# b* ^# ]! Ubreak;# n" j% A1 r9 G" z. T, L* k
    }3 j5 B. i  l) O/ V5 a
    }
    6 w) Y7 n9 w; M1 b3 ]- f+ E}8 [/ ?+ D$ e0 h
    else+ X1 Z3 n$ J2 S
    {
    " d8 F3 B' y- Z2 J$ k/ g7 g; P$ P) {! `while(1)
    / X2 Y# g+ C0 U- c- m; e3 f5 o{
    " C. @/ D( T0 n' h6 jflag=0;
      r+ s1 Q9 `, O& o+ O( M" Qfor(i=0; i<(*storage).proNum; i++); E; ~6 V8 p9 T- S0 ~
    {
    7 \# G( W: b. t( _9 Mif((*storage).p.askMemory <= *spareMemory)2 l3 w% v) _) `& F- S8 A0 f
    {1 A) x5 M2 E, q& W3 _" D' Y/ @
    j=(*memory).proNum;
    ' r, L2 g* O% V4 `* ^7 V3 e(*memory).p[j].askMemory = (*storage).p.askMemory;
    ( y0 ^6 k6 p2 G/ k& E" `(*memory).p[j].comeingTime = (*storage).p.comeingTime;
    . T3 S" o  v# }6 Q6 e* c(*memory).p[j].computeNum = (*storage).p.computeNum;
    8 p, s5 w3 P: H' ~(*memory).p[j].ioNum = (*storage).p.ioNum;/ d) s" m" V# g
    (*memory).p[j].processID = (*storage).p.processID;; J: t3 ~. Z$ r" A0 ?
    (*memory).p[j].flag = (*storage).p.flag;
    7 c% W( A% P) ]2 I2 E5 ?. |1 ~# q(*memory).p[j].ioTime = (*storage).p.ioTime;0 s3 z( q3 w" U7 `  ^% Y3 b# I
    (*memory).p[j].computeTime = (*storage).p.computeTime;
    % C' N5 _5 V* o0 p7 u(*memory).p[j].runningTime = systemClock;
    % W$ L# `& X4 j: x7 J# w) {(*memory).p[j].produceTime = (*storage).p.produceTime;0 @! `* b- @. I) ?1 L; E
    for(k=0; k<(*memory).p[j].ioNum; k++)# z1 w- ^8 @! O; _& t) |/ S
    (*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    1 _  o* _' v$ ?for(k=0; k<(*memory).p[j].computeNum; k++)/ m* J/ @# i% j6 k% y' L# x
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];
    / ~* ?# ~7 P* E: j(*memory).proNum++;: ~2 Q6 F$ y" d6 G5 Q( H
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    " P3 }% ]8 o. |4 C+ A7 _6 x1 pproduce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    ( R1 ~3 d, ]0 h/ I! yMAX_COMING_TIME = (*storage).p.comeingTime;
    ) P1 f# z# ?2 A2 z# h' A6 [flag=1;
    * x) N! v0 }5 k, N& |, g/ ptranslation=1;' o$ P  [' n% z5 z6 |
    }3 z& F/ D# v. h% ~# N4 m8 t
    }
    3 I' c4 f5 Q5 T- T& i: w7 n/ z9 |; Hif(flag == 0)
    ; C, _& D- g5 O# S1 n+ zbreak;2 z) h. }5 k1 U0 D" D. T8 Z
    }: R- W5 ?/ ?, p  W; p: n' J
    }2 e7 A: Q+ _$ [$ m( e1 T9 e- B' Y8 I
    return translation;0 I7 e) e: P; L
    }4 v; O6 |1 C. b& S
    int FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)" S$ n- g9 Z8 C7 @
    {( n" C6 a' X, x6 x, X' M+ O
    static int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;
    & d4 e- U; S6 H" R7 J7 Istatic int computeLast=0,waitioLast=0,changeLast=0;
    5 O2 _6 O  k4 k5 b) r" `int i=0;8 j. \& b* D! q2 N0 @5 L' m; J6 }. {
    if(draw==1)
    5 _, D' f% _1 Q; Z{. m# {7 D$ X" T7 A
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    ! J$ y( U; T, }# z% A% ydrawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);: G9 v+ c5 L9 z* `
    5 ]1 b9 b( D7 z# ?9 s
    ! ^: r+ {: v& Y% M6 \
    computeLast=compute;
    + @; k! W8 ^$ E7 J% swaitioLast=waitio;# G' }: \! _# @# m& {% i; D) \
    changeLast=change;
    % k, L8 ]  e& |' u}
    1 v' P7 W. O) J5 cif(flag==1)  
    - d$ \, _5 ]$ h. \# i1 m" C{% q, O2 a+ j5 }2 d! f- u0 e
    if((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed
    # t6 x* X4 p2 v" i+ P' Y{
    0 p- m( Q) V' _6 g/ @& Iif(flagiocpt==0)   // implement compute# L0 n  k6 ~  D) }4 R
    {, V3 ?6 x3 n2 g& `+ b2 e! `$ d
    i=(*memory).p[0].computeNum;* G; W) V4 r. q( k8 c0 p9 t  s
    if(i>0 && (*memory).p[0].computeClock[i-1]>0)7 I$ d: y% D0 H$ D1 w* m  Y
    {
    ! H  X% _# g: u8 Pif(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed
    7 |( T3 v4 R3 J" X{
    6 Q& f! ?1 L5 _% }flagiocpt = 1;
    6 {8 z+ y/ k  K4 ~+ h" m+ g(*memory).p[0].computeNum--;
    ( ~  g+ ~( G. f, Ochange += exchange_IO_Compute;
    . u0 d+ @5 x. P) ucompute++;, `% m  ]3 h# G5 b% b/ f
    }1 Z' T/ P7 P: C' r
    else
    ( w$ P! @2 D% Mcompute++;7 ~  E) c* _9 L6 X$ k* y

    2 V, @  p- T+ b! h}
    9 f: O' @" @8 C  a) f+ delse2 f6 V. ^" k6 j( m# N
    flagiocpt = 1;
    : q& d4 P) Z) K% C+ R}, m+ A: v0 w" ^, p) _& N) ^7 w
    else  //wait io9 Z; _$ q+ W# _/ h& ?6 H! n+ k; i
    {/ V* }$ J  g& }
    i=(*memory).p[0].ioNum;. p- {9 S! U- M+ d* V  X+ Y3 B) t
    if(i>0 && (*memory).p[0].ioClock[i-1]>0)
    # D; F* @' e+ ]- M- [{/ L5 e! C  ]& X. {3 e4 {, M
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed' H: Z$ _# G3 \& z. |% C( d
    {4 o2 m  I2 _8 k
    flagiocpt = 0;
    ) [- n, s- j- t+ }* D. _(*memory).p[0].ioNum--;
      ]# d/ E/ z( e0 Y! m$ P" o9 vchange += exchange_IO_Compute;, X+ F' M) t3 V! w7 [$ ?+ K  Z( m3 o$ ?
    waitio++;
    : b( M) E! A% S}/ t+ ?/ R/ K5 E0 v! N
    else5 L  Z) G& c" V( f
    waitio++;# Q7 |; M1 |) O* ^
    - p( ^) Q' U  ~9 F$ R7 ~* G; Q
    }% R1 d! s  V: t- X" t! X3 Z- E
    else
    + [6 ?2 W! O% H$ a) w3 L( ]  Kflagiocpt = 0;
    1 b; i8 ~$ O7 n}* w" ~( _# J* B1 F. L7 W( w
    }, d6 y8 }1 w6 a  w
    else  //task is completed, G$ N% D: o4 ~4 n: _* R
    {
    / `7 w& [0 [- \0 q, J5 K  I$ [; s(*save) = (PCI*)malloc(sizeof(PCI));
    6 h- d: }" _+ L/ f: E0 v(*save)->next = NULL;
    2 P; P6 K, D. ?9 Z& F       (*save)->processID = (*memory).p[0].processID;
    ' t/ z+ v( K* r" {(*save)->comeingTime = (*memory).p[0].produceTime;
    ( e. p" A1 P+ g* z' t# J3 C2 J) J(*save)->askMemory = (*memory).p[0].askMemory;) v- G- C3 C% g0 F$ u3 W% ]
    (*save)->compute = compute;- m) k1 S0 j1 M3 A+ J2 w! s
    (*save)->waitio = waitio;! B' m( D4 R% G9 {
    (*save)->exchange = change;
    8 p5 r' `' W- Q9 w2 ?/ v(*save)->completedTime = systemClock-(*save)->comeingTime;- v. P: {/ k! Z) V% B
    (*save)->runningTime = (*memory).p[0].runningTime;
    5 h  [; K; k. C' Z  W7 y) b" C(*save)->completedTime = systemClock;
    5 z% p, H2 B# ~2 z& D. {7 n% J$ g//*spareMemory = MAX_MEMORY;' ~9 F& U# N5 _/ z2 X+ ]
    free((*memory).p[0].ioClock);
    3 S5 l$ C- ]9 S+ S- K7 f/ |free((*memory).p[0].computeClock);
    ( T) q" y  |1 I( n& r& ]free((*memory).p);8 M$ t) [" ]; p' a2 X( n
    flag=0;
    . p) U4 D. [: T# k2 T' acompute=waitio=change=0;
    * j5 }5 q7 B$ i/ rcomputeLast=waitioLast=changeLast=0;
    0 M2 }7 G' E8 C% |0 R# greturn task_completed;2 ]: ~  U+ I! j! I) Y
    }
    * B/ F9 [& Y. ~+ ^5 p% N}  _+ o9 s( E; _6 K. E  C
    else         
    ) _$ I* M4 B2 v5 B{% b, U' F- \( \* b" @7 W8 ]1 D- W
    FIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));
    : _; g& h0 x! k# h3 o$ jchange += exchange_process;
    & U4 c% u, {- E4 G# O//*spareMemory -= (*memory).p[0].askMemory;% B* o6 C; c3 e4 Y& q. z. h. `
    flag=1;
    ! m" w4 a8 n$ g, }  u! s9 l//showProcessInf(*memory);$ W8 Y+ s0 z# ?0 L% y3 F. j( w* w
    return task_not_completed;
    $ S+ a1 P  o6 @* B0 h}& A5 X& x% F! u2 X) i/ k
    return task_not_completed;& Q/ A: H$ s, q. Z
    }
    9 e# _# e8 @3 I8 T9 Z2 @int FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)
    $ H0 y) m& t2 n; n{, ^7 Z1 E8 {4 P
    int i=0,j=0,k=0;
    $ H4 E# d2 a0 ^  O7 C* W( vMAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;
    # F# Z/ S* J( ](*memory).p = (process*)malloc(initProcessNum*sizeof(process));
    : y7 Z( V6 E' |6 f! t7 G! k$ ^memory->proNum = 1;
    7 S- P  V! o4 Kfor(i=0; i<initProcessNum; i++)5 h! Z# U- M8 Q) |9 Q3 f8 ?1 y
    {9 N' M1 z: i# m, H! X* R2 E5 w
    if((*storage).p.askMemory <= *spareMemory)
    , n$ C# z# i) g; n5 J" a{9 q6 [+ |1 M$ N5 J
    (*memory).p[0].askMemory = (*storage).p.askMemory;8 L+ W( j( G( y* p6 }
    (*memory).p[0].comeingTime = (*storage).p.comeingTime;* {! M( c, u2 y3 c, O: v  Y9 h5 z
    (*memory).p[0].computeNum = (*storage).p.computeNum;( g8 I! b5 G5 Y( I
    (*memory).p[0].ioNum = (*storage).p.ioNum;' e8 l1 ^5 R! z4 \8 q5 \0 V
    (*memory).p[0].processID = (*storage).p.processID;
    . t7 N; H# a( t' S9 G(*memory).p[0].flag = (*storage).p.flag;5 A2 A- s; T  f
    (*memory).p[0].ioTime = (*storage).p.ioTime;
    6 a. G0 s- _; J2 y3 A" P, d(*memory).p[0].computeTime = (*storage).p.computeTime;* E; a) D: F7 M5 k
    (*memory).p[0].produceTime = (*storage).p.produceTime;
    ' l7 i' {+ N2 t(*memory).p[0].runningTime = systemClock;
    + z. A  m- w( A: r(*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));
    , A3 m' N) q. ^1 |2 {5 q! \+ z! n& c(*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));0 l0 o; J+ s" C8 c, \: C
    for(k=0; k<(*memory).p[0].ioNum; k++), m1 H: v# B4 o3 d" w
    (*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];0 }3 ~. u2 _" ]
    for(k=0; k<(*memory).p[0].computeNum; k++)+ D+ l. |- r  d* F: p
    (*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];
    ! i6 R2 h7 _4 }# S: cbreak;
    . ]/ K: q7 K  i4 D* I, H6 F}% r: P6 M3 V  R1 r$ s9 q+ B6 E7 u
    }6 I: U, E+ S5 Z7 j9 ^
    if(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入
    2 j. A- S, u& w, v. w4 p{) O% C( W7 G% {  H# \# z- }
    produce_one_task(storage,i,ID_FIFO++);6 ~. Z$ e( Z( v% G+ L
    MAX_COMING_TIME = (*storage).p.comeingTime;
    ) [" s" H+ a  }+ c. P, @1 bsort_by_comingtime(storage,i);; \0 j# Z9 D, Y! V" t4 x
    }) V- R# j8 R3 _- J
    return 0;0 d* v4 _: f! t6 b# @
    }' K( N! T% d) p$ C' N2 e
    int sort_by_comingtime(processPool * p,int pos)
    * p5 f- a. ?; ~" {( s2 Z{' J+ E' V: f. W4 I7 l4 x* K2 G
    int i=0,j=0;6 ]" M3 x! D" `  w, R
    process temp;7 E' }/ j% o3 C  Z+ A. W" D. l
    if(pos<0)
    4 _1 g, h5 K0 ~{' @: n/ M5 ?9 z+ m. N) q' Z
    for(i=0; i<initProcessNum; i++)
    ( o1 h) Q4 r+ t( F4 m  C9 Mfor(j=0; j+1<initProcessNum-i; j++)7 U' F/ D) X9 g- c, K: q9 u" L( O9 ^
    {6 \+ [. m! h! D( i
    if((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)  O9 h  D; ?$ j3 \8 K3 b
    {
    7 ?/ d$ \  R! X2 e/ O. ztemp = (*p).p[j];
    " w; Q: _# S0 G6 v" \3 S(*p).p[j] = (*p).p[j+1];4 C! _$ k, ?' M  y" W
    (*p).p[j+1] = temp;
    3 J6 o# S9 q3 `}
    8 D. Z* k: a8 m5 @% b4 d) H}
    ) z, e; Y9 f) Z- H* y& Y4 W4 ?0 }6 ?5 D}! i+ x7 |9 v& n/ ?7 \# ~" k) g
    else if(pos<initProcessNum); y" @- r5 ?: y2 W# A/ a, n% @
    {
    2 ]0 C  t2 d/ ~  d* Ufor(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--)5 t+ ]7 ]5 J7 h, m
    {
    " B# R/ h2 `% H4 W8 N( _temp = (*p).p;
    , W$ V$ Z# K  |. ~+ n. P& r$ [& C6 s(*p).p = (*p).p[i+1];7 L, b9 U5 y: I  T! i+ P
    (*p).p[i+1] = temp;: v& }& G0 ^' j/ b" X
    }
    7 J. I: M* h" B& w' E" x* vfor(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)9 Y7 T$ z$ ]+ _3 g) @
    {
    3 T: i& _9 c+ R+ G% ]temp = (*p).p[i-1];$ u, n: [4 C7 I. j  R! q
    (*p).p[i-1] = (*p).p;8 d& n# y( ?: w: ^1 c# d
    (*p).p = temp;
      Z/ _: Z' v. [. T}; Q8 B5 a# q3 X  Q6 v8 p
    }
    6 J1 w/ Q: h6 h) N$ }5 {else
    " }6 D/ x( Z7 W5 l! L+ u" u$ x/ Tprintf("position eror\n");3 T. E( C0 ~+ P( T/ T& A) ]+ l
    return 0;
    $ e: ~$ g, p1 @  E/ p( c}  m" q. p1 N' r; Y5 |* @6 {
    int InitPool(processPool * p)
    5 P) h, G3 E+ T, c+ Z6 p( J{
    8 @8 e- Z8 I7 X) t4 T9 wint i=0;9 J& d/ ?) s! k3 Y/ N9 h( t! W/ R
    (*p).proNum = initProcessNum;+ p# s1 ?+ \3 o2 m$ O; c. }4 x) X: n
    (*p).p = (process*)malloc(initProcessNum*sizeof(process));  g7 }+ P% i# Q1 J5 [
    for(i=0; i<initProcessNum; i++)                                        //init process information0 y1 z. O& z2 {) M
    {
    $ U* l2 @; s0 m5 F5 ^(*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));1 V& \7 D1 l' I1 w, S
    (*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));; x0 c( ^  D& o. F7 `" L: j% ?* |
    produce_one_task(&(*p),i,ID_FIFO++);4 h0 E( H9 ~) T1 W
    }
    . s4 P% F: O! j1 E9 d( F: @% Y4 yreturn 0;  e7 j- Y. z1 f& Z1 a% S$ H
    }
    : u! s; T" X) Y+ I. }$ d. qint produce_one_task(processPool * p,int i,int id)
    . V; ?* \4 x" r/ U{
    0 D; ?/ s0 }# v5 K' x6 G5 `- dint time=MAX_COMING_TIME,j=0,totallTime=0;7 N) i; t  Z  z2 T( b* m! M$ C* ?
    (*p).p.processID = initProcessID+id;           : y8 r2 Z1 _# s) e- j
    (*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);$ Q! l7 u' ]5 L; b4 W9 s
    (*p).p.produceTime = systemClock;
    1 @, E! I. F* m* @) ?(*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;
    ) B+ \3 D& e+ ~( e3 ~! p4 Q. o(*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;
    0 ^1 d- B0 S6 ~3 c4 FtotallTime = (*p).p.computeNum  + (*p).p.ioNum;
    # V, `# }' F# }) Y2 i* z8 h4 K(*p).p.computeTime=0;% b- \- _7 v8 R" C4 q5 b0 i- \( J
    for(j=0; j<(*p).p.computeNum; j++)' x+ k$ S* D! V! S' T
    {
    + d' O, C* j4 B2 X( Z) |(*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;0 {: K5 J! @+ Z% Z. \
    (*p).p.computeTime += (*p).p.computeClock[j];
    ) z# v) [; y, \- N}
    % |5 |1 Q7 z8 w. m* V(*p).p.ioTime=0;6 r% T  v& e0 s6 [1 X# J
    for(j=0; j<(*p).p.ioNum; j++): g0 j5 Q' Q2 @- A! i1 q  h
    {" m. D6 `+ X: n' z, l. i
    (*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;% V2 ]+ L" V, m. A! y+ W
    (*p).p.ioTime += (*p).p.ioClock[j];) a5 J0 ~: u- ~8 F3 O
    }
    6 X( k* @6 W' F! s(*p).p.askMemory = rand()%(MAX_MEMORY/4);' ~  r) l6 q# x7 {
    (*p).p.flag = ready;
    ! e0 |8 b* T, _+ z) F' A& ^5 zreturn 0;
    6 }. u: a* D: Q% w9 D}, Z+ W$ g* I; _* ~
    int showProcessInf(processPool p)" \+ G0 x! O0 {# F" X$ w
    {
    ( G, r5 k9 {% m9 [7 fint i=0,j=0;4 M" C1 P+ w4 v  ~/ d4 J! B
    for(i=0;i<p.proNum;i++)( s" h5 i) E& M6 U
    {
    & N" Q' \' L3 N; V& xprintf("ID:%d,%d,%d,%d,%d,%d,%d\n",p.p.processID,p.p.comeingTime,p.p.ioNum,p.p.computeNum,p.p.ioTime,p.p.computeTime
    0 X  Q9 o$ s& b( w. J6 `  A% p,p.p.askMemory);
    3 E3 D, J" y) g; h$ n9 u5 E( Bfor(j=0;j<p.p.ioNum;j++)2 |" d& H7 }6 K2 f
    {, g, s1 c) h- }* R, |9 p0 V
    printf("%d ",p.p.ioClock[j]);9 v0 I" l  S! N+ N
    }
    4 i1 ]: [9 b5 f& U# }+ Jprintf("\n");
    ! r  B1 i  I% m, n/ qfor( j=0;j<p.p.computeNum;j++)- J, e% `: L6 i/ E( q/ x
    {/ `/ ?# b; `) n9 A: w4 r
    printf("%d ",p.p.computeClock[j]);# Q  `5 Y7 {/ O8 R2 t2 j, c& C! Q
    }4 h# Z, z& v1 m
    printf("\n");
    6 K5 O8 D/ P! {9 r/ Z: j4 u# b: C4 L}* h# {( G. P8 g2 z+ b9 f: q8 E
    return 0;
    + ^5 c  I5 l! F}. S* s. d: o% q% T+ e
    ————————————————
    0 w3 s8 A7 ]1 n$ l; J. }9 Y) D7 L版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    + P- x# g9 h+ u6 U" [; j原文链接:https://blog.csdn.net/wang_dong001/article/details/47843519
    3 Q) u, U7 p* H- Z# d& E/ q7 c5 ~# o- h* W$ K. _

    ( z; X. H7 H/ Z) E# u' `" Z* p
    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

    关于我们| 联系我们| 诚征英才| 对外合作| 产品服务| QQ

    手机版|Archiver| |繁體中文 手机客户端  

    蒙公网安备 15010502000194号

    Powered by Discuz! X2.5   © 2001-2013 数学建模网-数学中国 ( 蒙ICP备14002410号-3 蒙BBS备-0002号 )     论坛法律顾问:王兆丰

    GMT+8, 2026-4-21 17:06 , Processed in 0.693642 second(s), 52 queries .

    回顶部