QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 2495|回复: 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
      q* `) x' S# T! v1 ~8 z
    经典任务调度算法的模拟程序
      y' X" O! x9 w+ x+ E本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。# C4 y. m/ s- J+ G$ c1 W

    8 I  p# g$ u0 S& [编程平台:VC6.0+EasyX图形库环境。
    # r2 W  T0 `/ o- B& S
    / k5 z2 v/ r: c1 Y4 J- b以下截取部分程序运行图::
    * j; u, K* @, U# J6 F9 p, I, D
    . Z, x1 T" `# p9 J9 J8 T源代码:
    & G/ J! U& R9 M! i  f* i) D/ W6 L
      z* a2 y! l+ F- i#include<stdio.h>3 m: b6 g9 j9 a. O' [
    #include<stdlib.h>* i, {9 T) n8 l$ Z8 V
    #include<easyx.h>( d5 ^0 x7 a, B6 r$ k
    #include<time.h>/ x% d, i1 q3 U8 f5 }3 {
    #include<conio.h>
    ) a1 v+ @: V. P+ l8 f#include<graphics.h>
    ) w; o8 B/ N- q4 O) \' w#define initProcessNum 100 N- q( K  V/ A2 B
    #define initProcessID 1000
    7 c% x( p4 z9 `/ p( y6 y; r#define MAXProcessRunTime 10000
    - J' @% d# @: E, J; {$ C9 m#define MAX_MEMORY  4000! q: Y/ N5 |- A3 ~3 ?) \$ N
    #define exchange_IO_Compute 10% ~0 Q' ~, ^0 c0 m' K# E" c2 p
    #define exchange_process 25
    1 n: ~. b; W! i/ D' ^% U! J#define task_completed 1
      B$ z, M; k- q. K1 \! {9 k1 U) @#define task_not_completed 0# [) A- d( P9 c* V& R$ b9 t
    #define initclocknum 100/ C! ?# s, ?4 l2 P
    enum condition
    5 e  y; |) D% B; U0 x& U! U( ^{
    , Y/ u6 Y6 q2 t$ P* S* ~  z1 Z+ fdead,computing,IO_waiting,ready% ]- h( [- m& y0 B7 {
    };
    3 J3 \9 J% o4 T1 ostruct process
      H8 t+ {0 y4 t4 s' W{
    9 S! _$ C, Q! a" G2 F/ C; tint processID;, R* {5 E2 X% ?0 D
    int comeingTime;
    4 w- n# i6 d7 nint ioNum;
    - ]5 p0 p$ j' {; q) l% S6 nint computeNum;
    1 {/ R% v' H2 q" A6 z7 h* sint * ioClock;
    5 ?- W8 X1 }4 A! U. s! T7 gint * computeClock;
    3 y7 F6 G  G' D; Uint ioTime;8 u& f/ Z; Y1 g: ?# i4 G0 G& K
    int computeTime;
    : W$ c: t# E' @int askMemory;
    & n. X* C; s9 r6 T+ F8 F$ T, E0 icondition flag;5 C4 f- Y5 X% \
    int produceTime;  //生成时间,以下三个数据成员用以计算相关性能
    : q- Y: [9 k$ a  U- D" T2 z* u/ kint runningTime;  //第一次占用CPU的时间+ Z# E& J6 |2 X
    int completedTime; //进程完成时的时间
    5 U' J$ J* ]8 ?) |};
    : L* m% c  M. utypedef struct processCmpletedInfo  //保存完成一个作业的相关信息
    $ w2 h7 ~! D: ~& i) }{. U2 F* o+ |# r: n, N+ E, s# N/ J
    int processID,comeingTime,askMemory;
    4 t5 j2 T/ N( z9 N& j& K0 n& iint compute,waitio,exchange,completedTime,runningTime;
    7 k. P6 ^: u# O. m0 l5 c- VprocessCmpletedInfo * next;; F) B3 a, Q  L+ ]" \! Y6 Z
    }PCI;
    7 {8 l9 m5 r. V3 F1 Tstruct processPool
    8 w  O$ }: E$ b" w. y{$ n2 R7 u; p. J& p
    process * p;
    ! _. x7 L" V: Y/ Uint proNum;
    * H! S1 _) ~8 j# Z};
    3 [- D0 z) R- e; I: C! z$ x% Qint 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;; h3 S* c1 C( v1 u/ }. w
    int InitPool(processPool * p);- [& n* J8 ?( Q7 `
    int produce_one_task(processPool * p,int i,int id);
    " p, s' w) H" i/ Aint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);
    0 l7 w# O. x$ {  D8 O+ S; Hint TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    6 q8 @+ J  f! |0 M( F5 N* [9 Oint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);
    + f% b5 O  w4 O5 p  Z$ o7 w4 yint FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    0 Y) D# u( s; c' @3 Oint ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);$ Z" L: q0 T: W0 ^$ v
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);1 E2 N% _: E  g8 M' u. n. j
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);7 F" R; ?( q1 U
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);3 |" ~) }" Q( S* P3 g8 p+ E
    int High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);
    6 G1 B6 V& K% j' f3 m  Lint High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    , u7 N5 v  A& t
    ) R4 F$ z+ G7 F+ b4 A& q( C$ U) Z/ @! s, H( O" }3 G
    int sort_by_comingtime(processPool * p,int pos);( m" y2 N9 {7 q  j2 P+ C, v
    int showProcessInf(processPool p);" Q! t% S# U8 @6 I$ ~! P# M
    int drawPerformance_FIFO(int x,int y,int memorry);7 F3 m' \2 @) V8 Q5 ?
    int drawPerformance_HR(int x,int y,int memorry);* J$ X) Q! G! n( J; E* h) J
    int drawPerformance_PF(int x,int y,int memorry);1 t5 @6 _2 o) {" Y! O
    int drawPerformance_TT(int x,int y,int memorry);
    # d# ^$ @8 u7 T6 m" `int drawPerformance_SJF(int x,int y,int memorry);) q  J: \0 l/ ]/ x/ R0 |8 r
    int MouseListening();5 w0 C  Y2 c1 k, t/ R* ]
    int MouseListening2(int *flagShow,int * showTime);
    & G, |4 C4 d( I9 r+ G( H8 Vint showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);
    5 u/ F+ k$ G* |; b& d0 ]& v% ~! {  s! U2 j/ ?; d! \9 Z& F# v! ^4 L
    9 m) r$ _7 ]4 _9 A
    void main()$ Y  a; r) Y& @* n
    {
    $ _/ p# r$ e. \' B; ]PCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,& a: y: b4 b, Q( |3 u) f5 K8 a
    *Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;' T% t) `+ r  i8 w+ T9 w0 e
    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,2 T3 J  Y" F; u4 V# B1 W5 ^+ _
    flagDraw=0,showTime=100000;
    2 i  O8 ]  Y% ~$ q9 I* `processPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;7 z  e6 h( z3 R+ U7 c. F7 a4 R
    FILE *fp=NULL;
    ) s, m& W! p' I: |& a% D//processPool HR_p,HR_mmy;
    ; w/ T- v3 u$ h9 r  b
    ; Y; }. M* D, i% d- G3 S
    ' q+ v4 u: G# T: Fsrand((unsigned)time(0));2 ]7 c* H& z7 f6 h" M: x' N
    systemClock=0;
      z7 V+ {8 Y5 `4 tinitgraph( 1200,650,SHOWCONSOLE );9 C/ b: s. S4 S) `' L5 _
    settextcolor(GREEN);
    , u( o! S5 {/ N1 r7 `( Isetlinecolor(GREEN);& |. b2 j0 }6 X8 q; ^
    setfillcolor(GREEN);
    ! d. Z  P' U- l% s/ Q) H& K5 _InitPool(&FIFO_p);& O) D% i! t  B0 n- `3 h' h- H
    sort_by_comingtime(&FIFO_p,-1);
    - @7 V9 B1 O. X2 }# i) cInitPool(&Timeturn_p);
    + a: @2 I/ X* ~6 }8 r% F8 B: lInitPool(&SJF_p);+ r0 |. b4 i4 f, A1 G  T# Z
    InitPool(&Priority_p);
    : h. [6 b2 o# T, z2 uInitPool(&HR_p);; w, _" ~) v/ }8 k" E3 K; {& `
    //showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
    ) s) o- z9 R) N//Sleep(10000);# \# h) Z) Y  K, b6 _1 D
    3 m& C( t1 _# K2 V" e7 k4 |

    ; G! Z$ f7 T! e' aTimeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));' ~) ^& L7 K. o1 r1 i1 E, e4 f& u: x
    SJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    / p+ g; I8 ?; {  F4 j: f! JPriority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));* V! z+ |5 P; s" |
    HR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    7 L* R; u, x4 y; }' `for(i=0; i<initProcessNum ;i++)2 c3 M% a' Z) F; |. X% U2 @' {; e
    {
    8 ~( p0 y7 v$ z# W2 B3 oTimeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));5 s/ F/ ]9 B. t# K
    Timeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));8 w  w$ J! G9 O8 }- t
    SJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));9 ?9 L9 L1 O; ]. }
    SJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));& ~, S) M8 s6 K# n" \) F( _2 j
    Priority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    3 ~2 y! h' |$ u( M& X. G4 `6 fPriority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));  c6 t1 I1 G# f+ L( U; C& K: v& m
    HR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));3 l  n1 N1 \/ u, [
    HR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));2 I& K# \& T) M+ F1 K3 ?
    }
    ) R8 Z- F' a4 L. @3 |Timeturn_mmy.proNum = 0;
    ! z2 R( q9 C: m. r, r. |1 o/ _- yTimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);
    4 V. l' a! v' K" MSJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);
    0 i( ^4 a3 c  C- Z9 }Priority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);
    % d, T; h8 `6 f  f( y6 ZHigh_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);
    ) i( k  t2 x6 N; a//showProcessInf(Timeturn_mmy);
    $ J- S; E4 w- _( PFIFO_pri = &FIFO_save_head;. V- ?% S) @( G
    Timet_pri = &Timet_save_head;
    , ^& D, I; j; e/ U7 ISJF_pri = &SJF_save_head;& \% S4 Y0 H5 i& g. N
    Priority_pri = &Priority_save_head;
    " [4 l( h/ D  o, Q    HR_pri = &HR_save_head;; v& A4 L9 s! \! l# L3 }
    setbkcolor(WHITE);  ]7 H/ r1 M  G8 w: J' [
    while(1)
    : Z- Z: u& T7 Q  ?{
    9 @5 D* m0 {5 s: |) n1 Jif(MouseListening()==1)# Q" O/ X  R2 Y; U
    flagDraw=1;
    + H+ e) a+ G* f: }, {if(count==100)
    7 o/ r; Z* |0 i/ U5 i( f( y9 F{
    0 q! e6 S; i/ n; A+ Y* h! Kif(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed)2 P7 v7 V: P  f, v8 E2 d; [
    {
    ) E8 H& g; z. F  B) SFIFO_pri = &((*FIFO_pri)->next);8 ^5 L- ^$ o. Y8 ?  W
    ; w  I) [* `/ x. s$ H* @$ }
    //printf("hello");
    ; M7 |& R% {3 x& O6 \}
    % G/ l4 b1 {3 Q1 O) i& U7 _1 `! Eif(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed)( r/ d; N# n$ P3 P5 c0 Z
    {; L4 t$ w, _7 J4 d/ N3 u$ ^8 Y
        Timet_pri = &((*Timet_pri)->next);
    % }; a+ Y9 @& ]; A) I$ h* z! ?//printf("hello");9 A2 T  f6 X! {! r- L
    }
    2 n3 d: T& Q% {if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)# d) k' u* {% G8 L  ~  F
    {% o& s4 e" u9 }/ [) v
    SJF_pri = &((*SJF_pri)->next);! i3 E4 h, G3 W! l( }! d
    //printf("hello\n");2 g% L- }' [  I7 v$ j7 l- J
    }2 O' v' q! l: F0 l0 W- W  h
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed)  ]" l) a& d, O  q" _5 V0 C
    {; U: u9 n" H/ ]( [) ~/ N
    Priority_pri = &((*Priority_pri)->next);
    8 z. ?. W* R, F; r0 R+ `5 ]9 `//printf("hello\n");
    9 X4 f; X4 [, D: M1 K}  F0 j+ `! F( o
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed)  s- l0 b) Y  Q) {( `0 L
    {
    6 e/ e3 T- P1 ?3 Y( n5 AHR_pri = &((*HR_pri)->next);. r4 o" ?. j( z9 t
    //printf("hello");
    * ^8 x; Y$ c' C) x2 P! R9 `}" l; l- O4 s3 N9 g
    count=0;
    * f; Z. ]8 n! r}
    + g3 T- d7 [: Belse8 W& }! f- s8 d% n: i, e. r; l
    {' ^7 H( f: g) v! N
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)
    & _: K% }; Y7 r{
    0 k  C3 M9 [- ^FIFO_pri = &((*FIFO_pri)->next);
    / B1 c( ^3 D# _1 x// printf("hello");
    / z$ N1 a. r# T8 T4 H; j}3 p& I! ~- C! ]" w
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)
    0 @& p. Y; a. A* ~+ X{
    1 C6 u, y0 d% r7 D' I4 k1 q2 r/ LTimet_pri = &((*Timet_pri)->next);3 x2 ?5 H8 e* e9 [4 b0 i/ l6 ~
    // printf("hello");$ ?7 J$ Z! N  D  ]1 d8 `
    }
    . J+ X# N6 U) x4 Pif(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)/ w) _) b7 O: s. r4 R5 Y1 d3 R$ k
    {
    3 x0 }& j* R" \) E! v   SJF_pri = &((*SJF_pri)->next);
    ! I! O5 v% H5 f7 a: C4 b8 X# e// printf("hello\n");: V1 a6 Z8 ]. E8 r$ h2 D1 ]) [' \1 x
    }
    ! L5 m. p# i! N  y/ V" z$ _if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed)
    2 i, ?" `: z9 @$ q" d{
    : ^  T2 I; M5 ^( P& PPriority_pri = &((*Priority_pri)->next);
    ; L$ i1 B, E. M- ]+ a//printf("hello\n");2 C/ F0 O+ Z) }5 w9 V& F  }
    }% ^, I, [8 `$ v  x3 [" _
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed)
    8 n+ G5 h& v3 W$ _{
    ! i" p/ f  d: gHR_pri = &((*HR_pri)->next);8 H. v) X2 \6 c* |
    //printf("hello");) z2 L3 ^: o9 f# K, @+ C
    //Sleep(1000);: N. j# i) p7 P
    }
    $ Z$ C# S: |' x' I+ i) o9 p" ycount++;% v  u5 O! U5 K. X! \
    }8 H; v9 D( s% Y* I% ?% i+ e
    if(systemClock==showTime)
    : S0 J7 }( s) a# X: I4 }{
    3 {* d4 L2 k/ S+ r3 B/*PCI * p=FIFO_save_head;
    " z/ ]% T7 c) O& @8 L; _) W3 Cint i=0;$ }% P# S$ `2 P# m
    for( ;p!=NULL;p=p->next), L. `6 M* c% v. {0 c  G% }* q
    {4 b  M3 S4 X& U& C; Z; o( e: i
    printf("Id %d\n",p->processID);* P2 A; |' m& F' p! e
    printf("comeingtime %d\n",p->comeingTime);6 _& W: E. [. [4 s+ x) I
    printf("runningtime %d\n",p->runningTime);- w, p/ M' a  [$ c3 b( n% K. y" l
    printf("asdmemory %d\n",p->askMemory);
    9 H# H9 k& Z  c  V1 a& rprintf("completedtime %d\n",p->completedTime);
    4 r+ w9 ~0 u2 m, m, M) Jprintf("compute %d\n",p->compute);2 r+ d/ Y& G! C9 ~7 U% _+ k
    printf("exchange %d\n",p->exchange);
    + _" {( ^. I# qprintf("waitio %d\n",p->waitio);
    % q9 s: x, I' [7 e  c: Z0 @i++;
    ! k/ R/ |" I/ |$ p6 G( b/ |- ]1 m( G: U3 @
    8 _( Q( S- Z; @- q
    }$ ?% D" C7 [: s$ Q. I/ T
    printf("%d\n",i);*/
    - j. g8 _2 e7 X. J: Zif( (fp  = fopen( "data.txt", "a" )) == NULL )$ h+ K/ R' k5 T, z: I
    {
    5 g$ v5 g$ H  V) ^9 Mprintf( "The file 'data.txt' was not opened\n" );
    1 g6 |+ X, U: ]5 W' u- f) r//return 1;, \+ F% g9 X! t1 s
    }
    8 T2 s" @2 f" C2 P( L4 b; {) {- ]: Xelse4 E; T5 U" V2 S- f
    {
    ! m) F. d) o' \4 E+ lfprintf(fp,"FCFS \n");: F' N5 v" L4 Y( y
    for(p=FIFO_save_head;p!=NULL;p=p->next)+ J% z" T5 _; `( Q
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,) R$ R# l/ ^. h1 X& J+ x, [8 |% `
    p->exchange,p->waitio,p->runningTime);( t5 w2 b$ d1 i( u9 ^* q* A
    fprintf(fp,"\nTime turn \n");
    1 J6 o; {. D- U# ufor(p=Timet_save_head;p!=NULL;p=p->next)
    6 X$ e0 X+ _% J# o. Y1 H6 vfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    5 r! j2 @8 p) G8 ~6 M. Dp->exchange,p->waitio,p->runningTime);
    , x" t4 R' D4 N# b, wfprintf(fp,"\nShort Job First \n");
    0 J3 ~+ Q+ `1 ~5 N: i* efor(p=SJF_save_head;p!=NULL;p=p->next)( f/ T# o# M. m+ _9 r1 X
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,# S7 Y* M" R- g6 o" r
    p->exchange,p->waitio,p->runningTime);
    % P7 L% c5 K- |1 ufprintf(fp,"\nPriority  \n");3 q9 x( H) Z4 p1 R* S- n9 w
    for(p=Priority_save_head;p!=NULL;p=p->next)
    3 P, z/ q1 k! b" E# w) Gfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,! e, H' `/ T" n4 o( w0 X
    p->exchange,p->waitio,p->runningTime);
    % i3 p. x. I% S8 X! b  ~fprintf(fp,"\nHigh response \n");1 d9 r0 v' C* M2 L
    for(p=HR_save_head;p!=NULL;p=p->next)
    ! s0 C$ t9 m" u8 zfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    * z2 F, _( F' Z) _" X# l" H* l2 lp->exchange,p->waitio,p->runningTime);
    9 j5 y7 o& Z( L$ Cfclose(fp);
    8 ~/ H9 w6 Z) r0 s5 u+ @8 \9 O}
    1 Z' ^) d$ |2 _8 c0 l! X2 a% _+ GshowRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);: {7 O* o" \+ {- B
    MouseListening2(&flagDraw,&showTime);
    * c: L9 J+ t4 @2 u- \}
    - Y. S2 ^% `/ N0 c3 `% D4 ?  I; hsystemClock++;) ^' L5 M0 c, b4 f2 J. G- y
    if(flagDraw==0)( a6 ]2 X/ j+ t  P! Z  X: M9 D
      Sleep(10);
    6 O+ T& I  D$ k}; Q" p7 s3 }( a% Q$ T. |5 ^1 R

    9 ?8 m1 G% m0 I  _. j- a3 P9 @! t$ Y0 n5 ?7 g
    }
    * l  {! k; \& N5 s! n$ i. gint showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR)
    7 z8 b/ C2 _$ V) G. R# y$ v{* {$ B( B, N" k/ y( ]
    PCI * p=NULL,* name[5];" e& M4 o/ _8 ~
    int count=0,i=0;
    ! v- x5 s$ L, q* L3 ~char ch[5][10]={"FCFS","timet","SJF","PR","HR"};* ~% }" G; O4 q
    double turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};
    : F1 N" ?% U4 K5 Q7 mstruct info  D1 Q2 U0 n1 O' L% H: r/ j
    {/ j5 k; M9 K0 i  G/ @7 A* R7 E
    char name[10];; V, s) [& a$ j: |7 Y
    double throughput,turnover,wait,CPU_rate;+ B' H8 k; w, ]& V5 l
    }inf[5];
    1 G% Q% ^6 W* U1 d* Z2 F) Ename[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;
    % c. Z# z" q+ Uprintf("调度算法..........A\n");3 \7 z' \% b. B5 V) [
    printf("吞吐量............B\n");
    ( W  |' Y# r6 {8 T- d- a7 rprintf("平均周转时间......C\n");
    6 d1 \2 {9 _! M% y6 Pprintf("等待时间..........D\n");
    # a1 f9 U+ a: {' b( _* sprintf("CPU利用率.........E\n");
    / ~5 T  `5 t- B/ `3 Y9 V) Y/ B% Q) Sprintf("A\tB\tC\t\tD\t\tE\n");
    - C* t+ H3 a8 C1 Wfor(i=0;i<5;i++)4 m4 w5 o) g! u+ W5 H3 H9 K
    {
    3 k( r* B- S2 H8 Lcount=0,turnover=0,wait=0,c=0,w=0,change=0;: _: V3 s& [5 H( G
    for(p=name; p!=NULL; p=p->next)+ s0 n1 P4 u" \5 G
    {
    8 p& K* E  k+ k" `- xcount++;( v, F, b4 {, X- L3 X) T! V
    turnover += p->completedTime - p->comeingTime;
    : R$ |- K: b: i$ i- Pwait += p->runningTime - p->comeingTime;
    ! ]4 _. g7 {, oc += p->compute;
    # T3 X3 p6 O2 r- H9 Cw += p->waitio;
    - I1 x: {/ F2 ~' g3 @  q# @4 P4 kchange += p->exchange;
    " \: ?9 o- D0 y. s% J* v4 ?, a}
    - G# k' z2 h/ G1 I. `7 @turnover = turnover/count;
    8 k; `2 E  E5 u, ~& x, Aprintf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));
    6 e1 f$ K1 Z; p5 Gstrcpy(inf.name,ch);/ }& l  Q* [% Q4 \2 t1 X
    inf.throughput=count;
    & D2 q- E5 U# C* r/ q6 linf.turnover=turnover;2 w2 {' o4 R5 K6 c' N
    inf.wait=wait;( Z: A# d$ S) \, ~
    inf.CPU_rate=c/(c+w+change);7 T- L) ]$ ^0 R; y3 h6 k8 @
    }
    " @# z* u6 \% t+ w//画图
    0 c! d  G8 @1 [# J( d//cleardevice();+ ?. A* G8 |, [: F, \; G! C% a( Q* V
    line(0,600,1200,600);
    5 o- _# |5 e0 s) W( d9 Mline(10,600,10,200);, T# l  L" s4 q
    line(10,200,5,205);
    ; ^7 A) u- N8 q" h4 wline(10,200,15,205);7 s2 U; P. E  C/ O' V
    line(310,600,310,200);
    " }- g- @; u5 R( Y2 n) |line(310,200,305,205);
    4 I7 r: @9 Q9 M/ B1 C* _7 U$ d4 k9 iline(310,200,315,205);$ m5 x; K5 B# }& g1 c  U
    line(610,600,610,200);8 O4 U' B" F# Z; ?1 B+ @/ b
    line(610,200,605,205);
    ) t$ n; I+ B) N8 g0 P/ g/ fline(610,200,615,205);& K) J, ?5 M' Q1 j- o& q
    line(910,600,910,200);
    $ V9 b* [: U" \3 f! Lline(910,200,905,205);8 m% m4 R0 u5 Q- d
    line(910,200,915,205);//最高的长度400,宽度均为40' Q( s& b2 _/ N, i3 e
    for(i=0;i<5;i++)8 ^: h4 [0 y' L) F0 e) |
    {
    2 V5 I2 u6 Q0 K7 c, wif(inf.throughput>pos[0])/ L7 j% T7 W- N' T
    pos[0]=inf.throughput;* l  u, Z/ S8 y0 q3 w
    if(inf.turnover>pos[1])& m  v  s1 I0 T1 |% f; F
    pos[1]=inf.turnover;
    " o5 [9 q7 x' }4 Q; x1 r/ Dif(inf.wait>pos[2])
    ( x4 F) H( N4 z9 u7 ^/ @- r) Qpos[2]=inf.wait;
    " \# f& |" V, w. f& J3 C4 N. E. Sif(inf.CPU_rate>pos[3])1 j' S( c5 v" W' D4 y
    pos[3]=inf.CPU_rate;
    , O0 b5 a1 ~( r}
      S* r5 d5 n& y1 u& v" ]6 _7 ]( Lsettextstyle(30, 15, _T("楷体"));
    0 Z7 ~$ Q! }' P' y# [8 zfor(i=0;i<5;i++)
    3 |0 R# [/ q/ h. [: [2 \9 _{
    ; {$ ~8 T3 ]2 [% F& |- Pswitch (i)
    . l! ^& k2 [. C  X8 h' a# C) u5 ]{( g/ }1 f- E& q* o
    case 0:# H3 h7 @" D" b$ a$ ?0 h
    setfillcolor(BLUE);) M0 p' X9 A: U* c' P& S
    fillrectangle(100,50,150,100);
    9 J: h9 A- M4 y+ o' @outtextxy(160,50,"FCFS");4 e; X' Z) L! e" w6 N
    break;* A! q( {/ ~" g! O8 [3 {
    case 1:  ^5 M( t: y( I6 ?6 r5 v
    setfillcolor(RED);
    $ T% z4 P, B3 E" e2 j0 W0 Xfillrectangle(250,50,300,100);: G& e& |: Q- ?: y6 l% \) d
    outtextxy(310,50,"timeTurn");
    7 @5 e" C$ N1 Q6 B$ L$ R8 X$ Obreak;
    ( f. y- Q" a3 Fcase 2:5 Z' a5 P/ R  {3 N; T: n
    setfillcolor(YELLOW);) C; z* m# J5 m! ^* F# ]! i
    fillrectangle(450,50,500,100);- c( @/ i. }. s# Y- q, E0 ~
    outtextxy(510,50,"SJf");
    3 M$ P+ A  A3 b0 s( m4 ~2 ]break;) ^& d6 {0 ]9 P. }7 v
    case 3:. m8 O$ s+ k. k9 g0 l+ W" [
    setfillcolor(BROWN);
    ( U4 s7 M' |, h6 D4 Ifillrectangle(580,50,630,100);
    & {4 F9 p" `/ e( \0 }$ Jouttextxy(640,50,"PR");
    # u+ S2 O% _  i8 mbreak;
    / s5 j+ k$ n: ~case 4:8 I0 L. O$ o% a
    setfillcolor(GREEN);
    : U8 i! M) g' B; M6 Z/ o9 Cfillrectangle(690,50,740,100);
    4 H! q1 {  d  kouttextxy(750,50,"HR");% u+ V1 \$ d4 b  }# }9 i. s; N  @
    break;/ ]7 X' P3 e, ]# T" C
    }
    8 Z' Q  N. M& \4 c9 N/ tfillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);
    7 K* d; D1 k8 Ifillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);
      O% A* V" G" ]0 M" Ifillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);# ^1 |2 _+ C% k8 i% V
    fillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);9 q) O: N' u/ h* |
    % a2 t. y+ S% W( _7 b

    5 H, ^! x0 \6 V' s- s( O- B}. ?' q' A5 q" y- x! b" C$ o( ^
        outtextxy(100,150,"吞吐量");" x9 i% S  W3 l: v6 {
    outtextxy(350,150,"平均周转时间");' }7 q7 o' Q0 j& _$ u1 z0 @  t1 E
    outtextxy(650,150,"平均等待时间");3 V5 s2 t0 J$ _
    outtextxy(950,150,"CPU利用率");
    & b2 V! {  Q" N& H  Z% g  Greturn 0;. g/ E$ t# [& O6 E
    }9 H5 o- ^9 Z9 ]) [' W! ^
    int MouseListening()$ v* P( B7 Z7 \( }
    {
    % }% B7 r# L; S# b, o% T' `' JMOUSEMSG p;: h: G9 e3 F, Q  C" s
    if(MouseHit())
    , v, ~8 A) s4 Y" s0 m4 l{- ^  `8 F% r& T6 \
    p=GetMouseMsg();
    + Z% Y* x" P/ H! }if(p.mkLButton==true): s( L0 ?0 R; c: D$ h( o: |
    {+ y/ B+ z; c% R+ d2 n) T
    if(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    : G* O( ~# c& C& b& l: H  D" uFLAG_FIFO = 1;
    1 ^) ~6 B% V3 g7 h. S7 welse if(p.x>400 && p.y>0 && p.x<800 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)! k# ?  z! @7 ]! l
    FLAG_TT = 1;& i6 Z& @5 u5 N2 w* ^
    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)4 Q  c/ V8 B7 ]6 ~4 |2 Y" u6 W
    FLAG_PF = 1;  O& M( B2 l2 x% X
    else if(p.x>0 && p.y>325 && p.x<400 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)7 ?4 }) V7 ]# K% W" G# ~) F0 z% q
    FLAG_SJF = 1;" e( V) o8 q1 T8 x: ^( a% w
    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 a* z1 h" h; x* M
    FLAG_HR=1;  r, x4 t+ ~- J  t5 u$ e; d' l+ {
    else if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)3 r7 r* P+ x, u5 b$ O- v
    {  ]. l* T  g" J* C3 {! G9 q
    FLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;
    9 n* m" m1 j/ t; nclearrectangle(800,325,1200,650);2 @3 q8 |/ d0 a: r' P: n  d
    }0 E* m, L) ~* t
    else if((FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0 && p.x>890 && p.y>455 && p.x<1110 && p.y<510 )
    : i+ E) d& W3 O2 a  a{6 C: e) N, @1 t7 X" U) j% z  }+ v
    FLAG_show=0;
    + F0 m0 Z9 ]4 s6 _$ H$ y5 f4 qcleardevice();/ F, F/ l# v0 u$ T& b
    return 1;+ P, H5 R7 D1 w4 X
    }
    $ D  L6 v' _( G7 k, _7 [/ A- Q}
    . T" s" Z2 y! H% r1 B}( P, y& Z% q  Q* f$ z* @5 j$ a; J
    return 0;$ I! A5 k3 k0 [. @, G
    }
    # x( G* G. j" I$ c6 ?; Lint MouseListening2(int *flagShow,int * showTime)
    " F% f3 u% C# f: r{
    % n0 h- P( ^: Z: ]" eMOUSEMSG p;
    , B7 r8 k; X+ y- L) r+ b% P/ {+ Frectangle(1150,0,1200,50);
    ) S0 z  }5 F( `& j$ y9 Eouttextxy(1160,10,"X");+ {7 }8 |1 ]. R8 A
    while(1)- w  V5 S6 p+ ~' v  R" \: ~
    {
    6 s9 E7 }3 y' d3 p0 Y4 s/ W, v% k* Eif(MouseHit())
    7 w  e; C$ Z' l+ J( G* P6 Y% y{9 e; L: k& {# v# w2 U7 q6 I
    p=GetMouseMsg();
    8 r7 j' e* g4 X! k4 Vif(p.mkLButton==true)
    + T" r9 r$ y; r7 ^, ?" @; O1 ^{
    ! Y/ h, T2 F, z6 w/ s( s, Mif(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 ). U  b" L8 b9 E  S
    {
    / X# s4 j: v# z. j(*flagShow) = 0;
    9 Q9 |1 h) m& m/ I- ^(*showTime) += (*showTime);
    9 W; [6 i. o9 T" \$ V) VFLAG_show=1;
    0 }" t8 j1 P, r5 R4 obreak;/ \8 _1 N4 w/ p, Y, e: z% D' y
    }
    " \% f! H3 I) k6 p, y# x7 d. q; b6 [
    }/ B0 T3 W) v3 A/ W+ n
    }& i$ l" P& `2 q1 Y# k
    Sleep(20);; ]2 i3 W* p  T. |. d+ Q
    }5 P$ G: @' w% o6 g2 X
    cleardevice();; U% d0 x2 @, M: b: f
    return 0;( V9 x1 A+ ?* c
    }
    5 f6 l: D* K3 f! z3 i4 O' |int drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha)3 t+ z  i! ^5 m( M# N1 w( `
    {6 x; k, |" l  u5 s6 E  j. ]
    static int info[11][3],num=0;+ s8 X* E0 T2 v2 S/ U
    int i=0,j=0,pos[10][3][2];
    2 p5 u8 M" u# V, S! ifloat temp,t;) L: h& T6 i: M4 U
    //画按钮,不属于FIFO图的范围
    $ j, {9 p4 f+ q) H2 tif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)
    # {6 s$ l0 R1 b5 T0 l2 B% C% n{
    3 W) u1 y. [: B' Isettextstyle(30, 15, _T("楷体"));
    & j! _7 S6 d- U; g4 v" Krectangle(890,455,1110,510);
    5 u9 j+ k9 b/ h, _rectangle(900,465,1100,500);
    8 J$ l. E1 n$ T/ I- ^, K" `' q: ]8 touttextxy(910,468,"查看运行结果");" P: c2 R, i3 \( g) L; C$ R, c& q* X
    }8 X4 p1 j' W/ l+ j. `. f
    //结束画按钮
    # k9 d* `* W1 j0 @9 h7 uinfo[num][0] = com;
    , g0 J$ ~" ~% h; H# [+ ~' j4 Tinfo[num][1] = wai;
    9 @6 t5 U" `- D) u; e( ~# V& K' Ninfo[num++][2] = cha;8 }! U9 c" W6 I" ?% Y/ T
    if(num>10)  //存储10个点. H# }( V" ]; t4 J
    {
    , p) w% k9 U# y* w  Sfor(i=0 ;i<10;i++)
    * @) n5 |% i& A) v3 b7 a" L  T1 [{
    ( R/ h- U' q% T0 I$ L& ]" ainfo[0] = info[i+1][0];7 N: [% ]. a3 M3 T6 Q& g# W6 F: I
    info[1] = info[i+1][1];
    4 t' y5 p( b& Dinfo[2] = info[i+1][2];7 u( ?" v; l9 t  \3 Z) i2 ~
    }1 P* y& V. u+ c  t0 z* T
    num--;
    2 c, ~+ l! t9 T4 ]6 U}$ K" i) a& L  h. m
    if(FLAG_show==0)# z+ q  F, j& l0 E
    return 0;6 ~. W: D& u- a
    for(i=0; i<num; i++)
    % d/ H- S  M) E5 I& v! w{
    + m* t" ~7 y* r# @+ W8 mt = (float)info[0];
    0 V+ y/ X1 Y. Y% T, V) h% x* T) Xtemp = (t/101)*90;3 Q. \# j" ]; T, S
    pos[0][0] = (10-num+i)*25+x+100;
    % M% g: d$ u# G6 G- k, jpos[0][1] = y+110-(int)temp;& \0 {; C; b' J
    t = (float)info[1];
    7 m$ @, I, w7 a8 J4 l# Dtemp = (t/101)*90;
    8 u& N3 h2 Y  W- z0 }% Cpos[1][0] = (10-num+i)*25+x+100;/ q" Q7 U6 M; Y8 B% `/ D) j0 y2 D
    pos[1][1] = y+210-(int)temp;
    2 k' {2 C2 j0 @8 R; E  st = (float)info[2];
    ; V7 v. e+ U" O. d  xtemp = (t/101)*90;3 H$ n$ Q3 U: ]# J
    pos[2][0] = (10-num+i)*25+x+100;
    $ b/ `3 A' @; |0 q! Qpos[2][1] = y+310-(int)temp;
    6 y  o* P/ @- v( ]( `2 @! ^}, ^5 U0 Y) N' z( A$ ?
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    , g( \  A6 e, I! j) W{; b+ J$ ^2 U- H/ X7 I9 x* a
    clearrectangle(x,y,x+400,y+315);9 K/ v/ X% a3 ]7 i. y9 e
    settextstyle(20, 10, _T("楷体"));
      G8 \5 t/ w" P( j# t' ~, s0 krectangle(x,y,x+400,y+325);
    , n/ @' C- G# f- \( H8 R- Zouttextxy(x+40,y+10,"CPU");       //画柱状图
    / @0 i( D9 |  r+ B" B* i) P2 x3 jouttextxy(x+45,y+10+100,"IO");
    6 p( x2 x8 `& d! e* q9 Vouttextxy(x+40-15,y+10+200,"change");
    ; Q) ]$ k. V" ~# D% grectangle(x+35,y+30,x+75,y+110);7 `( u  H5 q0 ^& f7 ^
    rectangle(x+35,y+130,x+75,y+210);' o9 R: }8 l8 B! o# N1 z
    rectangle(x+35,y+230,x+75,y+310);
    ( }9 u; r* @' l# X& Y1 ?outtextxy(x+180,y+310,"FCFS");
    0 f- [9 K, n" J0 gt = (float)com;
    5 d" z& Z  z. f! etemp=(t/101)*80;
    ; s$ y5 ^& F8 s  ?" U' \fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    4 D' J) J, s3 Wt = (float)wai;9 t4 I( n; E4 \
    temp=(t/101)*80;
    $ }7 {( L& n* |& Y4 J" v: P! afillrectangle(x+35,y+210-(int)temp,x+75,y+210);/ J% U# L; j! _" i3 P! O" n
    t = (float)cha;. T" W! O" P* ]; _6 ^" y
    temp=(t/101)*80;
    $ \- C3 ^; d) _7 M: v# Zfillrectangle(x+35,y+310-(int)temp,x+75,y+310);; k; U3 W0 Y; E8 X- ?, u% U
    for(i=0; i<3; i++)   //画坐标   high=90,length=250: K8 L7 F7 V+ i& O/ h
    {& D& c7 K9 W0 r4 [' N' q# @# ?0 P: ]
    line(x+100,y+110+100*i,x+350,y+110+100*i);: R! _, A) ~# p- E: S: {1 D: M
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);9 o4 @& k, \2 t9 s8 J
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    0 L& c. M2 {2 Q  P& o1 ~
    ) i8 b& h6 V& [line(x+100,y+110+100*i,x+100,y+20+100*i);; V6 G/ `! j" I1 `8 L
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);- Y' o* Y5 J& |* L
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    $ |& ?/ |6 P8 s( K$ B' c! y" w* D+ C+ V5 nfor(j=0;j<num-1;j++)# M" _2 M" v% P+ N. L3 {
    {! F: s/ @* g& n
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);) j% C: n+ K* a
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);( V$ ?- W7 g$ o& x; X) S* s
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    ! z1 k: |) t* o: S5 v4 j: N}$ F9 O0 z. B3 e( A; Z) C, \0 V
    }0 V+ i5 O3 y' |8 r: L9 \; p- h4 F
    }0 U( A# P% j+ y% N* v( {
    else if(FLAG_FIFO==1)
    6 x, K* d8 _# M" i/ j4 i/ W{1 G& p; s% w* `( }! _
    x=0,y=0;! K* n& j. L1 l* C* `9 V
    for(i=0; i<num; i++). `% p& j  O& q
    {
    4 W  L( x6 B4 \3 O: [3 |8 a1 ~0 At = (float)info[0];; i8 {9 {3 ]' w, R2 {
    temp = (t/101)*180;
    $ E' z! _3 U3 A9 H4 J/ gpos[0][0] = (10-num+i)*50+x+650;# m3 l5 j1 G8 Q& @+ U' k: X9 S
    pos[0][1] = y+210-(int)temp;7 W2 G8 S# `6 ^1 w7 {9 m2 d- ?0 h" n
    t = (float)info[1];
      P, B0 ]- n( u" w1 O! R' ctemp = (t/101)*180;
    ( Y8 L  ]/ s3 W3 Z+ zpos[1][0] = (10-num+i)*50+x+650;
    ' X% K% y( [1 b- G8 Y* y/ npos[1][1] = y+420-(int)temp;# i8 E4 f4 u7 i0 {
    t = (float)info[2];5 w) `) Z" Q! ~! D+ Z& r% m/ R
    temp = (float)(t/101)*180;
    ! @: ]( N0 r2 S) Ppos[2][0] = (10-num+i)*50+x+650;* y7 W; b1 e, y0 G8 M4 _7 J  h
    pos[2][1] = y+630-(int)temp;; K( l. ~0 d* [6 o
    }7 j; ?* ?) \. f" B! |) Y
    clearrectangle(x,y,x+1200,y+650);4 T: L1 T0 Z8 v& }  B$ `# }. E6 \
    settextstyle(40, 20, _T("楷体"));4 N- y/ T% L! Y
    outtextxy(x+50,y+50,"FCFS");8 p+ H) T/ s) V; r" B
    outtextxy(x+280,y+20,"CPU");       //画柱状图! F3 M4 f2 A. L+ S- @9 Q. ]0 S
    outtextxy(x+285,y+20+200,"IO");
    ! \: i5 }; J9 s8 I' j1 houttextxy(x+250,y+20+400,"change");
    & W6 s# x; g/ \7 Brectangle(x+270,y+65,x+330,y+215);# T* v5 A3 J$ ~$ Z) p: x6 g
    rectangle(x+270,y+265,x+330,y+415);
    1 a. @( p- t- Brectangle(x+270,y+465,x+330,y+615);
    # k# J7 R- t( @& {outtextxy(x+290,y+620,"TT");4 ^( r5 {6 E# l7 X
    t = (float)com;/ ]  r% k* [: J% }. t' g; g' }' i
    temp=(t/101)*150;( ]: n. p, c0 z" i  U. x4 T
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);5 u7 \) ?5 v) K5 K" g% I+ a
    t = (float)wai;
    $ K* F2 Z' y0 X; f7 W* f* o' utemp=(t/101)*150;
    , N7 A+ ~9 H9 V' r3 l6 Y  A4 Ofillrectangle(x+270,y+415-(int)temp,x+330,y+415);& J8 b0 v* |" }' c0 C1 p
    t = (float)cha;8 w2 f% Z9 b, s# }+ D  I
    temp=(t/101)*150;  a- _: H. P( o2 b* i0 h  }5 M7 z" n
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    * h4 F. V& P* k6 Lfor(i=0; i<3; i++)   //画坐标   high=90,length=250: L2 F; s, T2 R  s
    {& \/ \: p$ w; z9 S5 y
    line(x+650,y+210+210*i,x+1150,y+210+210*i);
    4 ?0 I$ M- T, t0 x% H" ?$ t  |" yline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);4 `9 I1 [1 P3 k6 G5 d
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    ! o* g! X0 H/ ]( \
    ; m5 D" W6 q' o$ _1 D2 g0 aline(x+650,y+210+210*i,x+650,y+20+210*i);9 d) M: {/ l) K2 [/ i; L1 g
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);: _* }  B% o3 Y( U
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    7 C7 q& e( n8 ~1 E" }7 xfor(j=0;j<num-1;j++)
    4 f+ l9 N, W! s+ G$ m0 n; M{6 i/ L) o% z, W2 H! K  E( }$ E
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    . h9 `- i0 R# C8 Eline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);! [. L- e# z2 o  u0 F' i1 }- J; O
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    ( @* K# |# i2 N" u! ]}
    ! z  ?, _( c* t. E/ l( x}) l! N2 |  V9 V) V4 ?
    }
    $ a  g2 |/ |+ Z  Z9 \( i9 u
    0 O6 ?( E$ n! i7 f  H) M  G! g9 a' D% m. ^" \! U
    return 0;- v/ n. N- p, y4 a% w) |
    }
    . ^$ h4 W2 l& Wint drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)/ |* V$ R# X; w. b2 S
    {
    8 @& _" E2 u' f, p9 P; pstatic int info[11][3],num=0;" S- N% B2 K& T7 v6 f# |
    int i=0,j=0,pos[10][3][2];
    ! Q4 Z' O0 T' B8 u( Q; g/ ?float temp,t;9 w# X5 C( M" V+ F. u
    info[num][0] = com;
    7 X# n( ]) m8 `0 F+ u0 c, O0 t) Hinfo[num][1] = wai;# T* h! r2 l' b# k
    info[num++][2] = cha;& O$ }) N5 `6 N& d" [6 q
    if(num>10)  //存储10个点6 d  h* @& B: R; [0 S
    {% J  Y, }+ Z/ d$ z  H
    for(i=0 ;i<10;i++)
    5 j8 m7 j1 e4 a% U  j{
    / \* g' S& m. B4 K# _, Einfo[0] = info[i+1][0];& u& y) Y/ s6 f/ Z$ {: Y9 m
    info[1] = info[i+1][1];
    8 q; K. F9 d) B, [. einfo[2] = info[i+1][2];
    : e: J& o0 S3 F2 G% U" n. @$ O$ T}
    4 g# O0 Y- R! T$ Snum--;! N3 D' |) j5 o( w7 {! S1 Z
    }7 |- M/ z0 I9 ]6 K# _( d. f! ~
    if(FLAG_show==0)
    $ v+ k! U& x8 n; J7 greturn 0;
    5 F4 o$ q9 \0 ?/ E7 z/ K. B" m6 Cfor(i=0; i<num; i++)6 m" Y- Z. `, n) o/ I' _4 R
    {
    % X% h; s8 ~$ zt = (float)info[0];! `) `& D" ~$ W# S5 y$ S
    temp = (t/101)*90;
    9 J3 g; i3 m( y" n7 a. a6 t1 apos[0][0] = (10-num+i)*25+x+100;. J: D# `5 N- L6 ~
    pos[0][1] = y+110-(int)temp;
    , x% Z3 s- T, Q; y1 X+ Mt = (float)info[1];
    ! d9 _- O! ]0 T) A6 D! ytemp = (t/101)*90;
    5 l2 ^2 }1 v. h( o- Vpos[1][0] = (10-num+i)*25+x+100;
    + {6 {% X  B% K" @/ Xpos[1][1] = y+210-(int)temp;! F9 d" P  A( H* M
    t = (float)info[2];; ^* S  b5 K0 t( e5 y
    temp = (float)(t/101)*90;. {4 a4 y- C$ Y! E1 D  X
    pos[2][0] = (10-num+i)*25+x+100;9 c) a# f6 ]0 z! M& s
    pos[2][1] = y+310-(int)temp;+ W# b  S5 x5 n' H$ K' `
    }
    2 w9 s/ |* N) o# i8 M# xif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)9 Q8 X+ r% n  W6 _9 k! \
    {
    ' H0 L0 {. J+ V8 c" T4 C) vclearrectangle(x,y,x+400,y+315);* W) Q: x5 y3 I( n9 C. g
    settextstyle(20, 10, _T("楷体"));
    5 S) ?" d3 `) u/ b! O7 krectangle(x,y,x+400,y+325);- y9 f8 T5 U0 m$ C; S9 n
    outtextxy(x+40,y+10,"CPU");       //画柱状图; \# r. f3 ]  x7 Q9 ?, y7 G" Q6 B
    outtextxy(x+45,y+10+100,"IO");2 Z8 N5 S& |" n8 O% b4 @, ^# n
    outtextxy(x+40-15,y+10+200,"change");
    ' ?3 H5 R3 W; M% g3 e" xrectangle(x+35,y+30,x+75,y+110);( u7 b5 x" B6 R9 J
    rectangle(x+35,y+130,x+75,y+210);
    3 N/ |& k% U% E* l- g6 @rectangle(x+35,y+230,x+75,y+310);
    $ |9 N7 c2 x( h& Vouttextxy(x+180,y+310,"HR");
    - }9 C1 R6 o, Qt = (float)com;- [0 X& o5 z  M! {% e
    temp=(t/101)*80;% I+ ^  c  I9 F+ J
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    ) t4 y( a6 o# S4 dt = (float)wai;* P2 X) T* J+ y" m6 z+ o+ V$ l; P
    temp=(t/101)*80;
    8 A: X7 \7 @: ^  lfillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    : _7 v7 Z# Q0 N: B" P# Xt = (float)cha;6 Q5 y. Y4 W7 {+ C$ S& ]. ]' Q
    temp=(t/101)*80;
    8 D; V2 F, d% T6 Gfillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    ; e: a' k" T" g0 ofor(i=0; i<3; i++)   //画坐标   high=90,length=250
    ) I# ?. D- Z% }3 n! K{
    8 n% A5 W* t4 A  O; Aline(x+100,y+110+100*i,x+350,y+110+100*i);
    & I8 P7 ?9 c0 E+ t' S' ~line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);9 l4 I) A+ q- ?# a
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);9 u: X+ x4 U) e! J
    7 E% c; P7 J6 ]  G+ \) C
    line(x+100,y+110+100*i,x+100,y+20+100*i);" H* d8 y0 M0 P2 A. I$ V
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);8 |0 M3 s' ~" w1 B
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    ' P" @5 [# k% jfor(j=0;j<num-1;j++)
    ; W) w7 i% q! K3 u- `2 p# K5 i{' J1 k; r1 [* \% g: Z
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    ' S% V4 ^- v: wline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);+ `; T+ V7 W, I/ ~
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    ( }4 E& F' G: K: ~3 P0 s* L}
    ! o# L, `+ J* E4 j4 \$ w; i$ |}* {% B) U' h  `/ f3 U. z
    }) S# l5 K/ e5 m5 ]! c- v& Y
    else if(FLAG_HR==1)
    & @! D! j4 N6 m% Z{
    4 f% X( d! H% _" {% W" m! Xx=0,y=0;
    0 o( g0 {9 i7 Z6 y0 tfor(i=0; i<num; i++)
    4 B, @2 u# l, \/ V$ k{4 G* {1 t$ H8 |, Z
    t = (float)info[0];
    7 F" N* i; _* @! y# mtemp = (t/101)*180;9 V, W8 F+ e/ f( a3 `$ ]- q4 v7 M' H/ a8 l
    pos[0][0] = (10-num+i)*50+x+650;. K! I! |# d1 u  Z
    pos[0][1] = y+210-(int)temp;. p( P' b0 w1 h: ^4 q$ M' y
    t = (float)info[1];
    : d8 H! o0 H/ o/ Y- {- B$ ?temp = (t/101)*180;
    " C4 E9 m2 G1 M3 K% }pos[1][0] = (10-num+i)*50+x+650;
    7 B2 v( ]: X: p; J" X) k% Kpos[1][1] = y+420-(int)temp;! y% s% B, N  }. a/ ]" ~: N
    t = (float)info[2];
    6 X6 g6 f7 x  E/ etemp = (float)(t/101)*180;4 M& z" _! L6 q5 v- W
    pos[2][0] = (10-num+i)*50+x+650;/ c+ J! }4 V5 I6 c# s6 N
    pos[2][1] = y+630-(int)temp;4 r0 ^1 \( W( P1 ~( ?" S
    }
    # O4 V* {7 B* e: j+ R9 cclearrectangle(x,y,x+1200,y+650);
    3 ?) y# d8 e" b- }- i* nsettextstyle(40, 20, _T("楷体"));- ^! r: b# x& v6 \  A$ U" i& t% q
    outtextxy(x+50,y+50,"HR");
    3 G0 A% M( ^2 E: couttextxy(x+280,y+20,"CPU");       //画柱状图& |6 h: C1 t! V6 r
    outtextxy(x+285,y+20+200,"IO");
    7 }( o3 P. O, z7 W1 N7 Y: m& ~8 \outtextxy(x+250,y+20+400,"change");
    ! M2 y# A4 }" x. c* l& H2 Irectangle(x+270,y+65,x+330,y+215);! V! L) d1 H  V3 t, C* I* w8 x
    rectangle(x+270,y+265,x+330,y+415);! [) I# \+ P# L- R$ e  J! f
    rectangle(x+270,y+465,x+330,y+615);
    1 C' o" n( |- |- |( ~outtextxy(x+290,y+620,"TT");
    , |7 n- e: S6 E( A1 Z$ v$ [t = (float)com;; n; _+ Z) Z$ R  v
    temp=(t/101)*150;/ \: @2 ^; W6 T$ Y1 g
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);8 R, ?& U0 R) B$ z1 f2 [# X  ^1 V# ?
    t = (float)wai;. _9 B. u0 _% M% z- C
    temp=(t/101)*150;% I: Q( \! ^0 P% R+ Q! U% Q
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    / w1 U9 v* [  v& b4 gt = (float)cha;6 }, N3 |7 e4 Z# X$ D. _
    temp=(t/101)*150;
    ! ?& o8 _- k, M# Hfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    9 K8 A- \) D9 f, {( n# Tfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    4 N( d8 ?( e* a* O* C{
    6 b, {2 b; D$ Q; Z" x  eline(x+650,y+210+210*i,x+1150,y+210+210*i);
    7 a8 w! h! R; ~5 i2 g- R2 V( i1 wline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    + X" W! W1 v0 C( \. z( c: uline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);) V$ Y9 s: I, @3 ?9 m8 P2 E+ w
    ( G' G4 R1 [( i) w
    line(x+650,y+210+210*i,x+650,y+20+210*i);; t0 v0 ]" G2 r% [% \$ R, o+ a
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);* y# Z! b' P# F4 ?4 n
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    6 Z9 ~9 r# E7 [4 a& a$ C5 q. ^# Dfor(j=0;j<num-1;j++)* Y, [  Q# V7 U
    {
    # r, }) N: Q: m5 t) ^% Oline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    3 j7 p* V+ C" j7 x; E! X4 Sline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);, |. `& f4 _( v# g# g6 x, y6 [
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); . k4 Y# Z3 _  [  ?
    }
    * z6 N' t/ o( z* M7 `- p}
    % G4 Q5 X8 ~, V5 u+ t6 s3 x+ i}
    - }3 W( e( Q" l1 Y4 t
    . Q% N& b  n2 `" n6 A7 F3 ?5 Z, k3 s% g8 H3 M
    return 0;0 {: Z3 f- C* M/ S. k, }8 \
    }7 y' x, `; P8 q0 }" [7 |
    int drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)
    & d! r7 d7 K% c/ N0 Z- O0 R* n{
    1 _. |; Q& e* D1 }9 q8 Lstatic int info[11][3],num=0;
    $ K* m2 J/ K( ^( eint i=0,j=0,pos[10][3][2];, {) l% F  ?9 U) o1 v9 J, d: o
    float temp,t;
    ! y( T* l/ U" Zinfo[num][0] = com;
    * _# D: s& e! d, j0 Dinfo[num][1] = wai;
    5 Z6 g* V) E" ?6 U( W+ R  Pinfo[num++][2] = cha;
    8 F0 a; q, E( y+ y  kif(num>10)  //存储10个点; K. r; Q# p$ P/ h, v
    {" h% Q6 E5 ^: ~9 j& C+ B& Z
    for(i=0 ;i<10;i++)
    ! h  C: s: [4 s6 |' P$ h) I{  o. ]- c2 Y0 ]; _! |0 M
    info[0] = info[i+1][0];
    - v( V# N' w) R  Z) z' p: U" yinfo[1] = info[i+1][1];4 g3 Q8 e6 j6 f' ]7 W8 M# ^! q
    info[2] = info[i+1][2];
    6 a4 C4 d: Q4 H: S0 `4 s# J( r+ }- x" E}2 ~5 Q, |7 }4 s  D9 X/ }
    num--;
    $ q4 N- E( Y- a- d}6 v  l& }4 T$ n! I6 J6 v3 b
    if(FLAG_show==0)( a' o2 p6 _1 `0 n( a( Y' h
    return 0;
    ) Y' n& S% I: Pfor(i=0; i<num; i++)/ G# I0 d6 L3 r2 i0 D5 f* U
    {0 ~4 T+ L8 [8 p3 x' E' D# |
    t = (float)info[0];
    . b' S: @0 E4 o4 G! Wtemp = (t/101)*90;) i  N* j) b( q
    pos[0][0] = (10-num+i)*25+x+100;
      r# y: d- d# D: Dpos[0][1] = y+110-(int)temp;3 a% @# I/ t6 R% Y
    t = (float)info[1];6 M, [) e5 Q+ I8 q% A' b
    temp = (t/101)*90;
    # c% V  \: J# u7 L: Gpos[1][0] = (10-num+i)*25+x+100;
    ' I8 k+ i; x& R- r" k, lpos[1][1] = y+210-(int)temp;
    2 J( r6 z" ?/ i. N4 e: vt = (float)info[2];: f5 R( S" _% I
    temp = (float)(t/101)*90;
    1 J5 v2 e0 v4 D7 ^* ppos[2][0] = (10-num+i)*25+x+100;
    ' |  e; k5 N2 ^; r; w: o( o! Y5 Kpos[2][1] = y+310-(int)temp;
      X' C$ n# {" \; s3 \& w% J; l/ W" ]}3 K3 d* `# f# v/ o
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    4 q# a4 \0 E: [* V7 i{- `4 j) {5 r, A+ O; X
    clearrectangle(x,y,x+400,y+315);
    $ z" K. P2 P* i+ S& zsettextstyle(20, 10, _T("楷体"));
    4 F5 r; d. v. q& f$ D* r; \6 ?rectangle(x,y,x+400,y+325);% ~. @2 y4 F# W5 @: l
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    . g0 l8 X2 a- T3 nouttextxy(x+45,y+10+100,"IO");/ ?3 }$ M; s4 }6 _
    outtextxy(x+40-15,y+10+200,"change");
    ; E, {# V% B8 _7 B: ]6 b" Y. {* wrectangle(x+35,y+30,x+75,y+110);
    8 @; q" Q/ L: Z, Z9 Nrectangle(x+35,y+130,x+75,y+210);$ {9 u3 I& ^6 M% u
    rectangle(x+35,y+230,x+75,y+310);
    ) D/ V0 L: e9 ^$ I: k8 v- G/ ?outtextxy(x+180,y+310,"TT");0 E+ f( c9 ?4 a' U: f& ?. v# t  o
    t = (float)com;
    # O4 s% G; F% {* x% `temp=(t/101)*80;( ~3 A) u  t! X5 I: r
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);  F- X. x$ X5 J4 h& {
    t = (float)wai;
    9 m( A+ u  p6 y7 P& P" h3 Jtemp=(t/101)*80;
    - |) b, f/ z* C6 H! qfillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    & f: _3 M  K  m! Q+ Xt = (float)cha;
    , Y9 o. [0 C9 s; k' e- c0 s( h. g1 @temp=(t/101)*80;
    , A1 Z" @& H0 a( t2 c$ O) A$ \# ]) _fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    ( d) @( v8 w/ c/ Vfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    ) }! c* J: G0 `' b8 m$ u{/ y6 \$ v# u; K1 [$ T, {! @
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    6 v1 A, y9 ~. i: E' n; ^* G2 f/ fline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);" R" o( T; n4 U
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    ' S2 V8 `1 m& u2 O  S( e; \8 W: ^# x7 P2 Z% n
    line(x+100,y+110+100*i,x+100,y+20+100*i);. C& v6 G1 o5 F1 n( Y% Y& U1 q
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    / ?& T" g! e( n6 @line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);5 t  v! @( h" o5 T  O3 a
    for(j=0;j<num-1;j++): |3 j8 c6 o& Q+ R0 j$ s6 e7 d
    {: j) i6 y" p1 x* L1 k' Y/ k' \
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    * K& C# }( V9 O9 G) K- Z# O* U3 Hline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);% @; ]6 L+ u) l8 t+ U; M
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    ) ]! ~. V" L; w' i' P3 [}$ J* L: q! I7 u0 F. E! q% d
    }
    ( `0 H! z, m) X) y; s. Z2 r+ D0 V) H}5 G# o2 c# |4 O/ u
    else if(FLAG_TT==1)' x$ R9 C+ U" j3 g* p: B' J
    {
    # b1 e) Y  y  k3 ]x=0,y=0;4 f" D) m( n( {4 D+ e" q
    for(i=0; i<num; i++)! I) k5 V) b: y- d5 T* V. x
    {  W" D: g; ?3 B+ n' T
    t = (float)info[0];
    / m1 ?: w8 l; J+ \! `. q! Ltemp = (t/101)*180;
    # _1 Q/ G9 [8 [' `  lpos[0][0] = (10-num+i)*50+x+650;0 j3 T- a. o& ]# r: T
    pos[0][1] = y+210-(int)temp;6 u# Y9 M5 M4 J* A) `+ r, F) w
    t = (float)info[1];6 _+ X; @8 @/ M3 g" `4 J
    temp = (t/101)*180;8 Q' [/ O/ R& C/ ]0 _) N/ U" K/ [
    pos[1][0] = (10-num+i)*50+x+650;
    + X" Q" G' F" [& ?pos[1][1] = y+420-(int)temp;
    : z- ~0 C- f% Q$ ht = (float)info[2];4 ?& G1 p5 q0 `) Q. ~. H4 G
    temp = (float)(t/101)*180;
    " q' R7 b. ~  cpos[2][0] = (10-num+i)*50+x+650;
    : `' _& j7 E9 A4 h3 z/ C3 ~pos[2][1] = y+630-(int)temp;6 z4 C( u. q4 _* _' j
    }
    8 w) w  v' g" G, @7 yclearrectangle(x,y,x+1200,y+650);, n0 l/ i) `, R1 R8 _! P+ R  L; W
    settextstyle(40, 20, _T("楷体"));
    7 R1 ]9 {. N% h+ E" ]7 v) ?1 e( gouttextxy(x+50,y+50,"TT");
    $ B1 `) T( }3 C2 F- nouttextxy(x+280,y+20,"CPU");       //画柱状图% i, g9 w+ @9 i7 V: F; E$ ?
    outtextxy(x+285,y+20+200,"IO");& Z" k2 @0 X. o5 @# p
    outtextxy(x+250,y+20+400,"change");
    ' Y0 {& w( ^( V$ drectangle(x+270,y+65,x+330,y+215);( N1 K9 a, ^5 }8 G
    rectangle(x+270,y+265,x+330,y+415);8 |+ q. p( L. N
    rectangle(x+270,y+465,x+330,y+615);
    7 }- n5 n; m1 a; h. d7 ^outtextxy(x+290,y+620,"TT");
    3 l" J' o, r8 D* C- O4 }* Gt = (float)com;
    ' ]! D# b+ l7 E  k& Dtemp=(t/101)*150;7 D3 U& C. ^' R
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    * A" m6 J) }2 @& H3 I& mt = (float)wai;2 v! t. z  q+ P2 ]: ^+ @
    temp=(t/101)*150;  y# h* M1 b) Y% @
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    7 g) J, U! A  P2 |& O1 _- [t = (float)cha;
    ! j4 ~4 h: u7 S) d; R" j0 t$ |temp=(t/101)*150;
    # h6 l/ y: P) E2 ?fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    ! ~: c4 \  X* A0 j& j: H7 Jfor(i=0; i<3; i++)   //画坐标   high=90,length=250" G( ~' B3 s' y; N% r: q6 q  B
    {  K2 ?$ {  @2 Y) V; b
    line(x+650,y+210+210*i,x+1150,y+210+210*i);8 L0 w, S2 h/ @0 B- I
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);- ~4 _3 I1 O& q+ ~; G
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    * C+ h4 U( Y5 X+ X7 u. R7 K$ |4 D0 H0 u2 i
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    3 H' g+ P8 Z4 ^- H4 E) Y: {5 Xline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);- `: O6 m+ o2 D
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    & s; c. }2 x' N2 n3 r5 ?for(j=0;j<num-1;j++)
    . t' Y% b; N# M, b+ R; u/ k- B{1 j' t8 Z( O3 {
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    0 ?2 b' {- x: r( Y3 I0 k+ Dline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    # S# q. S4 M! o* Zline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);   `! o6 \' N6 [' ~. o
    }/ B2 W8 H' k& X( h! P0 z
    }5 [  }- A# U/ V& }/ e) L
    }
    2 ?+ V5 f4 j& P/ I* ^+ Q8 c' F. A, n5 z, e
    . ]: p) |* ]! Y
    return 0;
    2 T+ q( C  V; W- P: Q3 t$ S; }9 F}
    8 P+ u% Y! P% W; H! E& D# Pint drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)7 `- Z3 l( |  ~/ n/ k' B0 D7 ]
    {" g& l% ?* |. s
    static int info[11][3],num=0;
    6 J! d. s9 y8 h" I0 Y+ i! mint i=0,j=0,pos[10][3][2];
    ' s% `* Z2 t4 I; V) U' hfloat temp,t;0 |5 c" K5 j$ y' m0 ~9 ^) u* b  C6 x
    info[num][0] = com;) c" v* |; H3 }
    info[num][1] = wai;# v! j! z3 u  A- |
    info[num++][2] = cha;
    * o* Y1 P+ Y% e5 e4 nif(num>10)  //存储10个点( [; O3 |. B5 d: e4 n" {
    {' G. u+ m/ D2 d) ^. h% z
    for(i=0 ;i<10;i++)
    0 C& `6 b! ?! W. W/ y5 m{
    8 |% ^: ?( n# t; @' R! g3 [: L! g; hinfo[0] = info[i+1][0];
    + Y4 j6 c4 Z8 l% u+ ~6 h0 o6 s7 }info[1] = info[i+1][1];
    $ E- c: K4 g5 E/ a* y& r* qinfo[2] = info[i+1][2];. ]2 ]: B* N: H; Z6 Y, i, B
    }2 z4 B7 f' }5 \; G1 O& s) e
    num--;. j9 A# o. n0 M3 ?8 B
    }$ J- n' C8 ~. _( @1 n
    if(FLAG_show==0); r. c+ `$ m8 a8 d' {$ S
    return 0;
    5 |$ `1 F+ K, y2 p7 sfor(i=0; i<num; i++)' [1 B; [: P. ^. Y) O; z
    {3 z" o# X& j- f) T* B
    t = (float)info[0];9 U; Q: W9 C$ A4 l, V2 R( Z, u$ B
    temp = (t/101)*90;
      y/ f; {; r5 Gpos[0][0] = (10-num+i)*25+x+100;
    / y  k3 |( g  m1 t# bpos[0][1] = y+110-(int)temp;
    5 B4 [0 V* K% ^% K* U, }2 ]t = (float)info[1];
    ! l' l& m* f3 s' x5 h9 n% Utemp = (t/101)*90;
    * J) o- ~2 g8 R& Zpos[1][0] = (10-num+i)*25+x+100;( F) m1 C+ b7 K6 s% f
    pos[1][1] = y+210-(int)temp;
    - ?$ q/ v# {) [# T2 l6 K# mt = (float)info[2];3 a' N. G7 E% Y, O6 R
    temp = (float)(t/101)*90;3 P. L0 X- D! U4 v: \; E
    pos[2][0] = (10-num+i)*25+x+100;
    ( U. G) {0 I9 Hpos[2][1] = y+310-(int)temp;9 w# \5 X2 }  Q& ~
    }
    8 r% X3 U# D& A; Y# dif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)9 s  }" X8 ~( @& |; t) s( a
    {
    6 d. W% {) B- k: e, m! aclearrectangle(x,y,x+400,y+315);
    ! {( B. c3 [2 B8 a& K/ b; Bsettextstyle(20, 10, _T("楷体"));
    + u2 k  }0 e% @# prectangle(x,y,x+400,y+325);3 S1 P7 E& m. d& a
    outtextxy(x+40,y+10,"CPU");       //画柱状图  }/ F/ V4 C3 p. l& u6 [5 M
    outtextxy(x+45,y+10+100,"IO");- T& H. D8 T2 t0 h1 g/ ~
    outtextxy(x+40-15,y+10+200,"change");
    8 u; `& }* }2 M2 D# O4 x$ y* irectangle(x+35,y+30,x+75,y+110);
    4 l6 l8 M6 |, ^4 crectangle(x+35,y+130,x+75,y+210);
    & b! l: v3 H4 h8 U5 Q# Zrectangle(x+35,y+230,x+75,y+310);
    5 t5 U3 t/ c4 |& }$ jouttextxy(x+180,y+310,"PF");
    . o5 l3 I. |$ I& ]& @t = (float)com;
    ' K/ a) c0 b! Rtemp=(t/101)*80;9 p3 s# z3 q( g  |
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);' h5 S' S8 V0 ?: E* {3 {
    t = (float)wai;* o1 t  ?- }2 A. W% t% g: G
    temp=(t/101)*80;3 g1 P$ N- p% b
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);3 S. \6 L8 [: f2 F8 {) Y( m3 O, P
    t = (float)cha;; D* n4 L( T! x4 I
    temp=(t/101)*80;
    / m( N& c& g- i. S# u6 Efillrectangle(x+35,y+310-(int)temp,x+75,y+310);/ {1 ?# ~0 M9 F  L* G2 \
    for(i=0; i<3; i++)   //画坐标   high=90,length=250' d  Z7 w$ }$ s# ^6 {. M' [
    {
    , A( N) R! x, w2 }line(x+100,y+110+100*i,x+350,y+110+100*i);
    4 J* P4 _1 A$ @* tline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    3 P6 J/ @5 D% X0 n# @: ^7 R0 sline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);+ a6 S0 \6 o( ]6 z" }
    4 Q3 {" u) J# \6 y
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    1 A/ c4 E* J0 b* h0 c+ p% Dline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    ( n5 X, c. Q% W1 e7 s- \5 E- Qline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);% W1 i( Z2 E4 T2 P1 W0 s* k/ L
    for(j=0;j<num-1;j++)
    : |: o' a' R% H{3 d- H- ]5 }5 t9 o" j
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);2 D6 Q5 s: E) d3 ^) L
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    # F- {+ \& Z. g2 Uline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 9 T; I5 O& P0 o" @! W6 O* A+ a' k
    }
    7 J, N1 L. h  z1 b9 G. y}$ `7 i8 G. Z9 O! E, p
    }
    6 q/ I) v) T. [: N- x) e0 [else if(FLAG_PF==1)
    * O, T7 \: M! h2 ^" R* |, D% p5 o{
    ( i* L% |4 M8 _, xx=0,y=0;8 }7 B$ _- T/ M3 X
    for(i=0; i<num; i++)) a; z; j! z( o! ]
    {
    3 S; \* O  e' `. i0 ]t = (float)info[0];
    : S2 U: J9 j5 itemp = (t/101)*180;
    : U) `6 U1 T& [9 S$ C' r9 D; ppos[0][0] = (10-num+i)*50+x+650;
    1 D8 |9 f# X( T% {0 i" zpos[0][1] = y+210-(int)temp;4 J6 v! W6 E: B( L
    t = (float)info[1];  @$ Y1 u+ ^$ y" M* r! a
    temp = (t/101)*180;
    ( m; _) [: L) e2 I. N1 epos[1][0] = (10-num+i)*50+x+650;5 J, q; [! X7 H
    pos[1][1] = y+420-(int)temp;0 \" T) v* z9 D* d2 E# ~/ _- S3 h
    t = (float)info[2];4 [" X9 h' f/ ^& a1 F2 L# C
    temp = (float)(t/101)*180;: j' e6 l0 M1 ]3 `# P" M' m
    pos[2][0] = (10-num+i)*50+x+650;) @$ E$ j1 P" i8 }: R) ~
    pos[2][1] = y+630-(int)temp;
    " D6 Z/ f. F* v/ x* L& q}. j0 t2 N  h7 P  ]3 k% p" Y, O
    clearrectangle(x,y,x+1200,y+650);! _* Z% N3 ]& A3 E# N
    settextstyle(40, 20, _T("楷体"));
    / Y& Z) F, Q/ Gouttextxy(x+50,y+50,"PF");2 d0 s6 i* x0 W8 }8 O) ^' \9 O
    outtextxy(x+280,y+20,"CPU");       //画柱状图' L/ ^( j$ A# o, N) p- q
    outtextxy(x+285,y+20+200,"IO");
    + {) k7 @  D; ]outtextxy(x+250,y+20+400,"change");- ~5 h0 J  I$ Y1 H3 q0 q& d
    rectangle(x+270,y+65,x+330,y+215);' R  g- g1 R- ^& w- t' \
    rectangle(x+270,y+265,x+330,y+415);
    ' P+ p' J# E% `& S6 Nrectangle(x+270,y+465,x+330,y+615);
    " v1 P7 u# ~) o/ J( ]outtextxy(x+290,y+620,"TT");# M! }7 ?- J& F: p4 V
    t = (float)com;6 `/ f  c4 V* W/ d4 A
    temp=(t/101)*150;
    + S+ A; Z1 D# M7 q0 r8 ^0 K  b& wfillrectangle(x+270,y+215-(int)temp,x+330,y+215);% v2 y" e8 a9 t4 ^
    t = (float)wai;
    $ ^( y- i2 j/ T* \2 g4 B, g5 `( @temp=(t/101)*150;  `/ s: U- @6 e0 s6 ]% T8 T; m
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);3 t" @0 z9 q+ _* F
    t = (float)cha;& X) ^1 ?! S6 u3 Q2 O$ u+ X* ~# q
    temp=(t/101)*150;' n) s; Q5 j1 j/ Q
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);. W" F6 [4 q& b; M+ S$ d, Q9 a
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    + E. v3 t8 V9 x4 \{
    ; Z. g" C6 @) m: e( ?3 Lline(x+650,y+210+210*i,x+1150,y+210+210*i);
    ' ]$ o, e2 d* i, B2 bline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    ) h$ v2 ^+ z5 ~0 a  Jline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    * b: G( {. X0 a3 d. A3 y! K! L- {- V( N. A7 e1 K
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    ( K5 p: y4 t" @4 m# O2 gline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    : B# i+ c- q4 ^3 u# W- f) n8 ]0 _" ]line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
      z0 G# u8 N% n! t* a1 f$ k. D/ e9 yfor(j=0;j<num-1;j++)
    8 ]4 a- S0 a) k2 `' ^! ]& M* c{# Z8 S* Y) V* b3 Z/ q3 i. @: E: y- ]
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);  a3 M: f. c5 u7 x
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    & e0 c3 b) R- d& K( dline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    $ B  Q" ]7 B8 v; \/ ]3 l6 `}
    , @! f! y& y" P2 V: V2 V! _}
    : c; w. d( k$ U6 \. {3 H}. H! x: Y, w1 J4 ]( j, _& H
    return 0;* V9 C& R3 S3 _1 @. _
    }" M0 f1 M/ j$ U' Y- }$ g
    int drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha)+ ?% I* n7 \+ t
    {
    0 M! B0 H0 f5 J% a" W& V$ Jstatic int info[11][3],num=0;
    4 l3 J- ~& k7 h1 N) @int i=0,j=0,pos[10][3][2];; f6 g4 [3 t% T  w
    float temp,t;
    4 r" j  i5 q1 d  n' C' g# winfo[num][0] = com;
    0 k/ L* }1 Y7 Z- I+ y0 winfo[num][1] = wai;
    2 O4 n- U  B; M  H% @info[num++][2] = cha;
    * b8 E; N0 w% }& j5 Zif(num>10)  //存储10个点6 g6 ~3 j- r0 w' b. l
    {. F" m( L' `; O7 [
    for(i=0 ;i<10;i++)
    % I6 r# r' `; M" a! r! z6 J7 X{
    / z9 p4 O6 r, ], i$ w" |. ainfo[0] = info[i+1][0];' ?8 Y; V* |) ]+ H/ O6 j
    info[1] = info[i+1][1];! _1 ~2 V3 {+ t: t
    info[2] = info[i+1][2];
    4 _5 s5 `9 Q( @' [& N/ o}' G& E# M* Z; U7 q
    num--;
    ) S8 H: z% ^, G5 F* @9 ~2 `}
    : C5 [; ^2 e( b, Z* D" m, oif(FLAG_show==0)
    & d: H' h! ]7 t0 x& P1 R" oreturn 0;) p% B1 k1 Q3 r8 q; S2 c1 u
    for(i=0; i<num; i++)
    4 w& `$ r8 G, @" R$ y# ~3 Q{
    - ~) S. B0 _; j4 v: h. kt = (float)info[0];
    7 H3 `) F/ ]9 X/ Ttemp = (t/101)*90;
    3 S- k, @; ^2 ^( S0 J# Kpos[0][0] = (10-num+i)*25+x+100;
    ( _! L5 a8 b) e) Fpos[0][1] = y+110-(int)temp;  A) ?" |1 x: `1 _9 E  _
    t = (float)info[1];" a/ F; q; S; s5 j. c+ s
    temp = (t/101)*90;
    0 N; \# m+ [+ W) g& o1 z% L3 Apos[1][0] = (10-num+i)*25+x+100;
      G. |4 ^8 n; V0 Q; cpos[1][1] = y+210-(int)temp;
    ( ]8 @2 x  |2 R" N5 H# Ot = (float)info[2];
    , ]9 W' ^9 m0 c& m( e, ltemp = (float)(t/101)*90;* A% A. r5 n3 |1 O2 C! @3 {1 i- M
    pos[2][0] = (10-num+i)*25+x+100;' Z; z. t+ A/ E( z
    pos[2][1] = y+310-(int)temp;
    0 h% E7 N) N0 T, g# j6 _' R}% j1 S1 d  c6 j) t
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    7 w$ i. I  ^% N  P' |0 K% P! w{
    # h2 h& r* T% S, r  z: R& b* Aclearrectangle(x,y,x+400,y+315);
    ' B; b/ i7 u! B$ N" S# {! I" tsettextstyle(20, 10, _T("楷体"));
    9 W0 g  Y( O: S5 g( O0 Crectangle(x,y,x+400,y+325);* i8 W8 ]( r! S: s8 t5 s
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    / K  j% ]) x: s/ x3 k4 v/ Q1 [outtextxy(x+45,y+10+100,"IO");7 n# ~/ ~4 q3 F5 Q, K
    outtextxy(x+40-15,y+10+200,"change");
    ) n& |8 }/ O! r3 w0 i" x8 S/ g% Xrectangle(x+35,y+30,x+75,y+110);' |6 P' k/ `4 c6 Y+ W
    rectangle(x+35,y+130,x+75,y+210);
    ) E) v' q5 {6 s7 d  b  orectangle(x+35,y+230,x+75,y+310);
    8 t. ?7 J8 H4 A# c: Bouttextxy(x+180,y+310,"SJF");- [3 ^9 r1 v; B' L. C! t: n& W
    t = (float)com;
    ( ^7 C8 D2 m7 l7 {( [temp=(t/101)*80;5 ?+ x! K3 n- \
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);8 v! \  i& n; F  q$ X4 x6 e
    t = (float)wai;
    " a6 r; o9 v. v- xtemp=(t/101)*80;
    2 I$ [- X% u: y: R, |" F' _fillrectangle(x+35,y+210-(int)temp,x+75,y+210);; U6 Z# t( V' F/ W, C2 |. D* f9 x6 `
    t = (float)cha;
    8 F1 @$ Z5 Q+ d/ R* y3 t. Ktemp=(t/101)*80;7 \. {# V: W/ P1 o
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    % G! X3 _7 u+ x& j! ]for(i=0; i<3; i++)   //画坐标   high=90,length=250; T( H5 S6 e0 O& m4 }
    {
    8 q1 s& h# s- aline(x+100,y+110+100*i,x+350,y+110+100*i);7 o. t  x# M" H' K
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    * Y; W3 g" \: ?5 Xline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    8 C6 U7 C9 @% a) d1 {$ N' i+ m- ^, I( G
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    8 ]9 c- C+ T" J0 H! p# M! Dline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);  C. Y  M: h9 l% n: A' e3 A
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    ! b; y# o8 C- B3 G1 ~- t9 d) {for(j=0;j<num-1;j++)
    6 ~0 [8 E; H! k7 S8 t{& Z$ m# u7 ]5 K5 e' R) m8 r6 o
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    # b! O7 Z/ O; q1 {/ V2 y3 Q. d' ~line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);0 r0 R2 T) }' Q$ k, e& ]9 p
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); # w. W3 u1 v& j4 @
    }. v9 y. s& i% }& l' [
    }
    # m  u: P' I' o8 N' X3 ]/ l}% A5 Q- X2 U: d& ~- U& z, z
    else if(FLAG_SJF==1)
    8 k' b5 N# P; y! s3 ^{
    2 j, E/ j+ A: b4 w9 f$ @% }6 fx=0,y=0;
    - J- W$ k8 k- T: S% F1 d/ efor(i=0; i<num; i++)$ T' I& K' B! C' r
    {4 d' n1 |/ l0 l1 W
    t = (float)info[0];
    ; d9 x- f8 X) Btemp = (t/101)*180;1 B. V; E9 `7 }, h  K
    pos[0][0] = (10-num+i)*50+x+650;
    5 [( Q) E6 a7 apos[0][1] = y+210-(int)temp;; A7 K$ E; {) |/ L4 z. ?& p0 g7 f
    t = (float)info[1];
    ( R( K8 H& Y/ o- F7 I4 Ktemp = (t/101)*180;; X8 z& X8 c1 E, w. o+ o; N+ k
    pos[1][0] = (10-num+i)*50+x+650;9 o+ q+ l* `! r+ c' X# H; E9 a0 L+ R
    pos[1][1] = y+420-(int)temp;( q0 o$ R6 w. r6 {0 _9 r* L0 A5 \
    t = (float)info[2];
    1 q1 D2 X- r/ \4 [) E/ utemp = (float)(t/101)*180;
    / ?+ n4 r* F& |: I6 Apos[2][0] = (10-num+i)*50+x+650;) d' @: g$ K, l" [7 c. l
    pos[2][1] = y+630-(int)temp;
    / H7 \$ L3 J* _; Q+ c0 @6 o}  O1 D9 v) `3 y. W
    clearrectangle(x,y,x+1200,y+650);8 i& V- u1 L4 i# Z
    settextstyle(40, 20, _T("楷体"));! Q6 L5 F. i# Q
    outtextxy(x+50,y+50,"SJF");
    2 k& b( }5 y) youttextxy(x+280,y+20,"CPU");       //画柱状图
    . d7 D* A- s; i! g/ L. {$ g3 qouttextxy(x+285,y+20+200,"IO");
    / `% D5 _8 B' Y$ C& C" Gouttextxy(x+250,y+20+400,"change");
    9 u# ?1 `; m( P, h( ^' r4 Y0 ]rectangle(x+270,y+65,x+330,y+215);
    + P& R9 n3 J( W  K0 urectangle(x+270,y+265,x+330,y+415);4 {+ o1 s! m+ ~9 \6 Z) z* o
    rectangle(x+270,y+465,x+330,y+615);( B, Q4 D! f2 g$ E- E) D
    outtextxy(x+290,y+620,"TT");& n' G; l7 [2 B9 T, E: [+ X
    t = (float)com;
    , p, R2 I8 y: o. O) K2 d( xtemp=(t/101)*150;
    ) v* n) X( g# [. nfillrectangle(x+270,y+215-(int)temp,x+330,y+215);0 E4 H) H0 B- v8 G2 T) m
    t = (float)wai;
    , h3 m# Z* ~1 c/ ]temp=(t/101)*150;( J3 M* j2 a' c! g
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    ; S1 `: c5 E: gt = (float)cha;
    $ D6 K! T# y! gtemp=(t/101)*150;  `- _3 {" w, i
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);+ d; ^3 F) N8 @/ ]
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    . z7 O( Q3 r2 a& e- y( P% Z) s8 q{, v- g( M2 c' I& g- {; m# r
    line(x+650,y+210+210*i,x+1150,y+210+210*i);- A- l8 n" D7 E2 Y
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);) `9 P& w0 T( A3 a5 J8 X: a% E3 a
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);: j: d$ r- w: p  ?/ \5 z
    2 m0 f4 n% o( U4 l" E
    line(x+650,y+210+210*i,x+650,y+20+210*i);# E: L+ l  t8 i4 A) R( K3 H$ }
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);& d$ A5 M0 _0 @8 ~. ^' ]8 [
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);7 \" `! {4 o! ], G
    for(j=0;j<num-1;j++)# h1 v. p: ~$ [6 b- d0 v0 [
    {
    / t# z! f1 Q$ h! ?2 a' V$ V5 fline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    6 P/ d+ S( G  S, H5 S9 `* m1 E( u" Xline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    . U0 ?) @$ I! y3 O2 tline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    2 W3 e% n; V9 ?7 B1 f}# d$ e9 j% E  q! |% E7 g
    }- A: o& P1 u* o7 n
    }4 ?7 z/ ~; e, h5 A+ l8 M
    return 0;1 H! B+ g) c) A. R7 z
    }6 ?2 Z+ h% x) ^) W: M2 }
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)3 F: t8 r( W* A
    {
    8 P2 W& a8 ], C) m0 estatic int compute=0,waitio=0,change=0;# X  W9 C+ G5 |) `  L
    static int computeLast=0,waitioLast=0,changeLast=0;
    3 F6 {  i" x  Aint i=0;. D! @5 C1 }8 u5 {
    if(draw==1)
    9 t" j/ T! R6 B# R2 c/ V{
    & t* z1 ]( R0 k) a7 B//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    # ~; @$ J3 C& A! B( k7 S1 pdrawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);) _; o& o7 O; d+ S% b9 ?
    computeLast=compute;
    . w& F; v6 b1 s* C3 L, |! rwaitioLast=waitio;
    ( `$ U: v5 f) a, q# ^changeLast=change;2 r0 P7 j% y9 t- I, _( E! b9 O
    }4 _2 |9 z0 [& c( @. Z- i2 W
    if((* memory).p[0].flag==ready)8 e8 S9 b$ @, P$ Q6 @- H. K
    (* memory).p[0].flag=computing;
    8 o+ W' g  G4 M: C; ]if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    / b3 ~+ x1 u+ A, R{% R6 z$ ~  E6 l8 d3 Q
    i=(*memory).p[0].computeNum;: `/ r6 S" S6 v' U0 n+ G
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed5 F8 ^! [0 `# N$ _+ G7 l
    {' A: \8 b7 O4 C/ q1 K- f
    (*memory).p[0].flag=IO_waiting;- `( `" [2 W5 r
    (*memory).p[0].computeNum--;
    3 z! M) k5 y2 |8 bchange += exchange_IO_Compute;$ ?# ~8 x5 V8 ^8 Q4 E
    compute++;3 b& s  S. y: U2 U: ~
    }9 y, {8 W. I2 q# n
    else# ^! w2 D, `+ i% h$ V1 q
    {
    8 f) m. d0 o% }2 G- G0 D- Qcompute++;/ N  {% D: B: T; Y, ^. W" u3 s
    }- t( r. p$ ]! s
    }# r0 |9 Y4 z. Z: f
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)3 E7 H6 f: _  q/ u2 w; ?
    {
    , J* c! H- L3 n" Q! v5 H8 n
    9 |4 d7 p! W4 m$ C3 Ii=(*memory).p[0].ioNum;! O% ?6 x0 ]& u, z
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    * Z7 j6 x1 L+ _/ f{. I( W$ f. e( s% v5 N0 v$ I
    (*memory).p[0].flag=computing;
    ' X- O, R. c" P2 a* l6 S. K(*memory).p[0].ioNum--;; p! b* V6 D8 L6 H. A
    change += exchange_IO_Compute;
    : Y( M" X0 |4 B/ l" nwaitio++;
    1 C: y; g$ s$ \/ ^}
    . ]2 R; G+ k; F1 o  n4 R/ l" @; C7 K) selse# ^. w: k3 @3 v1 |5 p% U" |5 m6 p+ r
    {- a$ O* o2 Y8 ]
    waitio++;8 q2 p( v& w: I8 V" c' c' O
    }) H/ \- G. l+ w6 Q
    }7 d6 s: W, f3 o; r
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    . o* o' v/ h* A  ?, W{
    . c0 ^; Z  e! \; @; u( V$ q9 G(* memory).p[0].flag=IO_waiting;# v( b9 @6 V, p$ e; R' z' g8 k
    change += exchange_IO_Compute;
    0 b- a8 w$ m" i}5 v( d5 B  C( i5 G5 s
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    & F2 K5 f6 v# ~{
    / ]' \9 q( |  \/ J+ s- H' [(* memory).p[0].flag=computing;: j* }0 @- ~5 Q7 N' M( e$ U
    change += exchange_IO_Compute;
    + d8 ~# h( x, t% a/ }7 M. e* r}2 R/ \& |8 I" w5 T
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    2 m, |$ {: @% z6 [6 ]% P- \{4 F, s, |& n1 R4 Y! l  h  u  N* z5 ^
    (*save) = (PCI*)malloc(sizeof(PCI));, b" G% ?% Z  h
    (*save)->next = NULL;  Y0 ^( B, x, b& G+ c# |; G
    (*save)->processID = (*memory).p[0].processID;/ O0 |  \& A+ ~% K0 W2 r
    (*save)->comeingTime = (*memory).p[0].produceTime;
    " C, h0 h1 s. c(*save)->askMemory = (*memory).p[0].askMemory;! c: @( V) R9 L2 u
    (*save)->compute = compute;
    ! h4 @1 l9 I0 z(*save)->waitio = waitio;
    . h7 _* a* Z, }(*save)->exchange = change;
    : i& t/ Y$ N# v% S/ R5 |% @(*save)->completedTime = systemClock;# t" w, C6 B5 `3 X0 t& g, w5 g" D
    (*save)->runningTime = (*memory).p[0].runningTime;
      x; ?0 ]5 @0 U& L" x*spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;
    7 ~3 v  K6 {: q# |1 ^  H' wcompute=waitio=change=0;
    5 w4 l" v9 y( _% a0 T4 F; D" TcomputeLast=waitioLast=changeLast=0;6 P8 o" M$ ~8 _/ n
    High_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);0 \2 ?& T" u8 k) Y( [
    change += exchange_process;
    , `3 K! _. j6 I+ o1 o9 Ereturn task_completed;9 z* k* v5 _( ^& D9 ]
    }
    6 N$ H- J* s! G. }+ f$ l# Lelse$ K$ X7 q9 x5 k' [! t
    return task_not_completed;
    & E; y. z' _) L1 L. d1 ^}
    6 a) g$ Q  S8 Z7 Wint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch)
    7 o6 G: ^9 {( I6 x" |" M. e/ Z1 i{5 p' P9 K. S/ S
    static int waitTime[initProcessNum],i=0,j=0;
    ! N5 E7 F+ x( K. q. estatic double HR_ratio[initProcessNum];
    1 L4 g( j9 U) m' [" Jif(flag==0)                    //初始化数组
    - I8 J( S) ]. _{
    5 P2 }8 O/ k$ C& ^for(i=0; i<initProcessNum; i++)
    9 T( \" i( F3 I3 A2 n6 V% E{, `; ?: t9 U. w# S
    waitTime=0;
    # s! O, v3 x1 ^% b2 ]8 d% K' XHR_ratio=1;# S1 G! }: h* t* r; {4 w, O5 D
    }) t+ f: }( W) }2 [' r' H/ R
    }
    ) l: T$ p9 i8 S' ^' A# y. ]for(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比5 |0 j! z8 R  _4 p0 j
    {
    7 g# T2 }  h. g! l4 owaitTime++;1 j2 v5 v6 g3 q% \
    HR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);/ l( J5 {6 E8 p" K# ~# z7 s/ W4 O8 t
    if(HR_ratio > HR_ratio[j])! b4 o" ~' m7 b: u
    j = i;
    ( y: |; P% C9 r}
    1 O/ w* r5 |/ e8 m- `& h, k* Aif(dispatch==1)                    //需要调度一个进程到内存中执行8 e; f4 c  p  F& x
    {4 {& p5 C# D! L. ?8 l, c9 ]
    if((*storage).p[j].askMemory < *spareMemory). U7 G. ~  @) A7 |' l( b
    {5 T( v! S8 ?; H9 _* V0 a  q
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;3 D7 h# F9 m- B7 v9 I/ w
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    + j" G  }6 P# z' K$ a(*memory).p[0].computeNum = (*storage).p[j].computeNum;& |8 k& R) r' n# o0 ~
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
    % S, z2 X, H$ ?$ D( j. r# j$ s(*memory).p[0].processID = (*storage).p[j].processID;
    + G$ W0 I3 m# z- {0 H(*memory).p[0].flag = (*storage).p[j].flag;1 J: r6 c" {0 ?, q9 F. Z
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;5 |! u9 g) y! f6 g9 z9 e1 c
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;  v/ `; Y" k5 S# f1 X$ m- J5 v
    (*memory).p[0].runningTime = systemClock;1 L/ h. P) o, a! }7 I, n
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;
    $ `4 O9 j# L& b5 u+ v0 V6 @% Y, Xfor(i=0; i<(*memory).p[0].ioNum; i++)
    . R6 J9 X* h3 c4 l% \0 j8 x(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    5 L- w. W9 s/ g2 Gfor(i=0; i<(*memory).p[0].computeNum; i++)
    - \: Y  E) D4 d: k' O- Q(*memory).p[0].computeClock = (*storage).p[j].computeClock;
    ' E* {1 ^% I6 U$ U* v(*memory).proNum=1;
    1 [. i9 h/ T, H4 e3 p& v2 k*spareMemory = *spareMemory - (*memory).p[j].askMemory;, P& I4 @' B7 I$ M
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程3 f* }% o" k. ?% j3 ]; f% p6 ^
    (*storage).p[j].produceTime = systemClock;
    * S' |8 L; S6 W9 p2 D1 OMAX_COMING_TIME = (*storage).p[j].comeingTime;+ f. j% l( Y- t7 R# L; Z# V6 t
    waitTime[j] = 0;( U: E" h( x1 m' d# I
    HR_ratio[j] = 1;9 u: q6 I  g$ Z2 z# E# `
    }
    , Z; H. R5 |1 p; n- R5 }  nelse! ]8 \  `6 m& d/ A
    {
    . U8 t; }% e! E' t% aprintf("A process ask for a memory overed the system capacity\n ");
    . `# P# z5 M  f3 b0 r- s) [exit(1);* [9 C/ T6 u" X9 k
    }
    9 Z% y" |3 q) y! U6 ?: b/ G}
    : U8 _: n# Y, |+ i& n, S/ c: yreturn 0;* ]1 m( F0 Q3 G
    }
    8 \6 m( V) k) K% Gint PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)" i- B2 t4 C, [  q. B
    {+ h* k1 G) x! I5 U( [
    static int compute=0,waitio=0,change=0;
    " h) m. G6 l6 G3 |9 C1 `1 Ustatic int computeLast=0,waitioLast=0,changeLast=0;! d) P) Y$ n/ p, V/ o+ P
    int i=0;! R' q; c' x' M" |
    if(draw==1)4 [+ b1 @! b5 i8 @. i, {
    {
    7 n4 y- \3 s$ p3 P" _4 w  t9 b//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);- S9 T6 u3 r) w) W, P
    drawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    % v& B' P  W5 K8 B6 D% i; L7 B
    2 ~  v+ [: k8 z4 w7 ^/ p/ [" i0 [
    computeLast=compute;
    1 p/ y9 V/ v2 ~$ s( h, Y4 |waitioLast=waitio;
    / @) M; L- C6 C+ a$ z, EchangeLast=change;* n+ q7 a4 i# M7 D7 B/ n2 m
    }  I8 P; j; B4 ^7 O
    if((* memory).p[0].flag==ready)
    7 x  e: e7 _5 w  Z* Q(* memory).p[0].flag=computing;
    4 J  V5 ~1 h9 m3 Eif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)+ g8 `7 `& B2 Q  _3 L6 i
    {
    ) U/ [; S4 e5 G* p) j) B+ Ai=(*memory).p[0].computeNum;
    ' G& u4 b6 m+ f* k$ j" L% y+ oif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed  a: i( _2 n* u3 T
    {& _; }9 o0 n! v
    (*memory).p[0].flag=IO_waiting;, M7 u& S, X- o4 v
    (*memory).p[0].computeNum--;9 S9 ?) l( u9 e1 F
    change += exchange_IO_Compute;9 B% b" k9 v/ ?
    compute++;
    % e$ g5 @1 i* g( v" X}
    0 n( H+ R6 N3 H7 V- |else- H6 A! }% @: |
    {; v$ `& |2 ?8 C) w& Z. |) M$ \
    compute++;
    ( @  Z$ w, ?* u2 Y8 T% F7 S, Q}# n) F& {) \1 v: v9 X0 t+ u2 ?
    }
    - D; ^" G6 u6 ~1 Z! _( E1 D. R3 ~else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    / ^" o: E, k  U{( C( g" v% }0 G# L. T/ ^' O

    * r! n1 {9 R3 V5 J& M# [4 Vi=(*memory).p[0].ioNum;2 b# K$ s5 g% e' J- c4 D, g
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed% G9 }& X9 k# w
    {
    , t. B, K6 ?" [5 A- C(*memory).p[0].flag=computing;
    . T! \* U! Z4 f2 r0 w9 n(*memory).p[0].ioNum--;" {, K0 c; e) u  A
    change += exchange_IO_Compute;
      t- j5 p; r% O' |8 n5 cwaitio++;6 V; Q! R* Q3 T. K
    }
    9 ~  ~( n& C1 t2 x0 }8 C$ b3 i; [" @else! s6 |. s! Y/ F) T- E
    {4 V. @! g# `9 w2 G6 Y% h
    waitio++;  Y9 n4 p- A' @9 H3 {& H# Q, ^7 c+ Q
    }
    3 Y7 W$ V! n0 b: {  k}
    , T3 W% ]) ^2 yelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)/ ~; {% K. Z, D$ m$ k( L" i
    {
    4 b* ]- R- f) Q% X2 i: g& Q(* memory).p[0].flag=IO_waiting;
    % J$ `. a  \' q$ ~change += exchange_IO_Compute;
    4 K+ m) s, X: d% v$ j3 m; i}
    3 D, C; b6 b  ]4 g% Aelse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    * {" d9 [" T8 Z4 }% N+ e{4 q& G; R# C. C8 [$ X+ y
    (* memory).p[0].flag=computing;2 L! r; L$ q( n
    change += exchange_IO_Compute;
    ' D/ v5 _+ ]5 w7 p}
    , L/ b7 G- R8 c$ P  M. }! V; W& jif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成" {3 C  y3 q' j
    {1 _& t$ d9 |" Q, |  d0 I
    (*save) = (PCI*)malloc(sizeof(PCI));( F. c; |/ I  k  @$ z
    (*save)->next = NULL;) T) L8 P8 [+ y5 m* s9 y( x& e
    (*save)->processID = (*memory).p[0].processID;4 v5 P4 {5 n; j: U
    (*save)->comeingTime = (*memory).p[0].produceTime;
    ) G; ]( K2 c" ]3 n  V(*save)->askMemory = (*memory).p[0].askMemory;
      z' R( m* f1 X$ a' y, b9 l(*save)->compute = compute;
    ( C0 K! n, s9 j- e% K) h(*save)->waitio = waitio;
    % e+ |7 N  b( E+ v% l' Y(*save)->exchange = change;- v4 b# l" u% E% V
    (*save)->completedTime = systemClock;9 L6 N7 I  D" B- h' O
    (*save)->runningTime = (*memory).p[0].runningTime;- }9 w3 o) `% {3 N- T9 P
    *spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;
    7 ?# c4 L1 @; w6 n* D$ |& Gcompute=waitio=change=0;, `1 ?$ n: D9 y1 a/ Z+ E+ w
    computeLast=waitioLast=changeLast=0;, H7 E" s, z) K; B
    Priority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));
    ) O* J  S% |& p) e5 Ychange += exchange_process;
    / f& K7 x! k( \return task_completed;
    / a' R9 I! ]" k. k% Z+ G}
    # Q! @9 c- O8 @9 belse
    7 _& i  R6 {! J5 G: f1 n) Sreturn task_not_completed;
    0 [; J8 m2 m6 y8 {( }}
    3 ?* w" N9 Z' n& f* eint Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)- l% c2 o! H% V0 a
    {1 M. W. r' L+ N; n3 Q0 B
    int priorityNum[initProcessNum],i=0,j=0;
    4 e* q' w( k- ^3 U' R7 R7 L! b( ndouble temp=0;
    9 q1 q! ]. X  N) A2 Yfor(i=0; i<(*storage).proNum; i++)    // setting priority to each process
    ( L- {% u7 I; P: p{
    / h( E5 \4 Z5 ?6 y! ]" k, Htemp = (*storage).p.computeTime/(*storage).p.ioTime;
    6 V. v$ W) B# U$ E0 qif(temp > 0.8)! d  @! q6 k) j+ X* y/ }& W2 Q
    priorityNum = 6;
    1 f6 d- T2 Z3 g% p8 S. Kelse if(temp > 0.7)
    # w$ y3 l4 z7 D" o! d; IpriorityNum = 5;
    3 I, k2 o) B8 ~! U  m4 v) @else if(temp > 0.6)
    0 p$ `- c7 c# W+ C  JpriorityNum = 4;" J4 b- N: N% l! N3 f' P
    else if(temp > 0.5)
    ) N. b% M7 H) x# k" rpriorityNum = 3;. Z* x" E$ |2 v/ |3 z
    else if(temp > 0.4)
    5 ^1 p6 z5 ]4 u4 @0 @priorityNum = 2;6 _! h  p2 T1 u
    else
    % d+ }) W8 Y# \, }6 JpriorityNum = 1;0 \! \; I* ]. K9 Q
    if(priorityNum[j] < priorityNum)
    5 l! m! Q' z# K8 a8 d3 S- uj = i;
    # r5 M. x: X' i}1 z5 M/ c$ \% }- w0 X
    if((*storage).p[j].askMemory < *spareMemory)
    , I" d5 }) r, b3 i6 p{) @' f9 N. e3 r, ?# `! D& O( y9 u
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;
    9 r  g: q3 @6 t5 _(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;) x* d: p1 u& O0 ?7 t
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;7 v6 _0 W$ R- c" ~% X4 I3 e, T
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;9 w2 B( Q3 M0 U$ p- E( y
    (*memory).p[0].processID = (*storage).p[j].processID;
    4 H, G; X$ k( I$ ]/ v2 v(*memory).p[0].flag = (*storage).p[j].flag;
    8 P. ?% e+ [" r! a! {8 l4 {' o+ \(*memory).p[0].ioTime = (*storage).p[j].ioTime;
    0 c: O* `5 ], a5 f% Q(*memory).p[0].computeTime = (*storage).p[j].computeTime;
    & p) v& L3 P/ f(*memory).p[0].runningTime = systemClock;. E; S0 X) s1 E4 G
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;+ i; `+ U: ]$ b! `
    for(i=0; i<(*memory).p[0].ioNum; i++)9 D; ~2 i# \1 i" M" w
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;
    ) u3 n+ _0 m* _8 U5 V1 `3 sfor(i=0; i<(*memory).p[0].computeNum; i++). W" A- n% I9 `
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    2 q% ~: z. m4 n7 h: c3 |! C6 ](*memory).proNum=1;1 |' Q  q9 ?% {5 H4 o
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;+ P$ |% e; Q0 S* u
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    . o# W1 O# I% T& ?MAX_COMING_TIME = (*storage).p[j].comeingTime;, O, t0 k  ^) E) O9 d
    }- \! t9 c! C7 j) V0 V# j5 Y8 ~
    else- b6 x& E( L# Z4 c
    {
    5 l' u5 H( s' R$ r; M9 W6 b- Uprintf("A process ask for a memory overed the system capacity\n ");
    ' g- [: }: _1 D  v' cexit(1);- _) T' x: J/ s  D
    }
    # W+ U& {' {( y4 X$ r$ ^6 lreturn 0;
    & S% |( m) H3 W7 [+ A" m}
      t1 f* M/ v3 ]8 |* x) Y- Mint ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw), P8 }' x8 B% ]0 _9 P8 L5 L
    {
    ; ]# h* Q# U9 Qstatic int compute=0,waitio=0,change=0;
    ; @! {5 Y% G" T  K4 dstatic int computeLast=0,waitioLast=0,changeLast=0;
    4 a0 A1 m# \5 i7 D! Y( gint i=0;' G% q8 h9 |: z2 r
    if(draw==1)3 T/ ?$ t$ ^% ]
    {- V' t2 I/ t; ]6 y
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);3 y) s, |. Q+ K
    drawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    ( B# Q# K, n9 _! W) J9 u
    % a/ \4 t6 ^# u. N- o  H2 _; `% v8 y5 W. p
    computeLast=compute;
    / O" d6 ^" G" S8 p4 [( b( QwaitioLast=waitio;4 a+ [9 p+ ~7 V1 V# v( d9 S* p
    changeLast=change;( n; C; \: v- a
    }
    0 g0 S: R% S# a7 u: cif((* memory).p[0].flag==ready)
    0 u4 ~6 s) Q: `$ S) H(* memory).p[0].flag=computing;
    8 e  ~( j6 n' t0 V3 _" pif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing). \8 P0 M, d6 n1 t  ?4 q$ K0 Z& x9 d
    {
    ; `. P) h6 a. }, S6 ui=(*memory).p[0].computeNum;5 b" H$ B$ n9 F. c( J' y- c
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed* l$ D; {" O: i
    {
    - C9 \$ Z+ M3 P(*memory).p[0].flag=IO_waiting;0 r$ ]) o0 V2 m) P: e; o
    (*memory).p[0].computeNum--;; x: ]( r/ e' l$ `
    change += exchange_IO_Compute;
    . d4 u& e1 @( C( ?7 z; ^compute++;
    ' @5 x: q* |+ K* Y4 a}- r, V+ h* b9 y' r" R8 \+ [
    else
    0 I/ |6 _$ n' r/ ]  G2 g' S{
    7 w9 q2 Y: l7 l' [compute++;7 A. A8 T6 k: F5 L! |3 `" d
    }
    ; `4 O' T- @; p. G4 W}
    . \* ^. P* L2 R1 C* u2 v* a& Zelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)  b$ i9 `" S6 E6 r" N
    {1 f4 E: s) x3 G4 N% _

    4 l, H# Y1 |, h: M9 @i=(*memory).p[0].ioNum;9 c0 n; j6 {; ^5 n
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed/ W/ _! d( W9 k' b
    {8 Y8 T+ L2 U: q! U7 A! o$ F0 T/ q
    (*memory).p[0].flag=computing;
    ! v! z" O5 X0 M(*memory).p[0].ioNum--;, I8 R' z* g' S# U' M" d, j8 y* L& I
    change += exchange_IO_Compute;
    4 X1 b# Z( G4 w8 f% k+ Q( `waitio++;; }" H  v! |/ U1 R+ C# ]# D0 y- r
    }
    7 _; G: y3 ~- D/ ^! Y/ Z( o# s- T1 j; Velse. T( o6 V8 r" c$ [
    {
    ) e- B9 s/ c: s' cwaitio++;% Y+ Y0 a1 O1 a: o: d2 z
    }( h% N/ Y8 E6 B5 p8 x! x6 R/ S% }
    }, o2 d6 {; R6 r5 ?
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)7 A6 P' Z9 Y( W7 T* I0 ]
    {, P+ E' W) @( r7 Q$ I: q8 p
    (* memory).p[0].flag=IO_waiting;1 [* [! h- ?1 P
    change += exchange_IO_Compute;  J5 _" A$ W% E+ k9 C4 j: v
    }4 s+ o- ^0 _; F9 t' m* c+ ]
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    / [$ e% L" Y% R' v; \. k{
    - Q- p; B+ q! j4 C(* memory).p[0].flag=computing;
    8 f4 f9 _, @( s0 Q* S+ h* Tchange += exchange_IO_Compute;+ n% o: }+ c) d! I: T
    }
    7 G7 {7 f! u7 k6 Rif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
      Q/ l* U. M2 P{8 w- Y5 H9 t7 k# ~: c: s: `
    (*save) = (PCI*)malloc(sizeof(PCI));
    , e# O. ^! a& R; j6 `2 I(*save)->next = NULL;2 Y/ _' Q/ g3 r  ^
    (*save)->processID = (*memory).p[0].processID;" n& D/ D! D* k# ?5 m/ E
    (*save)->comeingTime = (*memory).p[0].produceTime;5 |$ U! r4 v9 y& j4 q: I9 w+ U
    (*save)->askMemory = (*memory).p[0].askMemory;
    % a* D& i. N4 U* h" U0 m! v& ](*save)->compute = compute;1 x" j( d: H' T7 H- r2 X
    (*save)->waitio = waitio;
    4 e) T/ S, Q3 w(*save)->exchange = change;0 x4 Y9 ]3 \8 V8 C" T5 }
    (*save)->completedTime = systemClock;
      c+ O/ t6 Y. W/ a+ J+ Q- j(*save)->runningTime = (*memory).p[0].runningTime;* |3 R; \" p& j- n/ u. F8 e8 Q6 t
    *spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;4 H0 H6 O% Y; l9 q7 d
    compute=waitio=change=0;( C0 P7 V5 }  c  ]
    computeLast=waitioLast=changeLast=0;: v+ P  u! F$ o3 u# \2 q
    SJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));
    ) Q/ P6 M4 e" I- g  {. q1 Jchange += exchange_process;/ S- n& |& T- w" M8 O' q
    return task_completed;2 N! K1 o3 p- i! c& Q
    }( f# o0 Z7 F1 E5 n
    else
    - X+ Z1 K  [; o0 ?2 B& ^, treturn task_not_completed;
      H9 u7 R- _; r* z# h}% Z$ a5 h! |( k- e, S. C
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)% m! A# X9 v8 d* M4 X
    {
    ! S7 u- h  P! }: ~) c7 s1 [) Qint i=0,j=0;
      S+ i0 H4 |& ?for(i=1; i<(*storage).proNum; i++); S# c& H1 R# C& V( x$ ?9 a
    {0 s) ]6 V& ~9 v* }% t
    if(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime))4 E7 I4 U; m. B" l' C
    j=i;
    9 k: b3 L! `) L, |+ A9 m5 f" q}
    ; Z; Y, M0 w) {8 Y" |% _if((*storage).p[j].askMemory > *spareMemory): x* ^6 k' F! ?
    {
    8 X& r$ Z4 ?* }5 \4 D1 p( Mprintf("The memory asked is overflowed than the system memory.\n");
    ( X! G) D5 e8 z' Yexit(0);2 b$ z  j4 e9 K% P! V( p% @. @' I. K
    }
    0 T9 `' B* N6 C% {! h, oelse
    0 t. M8 z1 t1 P{
    ) ^6 e& e6 M1 x7 B- t. W(*memory).p[0].askMemory = (*storage).p[j].askMemory;
    0 v+ o& g& P5 x) S2 N" p5 o4 i(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;/ b5 G+ R4 n4 s& j- C  ^
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;) r' V" U' n4 O+ l  A
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;% A6 A- ]0 }" ~. c
    (*memory).p[0].processID = (*storage).p[j].processID;  q6 L6 c( r( [. u% P6 _
    (*memory).p[0].flag = (*storage).p[j].flag;
    , `& T7 ]6 @% E% ]" A; t(*memory).p[0].ioTime = (*storage).p[j].ioTime;. d; g- I/ t: i0 b7 ]4 i
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;' V+ @  u( C! S7 E' F
    (*memory).p[0].runningTime = systemClock;1 G8 _' N4 s' n8 U- Y$ I
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;4 A, M$ t% w: ?+ X, v
    for(i=0; i<(*memory).p[0].ioNum; i++)4 \" B- T. s. `" G
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;6 R* S$ V. g$ X! B& H3 p" N
    for(i=0; i<(*memory).p[0].computeNum; i++)% g; {) B$ a5 L; v) N4 W6 d* p0 X" b
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    5 U. p# k) M- m" @9 @- M(*memory).proNum=1;$ U$ S( d* \) B) E: i1 p
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;9 b) N) Y* y2 C0 l* X1 ~
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程0 B( }' K! `+ x9 q
    MAX_COMING_TIME = (*storage).p[j].comeingTime;" a' Z% b) l2 R$ C/ m  T6 f! H
    }7 p2 Y" v4 |9 z; f3 h5 D- P& Y0 P
    return 0;+ ~! {2 k( I, B
    }' d$ C- S" U& E6 L5 e
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)* h, d0 `2 s2 g$ y6 B
    {
    6 J& }8 g: N# o  f" v+ ustatic int compute=0,waitio=0,change=0,clockSegment=100,poi=0;
    9 X% _. t6 v) k) A( ]1 nstatic int computeLast=0,waitioLast=0,changeLast=0;
    ) c- ^. ~3 @' y! ~int i=0,j=0,k=0;
    + d' K3 K1 p7 m) tif((*memory).proNum<=0)+ E9 J* H2 q3 F: t) S' Z
    TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);
      t9 [7 k: Z) ^+ X  Oif(draw==1); S* C8 P, v2 U
    {4 y) G# |9 E+ G$ s1 B
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    % N. g& p8 E& A; {( g% k' WdrawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    & D( p  [  a/ ?; b
    " U0 K: x; d! L2 o& J: d8 C7 z
    5 E: O4 Z+ A5 ?$ M& [computeLast=compute;7 c4 A6 e/ e5 Z' X% g& l
    waitioLast=waitio;: T; Q6 e6 @1 r  Q  Z0 ]0 r9 T
    changeLast=change;* w# k# i& j" X8 N) \; d! P
    }
    $ L- Z+ J1 j  I' x8 iif(poi>=(* memory).proNum)2 X; O2 ]) F4 N' j1 Y
    poi = 0;
    + S7 X/ F" e. Q# zif((* memory).p[poi].flag==ready)
    ' o; u0 h. S4 e% H8 o(* memory).p[poi].flag=computing;$ P# a3 @! X! [3 a% o
    if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing)
    , c5 \" b( y% N, z! m9 J{7 I, u( a" Q1 z
    i=(*memory).p[poi].computeNum;+ O* s, @  o" ~# Y& D
    if(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed, g6 ]3 d7 W( ~) @2 ]+ [% Z
    {# ^# R! k: z8 Y" y  ^/ b6 Q
    (*memory).p[poi].flag=IO_waiting;& c2 o# T- H5 u# N+ P5 E, ]
    (*memory).p[poi].computeNum--;4 [  t; U1 x6 }, E- t/ G- [3 g& X
    change += exchange_IO_Compute;
    * W9 e( b6 {) g% B: xcompute++;, l6 c7 o4 n) @
    }/ p- K: [) T5 }; i5 k0 V+ |. d% ^
    else8 D3 Y  Y+ O2 V: }+ O) l( g6 E+ a
    {  J5 s2 t" w6 H
    compute++;
    # n9 M5 M0 n7 y# b6 p0 B4 [  Y}
    1 a1 X. s# |- W1 c1 E' m7 k}+ u/ @) p7 {; N) V9 U+ O
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)* n! q8 o' `& |1 l3 ]9 S) y4 j  q
    {
    6 z; t- o7 {9 s  c' X8 W- b. f8 G9 @5 t) N' ]2 Q- \
    i=(*memory).p[poi].ioNum;
    ; s1 w# T. M& G# `$ R% c! q" [if(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed
    8 ]3 _- [( C  S4 a{
    - L& \  t- |+ h(*memory).p[poi].flag=computing;
    ! ^5 n; R0 P9 ^8 E7 H3 ]" K! z(*memory).p[poi].ioNum--;
    7 z# i" h  d3 d( y& a9 Jchange += exchange_IO_Compute;
    / V" c  K' h. e! P$ C) awaitio++;
    2 b3 q/ e% H* R" d) z4 e- ]}0 x& v, a6 N" u, P
    else" ?; s, J$ h" |
    {" j& t$ ]% S, ]) t# y. N" f& e  C, M
    waitio++;! z6 O6 M/ W( y% G* z# {# v) t
    }: l1 i* ^; i% n4 M, }1 X
    }
    2 G+ E: I) w; X% B5 yelse if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)
    9 \/ S/ f& U5 i+ D+ _2 J8 b{
    # |/ y' i5 S+ t0 x' i4 ](* memory).p[poi].flag=IO_waiting;
    * Z& w/ Y' p$ M: ichange += exchange_IO_Compute;
    , q( `7 o8 i3 A/ U}/ D- l# s* n; H+ Y
    else if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting)
    . z& W: p. J8 _, j) W* H' A{
    ; J; Q  \) V/ _* ], H- D(* memory).p[poi].flag=computing;2 `  Y- G' b5 H/ U
    change += exchange_IO_Compute;
    1 L# P1 d4 V" B$ @9 u}
    8 v; f! G6 q4 C3 F4 sfor(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进7 Q( E7 L+ Q) S
    {
    ; w8 B6 M2 R8 sif(i!=poi && (*memory).p.flag==IO_waiting)6 @0 l3 F) G; v$ s
    {. @( w' Y2 V6 }8 Z/ `8 L) `
    j=(*memory).p.ioNum;
    ) c9 p: X/ ?- F/ aif(j>0)
    - B, v) i8 ]. V# E2 `( k# F{  L; P6 I' G3 X
    if(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed
    . K8 T: }) P" o/ t3 q( R7 |{& B6 q! V0 G0 \5 t! J
    (*memory).p.flag=computing;. j/ V! p7 n4 m9 x( x0 @  N
    (*memory).p.ioNum--;
    7 }% n' Z9 E& L% `change += exchange_IO_Compute;5 r  C0 r2 R) H+ @7 @7 U
    }: ?- Q) }& Z5 V) g, @; S) o% b# N
    }
    9 G1 r1 R- Q) Y2 C, W- ~0 b$ p}
    4 G: g5 w% {" L. q% B- u4 N* X}
    * n' S  W7 _$ B) pfor(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程& s- B: [( p, h+ H
    {
    ' y& i  u5 A* q' N0 o& t0 xif((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed
    3 A0 g* u+ }7 Y9 b: s{' |+ {7 B# B* H: U5 Q& @
    (*save) = (PCI*)malloc(sizeof(PCI));$ d  R7 v2 q% Z$ @4 a  _
    (*save)->next = NULL;/ e4 r6 `: V; t; o
           (*save)->processID = (*memory).p.processID;, P5 q) m% ?7 ?
    (*save)->comeingTime = (*memory).p.produceTime;# o% Z* Y9 v* U
    (*save)->askMemory = (*memory).p.askMemory;* |+ C1 M8 e! e& A! d) M2 ?
    (*save)->compute = compute;
    , d+ D' v( N( ?7 @; }(*save)->waitio = waitio;
    4 M3 j9 ]( O8 }; v(*save)->exchange = change;
    $ M1 k& ^- t) o6 i(*save)->completedTime = systemClock-(*save)->comeingTime;; j; x3 r! g3 |$ t! [
    (*save)->runningTime = (*memory).p.runningTime;  D/ ?" X. u8 ~4 t' M! x
    (*save)->completedTime = systemClock;
    & E7 }/ q! u! Z8 ?* M*spareMemory = *spareMemory + (*memory).p.askMemory;
    ; }6 W$ h8 q; \compute=waitio=change=0;1 R0 T/ E# [) }# a1 \1 s! @9 T
    computeLast=waitioLast=changeLast=0;
    . Y# K' X7 n4 i# D  n* uif(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入
    . j0 K& @+ M& u' @6 K8 z! E{
    6 q% Q. A3 q5 ~( eif(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程
    * S, ~. K; h. g4 ]{4 `& v) b/ z& o! b" V& F1 c
    poi++;& Z- r/ L" F, P% M) z" f
       clockSegment=2000;
    ) ~2 S+ L% d" o* U}2 [8 J& Z3 \! h8 T, F
    }/ `" E" U- j9 ]7 T1 h( U4 R
    else  //没有足够内存调入新进程
    7 a9 S4 ?* N4 r3 c- G2 D; |{" U; v* v0 `8 T* o4 a$ o7 q) o) ]) _0 r
    if(i < (*memory).proNum-1)
    / h8 X7 g; X' u{# M* I6 H# Q4 z9 v' u: e. h
    for(j=i; j+1<(*memory).proNum; j++)
    7 f; p+ N+ o, G7 ^1 M) o6 ]{
    $ O; K8 z6 {+ B(*memory).p[j].askMemory = (*memory).p[j+1].askMemory;0 l0 Y9 j& m/ Z3 ]! k+ ]+ e( Y) L
    (*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;) Q) Y/ R8 W, ^: t" R7 F; b& |
    (*memory).p[j].computeNum = (*memory).p[j+1].computeNum;
    : |% J2 \, d/ @( T8 s& q(*memory).p[j].ioNum = (*memory).p[j+1].ioNum;
    . o4 M3 K' `* U. E: B(*memory).p[j].processID = (*memory).p[j+1].processID;
    7 M. `! |) Q% A. U(*memory).p[j].flag = (*memory).p[j+1].flag;( z+ I) J+ w: y% {
    (*memory).p[j].ioTime = (*memory).p[j+1].ioTime;
    " G8 O0 q" a# c/ d(*memory).p[j].computeTime = (*memory).p[j+1].computeTime;3 v9 r0 Y) k# r" P9 S" S& J  U
    (*memory).p[j].runningTime = (*memory).p[j+1].runningTime;
    2 h1 ~" D$ e' y8 I% t(*memory).p[j].produceTime = (*memory).p[j+1].produceTime;8 N; H% K5 @3 g7 f) v. N5 h
    (*memory).p[j].completedTime = (*memory).p[j+1].completedTime;% I6 N  n. \9 o$ g
    for(k=0; k<(*memory).p[j].computeNum; k++)
    6 L9 G' s6 t1 {: d* K7 p$ a(*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];
    4 D7 ?" l- p" f! b1 j4 |& @0 D6 E0 hfor(k=0; k<(*memory).p[j].ioNum; k++)& n3 w5 b7 _/ P# z
    (*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];
    % D5 G. k1 a7 |0 U}
    $ F- \! R: a" h& p- @+ g1 r. H  Pif(i<poi)
      W6 Q1 q4 z2 v/ A( j0 @, w: Wpoi--;" Q9 b0 ^+ J2 V0 B+ ^& |
    else if(i==poi)
    ) w0 `0 z7 Y3 K" Q* g  x4 H! \( {clockSegment=2000;: W% h2 Q  X; G! Y) _. D
    }
    ' ^* b1 `9 _% C) R- ui--;$ J  i$ R/ R$ D8 g
    (*memory).proNum--;
    0 A1 w' @3 M; `/ M: j/ z}( B0 y1 T" a. u0 o4 C
    return task_completed;* k; v8 ~% ?0 ?9 Y' ]
    }7 R8 Y7 O9 e: X5 n
    }
    5 o8 g9 o7 s. p2 t" m! H--clockSegment;
    , i0 W1 A" V% g$ q/ }8 j: Y/ Q5 Cif(clockSegment<=0)
    6 Q3 V. u- T9 e( y. @$ X{' Q8 L: Z8 F/ ]5 n7 {" }- M2 r  J
    poi=poi+1;
    & N, q8 b/ s( z. Y6 d- eif(poi>=(*memory).proNum)
    ! i* U# S% M, m4 h$ Ipoi=0;
    0 N! I" W& ~5 R1 qclockSegment=100;
    5 |& E8 T; A! j7 w}/ x6 T1 C5 s9 k7 g: x/ g/ ]/ M
    return task_not_completed;) Q5 G( i' E! E7 r: W! t  ?: A. p; S; ?
    }
    $ a4 D2 i8 e1 T& g2 @# _int TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos)4 B) q! w% _4 b: p5 u8 [6 m! j
    {
    4 x$ |  b3 l  {& r5 ~" Vint i=0,j=0,k=0,flag=0,translation=0;3 n  H5 q% i4 I; E0 k
    for(i=0; i<(*storage).proNum; i++)
    ) Q; }/ |& F% Q4 h/ f+ C{/ q1 u( v2 s' j- [
    if((*storage).p.comeingTime>MAX_COMING_TIME)
    ! v7 B& L) k8 D( t2 qMAX_COMING_TIME = (*storage).p.comeingTime;$ `5 i# d& R5 X) X) }4 x
    }0 \! ]; Y5 {2 M5 V1 a, A2 ~
    if(pos>=0)  y" E) n: R" z2 K1 D+ p
    {, _( ]( N5 O* {% y2 k) V: B
    for(i=0; i<(*storage).proNum; i++)5 r' \' k7 ~7 l4 g. ^6 ]
    {
    # w8 V! V6 z* V3 `' R6 h% hif((*storage).p.askMemory <= *spareMemory)
    . e. N: ]# b4 \. \{1 ?" |+ w+ o* [- C7 y
    j=pos;
    - }" d% P0 V- U) q! E/ ~" {& P(*memory).p[j].askMemory = (*storage).p.askMemory;
    5 \. v# ?5 U! a! N9 O) ^(*memory).p[j].comeingTime = (*storage).p.comeingTime;
    8 j5 M% D4 J& U. A(*memory).p[j].computeNum = (*storage).p.computeNum;( u6 z0 v2 {) `1 m
    (*memory).p[j].ioNum = (*storage).p.ioNum;
    7 i3 M- d+ X1 H(*memory).p[j].processID = (*storage).p.processID;% I% n$ a, ]7 w7 F
    (*memory).p[j].flag = (*storage).p.flag;" V' g* E* _' `2 i
    (*memory).p[j].ioTime = (*storage).p.ioTime;
    ( V. [8 J1 B9 D$ q(*memory).p[j].computeTime = (*storage).p.computeTime;" O' E5 y6 p2 ]4 z% ^: C! L5 v
    (*memory).p[j].runningTime = systemClock;
    " ~4 s( x; K+ ]+ G0 v(*memory).p[j].produceTime = (*storage).p.produceTime;, b9 r( G  W* Y0 o7 m% p9 O
    for(k=0; k<(*memory).p[j].ioNum; k++)1 m6 W7 x* x1 H/ I, \
    (*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];( i7 ~: n: s/ o4 Y( F
    for(k=0; k<(*memory).p[j].computeNum; k++)
    2 `# S0 y- x9 S, @2 @(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];9 q) ~8 X9 f+ z1 ^6 x
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;: V4 u4 i; A' F) r- S! [
    produce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程& Z$ [5 ^% v" y# \. r! A  X
    MAX_COMING_TIME = (*storage).p.comeingTime;6 v5 U9 D0 u* E7 U& ?" f% U
    translation=1;# z, X8 C, q' y9 Y6 ^
    break;
    4 Q8 u2 t4 L) f/ A- X5 w}
    ( {8 T' w0 H! S: K) ]& V}$ b$ V+ r! v9 M% b, G1 H
    }; v, k8 o3 u: o; n: B6 w( G" s
    else
    0 f  h, s, h& ^; c# E% J/ }) c{
    ' N4 W4 s' O. u  D. {& E+ Hwhile(1)
    & x' ^$ P; E7 h' z3 C* g{
    , G) a/ A% L7 u$ Z" G; \5 bflag=0;
    - U1 u  N8 G) {: c5 Q9 B! Jfor(i=0; i<(*storage).proNum; i++)9 u- s2 T  i) v8 ^& V
    {
    2 w1 ?4 h4 e8 K4 ?& {if((*storage).p.askMemory <= *spareMemory)" h' S3 k6 ]7 E0 H
    {
    ! U  L5 b# {5 K6 z- z: K- }. Ej=(*memory).proNum;
    . S# ?3 D$ I& O) Q5 |(*memory).p[j].askMemory = (*storage).p.askMemory;. n; e: ~9 E  |7 U
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;
    & v7 t6 n' H8 l, O5 H1 i(*memory).p[j].computeNum = (*storage).p.computeNum;
    5 q: X2 Y8 j4 n) i+ c(*memory).p[j].ioNum = (*storage).p.ioNum;
    1 J' X. G2 D* c, |$ b* v' j(*memory).p[j].processID = (*storage).p.processID;. O) h4 R5 [1 Q, d6 P
    (*memory).p[j].flag = (*storage).p.flag;# b3 N& r4 L5 o
    (*memory).p[j].ioTime = (*storage).p.ioTime;
    4 @9 n3 \  l9 q* R% [( ](*memory).p[j].computeTime = (*storage).p.computeTime;
    % d) k2 |2 C# x' q(*memory).p[j].runningTime = systemClock;
    3 ~8 s0 b( i1 y; [5 s(*memory).p[j].produceTime = (*storage).p.produceTime;1 @7 \; t& P: v: F! i( g
    for(k=0; k<(*memory).p[j].ioNum; k++)
    $ t- O5 r! {. H4 j(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];1 J& x% {/ W! N' h/ h& N& Z
    for(k=0; k<(*memory).p[j].computeNum; k++)
    1 _6 K) D1 u9 u% X/ m(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];  E) ?0 s5 a/ }6 V$ Q! c9 R; p
    (*memory).proNum++;1 p" D, _: s2 H" ^  u$ Q" t2 w
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;5 }1 H+ C1 r: M* t
    produce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
      Z* O* G4 [9 r9 b9 d# GMAX_COMING_TIME = (*storage).p.comeingTime;
    4 B+ n9 Y8 a6 \flag=1;7 g: n- D) r% C9 D+ h
    translation=1;
      e' }6 @3 g, n* N, M2 L, N}$ Y. d9 d% f7 ?( y
    }# T+ k0 J2 x; z" [3 O1 k' i
    if(flag == 0)
    * c; Q+ x) ]$ t; obreak;7 F: {/ r3 x7 ]/ l
    }
    : [/ @8 q( W  J# }: q}
    $ P( o  y# m- ^0 y6 Y/ `return translation;/ g4 e2 }2 y( K' ]" u; P
    }: ]* a! T% s0 k2 h( ^
    int FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)1 z6 N1 N; o2 E/ L5 u  O# G
    {4 i0 r& N3 C3 Q1 w
    static int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;
    . c3 n2 V( _; D5 a# Rstatic int computeLast=0,waitioLast=0,changeLast=0;
    3 D9 O4 T! U) b3 Xint i=0;
    ( g- |" x  T3 B% U3 tif(draw==1)
    5 E6 C8 y& O7 H. m{
    3 y9 ]& a. ?( A1 T: H; e) n3 X//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);: V" c  ?' t1 V- Q
    drawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);2 z1 t4 ?& y* V( D5 j

    - }0 q- L9 b. v6 x1 I3 Y7 V3 `- A- F, u" C( Z& H
    computeLast=compute;
    8 Z! ^+ l( X# L/ J  ^. zwaitioLast=waitio;& g- L1 r5 R$ u* L0 `, S) e
    changeLast=change;" |$ f8 l3 Y6 [0 N; y( O+ Y
    }7 ?& I/ U9 E9 k
    if(flag==1)  
    : |6 K  w$ S0 A3 ?{
    ' h- M1 O$ X: r6 gif((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed
    : k1 i- p( p" i. m$ e{
    . _( I- ], J5 C  mif(flagiocpt==0)   // implement compute
    ' Q1 j; x1 r6 z$ V7 ~1 T2 [{: {+ V4 \5 e& c. |" i+ o! C
    i=(*memory).p[0].computeNum;' J9 C9 H' {1 i0 p
    if(i>0 && (*memory).p[0].computeClock[i-1]>0)- P& Q. y$ U6 w& h: F
    {7 h  D2 N  o: d' o8 o; z6 x
    if(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed* K2 n/ v( j1 v  R! ~' Z7 w
    {
    . I1 y) P4 C( kflagiocpt = 1;$ t4 t, L5 ]! S1 d- d
    (*memory).p[0].computeNum--;  O. W5 O& L6 B; ?, K+ e1 G
    change += exchange_IO_Compute;( A5 X; S0 z$ q: b  S; {
    compute++;( c; r: X( T5 h8 S( T
    }! s! Q) r5 L9 `4 r5 a/ z$ @4 ]7 k/ v1 d
    else* C5 t- G# X4 ]' W! l/ p- l0 Y
    compute++;
    7 D6 e" F0 {3 M
    ! h3 z: B6 K0 k3 _5 S6 H}5 d& _6 O4 a8 m+ M+ G
    else: y& |/ T* U- `* c; r) R
    flagiocpt = 1;2 ]9 c* w1 W& ?
    }! m' s- t8 R4 V, Y. v# ~- p$ V
    else  //wait io. C% d) N6 W7 k1 E( g: _
    {( N" S( M" g3 I& P9 A) a/ y/ L
    i=(*memory).p[0].ioNum;
    7 s* E' h2 R6 N2 W9 Jif(i>0 && (*memory).p[0].ioClock[i-1]>0)+ e9 v' I' K% M/ l* |( `
    {
    8 t0 U. a# _6 ]0 b9 oif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed; e4 @" S6 N. F5 l& p7 R7 J+ |1 ]4 ]
    {
    + N1 B6 k  \' v) w: N/ s3 Eflagiocpt = 0;1 Q6 W, a6 d" G2 e
    (*memory).p[0].ioNum--;% a' {% b1 z& B" g: \
    change += exchange_IO_Compute;& U3 X) y5 X* I& s% I' w: f
    waitio++;2 p5 Y! ~5 m8 ]' o
    }0 {6 m/ G6 W: t  H% B9 i' H* u
    else) d# p- z6 {5 V, W1 P! E0 N6 o
    waitio++;
    # q. x# g* K3 d# v
    ( s( X1 g* x6 ]) |1 a% G: u1 I}
    2 O" t% F; t# W8 G3 z! k: K2 lelse5 u; n' H# P: `+ O
    flagiocpt = 0;
    * Z" C* t% o. S. h}
    ' ~) N3 k" S: w$ I4 q/ c}7 ?' `( ]: ?, i3 ]
    else  //task is completed$ I' V2 T7 e  m+ W" n
    {7 W8 O  ?0 P7 q  r( I  Y, v
    (*save) = (PCI*)malloc(sizeof(PCI));) f4 \: e' }. M& Q
    (*save)->next = NULL;5 v  r6 o/ s9 d( k# `
           (*save)->processID = (*memory).p[0].processID;
    $ P, H" w6 @5 `- d* q5 V# W* g(*save)->comeingTime = (*memory).p[0].produceTime;1 n  x/ ~' @" z3 [8 n" o
    (*save)->askMemory = (*memory).p[0].askMemory;( r' m" s0 t# E7 G5 X4 W. I
    (*save)->compute = compute;
    & @. I: ^: ]1 w) o6 P(*save)->waitio = waitio;
    ! H& K6 v! l* U(*save)->exchange = change;' `' C( j1 R8 A# n# e  o8 B) q
    (*save)->completedTime = systemClock-(*save)->comeingTime;$ o7 [  f. l) D' X, V! G
    (*save)->runningTime = (*memory).p[0].runningTime;  }' w- x: h+ c- j- t
    (*save)->completedTime = systemClock;. ^2 h5 k) l2 [7 n% O
    //*spareMemory = MAX_MEMORY;) Y0 a* \' ^0 e( r' H
    free((*memory).p[0].ioClock);
    ' n% l# \5 a* l6 B/ wfree((*memory).p[0].computeClock);1 ^+ t; U5 w) _: w; Q3 [9 }
    free((*memory).p);
    ' T/ b  @! \7 O; I1 k6 @flag=0;' L! W3 Y5 O& G; ?2 J3 |. I
    compute=waitio=change=0;
    " K: A: F( O: |. gcomputeLast=waitioLast=changeLast=0;
    2 ^5 d6 E8 y5 r# Nreturn task_completed;! ]! ~3 }- Y" S2 O* D
    }
    . ]' f1 y( S& c" O( A/ p}
    6 P9 ]' V( ]* v& s; {, ?  Relse         
    6 E  S' {3 `) v& ?9 E; Z{4 V4 N  y- R* p. z- S1 ~& U+ n6 F
    FIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));7 J' p) N, \! [7 z1 x; D
    change += exchange_process;8 h( Y$ i& {# ^! ~8 g1 T
    //*spareMemory -= (*memory).p[0].askMemory;
    % X+ e3 \7 T9 P. F2 y) Eflag=1;
    7 q3 ?; Z4 t4 h" B7 Y//showProcessInf(*memory);/ W1 j, t1 I  v, Y$ F0 S( a
    return task_not_completed;
    ; w" h4 i. t& v}3 }, a8 Y" Q* R' d# r1 W5 M% `) V
    return task_not_completed;/ r5 k; l7 r; k% q: N8 `7 V4 ]2 _
    }
    9 y% B. M9 \( i5 ?/ v) Aint FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)# E# m  z* M" g7 k
    {
    3 K$ V! A( f3 a# I7 q" W& Qint i=0,j=0,k=0;
    9 \; T8 {+ X/ ]3 F. QMAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;) I+ S: X; S, q. x
    (*memory).p = (process*)malloc(initProcessNum*sizeof(process));& v4 y0 @; q  x! L: N2 x% [0 `
    memory->proNum = 1;
    + k; u$ a; N! ]for(i=0; i<initProcessNum; i++)
    9 h9 t+ L' @* ]0 H{9 _, X$ J8 v  N' O5 @
    if((*storage).p.askMemory <= *spareMemory)9 `% q! H2 b5 Q; K. ~. ?
    {
    " d% E- o6 B  Y+ f: B5 f(*memory).p[0].askMemory = (*storage).p.askMemory;
    / d) y" n# N1 G(*memory).p[0].comeingTime = (*storage).p.comeingTime;) N9 [7 I% p$ U! d, e
    (*memory).p[0].computeNum = (*storage).p.computeNum;, e. R5 \1 w: I' g# K3 z
    (*memory).p[0].ioNum = (*storage).p.ioNum;
    4 q. _5 w/ A$ E# N- V0 v- V0 F(*memory).p[0].processID = (*storage).p.processID;
    7 [3 R/ |& }- D% b7 \(*memory).p[0].flag = (*storage).p.flag;
    ' \7 f9 Z9 Q6 ], Z(*memory).p[0].ioTime = (*storage).p.ioTime;$ [/ V- |1 b2 A1 L6 R
    (*memory).p[0].computeTime = (*storage).p.computeTime;
    5 R* G% F: ?# ^# q- y# L(*memory).p[0].produceTime = (*storage).p.produceTime;
    1 |) L9 D' O8 I9 a(*memory).p[0].runningTime = systemClock;
    & m6 U9 e/ P; p& n5 u3 ~# A(*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));3 e0 b2 P: c; v( f! z9 ~8 o
    (*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));
    1 ~) {" p8 ^$ x( B% dfor(k=0; k<(*memory).p[0].ioNum; k++)9 R5 ?& w  H3 t+ \5 G/ b
    (*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];
    9 ^$ s$ F, ^5 m4 Lfor(k=0; k<(*memory).p[0].computeNum; k++)
    3 E  U4 v& o" f! g(*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];
    0 `, ]0 O! a) obreak;
    ) j1 H& i' L' S$ s5 N. O+ R}
    ; w! b. d& _7 D( }}+ \, u/ I. w( c2 @$ v; ]/ ^& Y) I' V
    if(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入
    0 t0 f( T/ x% k# K1 O6 F% e{6 v- {' l& x5 H) G; [
    produce_one_task(storage,i,ID_FIFO++);! A  M0 s' |% G# F9 ?
    MAX_COMING_TIME = (*storage).p.comeingTime;
    0 F" K+ t4 q# j! U; O+ zsort_by_comingtime(storage,i);
    ; J/ o& o2 _' g- j6 I}4 t0 Z1 O% B  B7 G
    return 0;8 L+ K. L, _) u1 s8 ^8 t
    }
    - O9 ]9 ?1 o2 Y/ \* lint sort_by_comingtime(processPool * p,int pos)2 ~2 T6 {  S: k( [% a9 e3 `
    {7 A, l' \2 b# m. r1 b( M. O# ^
    int i=0,j=0;7 y7 X7 M: B0 M/ b/ O) [
    process temp;* d3 b" S: q' r. W
    if(pos<0)7 v0 @" Q) y9 k# Z3 `% T1 x' x
    {
    ; \3 z  F3 p7 nfor(i=0; i<initProcessNum; i++)
    6 \- S5 W5 p- I* ?# T/ Ofor(j=0; j+1<initProcessNum-i; j++)* |3 M4 p3 ?- k3 R" p" X
    {
    ( z; D/ s1 `- y" W- C5 x9 |if((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)
    5 u, I9 a$ m$ X: \  }! Y3 Z% r{
    % R' D7 \1 u" D, o- _/ ktemp = (*p).p[j];/ J6 _7 R% k$ n+ L6 V
    (*p).p[j] = (*p).p[j+1];
    - l; \8 l+ _  b9 d3 H6 U+ A8 l(*p).p[j+1] = temp;  _! h; j. t$ X+ ]8 a% {4 h* A9 a
    }* L4 H, R- o0 R, O
    }7 V0 k/ S; ]6 h# [+ E) v$ M1 W
    }% ]! I+ V3 ]3 T; X
    else if(pos<initProcessNum)' V: R) A$ o7 ^& X( e1 C
    {
    : g+ B+ s6 q/ ufor(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--), y- U" V7 Z, S+ A
    {0 P/ Y1 h: T! g# N
    temp = (*p).p;, r$ T9 b+ U& e
    (*p).p = (*p).p[i+1];2 Z7 g7 r4 q. t/ f, S3 c/ y6 d4 ?/ g" ?
    (*p).p[i+1] = temp;- {# d0 F; \* s1 {4 J9 C
    }
    3 j3 x; I! t1 d. Afor(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)2 g" H0 H3 U3 S, I2 N4 T
    {
    ' ~; S& L- _+ l# f: n1 U3 ztemp = (*p).p[i-1];
    5 e9 C6 F# K) O5 f+ C( ?(*p).p[i-1] = (*p).p;. A' @6 u  i0 e, u. e3 n! b! o
    (*p).p = temp;
    5 E( z" j: h* k- E}# G* B6 y& v6 a. h. \- b4 z2 C, p
    }+ w4 u- x2 Z7 L' c/ A
    else, _4 B5 l. Z+ V8 Y( _2 Q" y
    printf("position eror\n");9 _/ j9 C% _0 F% Q
    return 0;, R: o& K  J* t- x' p1 a4 N3 D8 c
    }% p2 [. ]( r# x, C, Y
    int InitPool(processPool * p)
    ; ^8 }' v8 v( o; p* t1 T{9 h( l6 F5 M" u8 i
    int i=0;
    0 d8 F4 N, A* P5 a! g(*p).proNum = initProcessNum;0 v* m  U: ^) y$ ?
    (*p).p = (process*)malloc(initProcessNum*sizeof(process));
    . Q9 U5 W; [* g9 }: k4 L, Qfor(i=0; i<initProcessNum; i++)                                        //init process information- c. G' W0 H, v& x
    {/ O# U- o. m3 i" a/ q
    (*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));' {$ d: N. w& J/ L7 ?2 k% n" E
    (*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));
    : ~* k+ P# Q5 `0 \4 [/ Wproduce_one_task(&(*p),i,ID_FIFO++);6 ]- Y' g) l  a' H& D& Y
    }" H* e" J1 n( V- P2 }
    return 0;. }' I- u- j- a$ y9 D8 u
    }  Z  [/ |+ U- Q4 \
    int produce_one_task(processPool * p,int i,int id)
      m9 o: K& H1 {0 W+ Z{2 v1 ?" F2 l, ~; V* |, I1 @
    int time=MAX_COMING_TIME,j=0,totallTime=0;3 e9 m3 \- L+ N
    (*p).p.processID = initProcessID+id;           ! b9 A- Q/ t' e. L1 S& j+ A4 c' ~
    (*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);+ @% {" s5 ?0 S6 W1 G$ _$ a5 H0 M  m) \
    (*p).p.produceTime = systemClock;
    ' C" f  y; u6 l(*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;
    2 ]% m7 o1 F3 ]+ C, H0 r7 o% f(*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;/ p7 z9 j1 r; Q7 I
    totallTime = (*p).p.computeNum  + (*p).p.ioNum;. k1 d) q- Y' I( `
    (*p).p.computeTime=0;
    9 x! b' `( {" Sfor(j=0; j<(*p).p.computeNum; j++)
    9 p7 O% Z4 X  U9 K/ b9 Y{. H. I7 `: r1 ~; o
    (*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;
    3 I# u, v; ~6 U# q  J(*p).p.computeTime += (*p).p.computeClock[j];
    $ k7 a' d9 `" V: M0 f1 ?! R% {}7 E$ k# L/ ^: X4 @: R, P! S3 {9 b
    (*p).p.ioTime=0;
    1 I4 f* y% H$ S. A9 sfor(j=0; j<(*p).p.ioNum; j++)1 x1 K1 t6 g  J3 l
    {
    : ]% K  Y7 z8 k3 X(*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;
    ) b8 t1 O, s/ [1 J, `2 L; F. V! |* ?(*p).p.ioTime += (*p).p.ioClock[j];; z; _9 ?: D+ r3 `1 S. _
    }
    * g$ x7 m" C! N# z5 k" f(*p).p.askMemory = rand()%(MAX_MEMORY/4);: S! h5 K+ |! t. U- }+ V
    (*p).p.flag = ready;
    9 Y1 T) b. m# v! T3 yreturn 0;
    4 f  p' l6 E7 S% }}
    0 Z  d; T4 i4 j0 Q3 sint showProcessInf(processPool p)# U( |' f, i, B8 R# ?# g
    {/ t7 U7 f8 K* ]4 i- g
    int i=0,j=0;
    * ^: F* _: R; E& ^6 Qfor(i=0;i<p.proNum;i++)
    % f$ ?  Y0 ?7 Z  r+ q$ S' A/ U{* y5 _9 B4 K0 |- d8 ?
    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
    4 `: _  d3 |" c! b0 f# g4 b9 _, o7 f, q,p.p.askMemory);' j* \# i& A! z7 _! x
    for(j=0;j<p.p.ioNum;j++)
    , c, Q" [" R. J2 g/ t' h{
    ; c% ^; n5 y0 F2 W6 R* Sprintf("%d ",p.p.ioClock[j]);7 c! a. d$ g0 {7 n0 o
    }1 t$ H: U; y2 T8 W( k- m9 J
    printf("\n");2 A0 V! h( i8 c1 w/ L
    for( j=0;j<p.p.computeNum;j++)
    5 ?: C- G$ }! u  E$ f{
    $ H2 z# U2 s* O9 Z7 Z) x, @8 vprintf("%d ",p.p.computeClock[j]);
    2 F$ H1 M4 H" I( N; }}5 g+ @* C) q7 `  g; |4 g4 L+ D
    printf("\n");- p. r& I, X# b+ a+ t) O
    }
    / H& i! T7 E: d. @return 0;
    ) q0 o1 Y) ]6 q. ^( I}7 D. q2 B" }0 J$ L" I
    ————————————————
    7 V' F6 X, [! S$ s$ R2 M版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    3 x6 `. k' N- S) `1 J原文链接:https://blog.csdn.net/wang_dong001/article/details/478435199 c5 ?3 C! X% m/ I' {: {

    7 m* e" |* \7 A' v2 P; p# O0 D' g* Q+ D+ F
    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

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

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

    蒙公网安备 15010502000194号

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

    GMT+8, 2026-9-8 07:50 , Processed in 0.450004 second(s), 50 queries .

    回顶部