QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 2525|回复: 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

    " Y/ l2 b/ W. p经典任务调度算法的模拟程序2 Y$ Y, O8 Q. b0 G: ~( F
    本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。
    2 w! M) m4 q  y1 O) k4 d7 w9 {* E4 n9 l3 o! g2 i
    编程平台:VC6.0+EasyX图形库环境。3 [" n( m& A% k- o$ @# |
    / K. @6 x3 k4 D4 A; f
    以下截取部分程序运行图::9 }! U5 P+ z5 m3 K2 J2 c

    + b" S% A5 P9 ?  G4 O' R+ U源代码:
    $ I( o1 I" S7 o$ X' d+ v6 v5 V
      M) N& u+ Y% J6 @# W/ c# x#include<stdio.h>4 ?3 z% P. Q7 Q" o' P
    #include<stdlib.h>
    7 }$ }" a, Q# S# C- L2 t( W5 g* f* V: E#include<easyx.h>/ `$ g! g4 t6 M  x* G8 o5 P+ }
    #include<time.h>
    & s. t- _# b& x( Q#include<conio.h>
    # |8 m0 W" \  `' x. a9 |. O' {, Q#include<graphics.h>
    & x+ {! w7 a. I" i! z#define initProcessNum 10
    5 L( @( D3 J' p4 {# S; [#define initProcessID 1000
    : q4 v1 w3 n% H2 ^$ e! E#define MAXProcessRunTime 10000
    9 `7 D  c9 J2 b0 J; X#define MAX_MEMORY  4000
    7 n7 e% N' X" e6 F#define exchange_IO_Compute 10
    1 M) f* b0 _* K) M; Q#define exchange_process 256 Z' v; ~1 X' Z4 @, T0 K; G+ k
    #define task_completed 1
    - q! v4 j7 R! r/ i#define task_not_completed 0; c' k, m0 h+ I
    #define initclocknum 100  e2 I" P0 c8 c
    enum condition8 P' m8 V) R( M
    {
    - g4 g) ]* S3 |/ t( ?& N$ I+ ^dead,computing,IO_waiting,ready" ]' O1 ^* f' d, ~6 h
    };2 q& _9 c  i0 K: ^( V! V* S  M
    struct process- `3 a8 E0 U% T( Z7 g
    {
    - g! q: B. S7 @' e2 mint processID;! G( F2 H* m6 q5 @
    int comeingTime;
    * m1 {* f6 d8 e( }int ioNum;! G1 [9 K" J+ S
    int computeNum;
    2 E( {( u  e7 j' X9 i7 [4 _/ T+ qint * ioClock;8 i* P. ^4 J% u! G( B% A6 Q$ u
    int * computeClock;( P9 E# ^: K% Q
    int ioTime;( s1 \) L) L+ v+ D* g. X
    int computeTime;
    3 y' T) t6 Q( w) u! p- pint askMemory;! y% k( h. b! B, N% @
    condition flag;; S0 K: y) R! R0 I% z) M
    int produceTime;  //生成时间,以下三个数据成员用以计算相关性能
    7 p& O+ U: R3 @9 l5 `/ nint runningTime;  //第一次占用CPU的时间5 r4 A& c8 L. S- R7 P: K9 {
    int completedTime; //进程完成时的时间  d3 B: v) P5 a0 m! T& N6 o- b7 e
    };
    ) [8 p. i1 |. K+ _- N+ o6 C9 G! J7 Ftypedef struct processCmpletedInfo  //保存完成一个作业的相关信息
    % Y/ j$ |0 n2 ~{0 O" l4 c' x8 g5 \( k: k. P
    int processID,comeingTime,askMemory;
    ( j1 k' u; }; B0 b( [int compute,waitio,exchange,completedTime,runningTime;# ^0 c/ l% B% X9 f  ~0 a0 n
    processCmpletedInfo * next;
    # x0 z5 F" U' }8 ]- A}PCI;
    ; V; v( x8 w- [1 Ystruct processPool
    4 A+ `+ s6 t* G) o{
    ( l+ B  N0 F2 |6 l0 k# Dprocess * p;+ Z9 r" z) G$ J  p: m+ h+ W; a
    int proNum;6 m: z9 ~7 F( O6 h
    };) \7 G0 e/ p2 O5 X2 r* y
    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;
    & I4 M; `& G) n: q2 R; B8 sint InitPool(processPool * p);
    5 Z; g7 |4 _+ ]0 [4 M2 @/ g7 xint produce_one_task(processPool * p,int i,int id);
    5 g! U: {7 Y' x' _; c* g" g+ oint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);
    - e- w( r9 u; I4 g) Y- a: b4 Cint TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    2 V: z3 m) I3 L8 k0 {4 R* oint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);
    5 w: i$ J% r- |% h  bint FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);3 }2 y; w! M; ]7 }: b
    int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);9 a; D; r  J$ ^$ N& D
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    6 O  @% Q% w& e  p! [  nint PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    ' m9 c% f& H7 m7 N# \int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    + P+ j. u# S6 N1 L& b& j6 b  s& Sint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);
    + }" w# `4 _  V/ zint High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    . M! |" }& f- F$ e, F
    $ \' Y7 w% G9 b2 f* ?
    5 g% c( a+ @" c9 Zint sort_by_comingtime(processPool * p,int pos);5 |1 Z8 t( P+ p8 f
    int showProcessInf(processPool p);
    ! U1 p) }: y) P8 t; t; Uint drawPerformance_FIFO(int x,int y,int memorry);
    . V$ Q4 @& P) [7 P7 q; Bint drawPerformance_HR(int x,int y,int memorry);8 {* u/ x$ W' Y+ Z% j
    int drawPerformance_PF(int x,int y,int memorry);
    7 |! N* _  o, _5 h+ \( d2 t$ u: nint drawPerformance_TT(int x,int y,int memorry);
    . E9 e, W9 n3 Z( fint drawPerformance_SJF(int x,int y,int memorry);
    ( \5 {6 {  y3 I! w8 ^% i8 A' @int MouseListening();
    # f2 s/ G# l; c$ g6 Z6 i1 fint MouseListening2(int *flagShow,int * showTime);& h, q! k0 Z/ ?8 y. ~* u: o
    int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);
    : y" E. b0 S1 B+ \& t/ {- q5 {/ N' O3 [( R

    + J# i3 |) {  I6 s8 \void main()) r( D0 s8 B4 T! X
    {( z) h5 Q- r5 s$ m
    PCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,- q5 \& |* z" X" C" X- X3 w
    *Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;/ A0 U- w& O8 b3 ^& ]% v
    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,
    . e5 I1 z- L  m7 Z& TflagDraw=0,showTime=100000;
    " p* p2 k% |( i, x4 YprocessPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;
    - H6 D9 S( W6 h8 g2 H9 eFILE *fp=NULL;+ f3 U0 s! a1 t7 Y" d
    //processPool HR_p,HR_mmy;) w- R: ^4 K, z# Q
    $ ]8 T# i/ b  ]2 y2 k. @& F2 ^

    - Y- k1 E& Z. u* Xsrand((unsigned)time(0));9 c: ]0 v7 V6 R9 Z  b2 p
    systemClock=0;9 W+ b! K2 I/ i/ f; R3 o; J* B
    initgraph( 1200,650,SHOWCONSOLE );
    , `) u6 c( B+ v5 ?settextcolor(GREEN);
    , t0 k2 l9 k) q5 M2 zsetlinecolor(GREEN);
    6 I2 Z) W8 P) B! l' |setfillcolor(GREEN);
    - B8 \5 Y/ ?: k7 X9 B2 M: ZInitPool(&FIFO_p);9 g# i: U! A( ?$ Y3 i' L& v
    sort_by_comingtime(&FIFO_p,-1);
    ( }1 {9 A* f2 s0 p- s; B- x' fInitPool(&Timeturn_p);
    - q: U* R) |# `7 X9 }InitPool(&SJF_p);
    8 I6 h2 l" [* g. S2 PInitPool(&Priority_p);% j' ~% W4 U3 F& n4 v
    InitPool(&HR_p);
    ' o0 Q: _4 q- e& C# Z$ D//showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);. Y, u9 ]3 `; }. r$ s8 }
    //Sleep(10000);
      a& K! E7 y, c7 m  \  D6 m0 @6 t6 [' V9 x

    ; u% K/ Q- d! j& y! n+ S$ ]Timeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));3 c6 ?) c" k+ ^! b. a' ?
    SJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    4 a3 x; a# s! PPriority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    3 ]- ?' I& [- N! ~, kHR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    ' M# }( _$ [6 [2 J- j6 R0 Lfor(i=0; i<initProcessNum ;i++)
    ; H- E# V% J! v5 f- C{
    5 O3 ^" _( R, I1 Q# d" R2 zTimeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));9 u# d5 L' f8 N% E2 S) u/ r4 e
    Timeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    " U( K( q& d8 l) G% x. ^0 t  h0 z' JSJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    : ^+ g* `3 R9 i! ^8 m( n& O+ i2 iSJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));) j- z. N/ |- H0 A2 S% A
    Priority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    " ~4 H' x1 i2 s9 J/ v: rPriority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));5 o3 g/ c8 |. _6 Q8 h& J
    HR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    7 }- {" u4 w% ~% ?/ c6 G& THR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    6 O1 \- K) G1 w5 S" b: @4 G7 A}
    - ^* M  r. p/ c6 KTimeturn_mmy.proNum = 0;
    0 s  f$ R/ G  \. P8 o' ZTimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);
    5 n5 u1 w1 R0 N1 p$ B/ G) O* OSJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);
    % T# Z+ \$ B. ZPriority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);" E. ^1 ]! Y% A3 S+ v2 r
    High_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);
    # v0 O  ~+ c) S0 S' g6 Q& @//showProcessInf(Timeturn_mmy);+ c1 x5 I3 S8 ]  R# l9 h6 y
    FIFO_pri = &FIFO_save_head;  m, v( Y. g5 Z
    Timet_pri = &Timet_save_head;* @  u- z6 I  W/ _6 [, f2 D
    SJF_pri = &SJF_save_head;
    ' z$ P& f  ~* J) J5 S6 t# T# }. qPriority_pri = &Priority_save_head;
    2 d0 _% j+ u8 Y8 b, A/ N    HR_pri = &HR_save_head;
    , M7 |/ m* g8 \# v, Msetbkcolor(WHITE);
    , u0 L0 F& g$ A4 e2 Cwhile(1)+ c+ y' H+ `' H& t# Y
    {3 X/ @+ U' m. U* d
    if(MouseListening()==1)% h# q  I$ L- q) q  ^
    flagDraw=1;4 [+ d, \( T- E4 c* O! z
    if(count==100)- i& f. a6 O0 o6 t# T; x8 I5 S
    {
    , o8 B- x& N+ jif(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed); A, ]9 ~! {9 g9 Q7 D: ?+ ?
    {
    4 V) e. b+ j) }, a, k* nFIFO_pri = &((*FIFO_pri)->next);
    / s. Q+ m5 j- X$ [5 `$ k. l4 c
    8 c6 N; Z. i2 B5 K: l4 u) b9 ]- d//printf("hello");+ k. ~9 x. t+ g) S
    }
    3 [3 Q. V0 f$ _2 Tif(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed)
    + y0 A- w5 q1 W& O; f* c{
    5 ~, a) T6 N- ]5 n. l- L( [    Timet_pri = &((*Timet_pri)->next);
    5 i7 W( L) J& Y/ l//printf("hello");
      Z" S3 y& l' K0 b8 f}
    8 a+ J* z; r  j/ k, @6 }3 Uif(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)
    * ?: D2 d" q& f; p% S8 `* ^{
    8 B$ x6 V4 a' \. g1 SSJF_pri = &((*SJF_pri)->next);
    + ]# \) U( Y" y# \& `3 r, _//printf("hello\n");9 |0 y8 G4 B# Q/ C0 H1 J) v4 q
    }& n6 y2 w1 o& z: F, O
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed); y. z$ K6 a. w: X
    {
    . N2 d7 r; }4 T2 S8 H% q) i/ q( HPriority_pri = &((*Priority_pri)->next);7 C# W- i2 v* t+ w) _- z
    //printf("hello\n");
    ) M- e* a) V9 U# y3 W}
    0 S* y, @+ `& F8 e* P* H7 fif(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed): w& R  h) e( [8 `% m
    {
    * ~+ q! E: Z8 v+ x" c. yHR_pri = &((*HR_pri)->next);
      ~0 H* z. `8 h- C. \* d2 z# e% i: g//printf("hello");" q/ d% j0 O! R2 R6 M) J
    }# c% n. o- O' O0 E6 U4 @$ t7 m
    count=0;0 X; _4 C/ S& D& u3 q) I" F; j
    }
    9 K1 i# r7 Y. U4 E6 m: |& K/ helse
      s& f* d. W+ ?% F+ P- |. Y8 I{5 D* L- O7 ~0 e) _0 s: Z( n
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)' F5 Y3 {8 ?, b. @  v& @
    {' R: ~: i! b0 [. T
    FIFO_pri = &((*FIFO_pri)->next);5 ~, J8 v8 R5 e% {
    // printf("hello");" j" k' n: `+ e  _! V* w
    }
    5 `" g' Y+ g4 hif(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)
    0 y- r! O1 H3 H{
    : J0 h6 H) w# W6 o% l: t, UTimet_pri = &((*Timet_pri)->next);
    7 d0 @+ y. i3 `! b// printf("hello");
    2 I% V9 a% w' A4 B8 j( _0 s}9 _9 [$ j0 S, @$ U" t
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)1 H) I( |; `6 V' D& b
    {! O/ s1 F4 }4 T1 M
       SJF_pri = &((*SJF_pri)->next);
    8 z1 h# x! j, x9 G  z2 y0 p// printf("hello\n");) \$ g+ {# f% p( o/ U5 D
    }5 a1 D6 m9 l: f2 @  P
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed), w0 Q5 d. E" j4 A$ {& c2 D: _
    {
    ) ]8 {" V1 U( ]) u5 N4 U+ [4 bPriority_pri = &((*Priority_pri)->next);- J5 Y* i8 i5 o, w* P" M  Y! L
    //printf("hello\n");
    ' ~; r. d# }# {$ T$ L* F" }- J}
    2 S0 q' h1 H1 x  `1 P* hif(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed)3 v) j9 i' y- M# X
    {
    ; f- S9 Z& ?, \" z; pHR_pri = &((*HR_pri)->next);0 o. L  \; B1 e0 {% W
    //printf("hello");
    . T1 t7 _1 s; r% f% K//Sleep(1000);9 }7 B  w' z, [. W0 T2 L" M( S
    }) F# ~6 S5 A% k& m
    count++;$ _9 ]) f+ |$ p! c) V9 D
    }! f* ]. c* m# s5 s# `% c
    if(systemClock==showTime)( h6 J  P' [. T/ b, ?  c' T
    {
    1 T2 j; W" T# a6 o: ~/*PCI * p=FIFO_save_head;3 Z7 e" H) m' @8 z( l
    int i=0;
    + J5 ?* G1 O1 l, B& p  i7 i1 ]for( ;p!=NULL;p=p->next)  N! l' u( a8 t; V1 r2 W& f  K) J9 g
    {
    2 [! b: j$ F9 \1 v* k6 k! L- D  Yprintf("Id %d\n",p->processID);
    0 C+ C9 u) u2 ]4 m; N& Sprintf("comeingtime %d\n",p->comeingTime);5 t1 Y6 m  t6 {0 D* q5 B) k0 X2 h
    printf("runningtime %d\n",p->runningTime);' {& {( }8 U4 j; Y  @9 q
    printf("asdmemory %d\n",p->askMemory);" z+ n- A0 A( o2 F1 ~  Q2 [
    printf("completedtime %d\n",p->completedTime);$ r5 M) p* ^! L/ K) D7 l- J* j- j
    printf("compute %d\n",p->compute);0 O" T& A) }. ~$ F0 W
    printf("exchange %d\n",p->exchange);% F" P; h1 s, ?7 ?' G
    printf("waitio %d\n",p->waitio);
    8 ^  a4 o6 t; q0 ]i++;
    4 N. \; T2 f: J' P& I+ w" L! g9 U2 l6 B3 p. l0 d7 G0 R3 ?  B8 ~

    ) G; w3 j/ B5 p& K2 P7 Y5 O- G7 n}: H0 l$ T: j  l5 m" l* w1 ^
    printf("%d\n",i);*/
    : W; e1 O% x' D+ |, ?$ E. @2 lif( (fp  = fopen( "data.txt", "a" )) == NULL )
    % r# ^2 m' y& G  ~" H' b- n{* K' W( C% a8 Q& g* O1 D
    printf( "The file 'data.txt' was not opened\n" );/ Z7 l( I/ P3 N6 A& s, n' @, m
    //return 1;% J; y" K% a: M5 [% a
    }% i. w3 n5 n  L7 Z0 I, u0 Y
    else
    " @. P( o6 H6 s{
    * e# E& I" i4 ^3 Cfprintf(fp,"FCFS \n");
    + |+ d/ x3 f* z7 ufor(p=FIFO_save_head;p!=NULL;p=p->next)  v  q1 k- M) A, h9 B" L
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    0 l6 Z9 I$ M/ X- J1 i  m, b9 Xp->exchange,p->waitio,p->runningTime);
      R2 r. t7 W0 qfprintf(fp,"\nTime turn \n");
    0 X+ u# Q5 S& I) K7 qfor(p=Timet_save_head;p!=NULL;p=p->next)
    * Z/ _6 a9 p+ g$ w0 I5 [: Ifprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,6 n) T$ ^8 c" v. G9 j% L2 O# G
    p->exchange,p->waitio,p->runningTime);
    : C0 y$ r- D2 M7 H$ e" e; Dfprintf(fp,"\nShort Job First \n");
    ; a  K  H6 t9 m2 i5 y! u* jfor(p=SJF_save_head;p!=NULL;p=p->next)) D+ ^6 \+ u6 M; Y; i; o
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,  \- u: U9 t, k& @
    p->exchange,p->waitio,p->runningTime);
    ! ?( B9 x. g8 v$ k7 V! a& ~fprintf(fp,"\nPriority  \n");
    3 p* l/ |5 p" ~5 w1 `3 n! Kfor(p=Priority_save_head;p!=NULL;p=p->next)
    1 }# ^# p  ^2 S/ ?9 Mfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,/ b( X( _  V' G( N
    p->exchange,p->waitio,p->runningTime);
    , e9 ?  }( ]* d3 ?/ o: tfprintf(fp,"\nHigh response \n");
    ( Q* L: F/ S, x, K2 [; d; ]for(p=HR_save_head;p!=NULL;p=p->next)8 K- h3 D* z9 ]$ D+ x0 F/ q
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    % }0 N- w# ?6 ^, E6 _. U9 o4 Dp->exchange,p->waitio,p->runningTime);6 E3 o+ W4 {2 n- e2 p4 T8 w; ]/ D' E
    fclose(fp);
    . Y' }' b4 A$ `! x+ t2 ]}2 O  j8 s, c0 @0 r4 V
    showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
    % x4 j) k  G( o! J" a$ I+ e& N) EMouseListening2(&flagDraw,&showTime);" O2 U$ s+ V4 X( K
    }
    , X' V! e4 X9 v. z' `6 S0 M* H& }" csystemClock++;
    ) l/ i, Z6 ?1 ^9 Z8 eif(flagDraw==0)* P- d0 @$ v) J5 }+ P3 u9 Q
      Sleep(10);
      w# Y% T& Q; H) X1 c}' W1 a4 f& J* k+ x
    ' `7 {7 w7 A7 ?9 u! ?
    4 s, w7 @8 `) R/ `$ W- @, `( L
    }
    : K) ?0 B+ A' ^( y% v' z3 P/ p$ S# Gint showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR)
    8 G  p( S3 D/ o1 y{; ^, p# S$ K( Y/ ~
    PCI * p=NULL,* name[5];: O9 h2 {- j" K/ k+ W, l
    int count=0,i=0;
    8 C9 f5 w- H- B; f4 |" B0 _char ch[5][10]={"FCFS","timet","SJF","PR","HR"};
    " z1 x9 u+ Z- M  G% P. {double turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};9 o. g0 X8 H( Q
    struct info
    " ~# w* J9 ~/ |! Q. q1 C! F{
    4 c4 H# M# }, }2 bchar name[10];
    * a. \3 L, A; ]6 e7 l" _1 H1 I7 Ddouble throughput,turnover,wait,CPU_rate;2 w' v9 j9 l6 y' f
    }inf[5];, O; O9 q8 o9 z/ O; O3 a! v0 H
    name[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;3 e5 c6 B( g9 w" F  k4 E5 i% h- {
    printf("调度算法..........A\n");9 u/ O; `: B3 m; m
    printf("吞吐量............B\n");
    $ K* r7 `) _1 e+ Q4 X$ Yprintf("平均周转时间......C\n");
    % b5 O  D0 K+ oprintf("等待时间..........D\n");1 ~! v: x/ ^* X$ d, J2 c& o
    printf("CPU利用率.........E\n");
    8 D3 m3 m) V4 ^, |printf("A\tB\tC\t\tD\t\tE\n");' `+ a# q  r6 }& }0 F
    for(i=0;i<5;i++)
    ; N( e6 |/ b8 A0 t9 @{8 Q# y/ X. A# x: Y, D! r& U
    count=0,turnover=0,wait=0,c=0,w=0,change=0;6 q4 a: i/ o9 F7 O+ k' o- o9 T
    for(p=name; p!=NULL; p=p->next)
    / ?/ B0 g$ Q, i4 C. y- e; s6 [& e  F{1 g+ B3 l* `/ H3 L9 T. u
    count++;  r" m. r. ]7 a# `
    turnover += p->completedTime - p->comeingTime;
    2 W! q( }8 j' d& U( K# u0 @5 V9 Vwait += p->runningTime - p->comeingTime;; o$ x& J. U6 V5 U: R
    c += p->compute;
    5 J% N( Q0 U2 |7 U4 M  E1 W5 x+ Nw += p->waitio;8 i( _0 _8 y1 B) E3 c1 C- J8 D
    change += p->exchange;
      V2 }2 D" a* @. k& A}6 t& O& g! M- q$ f- p
    turnover = turnover/count;: Z2 A, u- H! G4 k$ k) r
    printf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));) f, B9 `; n3 D
    strcpy(inf.name,ch);8 P: r0 s3 W0 x% @; H" n4 _
    inf.throughput=count;  X, U2 |5 }7 k2 b/ A
    inf.turnover=turnover;# q) L/ Q3 ]: [8 G1 G
    inf.wait=wait;
    & u2 K. Z1 `4 dinf.CPU_rate=c/(c+w+change);
    2 E* c  h7 O+ ?1 P0 x+ h}" W# v3 r' h) U/ w' ~8 Z- t
    //画图8 P6 D- R# u7 T
    //cleardevice();& ]7 J' A* s! V2 S! h: l$ D) a
    line(0,600,1200,600);! e* S/ `4 M9 W: o" I. N" `" p
    line(10,600,10,200);
    ; U4 O; O6 m2 J* M7 fline(10,200,5,205);
    7 @( m; @7 b' bline(10,200,15,205);
    0 [$ @3 z! e  n3 |# Uline(310,600,310,200);
    : l# i2 ^, s4 nline(310,200,305,205);
    1 g: x) R; N8 X, ~line(310,200,315,205);) q& }( z& {9 n4 ^( m3 }7 J
    line(610,600,610,200);6 i$ P1 O# [5 D" L
    line(610,200,605,205);1 z+ b( [6 `8 a5 |
    line(610,200,615,205);5 X* a/ P& A( M, ?. }5 J" I
    line(910,600,910,200);5 d; H: ^2 U+ _
    line(910,200,905,205);6 \5 p  J- }% }5 d$ j
    line(910,200,915,205);//最高的长度400,宽度均为40: I! O6 \  c9 K& Q, g& A
    for(i=0;i<5;i++), J0 Q$ q: v, D7 N
    {7 c: k% m0 w4 X0 P$ U
    if(inf.throughput>pos[0])
    # H! S8 t8 l, R3 h2 q; s5 s: k1 Hpos[0]=inf.throughput;0 H# B2 C; o% j2 B5 p% f
    if(inf.turnover>pos[1])
    8 J- ^' M( F( `/ [% `' l7 Ipos[1]=inf.turnover;% p+ Q. l/ o; x% K, P& Y
    if(inf.wait>pos[2])  \- {( c; _# a5 w* u2 W! L% c  [
    pos[2]=inf.wait;: V' x- o, ?8 N( A8 C
    if(inf.CPU_rate>pos[3])7 L. k( O- T  U+ U9 Z  c
    pos[3]=inf.CPU_rate;
    * E+ r% ^; e1 s8 V: r# s}* _( [) J3 V* M& {, b( n$ b8 L
    settextstyle(30, 15, _T("楷体"));
    # `% m0 V8 m( ]/ S9 \% Wfor(i=0;i<5;i++)7 }8 r  a8 J% \! k- A" w: ~5 V+ D
    {
    6 P. n1 |' D3 o7 U. r/ Z& {3 ~switch (i)
    6 R5 y7 F  O# U+ ^& W( \{
    9 T" E2 E) Q/ I: lcase 0:9 B) ]8 F9 v0 M1 j' Z& }. u
    setfillcolor(BLUE);
    . K- R" Y  t6 d4 f7 i! c7 V* F3 }; f# }fillrectangle(100,50,150,100);
    0 |! I$ ~. [# Q: a8 O( nouttextxy(160,50,"FCFS");& w; ^8 r9 g. {+ z: I6 M
    break;7 P0 Z+ U+ S6 W( V+ o( Z, g
    case 1:
    $ v5 z/ C/ W6 h7 p5 A8 O  `- S" \' T* Zsetfillcolor(RED);" [! T" v: }* N4 `
    fillrectangle(250,50,300,100);
    ! G0 a  ^! D7 [# V1 F  x) bouttextxy(310,50,"timeTurn");+ p3 R  l& ~1 D
    break;
    & U5 Q' ~7 M9 ?8 k5 q& {6 |case 2:+ W7 s. F* J0 F5 y0 Q
    setfillcolor(YELLOW);0 I; f- p; c1 t3 g8 {+ v
    fillrectangle(450,50,500,100);$ s3 x! Z% p% D7 r! N1 Q3 Y7 N
    outtextxy(510,50,"SJf");% \- B2 T2 A& P
    break;
    9 W. e4 ?: J1 D! y. G! q# Ycase 3:/ s" q7 K2 l, d% |/ |6 H
    setfillcolor(BROWN);
    2 \7 I# c0 @9 }! [, f% _0 Dfillrectangle(580,50,630,100);$ A+ I8 I& a$ t' o9 x: O
    outtextxy(640,50,"PR");* e4 J8 ]) K5 w6 j8 ?6 L9 ^
    break;
    3 {$ f: S8 E( S: Kcase 4:
    ' f3 C1 a  b3 r! \setfillcolor(GREEN);
    # [4 |3 f6 ]3 ~. G( i( v$ H6 z5 Ufillrectangle(690,50,740,100);
    7 R/ L! X& [" e  W( Touttextxy(750,50,"HR");
    & i7 R2 I7 ~! X& ]: abreak;+ _- A2 M  r' Q$ X6 ]+ J+ r
    }( l: j- m9 I3 F( S2 m
    fillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);
    ! |# Y2 f2 K6 k9 _fillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);
    " X3 \) Y$ S: Ufillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);8 E% o$ O) ~7 O  [7 Z
    fillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);
    & v, ~; F$ p* ^+ s' I/ H& a' Q) ]0 D( T% L& ?: v  k) x

    ( @- L6 R8 N4 P) J. \, S# e& K}
    " Y( |5 m; I: E$ P! s# p$ v    outtextxy(100,150,"吞吐量");9 j) y, P& {1 t" V) {4 b, a4 N
    outtextxy(350,150,"平均周转时间");
    - s& K3 Z3 y* ?/ ^3 c- w+ B7 B; J+ P6 youttextxy(650,150,"平均等待时间");
    % k, ^% C& u3 L1 [4 x5 n+ ?% Houttextxy(950,150,"CPU利用率");
    0 ]$ q: g3 P5 G- F7 \7 Sreturn 0;; \5 Y# g# o6 `" a: n& S
    }. Z7 j$ Y7 r. M( r  t
    int MouseListening()( o/ p# ?8 ~& [3 |
    {* v* S5 w* T' R9 {
    MOUSEMSG p;) z! L9 d) y4 f+ E
    if(MouseHit())( @, k- T; I# v
    {6 S, U, s9 [/ A! c
    p=GetMouseMsg();/ g0 {$ q+ l5 ]& ?
    if(p.mkLButton==true)
    2 [) ^" v0 T2 Z. S- a) z& P{
    + t# b/ X1 I! Q. P% S: ?, I: x% |6 }if(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)' {0 n: @, J0 ]+ H. ]1 e% T- `1 u2 Z. i
    FLAG_FIFO = 1;: H- z8 W4 j% b
    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)& q6 J3 g+ T, K5 [* v* K, }4 w8 u7 k1 D
    FLAG_TT = 1;5 G& d1 w( X+ }' C+ Y% e
    else if(p.x>800 && p.y>0 && p.x<1200 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0), S8 X5 i( m5 }; s* b
    FLAG_PF = 1;
    # J3 h3 \' u& {0 M' D; L4 G- a% j8 Welse if(p.x>0 && p.y>325 && p.x<400 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    * F: N' K" e: {9 CFLAG_SJF = 1;# u9 ^  v- ^# D
    else if(p.x>400 && p.y>325 && p.x<800 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    6 U9 u; u! o8 [FLAG_HR=1;
    * V1 y* X) x" `7 s" g7 helse if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)! }$ H, y) P. c  W& _7 s# z4 i
    {2 }: I( c) H9 D) J. Z
    FLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;
    9 z1 A; F" D+ s' |8 A2 f7 Qclearrectangle(800,325,1200,650);& s! n0 z* _1 J9 r+ f9 u
    }
    3 t( X1 ^9 i6 k* L- relse if((FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0 && p.x>890 && p.y>455 && p.x<1110 && p.y<510 )
    4 T3 z- u- @! G+ W5 \: V{4 D7 [9 E/ ?3 y  I+ p
    FLAG_show=0;" b' R% C1 n! `1 F7 Z. o+ K
    cleardevice();# M0 o0 ^3 p+ u% c
    return 1;  p' u% d6 f: k2 R! N
    }' S& _. b4 a+ l+ f0 P. e1 ~+ B
    }
    & F' H) C# F0 Y( N/ g}. Z' Q# b( Q9 h: J: v6 }) Z- a
    return 0;
    * R, o; P$ v1 l& }4 M4 h. O}$ @7 s/ ?$ b/ K
    int MouseListening2(int *flagShow,int * showTime)
    ) T# J* n% X4 r2 `6 l/ e+ X{
    3 X7 r, z0 \( \0 h* e) DMOUSEMSG p;7 w4 z' {; Y& s, B% q9 {! R  P
    rectangle(1150,0,1200,50);2 O5 P7 _" T/ K+ ^8 ~8 O7 X6 ^' m
    outtextxy(1160,10,"X");5 |' d# W8 ^4 y: P7 b
    while(1)) V+ z% Z/ q0 `: t5 d
    {
    ( s! ~9 |* ^& O! Jif(MouseHit())& W5 f. m& R5 X3 W1 R
    {0 C8 r# R2 ]6 f* J
    p=GetMouseMsg();
    : t; u  W( Q8 q7 j! P. zif(p.mkLButton==true)
    + t/ L8 c) q0 A0 I{2 m8 h. n+ ?; G1 v0 W
    if(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 )* Q7 |3 ]+ q1 x
    {5 x5 t/ P+ D) @
    (*flagShow) = 0;
    : t2 C' @  s8 _% b+ S1 ]! ](*showTime) += (*showTime);, o) i/ w* K& N: C3 ?" a* p
    FLAG_show=1;
    # c0 \! l: I) V' v6 |break;1 C4 I% E6 E: E7 ^
    }) `+ E* R4 E) S6 b6 x

    5 ]! h) s! U; f. A! q8 k2 O}
    : x% l- a+ g: p6 U  j, c9 T  i}
    . d& G3 d6 }, LSleep(20);. S1 I, U6 i6 t# A1 e
    }! Z1 [* ~" C; G( }; p$ ?
    cleardevice();9 _8 J3 N5 I& y! i4 P( c
    return 0;
    2 E4 b; J, p7 Y7 ]) d- B}
    ) u$ C$ [* a* D3 J- N) J7 vint drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha)8 [- ]+ Q( U, w0 \( G3 w2 J
    {, C# p' O* c/ }
    static int info[11][3],num=0;+ e. @! z* E1 s9 k
    int i=0,j=0,pos[10][3][2];/ x+ Q. Z, a( D" }
    float temp,t;
      s) w! e* ]2 y2 k& C1 \7 R% ]//画按钮,不属于FIFO图的范围! X5 u$ M4 D9 G5 b. M' a- J/ }9 K
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)! J0 g. A% u+ H, _
    {" g( ^" ~9 `! `6 R
    settextstyle(30, 15, _T("楷体"));
    ; H/ Q7 A% q+ e$ I" @rectangle(890,455,1110,510);4 g: u6 u- T' A, C( N
    rectangle(900,465,1100,500);, ]. h9 \3 x( v" w
    outtextxy(910,468,"查看运行结果");
    8 _0 I4 B/ g0 k4 B- v7 A1 T}
    / w' a1 E- [1 w" f& i6 F# v//结束画按钮8 G; }  g: z" f% Y% H0 H' S
    info[num][0] = com;1 y/ c6 i3 P  k
    info[num][1] = wai;
    3 t- S6 d% Z" y- Yinfo[num++][2] = cha;  i# W% ?, |$ O3 a4 J( s, s! j1 M
    if(num>10)  //存储10个点5 |- Y/ j9 L, t* E5 L
    {
    . T' @/ j! Z: B! P- efor(i=0 ;i<10;i++)* K- ^% \' B5 C$ V9 K
    {
    3 Z8 W9 N* k( K# R* x- [info[0] = info[i+1][0];7 M6 `) N9 R8 P" @) F; f. q
    info[1] = info[i+1][1];- n1 ?0 {# O" |! h* k, |$ n+ f" h* o+ g
    info[2] = info[i+1][2];5 \- X" T9 E% b2 L+ k0 N
    }- z4 J7 g7 }( h4 t
    num--;
    $ U. F4 e, [3 t}
    ; P- ]  b6 O' E/ nif(FLAG_show==0)
    6 d. t1 f, `; l. zreturn 0;
    * d1 Y; A+ n7 D1 Jfor(i=0; i<num; i++)
    9 }4 ?2 ~' a1 @8 T1 {{4 n/ D# t% J( u) O& b+ K" ]2 c
    t = (float)info[0];  @* r" ^+ `  b" A9 ^( e
    temp = (t/101)*90;1 x4 d- F9 ~. i9 C; S
    pos[0][0] = (10-num+i)*25+x+100;  ?! }8 }  r* x0 T) O
    pos[0][1] = y+110-(int)temp;# H" f' o: ]! M, M1 w( {
    t = (float)info[1];
    2 E7 g% ~0 ^/ h7 r% b3 w# mtemp = (t/101)*90;/ _! ^' j! C5 K8 E: t8 T% L5 ?
    pos[1][0] = (10-num+i)*25+x+100;  s5 E/ I, }+ _, [2 l$ O: p
    pos[1][1] = y+210-(int)temp;: {) r8 p) f! @$ }1 l# J6 I' T
    t = (float)info[2];
    * ?, H1 W" [% P) ~5 i" [temp = (t/101)*90;+ W5 s3 l! A7 H& m/ ~7 y
    pos[2][0] = (10-num+i)*25+x+100;* }4 ^- _) g# p- A- c
    pos[2][1] = y+310-(int)temp;
    8 m8 c" b# T. p' Z. g! a}+ S- ?8 Z( S2 z9 k( y& X
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    & ]4 L7 Q2 ?# ~; t* r& h1 J' Y{
    4 N6 N# n' ], ^- }$ Uclearrectangle(x,y,x+400,y+315);
      J4 o% P7 I: H" l$ _# Qsettextstyle(20, 10, _T("楷体"));
    7 j8 f; h: z2 u3 Hrectangle(x,y,x+400,y+325);9 [) M) C, s- q2 C7 Y
    outtextxy(x+40,y+10,"CPU");       //画柱状图6 R, f$ Q8 a' s) |' p
    outtextxy(x+45,y+10+100,"IO");
    8 F" @  Q0 G4 b3 Louttextxy(x+40-15,y+10+200,"change");! |% S, C# Y0 T3 C' {( k- b# N2 }2 H0 N+ e
    rectangle(x+35,y+30,x+75,y+110);0 B' d  J) h1 y# ~: y+ u
    rectangle(x+35,y+130,x+75,y+210);7 P* `- T8 J7 X: ]9 h2 r6 z
    rectangle(x+35,y+230,x+75,y+310);4 r; N+ ^, q1 M8 U1 J
    outtextxy(x+180,y+310,"FCFS");
    / j. D/ k7 s5 Z) j) W% u. Gt = (float)com;
    + |/ S$ r+ Y& p* atemp=(t/101)*80;
    " y" u8 t0 I, }5 u: xfillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    ! H2 L4 D3 A1 J1 d$ jt = (float)wai;4 w; K7 j. K+ G2 U( _% v0 \+ t! u+ X
    temp=(t/101)*80;" s2 q( t. m4 B- \5 P" n5 o  Y+ h4 N
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    " Q! m% Y2 w$ R1 b, i. Nt = (float)cha;' L$ q& x" G& p
    temp=(t/101)*80;
    / n7 d4 ^) o! f- pfillrectangle(x+35,y+310-(int)temp,x+75,y+310);: R- d+ {! @7 A( y
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    , |# e! ~/ e4 z- t{  i' v; h. t- w: V) ]
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    - }7 E  C# r' [! T$ Zline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    * N, E2 P. ?4 H% xline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    7 r- I& }  x0 i  d; h0 q! m
    1 z  [8 j0 j3 iline(x+100,y+110+100*i,x+100,y+20+100*i);
    4 p( l* D" s( z3 K$ s, B; b9 oline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);% h% Y/ p) M/ z9 T
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    9 ^- c+ m) l! o) x7 g( j3 ^for(j=0;j<num-1;j++)
    ( O- b5 X( N# p- c! H0 [5 D' U{
    1 v' t( K: n6 L: _5 g: gline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    " p" e  G! S% |, `, Cline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    5 U2 u- ~; m* u" V- J0 b9 [: Kline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    # c0 c0 n3 M9 C. L}
    " {* F: {; Y4 R}4 K/ c7 x# F* E! O+ r7 G! _6 L
    }  u+ i% ]6 [( j; b  p
    else if(FLAG_FIFO==1)
    7 d, j" S1 k/ c2 U{
    2 n+ o  X+ K9 cx=0,y=0;& I* [. s6 B' g( |8 w8 |  V+ `
    for(i=0; i<num; i++)6 K2 r) x, v1 G/ x9 g8 z! E
    {
    - }8 Y2 C9 i- ^4 \5 g6 @/ U; ft = (float)info[0];
    * Q8 |) D' Q9 c, dtemp = (t/101)*180;
    % }( z. A  R  L5 v5 Bpos[0][0] = (10-num+i)*50+x+650;
    ) \  L2 ?5 ~/ o. @$ Zpos[0][1] = y+210-(int)temp;! T5 A9 V+ j( s8 |/ o6 t( U5 x) }# u5 r8 B
    t = (float)info[1];% P+ z4 \) z% f# `4 @
    temp = (t/101)*180;
    & b) M' d6 E; y7 G* D) p6 ^( y' rpos[1][0] = (10-num+i)*50+x+650;( ~6 F) b" ~* J
    pos[1][1] = y+420-(int)temp;1 b$ N/ q* g# |/ A$ i6 ^
    t = (float)info[2];
    9 l7 x! g3 L' i" ], ztemp = (float)(t/101)*180;" D* ^/ S0 W$ q% J4 x
    pos[2][0] = (10-num+i)*50+x+650;
    ( z4 h' w- g( I/ \pos[2][1] = y+630-(int)temp;
    6 C0 \( W3 M! E1 Q8 L}
    ; _, O+ i9 @4 c. i2 M- K7 Eclearrectangle(x,y,x+1200,y+650);
    + H4 N% S% D! I, Bsettextstyle(40, 20, _T("楷体"));
    6 X& W) ]4 V3 R8 i# Nouttextxy(x+50,y+50,"FCFS");$ S/ `" ]8 V. |7 z: Y8 K
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    % K) k7 d6 n0 \' z4 b3 a; _6 g2 couttextxy(x+285,y+20+200,"IO");; N% g% C* s/ Q
    outtextxy(x+250,y+20+400,"change");1 t" h: J& ]+ D+ D- U- l) U/ h
    rectangle(x+270,y+65,x+330,y+215);
    + i) Z9 N/ \1 h& N9 Q6 `5 vrectangle(x+270,y+265,x+330,y+415);2 A. d0 C& [* b& i7 x8 y! [
    rectangle(x+270,y+465,x+330,y+615);3 G: k4 o9 y. H1 z8 M( G
    outtextxy(x+290,y+620,"TT");
    ! `, ?0 w6 s% a( Z; h9 G: L" o% zt = (float)com;
    3 x+ Y) M# L4 K: R* l3 ntemp=(t/101)*150;
    & r9 O3 I5 Z' W! [" w" y: ^fillrectangle(x+270,y+215-(int)temp,x+330,y+215);: R# o/ h; T. B& g4 H
    t = (float)wai;
    . E! W" T0 l0 btemp=(t/101)*150;% i" b( M7 q  l- x  j/ W. X2 C
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);. o  F/ C$ R9 N0 W7 H; D
    t = (float)cha;
    6 u+ d0 ^/ ?. w% Qtemp=(t/101)*150;
    0 W# L' e0 d" P5 }& P0 g; mfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
      \$ u7 J# W2 x3 z: lfor(i=0; i<3; i++)   //画坐标   high=90,length=250- z# v  |6 B* U" j: S7 S( t
    {
    & \2 g' D5 I" I0 ?  ?4 M! j+ tline(x+650,y+210+210*i,x+1150,y+210+210*i);
    1 ^( c( S; j3 P( I# f6 T* Jline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    / K. n2 N4 F; J& {1 F, zline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);  ^# ]( \# P2 G5 B, J5 T7 H! g
    0 M1 n- k  N: k3 B1 m# ?; m' _! x
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    , E. z8 h' r) ]3 [line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    # f6 c- [& a; i3 U$ f9 @line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);: a% h& z6 \& ]" [( c" [
    for(j=0;j<num-1;j++)
    / u2 T4 k$ |) j4 U0 O2 W/ m+ I{2 [8 e9 E, s# q2 W1 f5 S
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    * I2 @, D# n8 u$ H1 oline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    ! {" k3 i  e* c8 p7 G3 Dline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    4 _0 D/ T0 I  X  R* g}
    2 o. h9 Q$ ~2 [$ S% V+ [$ A}
    3 y, w2 N0 n4 f5 r6 q}$ S# w7 \# Y6 S. b6 g
    0 j& j! y2 o  v0 L  d
    & N7 Q; l" i! s* F
    return 0;
    4 [9 _3 `" _. c  Y% K; w}
    4 M+ r; ]. P( m8 rint drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)
    5 ]" z' C+ a$ n: V7 ?{( q: t3 F# A% U6 T5 J( V
    static int info[11][3],num=0;: M# L- k% }! }5 h; ^* J1 c
    int i=0,j=0,pos[10][3][2];+ `0 R; e- T' v2 d
    float temp,t;
    ! U! i$ C; Q9 M1 E& Linfo[num][0] = com;  B" H9 x7 e; w1 S0 ?! D# W
    info[num][1] = wai;8 C; O" g" ]5 z8 n& O- P
    info[num++][2] = cha;
    . a1 z7 {7 v8 d) D' e3 t- \if(num>10)  //存储10个点
    9 S1 t+ H) ^* H+ e{
    " K& C2 ]: j5 x9 \, k4 ~* ofor(i=0 ;i<10;i++)
    6 z0 \4 W; ~( `4 f* m7 c8 [/ A, C+ V{; v. r# k% E5 e
    info[0] = info[i+1][0];; r- P9 G# N5 L* i
    info[1] = info[i+1][1];
    " Y7 ^' `7 W# Z# ]- y6 {info[2] = info[i+1][2];# O0 H/ p- z0 P
    }: O. g3 S3 z, I3 y. y7 i
    num--;" m- X. ?$ |8 {3 S* l( F) @/ G
    }
    5 f, O8 K9 @& s! [$ `/ rif(FLAG_show==0)
    5 Q( @1 }: J- D0 y# G* r& a% [return 0;
    $ G1 P6 B' ^* A  j( \9 o0 Ofor(i=0; i<num; i++)  ]0 z" g5 O/ b0 b' s0 n
    {
    ( g7 s' w# [; l% s4 X9 q; c" N# a# vt = (float)info[0];
    * r# a( j1 f+ k* b) Itemp = (t/101)*90;2 T3 K- _, c* T7 c9 e: P( A* N. y
    pos[0][0] = (10-num+i)*25+x+100;
    3 l: z" ^  B2 cpos[0][1] = y+110-(int)temp;1 _1 [& J) M  S1 G2 h: M3 _. t
    t = (float)info[1];
    6 f; U+ u& e3 v4 O1 x  x0 Utemp = (t/101)*90;( ?& P) C" T" X# Z4 G/ B+ H, X
    pos[1][0] = (10-num+i)*25+x+100;/ l' r; o3 b3 N$ e) X  M+ Z
    pos[1][1] = y+210-(int)temp;3 p( b8 W2 ?) d5 b. u( J
    t = (float)info[2];
    4 X# H0 [: O! q6 T- R: L) U3 ]temp = (float)(t/101)*90;
    - I& j$ @+ @$ O- [! Gpos[2][0] = (10-num+i)*25+x+100;
    * ~% H4 _1 [; d- D. _8 h; s; s+ Q% ]+ mpos[2][1] = y+310-(int)temp;. |8 K% ~  V, g+ _! M/ I" m* }4 M
    }
      |+ U& ^% Y1 Q: i9 W( Y& Tif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    : V) z' y. ~) q9 u. T4 n- j{
    # s) J8 x( M6 G0 vclearrectangle(x,y,x+400,y+315);$ P4 A  J. \9 J9 u
    settextstyle(20, 10, _T("楷体"));
    * O2 J% p. J# R. b0 k3 g: K9 Xrectangle(x,y,x+400,y+325);
    ! X8 m8 E. j: p! P0 }; t" Aouttextxy(x+40,y+10,"CPU");       //画柱状图
    * a8 S. Q9 p" O, J6 `+ d6 S9 Youttextxy(x+45,y+10+100,"IO");
    ) q) o, x' b8 N- C* p$ ~: iouttextxy(x+40-15,y+10+200,"change");
      q, v7 o/ }+ H0 G" srectangle(x+35,y+30,x+75,y+110);
    1 o7 K! S1 a( urectangle(x+35,y+130,x+75,y+210);
    4 {2 }( w# h7 {4 lrectangle(x+35,y+230,x+75,y+310);+ S9 j3 ~& E/ [. E+ @$ O
    outtextxy(x+180,y+310,"HR");
    3 _& m% f& ^! E5 L% T8 w4 a# Rt = (float)com;
    + Q/ \: E7 H: \/ D% ^5 L5 Rtemp=(t/101)*80;
    & W4 j# {0 b; jfillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    + T2 n* M  `9 ^9 L4 D! @t = (float)wai;
    # K3 C5 c  Y# d- etemp=(t/101)*80;$ \4 H& ?2 J; y5 u2 b& A5 Z4 k! Q: H
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    ( E9 S0 x  x" h% O7 Nt = (float)cha;
    . ^. X8 K' t; G) wtemp=(t/101)*80;. I  H3 K8 g, d9 |' d; s6 C; E
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    & W0 A) S" ]  ]& p$ K+ P" Cfor(i=0; i<3; i++)   //画坐标   high=90,length=250+ c$ c# w4 k* ?, F8 L
    {
    ' _/ z; c/ V. L0 y1 l* _line(x+100,y+110+100*i,x+350,y+110+100*i);4 Q) j) d) A# o
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);" i; Q: b6 _* ?) g
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    : e0 ?- [# `: ^9 _7 [2 e6 O) F9 z/ ^. |. N. x" D  t. J& n- m
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    ; u/ @6 F0 g0 q+ hline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    $ i) b: Z  ]9 M# t5 J% S4 tline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);- }1 K" X+ j3 c
    for(j=0;j<num-1;j++); f3 @- C* `$ i
    {
    : @4 \4 T0 L9 t# Yline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
      j6 Y9 o5 X2 D' gline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    7 K2 @/ l; `" k9 }1 e; D5 |4 ?line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 1 h% z! U; D4 [+ `  H' x
    }
    ! U+ W+ z: M1 i}
    * G, X3 {' k3 E( P  ]/ L# S5 p}9 P: ~* X# F5 l) K# z5 |# {% W
    else if(FLAG_HR==1)2 R0 y) }( [$ @
    {7 \3 L& P$ F' ^( j5 P- R" t* s' r
    x=0,y=0;; [0 L/ R' `) x9 Q
    for(i=0; i<num; i++)7 W, C: y3 E. o% y; m0 S* Z0 Q  ?
    {
    / S0 F" k2 p, e* W0 lt = (float)info[0];
    : p6 c/ d/ i8 j& y- j8 }* ttemp = (t/101)*180;
    ; _" p( }8 e9 A* d7 O. y. w  F% z0 Ppos[0][0] = (10-num+i)*50+x+650;
    3 o" n  ]# [: Q7 u3 gpos[0][1] = y+210-(int)temp;( W) P+ X& m/ H
    t = (float)info[1];. a+ }1 p/ F4 O6 a' `
    temp = (t/101)*180;% S) T2 ^# v' a; k
    pos[1][0] = (10-num+i)*50+x+650;
    2 d/ R6 E+ s8 f% Z- W. ~pos[1][1] = y+420-(int)temp;
    , {. A( O/ R4 L4 vt = (float)info[2];
    . Z/ m3 @1 v2 T4 f7 _3 x  U7 ftemp = (float)(t/101)*180;
    . n2 _( e! X7 `" dpos[2][0] = (10-num+i)*50+x+650;0 A6 w; p+ p5 I6 `9 v7 Q) B) ?
    pos[2][1] = y+630-(int)temp;
    ( ?2 p4 g5 L" Z& x' X# c& p, H}# h9 d/ b+ M+ U, Y# ^; L  c* ^% i( H
    clearrectangle(x,y,x+1200,y+650);
    ! {' P' i9 n/ Q, F' ^$ y5 N9 G. Y- Xsettextstyle(40, 20, _T("楷体"));
    + U: c$ G- O/ o/ }outtextxy(x+50,y+50,"HR");' ]4 ?/ ^1 |' L5 H
    outtextxy(x+280,y+20,"CPU");       //画柱状图$ l4 _  E, u6 G! y/ [$ O
    outtextxy(x+285,y+20+200,"IO");& q7 C0 |, Y' L6 g: I5 ~1 k
    outtextxy(x+250,y+20+400,"change");
    7 W1 c" M) K5 w$ I4 U0 X4 hrectangle(x+270,y+65,x+330,y+215);  G2 k% U7 H1 y
    rectangle(x+270,y+265,x+330,y+415);- f+ {8 U& G. r2 L9 o% u% \2 ?& O6 w8 N
    rectangle(x+270,y+465,x+330,y+615);' z3 ]. i' X& J3 a8 N% B1 m
    outtextxy(x+290,y+620,"TT");/ Q) D/ u7 r4 O% E  H2 }1 B4 W
    t = (float)com;2 j; b+ N# g) N+ ~. k
    temp=(t/101)*150;  U$ _' }+ O7 ~+ y4 a* h6 m
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    # g  P; s. @  p+ ]7 H3 k1 ft = (float)wai;
    % E$ K. w8 B2 N3 b4 S/ `; ctemp=(t/101)*150;" \4 e: f1 ]# {$ O0 z
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    8 h; V+ h; e8 z. ~, kt = (float)cha;
    ' `4 O. s0 ]) P- E" y. |6 Otemp=(t/101)*150;
    2 a$ G1 X+ @$ g7 Mfillrectangle(x+270,y+615-(int)temp,x+330,y+615);; e: ~& b0 `/ H9 l/ n6 H
    for(i=0; i<3; i++)   //画坐标   high=90,length=2506 M& V  T& n( K9 ?/ r7 L
    {
      N# X" h% q" Y+ w' I& P1 ]line(x+650,y+210+210*i,x+1150,y+210+210*i);, }* x3 v/ r4 R
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    $ \4 k! o+ Y' W  Y3 ?% c. kline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);. Q6 v4 `% X3 }' d. i

    : F: M3 i. c! K6 `$ C6 c# x' vline(x+650,y+210+210*i,x+650,y+20+210*i);
    1 R; J9 ]: [' @1 [3 g6 F) wline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);+ U% l5 g% T9 K3 s' k" e8 \5 j0 `/ f
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    0 `% c. n6 z9 R6 qfor(j=0;j<num-1;j++)
    ! @9 R2 e, L4 `( c5 U{) q2 G2 T% v) h+ e
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);/ u+ j& O; M9 y9 M" B
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    : \, o' Z! ?2 a7 v& n5 S2 L5 j* Mline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    ! i1 P  G3 b! ]7 G4 ?}
    6 ]) U9 l+ J! V" m: U& v}3 g; a  d9 J0 H. F5 M
    }7 K8 j5 i7 V6 `) F' S
    * }: R7 `6 p9 P+ \1 j7 T& V; m
    2 r$ H" E5 T# P+ \: _6 m! H' v
    return 0;
    ! f& V! h6 o$ c' W* I}
    ! @- s) E  j5 d$ b* n0 Yint drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)
    : b4 P) i5 v/ M2 M; ~) h) m# [# N{# D+ ]- {" X8 C  A0 T
    static int info[11][3],num=0;
    : h. S& w4 t1 R; \& T4 b8 eint i=0,j=0,pos[10][3][2];8 j+ a; ~4 n) ?' s# s& D
    float temp,t;+ G5 ?  Q. H& }$ R
    info[num][0] = com;4 X+ T+ r* A! A+ W/ t# g' V
    info[num][1] = wai;3 M. {' Z$ c1 i- N& D
    info[num++][2] = cha;
    . [/ o# `8 D( uif(num>10)  //存储10个点
    5 T3 Y+ V+ n3 F) {* R* o{1 c" P$ Z3 B: v- b* Z& D
    for(i=0 ;i<10;i++)
    8 r! [/ u- L+ U$ R{
    0 `# T) a" ?* S, ?info[0] = info[i+1][0];
    3 k5 s9 u2 t; U/ d3 |info[1] = info[i+1][1];6 Q" T' d& g! y! C! V% F) s
    info[2] = info[i+1][2];. K' E5 J! F% M
    }
    % ]) b* s4 W/ rnum--;
    * K' T; J! U# B5 K6 @% Y( K  S8 a}
    $ a% ]" ], I& u  A. W5 f% x7 Hif(FLAG_show==0)2 ~% o  t+ j* Z. M. p/ A
    return 0;
    5 H( m. I! G( ]6 {$ efor(i=0; i<num; i++)" p4 L! l0 l; M2 S
    {
    + D4 d& \2 x3 i, v% ]) pt = (float)info[0];+ t* e; V7 q3 U+ Y0 ~
    temp = (t/101)*90;
    0 I2 h! G! H; j$ f) C( fpos[0][0] = (10-num+i)*25+x+100;$ X1 b/ K! w3 H7 v
    pos[0][1] = y+110-(int)temp;+ j4 ?: v* Z4 X& X0 B; ^% g2 W: R
    t = (float)info[1];
    9 v* U7 X* x2 F: W6 atemp = (t/101)*90;$ L" I; G' Q! L0 M2 B
    pos[1][0] = (10-num+i)*25+x+100;6 X- R* E; }5 H+ n7 q
    pos[1][1] = y+210-(int)temp;5 Z" V" }( P+ {# L2 m( n
    t = (float)info[2];
    / F5 V, E7 f, u4 ?6 g! S5 {temp = (float)(t/101)*90;3 m% b. Z: ^! R( a
    pos[2][0] = (10-num+i)*25+x+100;4 E' ^+ y% C; |6 s
    pos[2][1] = y+310-(int)temp;
    $ v+ Z4 T+ X+ X* b}
    1 ^9 J- K/ ?$ R- }7 `: Jif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    0 O! z9 M. t! L{
      `' k7 G' U4 S$ Q" }6 @) @7 Kclearrectangle(x,y,x+400,y+315);
    8 l# f5 Q: `# f) P2 L( F! Wsettextstyle(20, 10, _T("楷体"));6 X2 c, T4 b1 G+ r
    rectangle(x,y,x+400,y+325);) M( N( x6 J) |
    outtextxy(x+40,y+10,"CPU");       //画柱状图9 J( W) K3 X& ^/ O# o4 o
    outtextxy(x+45,y+10+100,"IO");+ }- Y7 c6 l/ Z. S5 Z  @
    outtextxy(x+40-15,y+10+200,"change");
      `/ }) d6 W9 q7 w: m( Trectangle(x+35,y+30,x+75,y+110);
    # E5 ?  ]/ s6 a0 t. B5 rrectangle(x+35,y+130,x+75,y+210);: N1 F& ]- F# I/ H( {$ }% B( j
    rectangle(x+35,y+230,x+75,y+310);; p6 k5 ?% e# T* H) k
    outtextxy(x+180,y+310,"TT");
    . Y; x( i( R# T; }2 B- ct = (float)com;
    9 @3 W5 ]- _9 Etemp=(t/101)*80;
    + V+ @. y. {; L; I2 [6 p# Afillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    0 d/ |; m. ~, u7 l# \" }5 ?t = (float)wai;
    ' Z; E1 v- q5 R* _; |5 D6 ~temp=(t/101)*80;
    9 Y3 M% ?$ a2 n, [* Vfillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    8 B2 V* g2 o' ?) k7 Q5 c2 Ut = (float)cha;
    # o1 Z% K1 {- q  Y( gtemp=(t/101)*80;% B4 m$ N) {( X8 ?( p' F! {- B
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);8 r+ @, Q* }& e  L: ~! z% Y. r
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    " f6 \; R; Z- I9 n8 ~# [{* v2 f( K3 m5 D' ~" P! F
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    8 E- f, |. R; F8 r# _; qline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);3 ]; e% v  N- L6 r& g
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    7 j% n+ O4 L1 k+ K1 U6 ~( i2 a" ^. x# s( G+ ]- o5 ~1 I
    line(x+100,y+110+100*i,x+100,y+20+100*i);' v+ U$ f4 l& x$ n6 U  d$ G
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    2 K9 }! o& `3 Sline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    ! p$ z" D4 a& Q: J# O, Yfor(j=0;j<num-1;j++)
    ( c, b6 t$ e% Q  M( n- x/ F9 C{( W/ b8 V2 V$ z" N& n# C
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    + R0 {: z* [) i) V- pline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    8 |! t" h* o6 O7 F7 r+ r9 C* X2 L; Bline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    * z; J# i( m( |9 q$ W! h}5 D3 b: r. I# E
    }6 z  ]4 u; q0 ]6 \7 S1 E" `
    }) @# ?) k) U% ~+ \5 e
    else if(FLAG_TT==1)+ g! t5 U. \& t0 H4 h/ v
    {$ d* E& X! a* K& [8 J
    x=0,y=0;; L8 V- B1 d1 U! c
    for(i=0; i<num; i++)1 P1 Y$ V6 c: Q: \
    {' [) v# m- C) l7 J, g
    t = (float)info[0];
    6 ]$ z- e( N- k* w" J( htemp = (t/101)*180;
    & |. h/ Y: I) v& `4 npos[0][0] = (10-num+i)*50+x+650;8 c; V$ `8 V7 p) s
    pos[0][1] = y+210-(int)temp;
    9 I  \+ O: P" ~% Qt = (float)info[1];
    , X9 _# Z; Q/ h, z# k4 K6 Mtemp = (t/101)*180;. t- ?+ g) ?2 y4 r
    pos[1][0] = (10-num+i)*50+x+650;+ I# {; X; m4 ~( f
    pos[1][1] = y+420-(int)temp;
      r* G# y5 g0 Q% |t = (float)info[2];$ j# }. j6 u; u6 D  |
    temp = (float)(t/101)*180;! [" ]% G0 h, G; ?3 S, |) Y
    pos[2][0] = (10-num+i)*50+x+650;, W  P% X: H- h+ D+ M: c  f
    pos[2][1] = y+630-(int)temp;
    , C6 P2 d6 I$ f% c$ l' A1 i  Y}
    0 B, @0 O  J9 Cclearrectangle(x,y,x+1200,y+650);, s8 C! x* y& I$ b. M  d
    settextstyle(40, 20, _T("楷体"));2 V. z. N9 E8 |. c
    outtextxy(x+50,y+50,"TT");
    / \  O+ A* G3 @- b) vouttextxy(x+280,y+20,"CPU");       //画柱状图
    - A% T2 a8 \' x8 s" g4 E9 m7 U. y! Bouttextxy(x+285,y+20+200,"IO");: [# t. k+ E& J; y, n9 }
    outtextxy(x+250,y+20+400,"change");
    1 Z, h+ v( s9 Hrectangle(x+270,y+65,x+330,y+215);/ R2 |- X' Y$ Z- W3 O
    rectangle(x+270,y+265,x+330,y+415);
    ' Q  o, k8 c" q" Lrectangle(x+270,y+465,x+330,y+615);
    4 ]2 r- b3 G; I7 c1 R5 b6 }4 m2 Uouttextxy(x+290,y+620,"TT");
    " }! k$ E: ?' ]+ nt = (float)com;2 S9 ]0 W! n: [
    temp=(t/101)*150;& I" V8 A7 L/ k4 t4 f
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    & ]" o3 j8 A3 d' N( l5 Bt = (float)wai;
    , e, [9 z! G& m% o( B4 S. p5 d6 jtemp=(t/101)*150;
    9 l' j2 z$ _# a( W+ p4 mfillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    4 K& X5 d; V  k; R2 g5 Bt = (float)cha;5 n( H/ q6 a5 ~: \( _
    temp=(t/101)*150;
    7 y: b. k/ P) Q3 p8 r+ _8 Sfillrectangle(x+270,y+615-(int)temp,x+330,y+615);1 f! X; O  z( `. E% ~8 d
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    + F  P# o# x) k3 d{; O+ g' y# |2 c0 O
    line(x+650,y+210+210*i,x+1150,y+210+210*i);
    + m6 k( O4 j+ |" P3 c2 O' ]( zline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    4 t, r- B$ |4 e; X3 f6 \4 m- Xline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    # e. M3 |: g" s9 i* o5 o& {( j" D: b8 q0 O& H
    line(x+650,y+210+210*i,x+650,y+20+210*i);+ e5 \. p, s5 j8 N
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    % r: E" O* A7 g; g6 b# {line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    ; ~2 i8 g) N& U' I2 d4 K* |1 i$ A, @+ X" Ofor(j=0;j<num-1;j++)
    1 k& y+ k# r' a! ?& k0 Z{
    9 E; b" ~2 E% X. C2 R' c+ v- O$ Tline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    " R: s5 N( t/ h: `line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);$ B$ E4 N# _: C3 W& [7 ~3 B9 S- `' h
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    + Z0 G6 u; B6 A; p9 A! g}
    ' }, L# H/ M7 P5 v8 Z, G6 L}
    ( M( m% g( Z/ ~& r; s}
    5 B+ k: |+ O6 k/ y( ?- i) |
    4 b( P/ _: k1 Q  w3 ~# |
    5 D5 g9 e; Q5 T0 G3 Breturn 0;
    5 r. ]) X# k' B- `0 i) S}
    - m! O, M- \& }* ], gint drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)
    5 Z4 U+ X  B% H" g1 K# w{' w7 w0 _$ m) y
    static int info[11][3],num=0;$ }2 Y; d& ]1 v( `8 a) X
    int i=0,j=0,pos[10][3][2];
      Z$ Z2 w2 w) z: G7 Cfloat temp,t;
    - a( G  m2 A* b* U* ginfo[num][0] = com;
    % u( @0 K2 V, @% `) U, w! q, iinfo[num][1] = wai;& ^' L$ a& ?/ N; N1 S+ ?2 L
    info[num++][2] = cha;2 M) o  O6 Z# y. M& Y/ q
    if(num>10)  //存储10个点
    ( x2 w* b& d( x0 B' d$ J9 U( Q{
    : x% j; o* M) h: G# }* h3 yfor(i=0 ;i<10;i++)2 S% l) {  z( O; R" h+ P9 [
    {2 Z7 f4 E& o5 l. W& t
    info[0] = info[i+1][0];% y% b! W9 i' h5 l4 \4 w/ k8 W
    info[1] = info[i+1][1];
    + ~9 I8 m8 Z' rinfo[2] = info[i+1][2];
    , s- V' f5 L* N) B: _% w: z}
    : e  N' O" j% J3 znum--;
    - Q+ ?8 j) r. K; l: W' T}  x9 p) A6 X6 a( X4 Q# k! P  Q* }
    if(FLAG_show==0)  G6 @" O& B2 m/ l1 |
    return 0;. p, r- Y* p: b& G% z
    for(i=0; i<num; i++)7 j9 ]2 J3 o- D* @4 Z
    {
    / g; H% e; P- |- f( Q6 Dt = (float)info[0];/ A8 k. W9 B3 T# [
    temp = (t/101)*90;5 J( |+ D1 z" k  T6 V( G! H' e
    pos[0][0] = (10-num+i)*25+x+100;1 o0 I) v1 ?2 k
    pos[0][1] = y+110-(int)temp;5 |0 Q' Y! R+ ~/ b* D. d3 ?$ [
    t = (float)info[1];
    1 g3 q1 A- K. [7 m' i( @* atemp = (t/101)*90;! K* r$ u7 |- \' |& \0 M
    pos[1][0] = (10-num+i)*25+x+100;$ S# T! S( r7 \# T
    pos[1][1] = y+210-(int)temp;' Q; E( R( R6 U4 n2 _, d
    t = (float)info[2];
    6 P/ h& O6 E1 \3 v/ f5 d* Ttemp = (float)(t/101)*90;
    5 ^. q  m% P6 R! S: E: Opos[2][0] = (10-num+i)*25+x+100;
    : D$ S& @4 f/ R% x0 apos[2][1] = y+310-(int)temp;
    ; l5 _5 d5 Q/ q) ]. D}: H5 \$ Q9 u; n  [' |
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    3 Q/ j+ F2 z9 j! b{7 e  U6 ?& t5 a0 _& T
    clearrectangle(x,y,x+400,y+315);1 Q+ `, ?9 d2 R4 Q1 _
    settextstyle(20, 10, _T("楷体"));& x0 Z8 r0 U( v% g
    rectangle(x,y,x+400,y+325);& N9 ^7 o9 T! |$ i6 R6 u) p
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    ' U# i2 G$ `) J' |  souttextxy(x+45,y+10+100,"IO");
    3 M3 c4 G, J/ P4 O! Nouttextxy(x+40-15,y+10+200,"change");
    , X' b. u# `; O3 V2 Brectangle(x+35,y+30,x+75,y+110);* z' N9 W1 [9 Q! N8 h
    rectangle(x+35,y+130,x+75,y+210);
    8 F- K' S" W* j" ~# m' ]2 Q" Vrectangle(x+35,y+230,x+75,y+310);) ~+ @/ I) R( B2 c9 o
    outtextxy(x+180,y+310,"PF");
    . h8 ~, y2 l  U" u& E+ D4 T9 X5 ]t = (float)com;
    4 Q/ @3 K; m( j: utemp=(t/101)*80;
    ; N. c! V9 q( Ifillrectangle(x+35,y+110-(int)temp,x+75,y+110);! B$ x7 K) Y. w; R" g$ _, k
    t = (float)wai;
      ^. ^" C$ z& V# u! stemp=(t/101)*80;4 j5 N- w, |. F1 C5 X0 N
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    . i9 K( a5 ]2 P) @t = (float)cha;5 O4 [* U2 M4 O+ ~8 j9 m) m1 G
    temp=(t/101)*80;% y3 P2 T* z  L8 b" P
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);: Y3 J7 T$ J4 F3 T% d2 U' l
    for(i=0; i<3; i++)   //画坐标   high=90,length=250$ N: B- @/ _7 G8 P; Q
    {" h3 ~3 a) j. G2 F
    line(x+100,y+110+100*i,x+350,y+110+100*i);2 t. r! W# `4 A0 F3 c) ^
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    8 i) `+ G: R2 b3 m, J% [line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);7 N8 J' B0 t& C# P+ t; o( F* n
    / a+ h# [: p: I4 ~# ^. U# o- }
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    0 k$ W+ Y' i, |- S9 Z6 ]  ^) [" Gline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);9 W" v/ `0 ^0 n7 I
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    ( B" a, D; X7 s; Cfor(j=0;j<num-1;j++)
    8 V  ~6 O) x8 q, j7 E$ w7 ]{
    # G* _% u  I& ~* s- [line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);* d( P. f' f/ o/ y4 l. t& s7 \
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);3 s3 |9 L2 d3 d& r8 j
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); : h  w' P- y- k- {' U$ A+ h
    }
    5 s: V4 ]2 ]3 l+ |2 }% `0 S}) E! O% K( k, u6 s- h
    }
    ; w/ f; C3 D8 k% }6 E7 Welse if(FLAG_PF==1)
    ) J; J" t3 p, q. I4 S1 L4 B{
    ' o" z1 b0 }: `$ \* F( k1 f( ox=0,y=0;  G5 A7 U5 B( Y3 ]! r
    for(i=0; i<num; i++)
    / @! B* ?6 t: `# w& [" E& R3 |{
    2 g1 i6 J5 x3 Ct = (float)info[0];: G9 q9 E& ~" p: E3 D* e
    temp = (t/101)*180;
    0 ]8 l" E  G6 g( [% a% r- i( Npos[0][0] = (10-num+i)*50+x+650;
    5 v" P4 t- [5 H, l  k. M+ B2 opos[0][1] = y+210-(int)temp;# t$ h* }4 D/ K) F" }
    t = (float)info[1];5 H7 o0 F) M8 b  Q% p9 k
    temp = (t/101)*180;/ m8 m# k* v; J2 g; k  U; m2 W
    pos[1][0] = (10-num+i)*50+x+650;/ d' v7 P. J) }1 \
    pos[1][1] = y+420-(int)temp;
    9 Q, [7 W7 i% e- U1 f0 I3 W% gt = (float)info[2];
    ) S3 t$ ~  B. V  g5 ptemp = (float)(t/101)*180;1 c% ]# Q7 \# f
    pos[2][0] = (10-num+i)*50+x+650;% P* n6 Q/ v+ V0 u' @& N
    pos[2][1] = y+630-(int)temp;
    + I3 r0 R0 K3 ?2 ^1 J- K. s& v}
    % ]6 V0 X* m. H8 ~. X# q6 Kclearrectangle(x,y,x+1200,y+650);
    % ~' n/ q) L7 v# K- Qsettextstyle(40, 20, _T("楷体"));
    ( ~1 |0 R/ l8 y6 ?outtextxy(x+50,y+50,"PF");* F" s5 c4 u9 \, M
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    . f/ k: c# x5 n/ q* Z4 `outtextxy(x+285,y+20+200,"IO");
    + v, r% t$ a6 l) Z* aouttextxy(x+250,y+20+400,"change");1 w4 l: J0 Q* T3 f) I& v! ?+ \" P% o
    rectangle(x+270,y+65,x+330,y+215);
    9 t- ]! l' X& h9 Wrectangle(x+270,y+265,x+330,y+415);5 v) M2 e2 P3 T/ @! ^# x
    rectangle(x+270,y+465,x+330,y+615);
    . u$ u: m" d- K+ Q. Aouttextxy(x+290,y+620,"TT");
    & `, H" H; |  [- e, yt = (float)com;
    ( y  r% @& s, b+ u9 \/ Ctemp=(t/101)*150;0 C) Y& Z. c: k0 W7 t
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);! u4 {0 }- u+ Y$ U5 M0 |
    t = (float)wai;
    " W+ u; w2 I  q$ Z: D0 r1 Ntemp=(t/101)*150;# L6 B& |7 J; R# F' O" l" b7 f
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    4 |2 u/ C- v! K  r1 M0 }2 ]t = (float)cha;1 g) w2 z$ X, E* v! Y
    temp=(t/101)*150;: Q5 S" K2 P) e, v
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);$ A3 v# U( d! K0 E
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    : x2 n4 ]8 m/ N& J4 ?/ u& K{9 x3 x5 T- r4 }0 S. v3 t. c. g% T
    line(x+650,y+210+210*i,x+1150,y+210+210*i);  r8 f+ r) x; Z3 ]2 w
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    ! m* P3 K( ]- }0 iline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);5 q1 o! V9 E  x& N* y9 U

    ' V" S* B' G6 C/ Pline(x+650,y+210+210*i,x+650,y+20+210*i);1 ?4 }. ^# K1 |# P$ }
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);- X. w( q8 O- D# @8 T
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    ( [) z, w+ p. ofor(j=0;j<num-1;j++)6 J! f  m' ]" o. p
    {; r0 T" x9 L; a% u) j
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    5 ^' E6 S( T9 e! M. Iline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);/ M0 m4 s& D, b! Z1 N9 m; u
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    , E7 k" I9 b9 F) v: D}
    ( X$ n0 Z; _, [5 o5 n8 P: D" d/ Q: q}6 V: r. c# Y! t5 E) Z
    }; n4 {' Z7 M7 Z1 n4 o
    return 0;$ q2 Q1 q$ T+ d  d4 n3 w
    }
      z3 ?( e) X% ]! \, j1 O* Hint drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha)
    3 Y) b! r1 Y, t$ A/ j9 _* Z{9 S/ q3 Q6 ^/ M7 v0 e
    static int info[11][3],num=0;  w3 b* u* u, Z2 P5 m8 f
    int i=0,j=0,pos[10][3][2];4 @, B6 Y9 s* v; Q8 n0 p
    float temp,t;
    3 Q; b8 f' z9 r. zinfo[num][0] = com;% Z) M# }8 n$ A4 w1 L# m# d& g
    info[num][1] = wai;
    & x5 N* f6 f5 x) P  M$ zinfo[num++][2] = cha;1 @; b; W9 k1 `0 K$ t7 k
    if(num>10)  //存储10个点
    - ~' R" Q) @( N, q7 }# k{* _* ~  d6 y+ L( @# R1 e2 I& k. I
    for(i=0 ;i<10;i++)1 p1 D9 T# W. P1 s8 r
    {
    , a# D" G: d- l5 r9 R% ~2 V: Iinfo[0] = info[i+1][0];
    - b; V# K; |* B% H. Pinfo[1] = info[i+1][1];5 I4 Z: J( X' F! s% B- `* ^
    info[2] = info[i+1][2];
    6 Y& m$ m3 a% \. E' w6 |# ^}
    . ]9 ^- t) J2 p' ]num--;
    ! u! k5 T. e  n) m}
    : q& i" o) n4 Yif(FLAG_show==0)
    " ?( ?8 y9 O" }" s4 R3 ]7 U7 Preturn 0;! V) R% M" m% p5 ~5 d- ~/ f, h2 `
    for(i=0; i<num; i++)
    8 }$ k, ]  o% P9 y( N# R0 N( Z# ~{
    ! G) P7 m$ t: U' s8 s- Pt = (float)info[0];5 l2 d$ h, y( s2 N5 I" t
    temp = (t/101)*90;7 h3 p) T6 {+ @! G! u' r
    pos[0][0] = (10-num+i)*25+x+100;
    ; r! d/ ?7 |6 I: Epos[0][1] = y+110-(int)temp;
    0 g  x. c; e- r  bt = (float)info[1];' J  ~6 _& `7 P) j5 v% t) M
    temp = (t/101)*90;
    8 t$ P1 c% D+ o0 Q0 Qpos[1][0] = (10-num+i)*25+x+100;
    1 b" V- c) |9 o$ |+ L5 xpos[1][1] = y+210-(int)temp;" `& T$ w& ~$ w5 {" v  E
    t = (float)info[2];
    - q% M; S7 q2 v8 Dtemp = (float)(t/101)*90;
    - h0 {# f+ S# T3 Hpos[2][0] = (10-num+i)*25+x+100;5 [) A' S$ a/ I
    pos[2][1] = y+310-(int)temp;- y4 \& H1 J( n
    }
    . I0 O5 P6 d' l; c* f/ X' ^if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    ' L& V" q) P. D{ , N7 k' @( t9 x1 E# b2 `
    clearrectangle(x,y,x+400,y+315);2 y% R& r! H9 w/ b0 n+ _# t
    settextstyle(20, 10, _T("楷体"));) e/ C: `# M- K6 ?: t
    rectangle(x,y,x+400,y+325);7 }1 d* b0 C0 _9 M9 P! v1 u
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    1 H( K2 V' |, d0 N4 |. douttextxy(x+45,y+10+100,"IO");: A' e" S5 w- D4 H
    outtextxy(x+40-15,y+10+200,"change");( a9 D  Y6 [4 F7 M$ l  C
    rectangle(x+35,y+30,x+75,y+110);
    - g) W- r0 G9 V5 srectangle(x+35,y+130,x+75,y+210);+ H! T7 s7 G* ^' @3 _3 K4 ]$ Q! d
    rectangle(x+35,y+230,x+75,y+310);4 b0 z" K/ h( M
    outtextxy(x+180,y+310,"SJF");# |4 L( C5 ~4 L! r/ |9 Q
    t = (float)com;
    4 Q4 |7 m0 p' Z4 s" Qtemp=(t/101)*80;+ u8 u; u! @3 ]8 U2 n5 x
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    3 e3 V( S, K; q! zt = (float)wai;0 S- I& ~: i7 }3 U5 a
    temp=(t/101)*80;1 g) j5 v. S- e- k
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    % e. a) F5 A* ^) at = (float)cha;& e0 y& M. t3 F1 K, B' \
    temp=(t/101)*80;9 B# V4 d: _7 N+ {
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);1 b. S& A' U5 g$ E5 w* P
    for(i=0; i<3; i++)   //画坐标   high=90,length=250' A' }: l( W9 F
    {
    5 |* S% y2 s0 O% {/ F2 A8 Lline(x+100,y+110+100*i,x+350,y+110+100*i);
    3 z* z$ ]+ x, L( ^. yline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    1 }, N5 t; ^$ o3 S$ a! bline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    # v4 z* w0 Y) j8 g  ^# Z
    - r( G' v3 i$ H3 wline(x+100,y+110+100*i,x+100,y+20+100*i);: d; T2 H- ]+ y" _) \  X9 @
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    ) ~0 g" {5 I' o2 H$ bline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);( \1 a" K, m' a" h7 O
    for(j=0;j<num-1;j++)5 v- ~, B& g# R2 N
    {1 o( \$ \4 f2 B  q# V8 F9 y
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    5 o1 A6 o  W: f7 g5 c. }7 qline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);; L, c0 U- h1 B. I7 v8 T
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    . M) x2 z0 ?0 r  @}- m& E/ R% E: x9 U% G; l4 q
    }
    # M# r# A. _! K}
    - ^. \" A$ r( Y0 Y) n0 d- I  X# [" Lelse if(FLAG_SJF==1)
    % \. v) a; U* D2 {{$ h3 W9 p- {- G. b# E3 e* _
    x=0,y=0;! ]$ V! ?( A: Y, \# a# T
    for(i=0; i<num; i++)+ d: G' x- h0 X9 ]6 f; [  X! F
    {
    & s0 n6 e6 ^, R; G. n: Z: At = (float)info[0];: O% T9 J: }8 m( ]8 m
    temp = (t/101)*180;( m4 b; J' v% H2 h
    pos[0][0] = (10-num+i)*50+x+650;
    5 B- ?6 v3 a2 m8 l" H' lpos[0][1] = y+210-(int)temp;
    9 P) s6 R! A0 Z+ N2 T, F9 `! ^6 jt = (float)info[1];
    . Q9 d9 H; _* c1 _8 ttemp = (t/101)*180;
    3 e' A% K) o1 y, B3 `/ l5 h* [pos[1][0] = (10-num+i)*50+x+650;9 G: q7 g5 @- a- X
    pos[1][1] = y+420-(int)temp;' Q0 o7 n6 J; m/ r4 N; q
    t = (float)info[2];
    1 K4 n' g* ~' R3 p4 H3 n( T" D' dtemp = (float)(t/101)*180;
    / R5 Y! R0 y$ W) p% Opos[2][0] = (10-num+i)*50+x+650;
    1 A/ K4 X  t; ?. f7 h' cpos[2][1] = y+630-(int)temp;2 X. C0 v/ s4 Z' E: N0 b* h& E
    }+ ]/ l, f/ ^( z9 ^( n' X4 P7 C- m7 w
    clearrectangle(x,y,x+1200,y+650);& _, ~$ d) W' I) u
    settextstyle(40, 20, _T("楷体"));5 S7 B! z' h$ O: H; Q! q
    outtextxy(x+50,y+50,"SJF");
    / l+ ^2 ^6 s7 u2 u$ z% n0 }% [$ louttextxy(x+280,y+20,"CPU");       //画柱状图
    * m$ f8 h* [3 B! ~8 a8 X3 Aouttextxy(x+285,y+20+200,"IO");
    ( W1 Q8 D  y9 F/ Zouttextxy(x+250,y+20+400,"change");4 t3 B9 ?2 o# A8 M7 J
    rectangle(x+270,y+65,x+330,y+215);
    : T8 G& H/ J% z: s) s6 Lrectangle(x+270,y+265,x+330,y+415);9 \  {1 o3 T  @3 K' d& j2 c* K/ J
    rectangle(x+270,y+465,x+330,y+615);  _9 f; ?! c3 N
    outtextxy(x+290,y+620,"TT");
    8 s+ \" d( i7 d% q* _t = (float)com;
    2 {: p4 {$ [+ G" d% B2 utemp=(t/101)*150;
    : m8 f' x5 R# x7 q0 u2 f* O: |% cfillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    ) f2 x8 r1 R' |# l/ at = (float)wai;
    5 u% U8 a+ j7 s( a9 etemp=(t/101)*150;' C6 g1 Z3 a4 m' e+ B6 v
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);! U" P; P& Z$ q, i7 ~; j9 ?# c
    t = (float)cha;
    * j" z# P' i+ t1 {+ \temp=(t/101)*150;
    * M4 Q' F* B( P4 a* W/ T, Xfillrectangle(x+270,y+615-(int)temp,x+330,y+615);* y/ r. z" R; x& l* h) }
    for(i=0; i<3; i++)   //画坐标   high=90,length=250& n* Y% d3 K$ W
    {
    % ^5 F& b$ H4 |1 Yline(x+650,y+210+210*i,x+1150,y+210+210*i);! H9 Y% o# Y% T0 z& K1 o! ^. w
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);  f( Q1 n* ~+ x7 K$ l
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);6 s+ T7 b0 q0 B$ N
    ! W8 |; v/ }5 K3 A! f8 j
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    6 r" V- R! X4 g8 g, ^- F! c0 [1 Mline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
      I* _3 }2 _) k3 E' {line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);  c' f0 d: Z' |  T0 R: F& ^
    for(j=0;j<num-1;j++)6 a3 C1 M! n4 n$ k( h! D
    {
    7 _9 ]- S' P8 Kline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    : p0 n9 C- J7 j, K5 Xline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);# f! w2 ^3 e: v: ?5 ^4 h8 Y
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 5 k8 `/ @+ c: M4 z9 C/ p  D7 e4 d
    }
    ' Y& L4 h9 G& ]+ T) M- k4 K}
    ; G5 ?4 U8 w4 [$ N3 j4 b}  {# ^+ B0 P( w+ y
    return 0;
    , B  X/ x  Y" Z; d}& E5 Y6 F+ a* D7 C% b, d
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    ; {2 g( k5 k; d- Y0 N{& @8 a" b( X2 ~6 A
    static int compute=0,waitio=0,change=0;
    1 M' M3 ^4 I6 F! j/ \static int computeLast=0,waitioLast=0,changeLast=0;
    * s5 ~. @3 M/ A+ w4 w2 D$ oint i=0;
    ! W$ B! z. m6 H+ _2 Oif(draw==1)3 v1 V! u+ S9 @
    {
    1 r! d4 I; o$ K9 v5 s//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    7 O( J$ X- j+ c, i6 \2 edrawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);) v% E! }+ |% f6 N: }
    computeLast=compute;6 z  D$ k7 L, ?  p
    waitioLast=waitio;
    . f7 T! t& A6 nchangeLast=change;- A# g# q. L3 ?
    }& `9 _, t, T: Q
    if((* memory).p[0].flag==ready)
    7 I1 p7 A0 j0 I% O& f9 R4 h(* memory).p[0].flag=computing;1 v* p* O0 o8 q" W% r6 c9 t/ A
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    * v5 A+ s' \  q- p{
    , x4 R8 u( H  m/ X6 Hi=(*memory).p[0].computeNum;2 }3 o0 q" R6 g- s1 O
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed9 @+ `" U' z1 g. a
    {
    & g) |% ?+ ~1 l7 X4 a0 @! w(*memory).p[0].flag=IO_waiting;
    3 H' ^; _) m; `( {(*memory).p[0].computeNum--;
    * j' I2 {5 M( F$ Nchange += exchange_IO_Compute;( T* ]+ E) p" s5 ]& y
    compute++;
    " h% m* C) |3 g( F: B}+ X4 f( p7 v) }: h  ~
    else) a! r, ~$ S) ?5 {6 V
    {
      R* E1 X/ P& |% jcompute++;
    " L1 }) z" g- E% u}
    ; L* w: [3 j7 y& Y, O6 r0 R}
    + m+ C0 G$ C) g0 v- V5 c. q+ W0 {else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    : \+ N9 {' H1 Y! K- `5 v{
    ; i1 G8 A8 V+ m6 T' I, x* c- F: z  i2 s0 X5 C2 r
    i=(*memory).p[0].ioNum;7 b# u& K6 o+ f% V6 ]8 q
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed3 L2 I0 b- [2 f5 c0 m/ j
    {
    4 ^' K% G0 ], D& g(*memory).p[0].flag=computing;
    * t' r, E) [! G0 F. F! h( t# w! O(*memory).p[0].ioNum--;
    * G4 u) V- j! b. k% Xchange += exchange_IO_Compute;0 A- i- p, a8 b4 ~: h# ~
    waitio++;- j% O0 Y0 s  m4 X) s* z
    }
    , s! r# u. y6 I2 w* Jelse
    1 f$ V4 D+ c( m( ~1 S{! l" q7 B9 @+ a
    waitio++;) H0 Q- X0 P5 F* i
    }
    6 ~# |6 V3 A5 c}) k  t0 E2 H% l' n  |& o
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    . j$ J, C# ]- k1 j7 q{4 |/ A: r5 U9 K' z# c/ B
    (* memory).p[0].flag=IO_waiting;
    . A4 Q9 o% S# mchange += exchange_IO_Compute;
    ; h* y: D" ^) M0 ~}. \; [  P; g7 o% I/ x, m: H8 ^' I
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)( M- I% ]( u# b8 N
    {
    6 B* u8 v- C# s$ `(* memory).p[0].flag=computing;
      e3 D$ ?# m% Q* d- Mchange += exchange_IO_Compute;9 b1 w' V: s; e( o9 e8 I! d/ W
    }5 w2 @* I# w4 z: }& h% S1 [0 j# x
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    " _# A6 G5 y# v{. D, w3 v+ y5 m; W9 F5 L' v2 G7 W, d. {
    (*save) = (PCI*)malloc(sizeof(PCI));
    # J. K+ K7 m6 @9 h( l' F(*save)->next = NULL;
    " r* g5 M" \3 w. C& p9 @0 W(*save)->processID = (*memory).p[0].processID;+ u9 ]& W2 Y/ f
    (*save)->comeingTime = (*memory).p[0].produceTime;$ D/ Y- i4 H6 Q* E$ c( {  @) @
    (*save)->askMemory = (*memory).p[0].askMemory;3 c0 ^7 ~; [9 Z( k/ Y- x
    (*save)->compute = compute;
    ; I. V; v7 V! B  e2 ~  T4 J(*save)->waitio = waitio;
    2 l) U3 W1 C# j5 F. t  x* @(*save)->exchange = change;
    1 w3 g& p7 @! b9 G+ a(*save)->completedTime = systemClock;+ T" v' j; W* T( E
    (*save)->runningTime = (*memory).p[0].runningTime;
    $ ~0 T  {, K# y5 o*spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;* s8 j4 c: }1 q6 B. H
    compute=waitio=change=0;; o# ~! b7 L* e
    computeLast=waitioLast=changeLast=0;
    : v! ]* u8 Y7 {9 }- x, i* uHigh_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);, @5 H( u' X% ], d/ V+ w
    change += exchange_process;
    5 x7 }- v$ T3 N$ F2 Y& |5 ^return task_completed;
    $ Y3 b3 e3 U% l( a8 j( z4 V}$ R. C+ W) z1 O! M0 Y+ k
    else) i2 p& C' w( i( i
    return task_not_completed;
    + [+ H$ ~+ h4 ]- X' _7 I}
    9 Z* K& F1 q6 D) Uint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch): \- V% a3 L6 r4 i8 U: ?, ^9 h' n
    {
    ' L3 U4 x$ X" x5 `+ [static int waitTime[initProcessNum],i=0,j=0;8 |8 ]% E, f. H
    static double HR_ratio[initProcessNum];
    * ?0 s; k+ \/ Kif(flag==0)                    //初始化数组# ^! D& d& u) g# X5 [! v5 T
    {7 A1 W, u* G6 N) X. O- g1 _
    for(i=0; i<initProcessNum; i++)/ o0 i) {0 Z& `$ G
    {* ^% B9 h) [) X6 U
    waitTime=0;
    / {7 t; v5 Q" i% J  @HR_ratio=1;
    6 [7 i& l, U! [! _* A8 ^}, G3 [: P4 _! B$ O
    }
    2 {2 }) n& D# e/ k1 x3 ?# L( cfor(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比
    . P8 t0 g$ U" A2 d{5 J. y( {' f) H; @5 ?; [; K+ \( e
    waitTime++;! t0 h( b( ?0 p% A) \' G( P0 I
    HR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);: n6 K4 V0 i9 I- S0 Y
    if(HR_ratio > HR_ratio[j])
    . h! [) O; z  r$ O8 e+ Y" Wj = i;0 i* e6 p7 N3 ]$ \; l8 s. D
    }
    8 S# h3 x  d+ U7 mif(dispatch==1)                    //需要调度一个进程到内存中执行4 U$ z  j. E$ x( l4 H9 W
    {
    3 s3 |! N. Q1 I2 f/ P) pif((*storage).p[j].askMemory < *spareMemory)
    % A! b: x/ |+ {+ Y+ U7 x. r{& U1 |- C& p- _5 d2 P; O4 Y6 Y( T
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;) C* V1 T5 \7 ?' l4 j6 n, x4 {/ ]5 P
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;7 C6 W2 n* ?& `* \. B. ]& c
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;
    * o- Z4 k7 R  i' Q- \) J(*memory).p[0].ioNum = (*storage).p[j].ioNum;, q; ]3 }8 Y8 }  Y
    (*memory).p[0].processID = (*storage).p[j].processID;8 _6 n/ T4 P1 e0 I! ^$ z4 @
    (*memory).p[0].flag = (*storage).p[j].flag;3 F) G2 d' K$ c1 C; M: ^
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;
    $ ]# K; U  i) a! j5 F+ f- ?(*memory).p[0].computeTime = (*storage).p[j].computeTime;
    1 x7 l9 L4 Z; h9 n" y/ E(*memory).p[0].runningTime = systemClock;1 Z! w$ W/ A* S& g
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;
    , ^* _; b1 @- a1 rfor(i=0; i<(*memory).p[0].ioNum; i++)
    3 s9 c% y7 Q) H3 y; u' E) m(*memory).p[0].ioClock = (*storage).p[j].ioClock;! W+ A* \+ O% Y6 a/ d) \+ c# i
    for(i=0; i<(*memory).p[0].computeNum; i++)" T9 p3 E- P7 h
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    6 K( q+ i( Y' P' i, @: {(*memory).proNum=1;
    / d* O4 q" C) s( m0 y*spareMemory = *spareMemory - (*memory).p[j].askMemory;7 J- E; Q' d) @1 C
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    1 f) C6 @% }# X1 L(*storage).p[j].produceTime = systemClock;# v; O) M$ G6 E- A
    MAX_COMING_TIME = (*storage).p[j].comeingTime;# }2 e5 [, N: i7 O8 x
    waitTime[j] = 0;
    ; b( j. r5 L2 W; x7 KHR_ratio[j] = 1;
    " ?7 H& i, L- C6 J}
    . m* m# C+ x5 J& n3 E. |  j  ielse
    9 U" L: [5 Z: Q{* A( L. J$ A! B. M$ {2 o/ T
    printf("A process ask for a memory overed the system capacity\n ");
    8 O% W) x1 t. K9 t3 \exit(1);
    + p: S1 F) n, B9 E}9 i, L7 I$ J' Q# U) R
    }5 o* o5 H( _1 ~- F
    return 0;
    ( g, D4 d8 e+ L* c  z1 x}+ C  M, L0 `1 e( K$ k
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)* O. V# q1 v, W( P) w
    {# e) l# t/ T$ P7 F. q! r+ l
    static int compute=0,waitio=0,change=0;2 `0 _* k: O, |1 I
    static int computeLast=0,waitioLast=0,changeLast=0;: `, v6 J3 M) Z1 p1 l
    int i=0;
    " |8 D$ w! `, _$ j  h1 W1 kif(draw==1)
    5 W* ?: a4 h8 W6 R3 o( V: f{5 n$ l0 t& q  ^7 B6 P" \' p: l0 b
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);: X( n( n. M% R; ?: O
    drawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    0 H, S; F+ d3 `* i- m) z- O6 k0 F1 g# ?0 j0 g! ]4 k# H
    : i2 {" B3 l3 {. d
    computeLast=compute;& M& H9 \2 f) _
    waitioLast=waitio;& \1 l4 y* c0 {6 U5 x# L* _& m
    changeLast=change;0 \( p* M2 `. b' V' P5 S
    }
    9 p8 c+ z  ?. m/ @8 Qif((* memory).p[0].flag==ready)( V) C9 ^3 {% k) J; @9 J, _8 x
    (* memory).p[0].flag=computing;5 ^& l8 x* R$ U- w0 J" N, G
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    + j; w0 q1 n# A/ \% V{
    , {) D" C: s6 ~, p1 hi=(*memory).p[0].computeNum;2 E/ ^4 L* C0 [- d% d1 F
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed
    ' H& ^; U) C* d& x{
    7 w& T1 ]  `! z% M(*memory).p[0].flag=IO_waiting;$ Z+ F: W) [7 l) x7 C1 {" _
    (*memory).p[0].computeNum--;' Y( a  B$ E- m' X
    change += exchange_IO_Compute;$ u% Y4 b' D) o
    compute++;! ]4 v! h  }, ?% v# {/ a: K% L3 J
    }6 S: p8 D0 R8 L8 s; |4 I& C- V
    else) r9 S( o) D. H) }5 O, C
    {. y* {- o' T$ H! C$ p, j
    compute++;
    . t3 [0 v" T; c, ~}5 K+ J* T8 ^# _$ ]
    }
    8 [& S' C, R; `7 U! `; U7 o( [; Velse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)( O! p! X  f! p' d
    {
    $ ~4 K5 i# f1 f; |/ j3 p6 Z* i
    : \2 ^( b8 `' E/ `# w! W1 d9 B- Ui=(*memory).p[0].ioNum;
    3 a8 `6 B7 n$ {0 E9 T! Oif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    0 [4 y- _. W6 x1 M% e{0 ?, [' b2 D7 J  p1 l; X* V5 g
    (*memory).p[0].flag=computing;9 e; Q0 x( P# M
    (*memory).p[0].ioNum--;
    5 E7 C0 n/ t7 e! Vchange += exchange_IO_Compute;6 z  R/ N- n% s3 m) {) n7 {# S# P; e
    waitio++;
    ) m$ D. P# T& Y9 i3 \# R/ N}
    ! j# f/ ?, P' ]5 [* S$ ?# y! melse
    7 b+ o4 q' P0 g1 s/ H  y{9 N9 j3 J$ T1 C7 h- J- \% E
    waitio++;3 }! p/ [$ Z. U5 U# J$ L
    }; V; d- [! \5 G5 U3 U3 I7 z
    }6 p5 q5 u" w) V- u' {& M
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    & {' `; d* [& c! @( I1 i# g0 G{
    : Y. e) p  s$ O3 K. D3 X& ]* I(* memory).p[0].flag=IO_waiting;- C1 m- `0 a( b1 v
    change += exchange_IO_Compute;+ E& S3 q0 R1 E- i
    }7 n. [+ o; s+ ]' ~  \
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    7 w1 e1 p8 v4 r$ d$ ?) n, C{
    $ E9 D! j/ X4 k+ d3 R(* memory).p[0].flag=computing;
    9 y, \7 e7 ?% g: r: Echange += exchange_IO_Compute;6 n5 u" g  R# u% T  }: w* W
    }# _' D5 R3 P( @$ b
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成* @: O9 P$ D9 G9 f- ~
    {+ h4 r1 h+ V- o) s  q4 Y( O0 A8 f" `
    (*save) = (PCI*)malloc(sizeof(PCI));
    " F2 ?3 z9 ^+ f& n(*save)->next = NULL;, T6 @+ D2 o7 _0 t: D( X) ?
    (*save)->processID = (*memory).p[0].processID;
    5 s+ O( D" ^, l7 m# }(*save)->comeingTime = (*memory).p[0].produceTime;
    % Q/ R" N- P* G+ p5 p6 V(*save)->askMemory = (*memory).p[0].askMemory;
    8 G$ V/ H( [' O; ?4 p  J(*save)->compute = compute;7 c9 ?! y  B) m  x; [' k) S
    (*save)->waitio = waitio;9 O/ ]( v  X/ z& w$ U4 l& P3 N
    (*save)->exchange = change;
    + i7 g8 D$ j4 ^5 I# U) n(*save)->completedTime = systemClock;
      O  l" X9 K$ d(*save)->runningTime = (*memory).p[0].runningTime;
    ; Y  N0 h5 L, I( L*spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;
    2 Y8 r8 J4 l8 }1 |( P0 Ocompute=waitio=change=0;
    " @+ E" m1 w# @( x$ G( L9 ^; E) xcomputeLast=waitioLast=changeLast=0;
      y2 U# s4 r7 r0 \- T& q; c: ~Priority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));7 u' Z4 p, a# p: F4 h8 P
    change += exchange_process;
    . G3 U+ {& L8 ~5 `5 V% B5 V0 y! }* y. breturn task_completed;) f1 x  Q6 z4 J+ D. Y' f+ z2 o5 Y
    }$ c1 t$ b5 f& q# _
    else* I: @, R% G: t) Z- B% e8 \
    return task_not_completed;( ^5 ]6 a) m6 A$ H  g  v9 S2 M5 Q8 _
    }
    " ?" A7 Q8 _9 Qint Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)9 S2 M" @& A% \: a4 x
    {2 ]1 N: t. u! p! o  w0 f
    int priorityNum[initProcessNum],i=0,j=0;: e7 D8 F4 m" y1 w: |9 O) D0 Q- E
    double temp=0;
    " b3 O' u& K: j. |  F) `for(i=0; i<(*storage).proNum; i++)    // setting priority to each process4 Z3 p& x/ x: V) W$ L- T
    {' r; B: D- C: p! G
    temp = (*storage).p.computeTime/(*storage).p.ioTime;
    , Y0 b8 K+ }4 wif(temp > 0.8)( E- O% n/ H* z7 n0 g
    priorityNum = 6;% B# ~, }( E( n9 l% E
    else if(temp > 0.7)
    0 c! ~6 y1 I, [' c0 lpriorityNum = 5;! ?) m; B0 l4 |( c
    else if(temp > 0.6); T, E* ?" K7 {: S/ O3 |- ^% a/ p
    priorityNum = 4;
    . q! T- W$ Y$ m0 g# b" zelse if(temp > 0.5)+ w. u+ \1 _7 h
    priorityNum = 3;" c7 E, M4 [' N
    else if(temp > 0.4)
    1 d: R) w& [& P/ C% G; Y8 ZpriorityNum = 2;0 z6 E2 Q1 ^" ~: b+ L; q) G) }0 M2 W
    else4 K4 x$ z  \/ ?
    priorityNum = 1;# Y. Q  Y1 [3 @7 G' i& H5 @" ^( F
    if(priorityNum[j] < priorityNum)
    ' ?: y$ a  a6 }$ N+ E+ m0 l: @4 r( a2 Pj = i;
    6 p1 D# R) o; }3 v9 z}
    ) A/ v) E( O8 kif((*storage).p[j].askMemory < *spareMemory)
    4 o; n* B5 c/ C' g$ i0 \9 H{- M8 w+ k7 ~( A5 J7 d0 D
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;) s" [9 C8 C3 D+ U# T: y3 K* `: h
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;5 _4 u2 Z+ v! R* j) O
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;' E8 c  Q  @  C( V7 z$ @
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
    ! a) p! o5 h; f+ T(*memory).p[0].processID = (*storage).p[j].processID;) t: q: A3 ^) A) p3 |
    (*memory).p[0].flag = (*storage).p[j].flag;
    ' y. g2 {* V1 U* ^0 J7 n% Z7 C(*memory).p[0].ioTime = (*storage).p[j].ioTime;  e  x7 |  e; A& K3 h) X& ]
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;
    5 O) q* \2 i+ a) `(*memory).p[0].runningTime = systemClock;
    . G2 H, X. z" K$ t0 b% Y  e- X(*memory).p[0].produceTime = (*storage).p[j].produceTime;- X; ]2 e7 t7 H5 S0 b( h
    for(i=0; i<(*memory).p[0].ioNum; i++)
    % N9 y, [8 w* X; `8 s(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    2 {5 h5 Q2 m' j( |for(i=0; i<(*memory).p[0].computeNum; i++)
    + ]5 O# X7 g: H' R# d5 B. x  C(*memory).p[0].computeClock = (*storage).p[j].computeClock;
    ; f6 l( W% B& \) u( E" {; O(*memory).proNum=1;
    ; ]$ @6 f7 t  _*spareMemory = *spareMemory - (*memory).p[j].askMemory;
    7 e# L1 a& x$ t/ f8 o" ?+ N% r  u; Mproduce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    2 ^+ T6 i1 l" S! ?5 z% i# ^MAX_COMING_TIME = (*storage).p[j].comeingTime;
    9 G6 S! X4 \$ A+ L" `}6 O; c8 y2 F0 L+ V# X  x
    else+ V+ t- ]0 A) D
    {
    0 v0 S1 v0 k. a3 Xprintf("A process ask for a memory overed the system capacity\n ");
    4 f- ?) W. n, i9 \! w- Y! l0 Lexit(1);
      b4 v9 h- a) u}& h5 ^0 Q# k4 }
    return 0;
    ! o2 l; d" m- R7 I# b+ U* P1 L8 U: h}+ h, V* L8 G% X4 h' |* H. S5 t6 s' k
    int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    8 |4 \. d1 W2 {$ e' p& R0 ~, O{3 l) Q9 T! U! |! k0 [
    static int compute=0,waitio=0,change=0;, z0 b; j7 C" v5 h  p& d
    static int computeLast=0,waitioLast=0,changeLast=0;1 b7 I1 F* N4 g3 X$ H1 p
    int i=0;
    ( J* I; S4 d  r# ^if(draw==1)# d8 H/ B* l, C" ^0 G( p
    {
    : K+ F* `* k# c8 Q$ e* B) [//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    " P: F  G( N+ X, A3 E5 s8 L; ]drawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    ) e+ q5 ^6 f4 v$ K
    7 j" Y: Q+ r5 j' g
    . n% R& i7 K- X8 ^: o5 McomputeLast=compute;6 P( A' ^0 O: Z% T# B
    waitioLast=waitio;7 |3 S0 q- q( s" L3 d! d
    changeLast=change;9 t7 g3 A+ M5 O0 V& @
    }5 Y3 m7 t% l: x" F) h4 c" ]
    if((* memory).p[0].flag==ready)3 w7 n! I! b% H" p& a
    (* memory).p[0].flag=computing;3 m% c: j* V, G
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)+ q! x* O9 G2 L: }/ P9 h  `' h1 O
    {
    . v8 v2 H* e3 F$ A( k2 `2 Pi=(*memory).p[0].computeNum;% o. m% Y6 ^2 H8 p
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed
    # g% N. M6 ~! w8 r0 C* i$ }{3 P5 W" _3 u! Z' J2 i9 k$ O
    (*memory).p[0].flag=IO_waiting;9 j5 X; I! ]% e: Z$ W3 W, V
    (*memory).p[0].computeNum--;  q# }. S' [& F7 Z9 k; z/ `
    change += exchange_IO_Compute;- {$ U  B8 V! t
    compute++;; k: i$ Q+ c6 F/ _
    }3 d4 J& m- ~; X; ~; j
    else
    6 |2 X6 K: J( D0 y$ F{1 p+ b/ ^$ u! A
    compute++;2 x3 \, X6 W( a7 u9 [  Y4 H
    }
    7 j% J3 b7 b& ]8 t9 ~9 |% `6 r}: T; {! |' k8 o$ a
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting): z+ [4 g  U3 K3 w7 O2 o$ _; E
    {/ o- |6 D' u- N" h! W' E2 }% j( G
    3 i3 ]5 ?3 u. ^' T" n
    i=(*memory).p[0].ioNum;$ S: z) K& U$ k3 s
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
      P3 Z: W2 |* U1 W6 ~: x: c: S{4 Z. J7 F  M* W9 K2 ~3 B
    (*memory).p[0].flag=computing;
    3 d8 Q; z$ a  h5 R# }' U(*memory).p[0].ioNum--;% G: }% J1 _  d7 e; Z# s
    change += exchange_IO_Compute;# n6 p# y* o1 H) A7 r- G4 z
    waitio++;
    , f5 ^, t' D: D) k}
    / j! H$ }- \& [+ V8 Nelse
    , F' i( x* Q7 K  K5 j6 b0 l{7 l# A2 k2 S7 S! U- j
    waitio++;
    $ A- e- R( v5 L9 \6 D- M}, M, I' o& d9 I. k5 n+ y
    }
    7 B' W) p8 C) Z. A9 m( N; yelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    % ?: m- f+ _; O" @/ o& \2 o{
    6 p. o- m+ C% _! u2 h* O2 e(* memory).p[0].flag=IO_waiting;
    9 ]5 A/ v1 D3 f2 v6 ychange += exchange_IO_Compute;% R1 Z8 B8 B7 o- E% u
    }
    $ ?  b4 y1 j' j' j+ y: Zelse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)4 o1 d' c) F! e9 h* ~& r; g+ B
    {1 R, b$ I( ~6 t8 D; C7 G* Y) o: o
    (* memory).p[0].flag=computing;
    : s* c1 ?2 z8 B9 N. M5 @change += exchange_IO_Compute;
    * F- L. Q% V* L3 L1 l3 K8 y}; b3 y- V7 z- }2 W; H4 E7 w+ `
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成4 X2 N  m0 Y1 I- ~9 O
    {
    * T# D. O% M, y! i(*save) = (PCI*)malloc(sizeof(PCI));
    % L/ s# z. T5 n& D2 E4 F( L(*save)->next = NULL;
    $ r' E; q. B" \2 `$ L# g(*save)->processID = (*memory).p[0].processID;
    $ u# R  l" \- q+ ?/ v; u- C(*save)->comeingTime = (*memory).p[0].produceTime;; s8 W* k' B* ^$ n- P
    (*save)->askMemory = (*memory).p[0].askMemory;
    - y% g4 f# Q2 L4 n2 F(*save)->compute = compute;. r+ w2 v. [5 K* o+ m! P
    (*save)->waitio = waitio;  {: d2 N* V: L0 V" r/ x
    (*save)->exchange = change;
    8 C: S: m3 x' @(*save)->completedTime = systemClock;6 v, X# t0 }+ L- r
    (*save)->runningTime = (*memory).p[0].runningTime;' ]+ D+ Y2 K# s- F- @8 R  p
    *spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;+ L/ z6 ?& w9 w' j
    compute=waitio=change=0;
    4 Q+ n  [+ @' g6 b1 v" CcomputeLast=waitioLast=changeLast=0;
    & M% M. P, D% O& C  h7 HSJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));; ?' A0 q) s5 |) Z9 Q) M
    change += exchange_process;. c7 r, q. f: q0 I5 L' B
    return task_completed;5 v/ S6 o7 C: X( z# R
    }
    1 |' S8 m! x+ c9 X( e! Kelse
    0 G4 a/ A, G% W( i! Areturn task_not_completed;6 }8 n5 a/ |- ^: q
    }+ B/ ~7 p, p) W
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)) T4 o& n( `1 S
    {1 s3 p' ^3 I7 M+ j* ~
    int i=0,j=0;$ N& C6 d& i/ c5 F# j2 s: h
    for(i=1; i<(*storage).proNum; i++)# {& r. X8 f$ b
    {6 X% ?9 i9 p6 M' ]% @8 m- b4 G
    if(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime))4 `! B, a) j( j# M2 v! v; m
    j=i;
    7 W+ F  i$ @% }* I}* i; y& [, K: X
    if((*storage).p[j].askMemory > *spareMemory)
    % o, e9 V3 G; K/ q' X{8 c/ K; z, J5 G2 _( H
    printf("The memory asked is overflowed than the system memory.\n");" d; {' n9 A1 _; r
    exit(0);
    % M1 ?. K% J1 O2 ^/ u9 q}' N: ^3 ~/ b7 g3 W7 n1 K
    else
    * p6 M' s5 V" }+ v{
    ( n& S% N& t- w1 o, r5 G(*memory).p[0].askMemory = (*storage).p[j].askMemory;
    " r1 p# t6 \4 Y0 y(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    * D( V; }# s4 e% f. c(*memory).p[0].computeNum = (*storage).p[j].computeNum;
    & _: j* [: r: j$ c* Z- y5 U(*memory).p[0].ioNum = (*storage).p[j].ioNum;+ w7 E0 v: C4 N
    (*memory).p[0].processID = (*storage).p[j].processID;8 b* B  J7 b% |+ j* G
    (*memory).p[0].flag = (*storage).p[j].flag;
    5 p* `  f  I/ N2 h8 ^$ j3 H(*memory).p[0].ioTime = (*storage).p[j].ioTime;
    2 z7 ?2 u7 _$ t* a- Z  ](*memory).p[0].computeTime = (*storage).p[j].computeTime;" H1 L5 X# P% k5 _! [4 c, g
    (*memory).p[0].runningTime = systemClock;
    ) ^  V( O) e8 f(*memory).p[0].produceTime = (*storage).p[j].produceTime;0 ^1 ]8 F" k+ o) R* [
    for(i=0; i<(*memory).p[0].ioNum; i++). j; a( R: G/ Z5 @+ {
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;$ G# j" {0 Q. N1 \4 Y7 T- C: E4 v
    for(i=0; i<(*memory).p[0].computeNum; i++)' m3 F) y5 B" m# Y5 ~' ^& }( Q
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;9 b3 P% n' A# c& \6 {5 t/ N
    (*memory).proNum=1;
    5 O5 ?% {) @, e7 f* d  j4 S/ _3 Q8 \*spareMemory = *spareMemory - (*memory).p[j].askMemory;! V/ a/ f" F( b1 B
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    + D; h* z! u  _7 B+ q$ kMAX_COMING_TIME = (*storage).p[j].comeingTime;
    , w" a( k! b4 }}
    + m& o, j3 y+ }9 R3 o4 U) F! K4 areturn 0;: N& D. T& G1 K( k* A3 _
    }) \% ~2 S: d# D; b. {; B0 a/ _6 t5 m
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    ' v& b+ ?; X; W5 G* Z{
    " z+ p. c& U: n( _0 R  X$ n) Istatic int compute=0,waitio=0,change=0,clockSegment=100,poi=0;6 ^/ [! b% j* N, b* j0 I0 J3 Y" F
    static int computeLast=0,waitioLast=0,changeLast=0;2 Q4 C, \' g* l( m1 h2 M9 N
    int i=0,j=0,k=0;
    ' N% n- d2 l0 H5 lif((*memory).proNum<=0)5 w0 Y0 \! p$ F. ^- a1 S+ ]+ i
    TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);
    6 \; L/ t0 }# e* Vif(draw==1)2 |$ W9 Y  N2 A7 k
    {8 \, ^  S, n' b4 _: t. b- t
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);* F* o& O4 O" Z
    drawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);' O- ~- \  P: t: E7 y
    6 m0 ^$ R+ a8 V
      S0 p0 c4 h, p
    computeLast=compute;. ?" L8 S" u' R5 L! o
    waitioLast=waitio;
    2 z# l; {! D+ A: t' o9 VchangeLast=change;
    2 r* {2 V' _% `2 g2 C}
    . r: a6 B& {3 C$ z# s2 }if(poi>=(* memory).proNum)
    4 d  C; r. I% [, |' Vpoi = 0;
    ) q& e8 x( J2 N3 T: T  a6 mif((* memory).p[poi].flag==ready)
    ' R/ [. u) E- J9 ?(* memory).p[poi].flag=computing;
    6 U# x3 X6 H) A/ I2 `* f  U1 gif((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing)
    ' s/ {5 M$ j# X! Y{: U, O& O. m7 [# O$ k( U
    i=(*memory).p[poi].computeNum;1 O- h! v% S  [
    if(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed" m4 f: D+ q! b+ [
    {
    & E/ W2 U, p' o. i2 K(*memory).p[poi].flag=IO_waiting;
    * R( p& @4 H6 m' z# L/ T(*memory).p[poi].computeNum--;
    7 H' A: I" d4 T$ K" Lchange += exchange_IO_Compute;
    : _4 h- j8 I9 Q9 ]2 acompute++;, @" A  S3 t* ~  ]: P
    }$ c/ w# ?7 |3 C. R8 o8 l
    else
    9 Q- Q, ?! U1 W# w4 D- R* i{
    " O8 q% n0 _- B( J1 ]% Y; ncompute++;
    % q; S- v. ~+ d6 k+ j" r4 k% x6 b; A1 t}4 @( F, s3 ^4 m# |4 Z' g% z" z- G5 U
    }
    " h' L. _5 \. R8 E5 O$ Pelse if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)
    $ _3 U/ s9 ^" S; \{
    7 A4 f+ i+ B& W4 _+ S9 S8 w; N9 o
    1 B9 }6 E, _* h( s" ^5 Ui=(*memory).p[poi].ioNum;9 J, V/ j! f7 i8 G
    if(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed
    3 O% g- u& j+ S/ L{
    3 q. V) N  S# k(*memory).p[poi].flag=computing;' ?0 X5 d' V' w4 r  X1 K% i
    (*memory).p[poi].ioNum--;
      ^& P; Y- W2 U7 f- b5 Bchange += exchange_IO_Compute;
    4 t2 O3 U4 D) n% h% fwaitio++;
    % Y& L8 y9 f" j; r}
    $ S9 k; d& Y' [! B9 Aelse
    9 R+ Q  U: I3 J9 f{# ^  y5 n1 p5 l* ~0 z
    waitio++;
    . [( Y! P5 V- H! d1 Q}* i4 i+ ~: ?! I- H! i/ b* W7 V/ a
    }: w1 J) f4 \3 C" G
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)+ l0 u7 h) T! a8 F& u+ p5 s
    {8 u) ^0 J3 F, e; s# B! B& R- ?
    (* memory).p[poi].flag=IO_waiting;' a7 j3 W; A, h4 d
    change += exchange_IO_Compute;* }5 Q. X) d4 v$ v8 k8 [
    }
    & l8 b+ o: K0 N* W, P: V: nelse if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting)
    ! I' L5 N2 J& B{
    ! q3 q7 M3 u2 F5 O(* memory).p[poi].flag=computing;
    , C. \  U- @" [change += exchange_IO_Compute;2 t7 U, P+ n+ x" m. _/ k+ M
    }
    , I3 S5 D$ y. n* _& P" S9 Hfor(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进4 `5 Q) a+ H6 `: k; ^- N
    {
    4 M5 s0 L) h6 xif(i!=poi && (*memory).p.flag==IO_waiting)9 |7 {4 m! `- V% P
    {0 l* _9 ~! v  o( n5 k
    j=(*memory).p.ioNum;; s& ^; a+ y, d2 d: L
    if(j>0)/ K- [  ?% O2 c+ E
    {8 C# N! t; d# t7 g( G6 V
    if(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed
    / F) D9 A0 z( E{
    - U8 ]2 U0 a; c. E6 u0 t(*memory).p.flag=computing;/ y1 a9 I/ C3 Z1 k) e, L
    (*memory).p.ioNum--;( D( U  {) q' k
    change += exchange_IO_Compute;
    6 j7 n# [2 F0 I6 Y9 N$ q}- ~' w* A4 z2 @- L
    }
    $ v% q% `8 r1 v  ]% P- _}
    ) M0 c$ [4 ?. L6 x8 H8 s5 V' m* M}
    , G6 C3 p! c) Ifor(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程
    ! s" z1 Q5 [' Y& G3 g' e( S( v{
    " c$ Y) d: W  }* H( kif((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed0 c- O% Q) X' [& o5 C- _
    {
    $ F% K5 f# _% j" \/ L4 c(*save) = (PCI*)malloc(sizeof(PCI));( U+ X  Y( d2 i6 F9 U
    (*save)->next = NULL;
    3 }& o5 Z6 R& ]" ?$ y0 b8 r       (*save)->processID = (*memory).p.processID;
    4 E% u. G$ j9 [, ]* f(*save)->comeingTime = (*memory).p.produceTime;
    9 Q& @1 `2 o+ w+ O4 U+ ]  z: k' A(*save)->askMemory = (*memory).p.askMemory;4 D) h3 b& _0 i- }8 }5 ]) W7 l3 X
    (*save)->compute = compute;( p% S6 `3 e& X7 {0 x' D% H, t
    (*save)->waitio = waitio;
    0 W0 a- l2 G, ^4 b  H) c7 k(*save)->exchange = change;2 K0 {0 z+ ?; g- |- C* p' g) R) M2 Q
    (*save)->completedTime = systemClock-(*save)->comeingTime;
    7 S% P: ~/ o' @0 G# C, p* z7 ~& |(*save)->runningTime = (*memory).p.runningTime;0 v# u% k4 G) p6 Z
    (*save)->completedTime = systemClock;1 T0 _5 Z  y6 a; p& }" u9 ]% ^
    *spareMemory = *spareMemory + (*memory).p.askMemory;
    - n9 q& q6 E8 z! H# k" I3 Rcompute=waitio=change=0;! e6 i1 b! n6 A. E% ~
    computeLast=waitioLast=changeLast=0;
    - O# t6 W& g% m6 Gif(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入9 J5 I4 b" q' v4 u: D0 ^' [; [! D
    {0 H- w& _, r  D# a1 k# c5 m8 ], B0 \
    if(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程8 u) u3 O+ v' b: J
    {
    - m" ~- v; N5 h/ X3 [poi++;
    / i; A# c% ~8 ~) r   clockSegment=2000;
    8 R. D1 l# ~7 s* R% `* R}
    4 |7 V9 j1 i$ b$ g8 C}
    8 }8 W2 h! G7 r9 t8 M( ?7 x6 v8 N, ^else  //没有足够内存调入新进程
    + F8 y7 P" j* R/ Y$ h" b7 v( s{
    & i% n1 c& M, \* C0 Z8 s& qif(i < (*memory).proNum-1)
    % J# ?8 C* X5 K& Z* E, {- s+ y{
    & w. [! j" d4 j( R2 i2 j/ dfor(j=i; j+1<(*memory).proNum; j++)
    . y2 u% e% e5 \- i# e{2 {. R! \) u. }3 D2 A. g
    (*memory).p[j].askMemory = (*memory).p[j+1].askMemory;
    ( V+ G* I5 O1 ]9 H' `9 A(*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;
    / u1 c8 k( \- \6 ?(*memory).p[j].computeNum = (*memory).p[j+1].computeNum;- E! O! Q) g  E9 s$ J( }2 f# _
    (*memory).p[j].ioNum = (*memory).p[j+1].ioNum;
    - Z9 A3 n, |: [  e; q(*memory).p[j].processID = (*memory).p[j+1].processID;9 K, x8 r# p- v
    (*memory).p[j].flag = (*memory).p[j+1].flag;
    / \# {& z( |$ v/ _4 b(*memory).p[j].ioTime = (*memory).p[j+1].ioTime;
    * H- b: B4 c, R! A(*memory).p[j].computeTime = (*memory).p[j+1].computeTime;0 u' l$ z* V6 I' e
    (*memory).p[j].runningTime = (*memory).p[j+1].runningTime;
    5 |, _, X# O$ }5 a(*memory).p[j].produceTime = (*memory).p[j+1].produceTime;: W( e5 Z, G* _8 N. s) n  A
    (*memory).p[j].completedTime = (*memory).p[j+1].completedTime;, m# b0 {$ Z, u: x
    for(k=0; k<(*memory).p[j].computeNum; k++)& p7 O3 t5 b- C* y
    (*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];
    0 T3 R$ H& Z+ Tfor(k=0; k<(*memory).p[j].ioNum; k++)
    0 t- x, ]1 d. a, l/ w6 @. l(*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];% S; B5 {/ U5 ?) S, E
    }
    ; ], ?. n& V8 X; i: K6 k6 B! dif(i<poi)+ B6 ?7 i1 n! `( \1 e# n9 Y
    poi--;
    1 D+ m0 W* ]" Z$ S/ ]$ b  ?/ G6 Kelse if(i==poi)
    " J6 i9 o: m7 r" ?clockSegment=2000;
    % v8 f' H4 e9 Q- t}
    + c6 p" R3 T* o, |& g  @' n1 }- F5 C- Li--;
    " Z# k0 j8 \: }$ B(*memory).proNum--;4 p, B* ~+ y7 o+ |% [* q
    }
    $ T/ Q. N) p- V6 A; _9 Areturn task_completed;
    # P! y9 G! s- P  m8 [1 u}
    1 |* A! B, e) l# B# v2 @1 w}7 _6 |- O  {, w/ b
    --clockSegment;
    4 b/ A7 ]% q. b% j& q$ \# v3 M* b8 eif(clockSegment<=0)* T% l5 O: y9 e+ s7 G: M
    {
    ( s$ Y1 m/ y! t+ ?* N' ipoi=poi+1;. N& L; |' L7 k- k8 q& |  ^
    if(poi>=(*memory).proNum)
      u" |8 D- w, r2 q' U5 Ppoi=0;
    # e+ [4 K: _- [  u% A$ WclockSegment=100;2 j; P5 a9 ~2 o" f
    }. n/ r5 X) e+ D, [- S1 N9 k
    return task_not_completed;
    . r0 q8 ^5 _$ m! k! ?0 x}
    + n0 K" \1 v; H# T+ z% Bint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos)
    # C+ x- ?/ w8 [+ `) U{
    ' h# E' {) q" h' pint i=0,j=0,k=0,flag=0,translation=0;
    " e; s4 ]  w  k4 R  }for(i=0; i<(*storage).proNum; i++)
    8 U3 \$ B$ z  a# g! ?) U{
    " s- Q% K$ ]# r5 q- Q7 C8 \5 y/ jif((*storage).p.comeingTime>MAX_COMING_TIME)
    " g+ w/ c. H$ a, G$ ]4 ]6 A( JMAX_COMING_TIME = (*storage).p.comeingTime;# }+ g! ]* z/ \4 d7 d6 k5 c- ~
    }7 w6 \/ Y9 A3 P) q. {1 {2 q
    if(pos>=0)
    5 A5 o" e. `1 l; K+ D3 @{4 r1 |9 {; E2 H+ b( b
    for(i=0; i<(*storage).proNum; i++)
    ; x+ T( D/ b0 X9 b8 _" L" E{
    : ~5 f% a7 u. \2 j4 L. gif((*storage).p.askMemory <= *spareMemory)
    9 h5 Z5 E  v% l4 v$ L( m0 ~{' e/ @, i' Q9 t; o- {5 O) E# k
    j=pos;
    0 b" Z  q8 f* Z+ n/ N, a8 W1 I/ i" P(*memory).p[j].askMemory = (*storage).p.askMemory;
    " a1 ]& V6 A4 S3 D(*memory).p[j].comeingTime = (*storage).p.comeingTime;* y# @& P4 b+ Z* a
    (*memory).p[j].computeNum = (*storage).p.computeNum;
    * k& ?$ T. [9 ^6 `) K+ g" G(*memory).p[j].ioNum = (*storage).p.ioNum;
    8 _3 |' {) `) e0 Q& E(*memory).p[j].processID = (*storage).p.processID;
    . @  M! e9 N# S! @9 |(*memory).p[j].flag = (*storage).p.flag;" L+ R) l$ S( y( Z# b
    (*memory).p[j].ioTime = (*storage).p.ioTime;0 ]- B+ m( F' O# F
    (*memory).p[j].computeTime = (*storage).p.computeTime;1 K' |! @/ R5 i6 O  x' [
    (*memory).p[j].runningTime = systemClock;- a( s6 e0 g& j% b/ w" B- i
    (*memory).p[j].produceTime = (*storage).p.produceTime;
    ( I$ p! o# Z! i! \for(k=0; k<(*memory).p[j].ioNum; k++)
    , X' F" P9 y$ i4 {(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    . l) C$ P+ W& [for(k=0; k<(*memory).p[j].computeNum; k++)9 V5 |5 D$ ~# ~) a2 @4 N- ^4 q0 A
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];5 n; u% m( a& K# o) E3 N6 Z3 F+ k( x
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    1 G, \4 H, N" K  D1 a9 Xproduce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    2 }+ q; \2 o* `3 l' g- i) Q5 Q8 gMAX_COMING_TIME = (*storage).p.comeingTime;) R+ k, D/ I& {- ~) H
    translation=1;# _" k2 R3 e7 m$ I$ y9 J6 O4 \
    break;( j  T- O' Z6 C5 c4 |. ]0 Y* X
    }
    9 R  y8 e9 [6 Z0 j}
    ' k. T+ L6 z) d; D/ N) O}
    ( ]' @$ v+ |" ~. d5 _% m; ]else! g) z- w8 V# g) A
    {
    / b) ?; a4 w% P  y, w0 a9 hwhile(1)
    9 y  ?/ i, K3 y3 c8 g# O/ D  l{, x9 w% W6 K/ J( ]) [3 l
    flag=0;$ y! i7 y& }6 j/ R/ n- q4 ]
    for(i=0; i<(*storage).proNum; i++)8 o/ @8 b5 u' W* U2 }8 A: o
    {
    5 Z# t8 S$ H9 h2 u5 o$ e  E+ Sif((*storage).p.askMemory <= *spareMemory)
    ) X; Q7 u5 n7 G$ W{
    " a7 t; d# o1 p, }0 _& l# N/ ?j=(*memory).proNum;
    % f5 ^' R( {6 I  ^" w0 H2 Z3 j; j(*memory).p[j].askMemory = (*storage).p.askMemory;9 n5 g# `5 x! S
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;! b# }& o. I" i# A: Q: k
    (*memory).p[j].computeNum = (*storage).p.computeNum;
    " y3 ~: ^! t3 }; b2 Q. t4 ^(*memory).p[j].ioNum = (*storage).p.ioNum;
    # g+ H  l! R4 I, b: ^; j(*memory).p[j].processID = (*storage).p.processID;
    : t- u) N: c# h8 S! x(*memory).p[j].flag = (*storage).p.flag;6 |5 k: Y$ u& g  R# C$ q/ d
    (*memory).p[j].ioTime = (*storage).p.ioTime;
    1 n" J4 K! v, |' i- F" Y7 @& w% ](*memory).p[j].computeTime = (*storage).p.computeTime;" u! P: a  b5 r1 S0 z- t8 R
    (*memory).p[j].runningTime = systemClock;% ~) V+ o. Y! }& j/ y* a! n
    (*memory).p[j].produceTime = (*storage).p.produceTime;
    : L% g( e8 H( v5 zfor(k=0; k<(*memory).p[j].ioNum; k++)- H: X) H9 y/ N! C7 A. L* ^
    (*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];4 ^- @# y% Y3 c& d
    for(k=0; k<(*memory).p[j].computeNum; k++)! y$ t9 x, E$ d' L) m
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];9 {5 j! t" w- d* _
    (*memory).proNum++;, g5 c' k8 U; O- y
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    . ]4 m5 V, [& h* j0 [produce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程( x* H7 Q+ }5 ]. u, _6 |  ?
    MAX_COMING_TIME = (*storage).p.comeingTime;
    4 J6 N/ v3 e$ z1 X; D  F/ [. Zflag=1;
    1 B6 M8 _) J% \. ?/ ttranslation=1;1 X% ^" W  F9 F0 o! ^
    }
    / e) s$ O% X/ S% v7 J1 ?1 ~# [}' l" Z: n/ c) ~2 [
    if(flag == 0)( i8 r7 h, E( o. y% H
    break;
    + k0 r0 o" d; j1 J}
    8 K$ [) F$ {* K& n9 j7 o5 M2 V}
    ( }6 \5 L: j2 K+ I: @& hreturn translation;
    3 }6 K8 F: L: n! U}& b2 M% Z' D6 Y! D1 D  g! o
    int FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)
    ' `" @/ r/ O5 Q6 k{
    ' C# B1 g) ~2 m4 Istatic int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;
    $ [) e7 Y* i7 i6 z% i, a% A) Gstatic int computeLast=0,waitioLast=0,changeLast=0;( Y& o# q' A; I# T! d/ m/ i' A
    int i=0;
    7 U5 `2 ?3 u) d8 o1 [if(draw==1)
    * P9 u' O0 p4 {. o& \{' _/ L! F" |2 S. e+ k+ H
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);- ^! ]5 m9 B- `# p$ r. E$ N
    drawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);, O: T" ]9 j; A' J  A/ x( F3 F$ G

    / b! U3 o7 g. j7 l
    3 m5 I9 V, D5 QcomputeLast=compute;
    / t) B8 W; v+ Y1 Y- j6 ]2 {0 ~9 ~waitioLast=waitio;
    + Y# u# Z* }. f! _5 A1 b; ?, `changeLast=change;
    ( m0 {# H! U. P3 ?* e}
    # w+ m$ H- a# L- e8 ~5 h: S, f1 mif(flag==1)  * K/ m8 C* a9 H" b$ b# F+ Y/ h
    {
    5 {2 m& M  i8 k1 sif((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed/ V' f' [" Z* A5 S. i6 n
    {
    & h: J7 c/ f; [; v  i: cif(flagiocpt==0)   // implement compute* [3 z# ^* }5 ^0 E8 p
    {
    3 P1 D$ \3 r3 G) C/ ?i=(*memory).p[0].computeNum;: z0 N' P$ Q9 q* u
    if(i>0 && (*memory).p[0].computeClock[i-1]>0): s+ P/ ~' V7 ]6 w
    {! h( q- X' N% Q! _* M; k8 j
    if(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed5 K) x8 w$ b' Z8 L6 H
    {
    3 V! i$ x2 a) |flagiocpt = 1;' ]3 C- g' g- P( u
    (*memory).p[0].computeNum--;5 Q. ?0 R& l: V4 Y
    change += exchange_IO_Compute;5 T1 O/ l4 ?% W3 }
    compute++;
      [& k+ [, D) o& p4 u}4 s' Z7 I; x& F0 Q6 ~1 N
    else# R2 I" \( P- n6 h
    compute++;
    / B/ \6 u- A: m- R# r* p% D' e% X8 O( i6 e# }( ?& ?
    }
    ; \- {& X" a# _( velse: n2 L7 }$ f' ~4 r
    flagiocpt = 1;
    9 O3 m7 U5 O8 H4 V# I}6 y1 A+ o( E6 g  u
    else  //wait io6 w$ r3 h$ r/ Y% p/ q7 R& f$ a
    {
    ' H& |$ ?- `9 t3 M- u/ li=(*memory).p[0].ioNum;( Q7 z. m% @1 s8 A
    if(i>0 && (*memory).p[0].ioClock[i-1]>0)# }3 Z* a6 I( T" w
    {
    % c8 |+ b' y* |/ W, p7 ?+ f& ?if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    ( \$ X" }$ w$ D{
    8 \; e: ^$ w( R6 U! y! k% Kflagiocpt = 0;
    , R& P. C* E5 x(*memory).p[0].ioNum--;
    6 q1 O5 t, i- T/ ]) U; X! Wchange += exchange_IO_Compute;
    6 i, z9 Q% |# j! u+ O! u) b# ewaitio++;
    & d" E% T" [  H- Q: l$ Q/ c}: P, g- A' Q5 ~7 e9 L# ?
    else
    2 v' K! o1 ^  hwaitio++;
    # R; f1 N9 d% Z$ @) E& Q( e8 D. y. J6 ~4 h0 u& L9 u9 X$ A6 `; S9 e$ z7 Z
    }
    ( I3 t. H! y0 v% d! w0 belse
    ' G* X- R* f. p$ L5 Z7 Dflagiocpt = 0;
    ; [2 y8 Q1 x/ d/ s8 d2 S}
    * Q, ~' F9 F( }5 ]! F2 p5 w}; p, a) z( ?5 H0 ~! |2 l* R# Z
    else  //task is completed
    / M( k6 Q2 _: E8 @# M& N{9 u2 }4 Q6 M/ w* {5 F! Z# h0 ]. s
    (*save) = (PCI*)malloc(sizeof(PCI));: q% l' U2 Q  c' h4 B
    (*save)->next = NULL;4 f2 j; C0 J9 c. |* l
           (*save)->processID = (*memory).p[0].processID;9 s; S( I& }( g' a/ r% y$ u- v1 j
    (*save)->comeingTime = (*memory).p[0].produceTime;
      F+ g6 C) U/ v9 B( `) @. B(*save)->askMemory = (*memory).p[0].askMemory;
    & Y0 O  E: ]/ ~( [! }(*save)->compute = compute;0 @9 B9 z: k  x6 G  P: M, L
    (*save)->waitio = waitio;) N' s  b2 `. Z
    (*save)->exchange = change;/ Y7 l; T/ n8 x/ E$ e, J
    (*save)->completedTime = systemClock-(*save)->comeingTime;# w8 y) Y* S1 u/ s! v/ x( X/ |
    (*save)->runningTime = (*memory).p[0].runningTime;
    ' A2 o. A' f* O; M& u4 `  |8 x(*save)->completedTime = systemClock;5 j* v2 U, M) R/ |& D; C
    //*spareMemory = MAX_MEMORY;1 O; c  W' b* _' j
    free((*memory).p[0].ioClock);' D& m* f% N' q
    free((*memory).p[0].computeClock);
    ) G6 i/ S1 \% G0 K& ~3 hfree((*memory).p);
    2 M+ N; b7 n, v! G3 H1 `( rflag=0;
    " C* C' k! [# q7 W6 h+ I0 dcompute=waitio=change=0;
    ' l/ \* l( M+ u% \- VcomputeLast=waitioLast=changeLast=0;
    - V6 k3 `+ s( p  f2 |5 lreturn task_completed;  T  W! C& B% K( l# ^
    }/ r5 s- ^8 ?2 u
    }( P0 P" [5 [# d/ |8 b! c/ J0 X
    else         
    $ \& y3 k  \) n# `{
    7 }& h7 B0 K3 uFIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));
    " Z) w: S' G. y) k% r; ^2 |change += exchange_process;: U: Y( L7 Q$ V7 _. o
    //*spareMemory -= (*memory).p[0].askMemory;
    ' b1 ^$ Z; C2 B. U0 y. q. Vflag=1;
    $ s2 k& \, T# B5 P; z$ k' [//showProcessInf(*memory);5 [- w$ Y0 x4 n, J  o  O
    return task_not_completed;7 L, O3 b2 V/ V. g3 k
    }
    ( I4 J# L% z6 O7 b5 |$ }2 G' x- preturn task_not_completed;
    ! M/ t  w% Z3 ]5 B* w}
    % V# ~$ C3 P; o# E/ U, W8 K4 @, iint FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)& ]& O) b: i2 ^9 D! ]
    {5 e% [5 i& ?( Y) }7 L9 b1 F! u
    int i=0,j=0,k=0;
    : D8 p  S( E4 v7 ?+ w, {: aMAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;
    2 d. r- N; B* }# [* H(*memory).p = (process*)malloc(initProcessNum*sizeof(process));! ?! \8 B; m& k8 O
    memory->proNum = 1;
    7 n; ]' A( {$ X5 [' l7 M  ~for(i=0; i<initProcessNum; i++)
    , r$ S: Q3 k$ l# S4 `' }; D) B1 f{
    0 z7 h& y4 i' K4 V8 I6 `) j. s2 F% k2 Kif((*storage).p.askMemory <= *spareMemory)* E) K1 E* F9 p+ V* H4 v
    {1 a4 J" i5 \- f0 l# c9 r
    (*memory).p[0].askMemory = (*storage).p.askMemory;' t& L8 D8 Z# W& P; k+ t
    (*memory).p[0].comeingTime = (*storage).p.comeingTime;  z3 _; v; b% z) O
    (*memory).p[0].computeNum = (*storage).p.computeNum;
    5 z3 j8 |5 {3 f+ a8 k(*memory).p[0].ioNum = (*storage).p.ioNum;6 @& A1 V9 x3 s/ f9 p( l# S; ~
    (*memory).p[0].processID = (*storage).p.processID;5 g( w7 q2 t" F, K, c' X: e8 I
    (*memory).p[0].flag = (*storage).p.flag;
    $ G, J' }4 `2 w# b! ](*memory).p[0].ioTime = (*storage).p.ioTime;$ m* {" Z5 g9 E5 U
    (*memory).p[0].computeTime = (*storage).p.computeTime;# S' ~. W, \) y( m# z
    (*memory).p[0].produceTime = (*storage).p.produceTime;% i6 r' i3 @+ h, o) c0 D
    (*memory).p[0].runningTime = systemClock;. [, i. e9 P6 G" A, A. g7 R
    (*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));3 r# Y) M% G( L# L# U
    (*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));) B* O  `% k+ H5 N# z2 G# e6 q9 h
    for(k=0; k<(*memory).p[0].ioNum; k++)
    9 W% K) B8 g2 I(*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];
    , ?9 z3 ^- |; W9 i( ]  i; jfor(k=0; k<(*memory).p[0].computeNum; k++)3 s4 o4 e# q( r; @' J
    (*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];; |. l5 z! i1 @( p# \# a4 ^$ S- K
    break;* [, b% @& \* ]$ t  C3 q
    }
      R' G2 A% m* A& |1 z  X8 L+ K  d- ]}
    * k5 y' o  x6 @# T7 {4 p( Pif(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入- c+ b/ u. c1 ?9 Q1 Z
    {
      \1 \8 r7 I) I1 l6 G6 [+ bproduce_one_task(storage,i,ID_FIFO++);" g# c  h/ v0 A0 ^8 y, r9 D
    MAX_COMING_TIME = (*storage).p.comeingTime;; F4 r4 u3 C  [
    sort_by_comingtime(storage,i);
    6 P5 N1 [7 K) E6 h/ B1 ~}
    8 |6 y- e2 i  A6 n! ereturn 0;2 _, i$ c1 p1 F- m8 U' @8 `
    }) I* y% W6 U3 E3 |
    int sort_by_comingtime(processPool * p,int pos): e5 B4 S  T# F: B
    {
    0 D4 K, N  b$ N( k) vint i=0,j=0;6 k2 r7 G# r$ i0 @- p2 l, V+ z, a
    process temp;
      V5 q6 ], G$ [  Oif(pos<0)
    8 D9 M  O3 V& z{! k# w) m$ r, q) ^2 Q% _
    for(i=0; i<initProcessNum; i++). e1 a5 X) ?4 D; t( L
    for(j=0; j+1<initProcessNum-i; j++)& ?* D1 |% S# I
    {4 D6 l# Z& v! O5 I6 V
    if((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)
    # z) I- j: v3 `! ~3 E2 x% X, ]{
    2 d3 n$ b, J8 Rtemp = (*p).p[j];
    2 t% k5 l: x6 s; O6 d0 ](*p).p[j] = (*p).p[j+1];9 ~8 V9 x4 Q1 O6 f( {
    (*p).p[j+1] = temp;
    5 U; `" b' F% v& s. V}
    2 w1 r9 |0 X# u+ C5 c' ?+ ~' T}
    ! w6 }" B- @: v9 n6 F% g}8 S( L1 t, ^" @) j" A& N
    else if(pos<initProcessNum)  X9 D1 A5 d8 {8 a$ z
    {5 y: A7 l& f6 h" V0 Z( n2 ]- `
    for(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--)* ^, J; D5 l: S
    {
    & Z& w, X( U6 g- Ntemp = (*p).p;
    / E4 |1 N! U& b' Z9 J$ Y(*p).p = (*p).p[i+1];
    8 R+ o* _# U4 ?4 E* T! [* N(*p).p[i+1] = temp;
    " d# @, B. [; P  B% }2 z}
    , y& e# ^. m" g: }( Vfor(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)# h/ x" U. N! `/ W. ?! V( P% O
    {
    3 e) C3 I. o8 Y& otemp = (*p).p[i-1];
    $ K% \) O- z! K4 C, E$ r(*p).p[i-1] = (*p).p;
    3 Q% ]9 c5 j5 w(*p).p = temp;( {! n) c0 U9 s5 D; a" Y9 p
    }
      `, [" g& w  e}4 i" h9 u" l: v" r! N- r1 Y
    else
    7 A- N7 k( c9 X1 @, qprintf("position eror\n");. o- {7 T# N3 @  }4 Z( n6 ~
    return 0;
    : ]' Z+ d+ [# e5 W$ s& g}# [& c/ `9 O: q, ]+ {7 \
    int InitPool(processPool * p)
    ' w- a0 J* r4 W* G4 R{2 k$ M/ G4 h% ?" [; |
    int i=0;
    & e* F" Q' _& Q5 x$ i(*p).proNum = initProcessNum;$ j- |2 J# S- U3 i9 q
    (*p).p = (process*)malloc(initProcessNum*sizeof(process));
    3 J; S+ U8 O6 d  ]7 h4 xfor(i=0; i<initProcessNum; i++)                                        //init process information. z! A! u! H) s+ Q% Y
    {  r- x1 m* T& |, a! S  G5 R
    (*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));' y4 j6 ]* w! E/ n9 _! ~  `5 X
    (*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));
    : E2 ]3 p: @. X  g* k" e) kproduce_one_task(&(*p),i,ID_FIFO++);
    # m0 m; {) n, K/ V}( T, V% `  s* A3 H/ _6 i
    return 0;
    5 g' I/ O2 o: h! w/ _9 \}
    : W/ {& S4 m% g$ s  }int produce_one_task(processPool * p,int i,int id)
    & O7 d9 P* `% H% n3 J# @{
    , g" q5 ~) v/ `0 q! }int time=MAX_COMING_TIME,j=0,totallTime=0;
    7 Z( L4 g" X7 N(*p).p.processID = initProcessID+id;           6 g1 O) ^% J0 ~. ]' L
    (*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);
      \- N$ j' `2 U* a/ b: z$ N. C/ I(*p).p.produceTime = systemClock;
      e- Z5 i( X! T- f7 d(*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;
    % c/ F. D+ ?7 ]4 r, U(*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;
    / `" r. ?% k+ T4 l) K) ntotallTime = (*p).p.computeNum  + (*p).p.ioNum;: V* k# b  I3 ]6 w
    (*p).p.computeTime=0;1 L4 V# _* J4 `* E3 x
    for(j=0; j<(*p).p.computeNum; j++)2 Q, p7 f0 ^+ z7 d
    {  J8 a" E" W3 ^
    (*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;
    , {6 Z# }9 @* j) S& m(*p).p.computeTime += (*p).p.computeClock[j];
      \- V3 Z& Y5 F& Q4 Q}  U) I( a0 M5 D6 k$ P) n, C
    (*p).p.ioTime=0;
    : A- S  M6 Q% F! S; Mfor(j=0; j<(*p).p.ioNum; j++)5 v& a/ C/ `& V0 X* Z! V
    {
    % f& ~8 h' `$ [( @(*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;
    $ F* s+ Z# u9 v/ N(*p).p.ioTime += (*p).p.ioClock[j];. v, p. G' r! d+ |% e0 X& R4 X6 V
    }# [- d- R9 b5 {3 g9 U* [
    (*p).p.askMemory = rand()%(MAX_MEMORY/4);
    & K3 s0 d! D( w& D7 U& f7 v(*p).p.flag = ready;
    ! X! c% e$ i7 e! u& ^# t/ ?( C+ Ireturn 0;
    1 A; q+ h3 e* O7 X}3 f3 x) M& ^+ N% a
    int showProcessInf(processPool p)* Q6 @: w8 [  M4 I! E, F/ x
    {2 h/ X" @- ^% n2 w% [6 `) F
    int i=0,j=0;  _* W; G8 k9 l% W* m1 _
    for(i=0;i<p.proNum;i++)
    - c$ U% h- T* Y' Z8 ^7 q8 _{# K7 j: O: u4 h4 y
    printf("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
    % X- j( H- Y& _4 ^  g+ h6 e,p.p.askMemory);' L- p! o1 o3 ^
    for(j=0;j<p.p.ioNum;j++)5 y/ |& b  R  l" e1 f  J* Z; Y
    {
    , E" }" ]. e# x- x+ k7 gprintf("%d ",p.p.ioClock[j]);! F% L7 K  c+ Q( M' P! t
    }
    2 b+ t% n/ |: R! ~9 Sprintf("\n");' d0 p$ h+ A, Q( l, r3 ~& Z8 I5 E
    for( j=0;j<p.p.computeNum;j++)
    & [0 P2 ~% N& A! {* R9 E2 l{
    " G: E) a+ S3 @, ]5 Q: ]printf("%d ",p.p.computeClock[j]);
    1 I: A2 D; z6 w0 E}" J% J( l9 Z2 }# l+ `
    printf("\n");
    * J/ A$ r, f0 {}, j0 |& }: n2 M/ ?% \: X9 i0 {  y* L
    return 0;
    0 Z. G1 C' h# w6 v}; C& K0 j9 {0 L
    ————————————————
    $ I8 ]: K" L+ b7 W$ R' {4 e版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    ' W- S$ w0 F- i/ ?原文链接:https://blog.csdn.net/wang_dong001/article/details/47843519" {6 ?$ x7 m' J4 G' C+ {! W, g& Z
    , ^4 H9 a, l/ J, W1 \

    5 y. f- |2 K+ r" x" j, T2 a9 h3 |
    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    fastpost qq
    收缩
    • 电话咨询

    • 04714969085

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

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

    蒙公网安备 15010502000194号

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

    GMT+8, 2026-10-31 21:33 , Processed in 0.344032 second(s), 51 queries .

    回顶部