QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 2471|回复: 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
    6 D( g. E" c- z
    经典任务调度算法的模拟程序3 u5 j# H* W8 a8 a, ~: q
    本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。
    : ^) ]) Y& g8 g7 g  I. f  L+ j; b; T" F3 W2 Y: g- \# T0 k7 i& i% L
    编程平台:VC6.0+EasyX图形库环境。
    " x/ B7 l% n9 @- W! l' N/ x$ c6 Y& A' ?/ j
    以下截取部分程序运行图::% D- K  C* P5 I7 L3 T' e% i

    3 g+ o$ f' u& N7 z7 m, {源代码:+ {6 u, E- p9 O6 V$ S
    0 R3 B7 ?4 R6 y
    #include<stdio.h>' P0 t3 x3 b. [* [; `
    #include<stdlib.h>
      m# s! K( u% p" W  x/ ^9 H* w! [#include<easyx.h>
    3 O) d5 q5 v6 V! {: M! v! ?#include<time.h>. R) V  i2 Z5 J/ G; s; N
    #include<conio.h>
    5 ]( m. l1 ^! k& Q3 X7 y  z#include<graphics.h>
    ! N5 {  R5 E# G#define initProcessNum 10
    3 x3 g& J& m: f+ F1 ?. M#define initProcessID 10007 J% z) Z8 t* I% P* i
    #define MAXProcessRunTime 10000
    . Z, H5 `. X2 M/ M$ `" n, E/ n' a#define MAX_MEMORY  4000, I7 @% v2 s, o- `' h/ B/ Q
    #define exchange_IO_Compute 10
    # ?( o1 J, m) S#define exchange_process 25* L' g# l2 F9 M- i1 M
    #define task_completed 1
    - n. ~% [# u2 v, Q* {% w#define task_not_completed 01 l0 x1 D1 q+ x/ p$ I- L- ?9 X' b
    #define initclocknum 100
    2 A2 f- ?- T6 b2 C9 }' wenum condition
    ; ^& p; y5 K; j! d: c9 H{
    $ x. P8 M% A# M9 K2 |8 |1 i" Bdead,computing,IO_waiting,ready
    . m' u4 h0 j4 L};+ N, x( q2 J, g% y
    struct process
    3 p8 S# E& v- f( u# o  c8 n" F* A{
    / i) T8 K" A- v( {: G9 U  gint processID;
      N. R; x& w6 E$ ]5 o! `int comeingTime;# ~/ @4 q" c) s/ w
    int ioNum;# m1 z! C5 C6 a) e0 g2 H* Y# `* j) d
    int computeNum;
    ( H  N& K: T: eint * ioClock;3 v% t( P2 v, U" m9 s  l6 M
    int * computeClock;" }/ m) o( ~% ?
    int ioTime;
    4 {5 _9 y! U0 Z" J( ~int computeTime;7 V3 o" e5 M3 j/ s1 J9 T1 }
    int askMemory;7 `8 m* _$ S" b$ L2 Y0 W- P. Z0 J
    condition flag;
    . |& R) b! t# ?( lint produceTime;  //生成时间,以下三个数据成员用以计算相关性能, |1 l2 U" c2 V; t
    int runningTime;  //第一次占用CPU的时间& k1 W& X4 y* n
    int completedTime; //进程完成时的时间
    9 z; U. D8 I  S, l- L2 ~5 h$ K) C};
    & G* J  D, ~0 M0 T; Q8 u# ?7 ?typedef struct processCmpletedInfo  //保存完成一个作业的相关信息/ K$ k3 f3 l" M0 j9 h, {6 d" {  S
    {
    / M9 G* l# P' ?; Sint processID,comeingTime,askMemory;* J5 X/ v, E. p) Z- B* ]$ s
    int compute,waitio,exchange,completedTime,runningTime;! H$ t) m' }6 f6 I. f2 W
    processCmpletedInfo * next;$ v- l. @& f9 b1 ]
    }PCI;
    5 t- i; [3 i. G7 }% kstruct processPool9 H& c5 Y% B  y
    {2 G; j; r* |) {4 ?1 b$ e# M
    process * p;
    * J) B) D) G& f0 r5 N2 \, I' n/ iint proNum;
    # i- [7 j: w8 b( S: w* U$ {};
    3 E  O4 h, F1 r2 L' j' x' Jint 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;5 r( W$ b& |; Y" p- I
    int InitPool(processPool * p);
    , n) B; M8 s9 c/ v) l; }int produce_one_task(processPool * p,int i,int id);, A( \( ~2 @2 J7 @
    int FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);( e) G1 {6 ^8 z4 c
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    $ T7 @1 ^2 X7 ^$ p; i$ k6 @) H  Pint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);- U+ y4 K3 B1 `' y
    int FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    ) L$ r3 q0 I, ]& aint ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);8 T  |) C- b5 a( w( M
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);4 Y# D, ?/ _% ~4 D: |
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);' ~$ e, B' h* e" a# R2 V- A
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    " o) k  d/ k9 k& K& b) j. I7 L) l- Tint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);
    9 z8 z7 s4 x, V+ Q6 H6 iint High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);- d. i: L! Y) F8 j

    & J8 {* W. y0 m) c
    # l5 H  }; o' D- @% \int sort_by_comingtime(processPool * p,int pos);/ z6 R! n' A& a3 q6 `
    int showProcessInf(processPool p);0 l; h0 X  o7 t3 q* T
    int drawPerformance_FIFO(int x,int y,int memorry);
      \! S- M- @7 n, hint drawPerformance_HR(int x,int y,int memorry);
    1 t, X, x; Y8 vint drawPerformance_PF(int x,int y,int memorry);
    8 e* i5 C; A1 I% t/ _+ n9 qint drawPerformance_TT(int x,int y,int memorry);
    4 y; e4 ^' M) c$ Vint drawPerformance_SJF(int x,int y,int memorry);
    ' ~% ^& b6 O# @2 qint MouseListening();
    1 n# k- a0 B# Bint MouseListening2(int *flagShow,int * showTime);
    3 `6 U* r2 t* M7 eint showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);
    . l1 ~0 r1 g0 P& k7 E5 p. x$ }! J

    5 K# t7 o$ _% E. tvoid main()
    $ O- [6 E( v/ o3 h# l$ d6 O' @& M{- d, }9 d: F/ x' U3 q
    PCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,
    0 z1 N0 }' k, V& I0 ^*Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;' d! H  W! o" x4 K
    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,
    7 b4 q& f/ ?2 F2 y( hflagDraw=0,showTime=100000;  X( D* p# c4 A
    processPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;" [) A" ]/ P" U6 v: @, e
    FILE *fp=NULL;
    + ]" n" H+ b' U- `, w0 ]4 s  M/ R//processPool HR_p,HR_mmy;0 T3 e0 c- ^8 ]7 l( u

    / ]! s9 i$ ]3 x6 `9 G# v" l) M( o1 r$ V# M( s( E$ I; g$ `" f
    srand((unsigned)time(0));
    4 E0 _0 X7 G* z; gsystemClock=0;
    , S# q5 R- ?/ p7 `2 J+ F+ Ninitgraph( 1200,650,SHOWCONSOLE );! X: R8 J8 g5 _0 P9 j, Y1 s* s7 }
    settextcolor(GREEN);
    + i9 j# Y6 d- @- o1 E- E6 fsetlinecolor(GREEN);
    . c6 Q7 Z2 z9 a! b  ~setfillcolor(GREEN);
    $ K$ o# D0 H% _6 j9 q9 XInitPool(&FIFO_p);
    ' v1 w# c6 J9 T8 M8 x* X' ]sort_by_comingtime(&FIFO_p,-1);
    7 c" P0 r! I* I7 g" U3 m* b5 ~3 t( fInitPool(&Timeturn_p);
    $ E+ G  e' p$ l8 d) h& ~6 m. BInitPool(&SJF_p);
    : N! \- G4 T! o/ }4 L4 V9 `InitPool(&Priority_p);
    . ]' A; H) H3 j- T# G* N8 }6 fInitPool(&HR_p);* y- F' i0 d" R9 X' b6 B. \
    //showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);! a5 m; s0 \$ R) M* Z. O5 r
    //Sleep(10000);- i9 L! ]% b+ f
    5 e3 `& O3 d. \4 V& }1 ]
    . s1 f- {7 x, O( ]) q
    Timeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    1 ~$ G0 L/ _3 e  M' WSJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));) e$ E1 ?, D$ l4 f
    Priority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    ! \9 t! ?! Q# \7 mHR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
      ]" g2 H# `' Z; Cfor(i=0; i<initProcessNum ;i++)+ d' g( b( J5 `7 L& t9 L- I" F
    {
    ( o" {) M! K" L. M. E0 GTimeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    % y- q. B3 Q" G. N2 B* `, s+ STimeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    - c: h9 U8 o7 H. k" w! `* ?SJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));( F  t) G+ X0 ?" k
    SJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));: U# O1 }% N4 O' y; w
    Priority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));, [( a+ h! T+ f! k, g
    Priority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    , V  z# M! ^) i! o. nHR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    + b' n$ V. R1 k* h1 JHR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    / y0 {$ G2 ?5 q  ]5 N# F! p}
    1 p& Z8 S0 e/ a( r* b8 }! J' KTimeturn_mmy.proNum = 0;: m$ E9 P& V8 ?. M
    TimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);
    1 o/ y  ?9 |8 PSJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);
    2 O" t9 q1 @4 {- GPriority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);
    * F$ F7 j; V0 X  u, pHigh_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);3 x- V- G* _  F5 c
    //showProcessInf(Timeturn_mmy);' ]; u8 r; L" F0 j0 J+ M$ X
    FIFO_pri = &FIFO_save_head;+ G: I4 g2 B$ O. ?/ i1 [3 T( _  j
    Timet_pri = &Timet_save_head;
    3 ?+ A9 a0 Q. \& P4 k. A' MSJF_pri = &SJF_save_head;' ]$ L: r  |! `* R' ?9 R
    Priority_pri = &Priority_save_head;
    2 z, ~0 F% N3 Z: K8 p) [/ p5 Y    HR_pri = &HR_save_head;
    6 H6 J* T( F% {setbkcolor(WHITE);" m/ B$ T3 Y% M! V
    while(1)& e1 X" l3 X% D
    {* k- H, _& n0 M5 _' e
    if(MouseListening()==1)+ U8 s( ~$ h3 S# m- H' d( m, q
    flagDraw=1;; t( V# L% w3 K  H
    if(count==100)' y9 G& ?  B5 N. e$ v3 g
    {: M$ h8 Z. _3 b1 e" r
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed)4 Z- l1 [1 g" V, k/ z
    {2 k$ e4 v' `$ I- N: V
    FIFO_pri = &((*FIFO_pri)->next);
    $ g  F% h  }* i3 Z4 T
    , F5 z- T4 z3 i- O//printf("hello");4 ]% }& Y/ L8 N: _2 @. K8 G* q
    }: R) U' b7 N$ d( w7 J( U  \
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed). ]1 }! _3 }7 a9 }5 e; M0 a" A; y
    {
    6 ~! j9 B; r& a! `2 a3 y- Y    Timet_pri = &((*Timet_pri)->next);8 |2 T" x. A7 @( l/ r" }$ D
    //printf("hello");8 a8 M0 z& w) q' G
    }
    / J0 w+ @5 y, m6 l, n. qif(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)( w& v4 m1 r" L, F% U0 G; j, J3 P! t2 i, i
    {# F9 Y5 t: Y$ E1 W) v
    SJF_pri = &((*SJF_pri)->next);
    4 e/ o; i6 ?8 X1 `3 x6 s% h5 @) x//printf("hello\n");9 ~% P4 p  b+ `0 C$ w3 c) o
    }7 F4 s6 Y% Z% Y5 D: q
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed)
    ) U9 r; u6 h9 @5 g. z% N3 |! \{! a" [+ q. |$ p! Z$ `+ H, x- u
    Priority_pri = &((*Priority_pri)->next);; V: j3 e; e7 V
    //printf("hello\n");3 g5 M9 O5 G5 o4 h' v5 M/ H  n
    }
    " y0 g' ^3 ^& K, ~  Uif(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed); l2 B6 H/ V; a7 R$ U+ H; X* b
    {) \% p1 q- Q) Y
    HR_pri = &((*HR_pri)->next);- L0 r1 p; K3 N8 x& I' a5 P3 O2 I+ D
    //printf("hello");( u1 Q% W$ c' M6 q9 N
    }
    4 D; H8 v$ J  w( @+ gcount=0;9 H( f" }) v# g* o) V8 f1 T% Y# ?% D1 |
    }$ T, O6 [  D9 N3 `5 j5 _$ t
    else+ M3 B# P' [6 J( a( q+ w) ]4 V
    {7 ]" k+ s3 \" p& o  ?, H* d0 B
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)6 c, ~( G% c5 t1 _
    {
    / n/ D( s! `" p) g, r) Y  h1 {FIFO_pri = &((*FIFO_pri)->next);
    # Z6 s- A/ M$ V+ e6 q5 g// printf("hello");
    * m5 U2 G5 @( I( t7 H& \5 p3 X}
    ' C$ n5 r. r: y- E! Sif(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)
    : t1 k' M; D7 N0 _7 K1 ]{
    # ]0 |. a4 \! m7 ETimet_pri = &((*Timet_pri)->next);
    8 e3 L/ N* h! K  A. X7 |* h// printf("hello");
    ' g6 m. u3 f+ p. }/ \' I/ m}; A* r6 G2 X# X, ^% c) }1 l5 W: k
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)5 Q) X, `: R2 X7 E3 `$ L0 _0 x
    {
    " H" `' p  V, b+ M# b  Q9 ~* e   SJF_pri = &((*SJF_pri)->next);5 E) U8 J" B! ^, W1 {: F# ~0 E4 z' r+ d
    // printf("hello\n");% A3 ^* [- W, I, G
    }, \# Z+ l. w- V4 P' h
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed)
    $ A2 K0 P6 ?/ c2 B2 ~0 d/ O{
    $ I& Z% ~* s& U3 l( e+ Y0 Z: z! ~Priority_pri = &((*Priority_pri)->next);$ v, R) h7 k0 a
    //printf("hello\n");
    / j# r6 W, F! m  z/ f% h7 x}/ f+ w  W$ {! I. e) ~$ d; {
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed)
    , A& J; F: ~- Z. @( \$ W{$ i* G# l# E, ~: Z6 n' J4 M  T, s  o
    HR_pri = &((*HR_pri)->next);, J* E) r/ d) \
    //printf("hello");4 ], {1 B* e/ q3 v: j1 x/ I0 Z: a
    //Sleep(1000);
    " ]& D  B5 r" `! C5 s0 e. y) K/ j, u}
    - C* c1 f$ e( ]' Zcount++;
    0 F$ _$ z( g! e8 e: |) @2 d  S}
    * K' @) E) W2 _7 j8 O" E9 `+ I( qif(systemClock==showTime)
    5 i- J" E. J/ j! M{
    * V7 Y9 a2 F( w+ ?2 [* J/ y; h- g/ g/*PCI * p=FIFO_save_head;% L2 v2 T% `4 \3 p! c
    int i=0;& l- ~8 R8 K4 D$ d2 P
    for( ;p!=NULL;p=p->next)
    ( |& Z1 \6 v% `7 H  c5 A# q* C{. b) ~+ }- p4 ^# Z) y
    printf("Id %d\n",p->processID);
      b8 V& T* m) ^1 l9 sprintf("comeingtime %d\n",p->comeingTime);: A: x2 l2 [1 ?+ Z% O$ u* b
    printf("runningtime %d\n",p->runningTime);
    4 Z  `' l9 b# _/ h1 ?: E( l+ |7 dprintf("asdmemory %d\n",p->askMemory);
    ; ?( n( P$ h5 s9 a: A; `4 lprintf("completedtime %d\n",p->completedTime);$ l% @% \5 W$ Z' A* O. L" u- Q
    printf("compute %d\n",p->compute);) [+ q) a- L3 P- m& B
    printf("exchange %d\n",p->exchange);
    0 r' r( q& ^  `/ t2 [$ F( P, Eprintf("waitio %d\n",p->waitio);! ~7 G. p8 R8 J. G
    i++;
    ( `  p2 F% N( y: J1 n
    9 @+ {: z0 ^3 t8 k3 }: ^! b* |3 V1 Z* f/ l0 O  \
    }
    $ E9 K/ y4 B: P* V, b  pprintf("%d\n",i);*/# ~% ~7 q" o9 |/ F) H* i5 o; }( W
    if( (fp  = fopen( "data.txt", "a" )) == NULL )0 g1 O& G$ Y' p. L* r
    {- ~+ |0 ~$ W1 ^* I5 d) a2 v6 v
    printf( "The file 'data.txt' was not opened\n" );
    . D! d# E! l' U//return 1;
    6 ]  I8 j+ C& E% k! w}
    8 |8 v- p" d' Jelse
    7 A6 A. e4 n( N. g5 s{. ~" ^2 c0 c1 L: i4 W, x
    fprintf(fp,"FCFS \n");
    : e3 f* z7 ]# \1 b$ m1 pfor(p=FIFO_save_head;p!=NULL;p=p->next)! Z3 X# y$ w  }( ]6 \9 S( r
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    % s8 ?, Z* ~1 xp->exchange,p->waitio,p->runningTime);
    - Q+ a* K; ~8 m# a; ~& D/ \4 Dfprintf(fp,"\nTime turn \n");: T7 z) b. ], O2 s4 ^) y
    for(p=Timet_save_head;p!=NULL;p=p->next)
    & _% u* }+ w# r2 F. P% Gfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    1 i$ M& R2 J3 ~9 lp->exchange,p->waitio,p->runningTime);" h8 }! Y$ `. m8 ^$ W( E; w
    fprintf(fp,"\nShort Job First \n");) z# Q) D; F: D0 `
    for(p=SJF_save_head;p!=NULL;p=p->next)
    3 @, C+ H3 s: D& C2 d$ M7 ]7 xfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    ) ]+ c- H& m- ]p->exchange,p->waitio,p->runningTime);
    ! }. M5 D: m0 y7 s2 Wfprintf(fp,"\nPriority  \n");7 x- @2 F  j1 R) H, u" f
    for(p=Priority_save_head;p!=NULL;p=p->next)9 u8 ^) ]! |" i8 m
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    & m& w5 V, L/ H, [# s& X5 M0 Wp->exchange,p->waitio,p->runningTime);
    , @$ q0 D4 m/ {" I; K4 `2 V2 ~fprintf(fp,"\nHigh response \n");  k* Q! Z1 w) }0 P+ c
    for(p=HR_save_head;p!=NULL;p=p->next)
    ' T0 c* f) _: S* dfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,  p+ q: O+ E; w" Y' K' F- c$ g" g
    p->exchange,p->waitio,p->runningTime);" F0 ?+ b+ U# q* `% q
    fclose(fp);" v) l- i8 J1 _4 f1 \; B
    }, C* z0 [1 R+ a+ N
    showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);$ E% W5 N$ B4 A+ F$ D( @+ L% `
    MouseListening2(&flagDraw,&showTime);& Q! ^( X% R; ]) n# L- M
    }  M9 N4 \; ^. W. m. Y  J  ]
    systemClock++;% \  e% ^6 S+ l
    if(flagDraw==0): v, p7 q# T& T/ _" b
      Sleep(10);  f. [8 \- h4 g# C  y  s
    }. p/ ^1 E+ h4 x* u: p/ G
    ' V9 ?4 c: j8 v

    ; j( e: U3 |9 g! }# w! v4 P5 B}  p6 @1 Y9 ^6 n
    int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR)1 t. @) n" }0 {; `. G
    {; r# I- g! a8 m1 v1 M
    PCI * p=NULL,* name[5];
    " [8 T+ a& B$ `: s( f* ~/ p+ \int count=0,i=0;
    & B: ~0 l& Q/ ^& lchar ch[5][10]={"FCFS","timet","SJF","PR","HR"};5 t* \: ?: I1 h2 Y  M
    double turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};
    " m, X1 m9 Q2 e0 q1 d$ Estruct info, G4 o! h- f0 H" i/ W2 B
    {
    0 U% s5 j2 C, }! N2 @+ mchar name[10];; f% |# G3 W) i3 O
    double throughput,turnover,wait,CPU_rate;
    * n8 Y8 F$ @  R8 M3 i2 v}inf[5];, }; [  R+ @3 t8 Z+ m
    name[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;
    7 R: M5 m! H1 T3 q, K+ u  [printf("调度算法..........A\n");& \4 C) v+ w0 D4 M
    printf("吞吐量............B\n");+ n  M, q* G4 A
    printf("平均周转时间......C\n");
    8 `5 [+ m( H% b6 Qprintf("等待时间..........D\n");
    ( J) Z2 ~0 S+ A% [printf("CPU利用率.........E\n");
    % c' m8 U$ u3 B1 ~printf("A\tB\tC\t\tD\t\tE\n");
    0 `( `7 E1 W* `. O0 s; sfor(i=0;i<5;i++)0 f! W2 I8 v$ c
    {: ]5 n& i: D7 u' ^
    count=0,turnover=0,wait=0,c=0,w=0,change=0;9 j0 p' ?' q$ W5 G3 T
    for(p=name; p!=NULL; p=p->next)
    ' r; }( p- T6 k4 g9 L{( o, C; c: K( `9 k; H' m
    count++;
    / v  Y2 B; R% N* q9 R9 j/ g0 q3 y! Lturnover += p->completedTime - p->comeingTime;. f0 c1 y8 U2 r
    wait += p->runningTime - p->comeingTime;
    , C+ O% o: J" d+ S0 P- r4 z  B9 V/ wc += p->compute;
    8 i0 H; P. D& x) S$ _  kw += p->waitio;1 P; C* ^" m: x% ^/ c8 }; L3 D8 G/ ~
    change += p->exchange;
    # v8 B1 y- Z7 M+ o" D0 `}# T! r" R" ~% e4 |
    turnover = turnover/count;$ S  c. ^) G7 J/ W4 \' V8 i
    printf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));
    $ \  a* I( |/ {2 o% f9 Dstrcpy(inf.name,ch);3 U& r4 f, z0 z: t( j4 y
    inf.throughput=count;4 _& l. J& O+ f3 Z  W1 H6 C4 O
    inf.turnover=turnover;
    ! i4 o" s1 w2 j8 X6 S' Pinf.wait=wait;1 E  z$ X$ o2 G: u; k
    inf.CPU_rate=c/(c+w+change);1 d  f* n: e" \( o5 s
    }  Z) I5 z- m, Q, T  F  m& {
    //画图
    9 Y* C+ D! j. Y. |2 b# y//cleardevice();+ s7 f* h# Z4 a( S1 J
    line(0,600,1200,600);4 n5 F% z8 A  Z5 Q! X$ V8 z
    line(10,600,10,200);
    ! }+ F' ?1 \+ q' G4 kline(10,200,5,205);2 t! [2 l6 Z4 ]$ E! @
    line(10,200,15,205);. P: V4 p- `6 n% ]* L3 C
    line(310,600,310,200);) E. C- b( H. S* y4 K! y
    line(310,200,305,205);
    1 `  |" ?& z( ]+ a* zline(310,200,315,205);$ T, B; a2 E5 H) Z) F% r, b9 ?  F$ G
    line(610,600,610,200);
    5 {5 `! L# ]( P5 f9 T/ D: \5 {* p& vline(610,200,605,205);( E4 M* f, k# ~  Z6 u% r
    line(610,200,615,205);
    3 a& c- _! z$ ]; s7 n. A! oline(910,600,910,200);+ D9 i+ F: D( c) a3 Y3 }+ _# l3 X
    line(910,200,905,205);* T+ m# K# `, V6 g1 ^
    line(910,200,915,205);//最高的长度400,宽度均为408 B4 x$ v  Z( U* Z5 t8 R
    for(i=0;i<5;i++)' e) q. ]% a8 ^* T4 K( s& {7 P
    {! U1 j, B* R3 i2 E7 L: z6 k
    if(inf.throughput>pos[0])
    ( L) ~: q8 o  y- j2 _: ~  vpos[0]=inf.throughput;
    ; e/ H( |1 q3 \' Lif(inf.turnover>pos[1]): U7 G  d/ @6 K( o7 `' i' o
    pos[1]=inf.turnover;" l8 M& P1 |  I% A
    if(inf.wait>pos[2])8 Z4 y5 ]) j  y' d5 h3 {0 c
    pos[2]=inf.wait;
    & J; P+ p& c1 X4 tif(inf.CPU_rate>pos[3])( A( r" C; i6 y6 e3 Y* i' R; L) ?7 n( e$ K
    pos[3]=inf.CPU_rate;' t) d0 o' ~' R* c; a' q# ~' J; p
    }; c0 J  D3 n/ j5 k
    settextstyle(30, 15, _T("楷体"));' r! M/ m3 e0 S% D  ]# g
    for(i=0;i<5;i++)
    - C7 j+ m2 X/ x1 g7 {  f{4 d: ^7 @) X* r" O0 j7 ^0 l4 K
    switch (i), f: Y6 L5 Z2 b
    {$ `5 v, a$ y* b1 k" n2 O1 b
    case 0:+ v2 |5 n2 C4 B: G' q$ J" O9 n& k
    setfillcolor(BLUE);3 o9 }' y0 l# _5 j2 ^
    fillrectangle(100,50,150,100);
    $ N$ g% w, I2 r1 b) m% Eouttextxy(160,50,"FCFS");  M" P2 m/ I1 l7 m
    break;6 ?" H5 \9 S2 k9 T2 `( K# C
    case 1:! d* m0 s" M( n  C' M; T% G
    setfillcolor(RED);
    ) ?$ g' t8 H+ [fillrectangle(250,50,300,100);
    9 N, F. p# u# S% qouttextxy(310,50,"timeTurn");
    6 h/ D. m8 i$ Gbreak;
    ' j2 Q3 i; d: A+ n( ]case 2:' F; B4 I$ v/ N% B% u
    setfillcolor(YELLOW);
    ! r5 R) w  `& y, }3 j) F# P+ r8 J% C5 [fillrectangle(450,50,500,100);  Q/ M% u. ]; u1 F; N
    outtextxy(510,50,"SJf");8 ^. A  p9 z: F' Q" i
    break;+ O5 X- V" E  H: f: m) [
    case 3:
    7 M( l' N8 O4 r9 t9 G. ssetfillcolor(BROWN);
    - G$ I: Z, y' P6 Afillrectangle(580,50,630,100);* o6 |6 d, S0 [
    outtextxy(640,50,"PR");! t. D9 [, x8 N# {) k1 P, }3 X
    break;* C; g  X+ f; t' L( N
    case 4:# [/ e9 e6 i2 R+ O2 f" `1 h# @. P
    setfillcolor(GREEN);. c# @7 u: ~; B& U+ F% Z
    fillrectangle(690,50,740,100);
    4 R% T9 l* z. F: \outtextxy(750,50,"HR");
    / k1 i) @# ~! Y2 w, X5 L' wbreak;1 o/ h1 [+ D9 K5 B2 K5 E: P
    }
    , Y# y6 a0 V! t+ v# `7 ?3 y% Ofillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);) J% ~( R7 E- p% o6 f6 V+ n: m# }
    fillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);
    " i1 _: J6 O2 h1 o  a2 xfillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);& h- W2 I8 x" L; L
    fillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);" L  l5 |  d2 b" a$ E$ m1 q

      l% Y( X- C7 W7 L; o. o% a5 \6 H- s" i# p1 d
    }
    % Q& `4 c6 u. K& k. A! h: y    outtextxy(100,150,"吞吐量");
    - H* `! I" |3 f. R( Louttextxy(350,150,"平均周转时间");
    - k$ n; o  e3 q$ eouttextxy(650,150,"平均等待时间");
    - ]) p/ Z4 ^6 W% gouttextxy(950,150,"CPU利用率");( K; u0 w6 c' @+ H2 V
    return 0;
    " F% T, }- t- N  v! u. ]  ~}9 h& W' s+ H' o8 x7 q8 C+ D
    int MouseListening()
    , k" q8 N4 l# D{
    9 _4 o* g) n# \/ T6 EMOUSEMSG p;/ z# T/ D+ u9 i9 C3 E
    if(MouseHit())
    1 T. Y: X$ c9 Q7 i7 u. `0 b{
    ; H$ O7 s7 n1 f% n4 T/ j' \p=GetMouseMsg();
    ) k0 Q9 I6 J8 G) w1 |if(p.mkLButton==true)' C) A/ u" e" |
    {; j$ q2 Z6 p, |% @
    if(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    ( i2 i4 m4 w6 dFLAG_FIFO = 1;
    9 C3 v4 ]( b" {, L0 n" ?; delse if(p.x>400 && p.y>0 && p.x<800 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    7 V( H2 ?4 T/ t) `FLAG_TT = 1;" m! Y9 o' i7 |& v' L7 }6 r
    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)
    3 t5 C. Q$ @' M2 }6 c, lFLAG_PF = 1;, [+ y5 d$ S3 `( [( @9 _3 ?8 ^; {
    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)" I) w+ a/ f3 A& r/ u9 u
    FLAG_SJF = 1;
    * `  {5 d1 v; Y3 \: I+ I5 Yelse if(p.x>400 && p.y>325 && p.x<800 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    3 Y- q4 I  _3 c8 E6 LFLAG_HR=1;9 ~; {0 N4 Q  I- F
    else if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)
    9 t+ h3 c* P0 S# C+ x) g3 L/ E{. ]# N' q& L3 l# e0 f: q
    FLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;
    6 z: ^: |' W+ N7 k7 n: q' ?clearrectangle(800,325,1200,650);- d4 W) ~* F' M" B8 @
    }5 M1 @* c; M" r% x4 ]1 a. _
    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 )
    / Z6 Y0 @# r* b% j5 c{4 h9 f$ H+ \7 H; M* f
    FLAG_show=0;
    ! W! R; v/ q8 d' Jcleardevice();" d, c$ V! E  p
    return 1;
    0 w2 b# |0 T5 f* c( c}
    ' n5 ~; y! U9 T& E}
    " r" y* D: r! _. V4 P0 O* q- g% z}
    2 {  U5 b0 a6 f. m2 w6 l$ Y5 Hreturn 0;4 h& p2 |: ^' f5 W" q' E5 s
    }4 R+ \7 t5 I. P+ L' h) }1 H4 C
    int MouseListening2(int *flagShow,int * showTime)! s' N# _+ K, e. S/ V9 s8 O3 J% @) [
    {% Y" I/ p# x% R( S- G9 U  o0 j% I
    MOUSEMSG p;
    : [! f' L6 M# d, c) |; Xrectangle(1150,0,1200,50);
    ( f, Z6 p: L+ ~: x6 o, Routtextxy(1160,10,"X");0 ^6 V; U# Y$ j% x# p
    while(1)& O1 S; G! P6 Q
    {2 o3 F& ^9 [6 U! D/ P
    if(MouseHit())
    , }3 S/ [1 O* u9 J$ f{
    " Q3 z$ q1 [) S4 Qp=GetMouseMsg();
    ) \3 x9 O! a1 {8 C; P' S3 bif(p.mkLButton==true)
    3 C0 H1 f/ M% }3 m# t# V{
    - j% y- Y6 p% W& ~9 nif(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 ). F# s) k; |  E6 j6 N
    {( V! o9 i3 \9 m) O  l
    (*flagShow) = 0;; i4 e8 O: E  ^' o$ n
    (*showTime) += (*showTime);
    3 t1 M# b' J7 e) @FLAG_show=1;
    % r0 X6 ?% M, z) t# R5 |* Pbreak;8 `* g  S: W1 m
    }
    / ?3 S% }7 o) U1 Q" C" p. k8 D* N& C
    }
    # ~9 p( H7 {5 U' S' K+ {; l}- J7 l; a3 w5 @# l/ z. v
    Sleep(20);
    7 u9 O4 d+ y5 A2 o0 Q; i}4 s8 o4 _' }  W; H0 m' X
    cleardevice();4 c2 m% G7 ^; L( k
    return 0;& ^2 c: A& x1 ^' F
    }
    ! n% Q: a- y7 v! kint drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha)
    . S$ T9 N! [; @9 A1 \{
    # a9 A/ V3 f  G+ Jstatic int info[11][3],num=0;" r7 K" s7 @- J9 Q
    int i=0,j=0,pos[10][3][2];
    4 B& Y. i* z! T' z0 efloat temp,t;3 j  X; l0 L0 }
    //画按钮,不属于FIFO图的范围
    5 R* K7 J/ J3 Gif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)
    8 f2 v$ l7 D6 ]1 n- p{1 Z) N( ]$ R' [! m0 l; b  R) p
    settextstyle(30, 15, _T("楷体"));
    6 K0 u3 E: k& P4 X. c* Grectangle(890,455,1110,510);8 h) G* j) C# p' j/ I
    rectangle(900,465,1100,500);
    3 r" {- ?) M: c( Fouttextxy(910,468,"查看运行结果");
    + H& W5 Z; m# z0 |: M6 M' ~( X}
    # x: @, q  L3 |& v//结束画按钮. Z# b5 M* [) n, ?2 E
    info[num][0] = com;+ J8 O/ N. w! U5 R% S9 I7 z
    info[num][1] = wai;
    $ f' \$ j6 B  finfo[num++][2] = cha;
    ; x0 V' X1 v. `6 N) P8 `if(num>10)  //存储10个点; D' C9 N- G0 T5 ?! x9 {5 I0 q
    {1 G2 N) Z; [& F6 K* `5 g( X
    for(i=0 ;i<10;i++)9 U" N0 D0 a6 E1 d# y
    {- e" F4 H) q# h# A: t/ m
    info[0] = info[i+1][0];
    ) J! f9 v/ N; T5 Q! b5 ainfo[1] = info[i+1][1];
    8 e5 C& W2 T" m  ]3 J) Z. l2 Winfo[2] = info[i+1][2];9 t: r2 z% K8 C2 \. S' W% c
    }5 I2 {; g; P/ z5 R# b& }
    num--;
    1 Y3 A8 C, n6 r( y4 k! E}% k8 `; L5 ~# T, }
    if(FLAG_show==0)
    " Z; g4 m6 J$ ?( Yreturn 0;! l& F+ O% F7 J
    for(i=0; i<num; i++)
    1 J$ {8 f( o, R: F/ h/ \( X{
    9 T9 [( T0 p5 {: O8 @0 wt = (float)info[0];, h4 L9 l2 N: E9 f
    temp = (t/101)*90;6 Z1 j, B1 x# t7 ]! G9 y
    pos[0][0] = (10-num+i)*25+x+100;9 W3 m8 l& ]1 ^9 j/ Z% [7 p# P3 L2 W
    pos[0][1] = y+110-(int)temp;& q, S( t( o+ a) u8 }
    t = (float)info[1];( x) a$ X: X9 y  `% w" q. w
    temp = (t/101)*90;9 r8 h3 ^( ]! R0 ?; J- A
    pos[1][0] = (10-num+i)*25+x+100;6 u5 k3 T( b, k" r# V
    pos[1][1] = y+210-(int)temp;4 B6 B* m8 K  G4 Z" _
    t = (float)info[2];
    + I7 }, t; j! z: i) V2 F- k$ Wtemp = (t/101)*90;2 p  [7 X6 V2 Z0 w; g! K, [- K' q$ ]
    pos[2][0] = (10-num+i)*25+x+100;
    " N0 b7 ^) |. @( a& c! Mpos[2][1] = y+310-(int)temp;. X! j& {  H4 ?( z" X7 b2 @
    }
    . |  R3 @) _( U* Bif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    ; r. z: o& V' u{* }) U3 Z, b- q! n0 n- s! A
    clearrectangle(x,y,x+400,y+315);6 [; g8 L6 O2 ^- t
    settextstyle(20, 10, _T("楷体"));' |/ D( ]  U+ K- j8 g
    rectangle(x,y,x+400,y+325);
    # l$ f+ y+ e& K! Bouttextxy(x+40,y+10,"CPU");       //画柱状图; B, v) z( i" T; U
    outtextxy(x+45,y+10+100,"IO");' X; u. t, }- G$ c+ B
    outtextxy(x+40-15,y+10+200,"change");
    ' a+ j8 P' |0 `rectangle(x+35,y+30,x+75,y+110);' h+ _" a3 d8 C% J7 c' A: u, |
    rectangle(x+35,y+130,x+75,y+210);
    - s- o; A, Z; Q. Erectangle(x+35,y+230,x+75,y+310);+ f  C& I* E/ P0 m( H. Y' @
    outtextxy(x+180,y+310,"FCFS");
    . M- i/ p5 Y9 ]4 j  b# zt = (float)com;
    ) q/ l4 s* {# k5 @' R( ttemp=(t/101)*80;& A3 K: |3 x8 |1 U, S+ v
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);8 h1 `7 y# b8 d; S
    t = (float)wai;
    2 X9 d& A3 U" s4 \  T( M, atemp=(t/101)*80;. }4 t% [" D. [2 W* d
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    3 {) N1 K. W8 L% t- [  A9 Et = (float)cha;
    ' y# c5 u" E( g- [/ I: Ytemp=(t/101)*80;1 ?! g: D, D4 n' M. U6 U6 p
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);; k: d% ?+ b6 J! e. `1 t% y/ T" b
    for(i=0; i<3; i++)   //画坐标   high=90,length=250$ d4 [! R6 Q& C* t. \
    {& i9 @. k2 q3 J
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    6 w* F, f8 y; c/ [' \* |4 _( Uline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);1 Y7 O4 q; d# ^- Q9 L
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);+ J; b( l+ F( A# L" P: D, d0 Q
    0 e, n6 e7 B& A3 s7 W3 W
    line(x+100,y+110+100*i,x+100,y+20+100*i);3 S$ S: B0 L! d$ q7 w; a& k
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);; P9 B9 Z' {6 y- a/ {$ ^5 z: I
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);2 j4 D& q& V; K/ i8 U0 N% E9 [! m
    for(j=0;j<num-1;j++)
      A0 b! Z* J# \{4 Z# v2 \+ a; @) r: p7 K
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);' ]0 E; [6 N, R. n/ t$ U
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    / ^7 o& x4 u3 Lline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ) `7 Q$ d' ]0 I' {: K
    }
    & j8 S- d, ~" Q% L8 w, Q2 l}( S1 I9 e4 {6 n% ^, Q7 A
    }
    / p1 I$ t/ k5 I) J8 relse if(FLAG_FIFO==1)* a# U* j* m; \4 j9 [  T4 d5 }
    {. v  v' K9 ?5 R3 N1 C/ ~$ ~  ]
    x=0,y=0;) B7 g, [7 k/ Y& R& J/ P
    for(i=0; i<num; i++)% H% G6 ^7 |. V: r1 \
    {
    $ |% ~0 u, j' X% k  g% et = (float)info[0];
    $ K$ ^3 _. y( Ttemp = (t/101)*180;
    6 f5 t% Z, y# F3 T2 apos[0][0] = (10-num+i)*50+x+650;
    % n! s4 X1 \. a& i5 o9 x, w8 w9 rpos[0][1] = y+210-(int)temp;$ B# d2 E" Z' z) b- W- @, F. c
    t = (float)info[1];, b8 E5 ]; c- Q: K2 F' U2 N
    temp = (t/101)*180;
    ! ?3 C: b% ]0 K; K- |+ k* v; Bpos[1][0] = (10-num+i)*50+x+650;
    : P' K" G+ G  M, [1 ]1 Rpos[1][1] = y+420-(int)temp;. H. g. c) M5 T7 [) E5 B/ n- t
    t = (float)info[2];
    ; I9 P8 Q" X, @, Q4 {temp = (float)(t/101)*180;
    % C1 R2 J( f  s1 D  @9 Zpos[2][0] = (10-num+i)*50+x+650;3 n9 P, r$ ]/ v: ]* ?6 ~, H) a
    pos[2][1] = y+630-(int)temp;& X( ?: r+ d# ^
    }% g) r9 s. B* ^2 h
    clearrectangle(x,y,x+1200,y+650);
    8 b' x+ W) D2 K7 n# k6 Usettextstyle(40, 20, _T("楷体"));* J6 ~3 f9 d' n- V. A( e& y- C$ L
    outtextxy(x+50,y+50,"FCFS");
    & v0 C2 F& N( ~: E! ~, y4 houttextxy(x+280,y+20,"CPU");       //画柱状图
    9 [4 {5 I7 z& D! w/ T/ a# ]outtextxy(x+285,y+20+200,"IO");
    " U; R' r* n7 a* routtextxy(x+250,y+20+400,"change");5 t1 Y! l3 j7 H
    rectangle(x+270,y+65,x+330,y+215);
    ; ?; _; ~0 x' V9 orectangle(x+270,y+265,x+330,y+415);
    - m2 k: B, @, e. `, O* _rectangle(x+270,y+465,x+330,y+615);1 T3 y& z4 A) g0 W7 ]1 x
    outtextxy(x+290,y+620,"TT");
    ) ?! @1 l4 d; R; ot = (float)com;" H0 b3 ]+ `) m! u9 [! u, `% d/ G" b4 H7 X
    temp=(t/101)*150;
    - L7 _, l' p& z) Q; M" x6 [fillrectangle(x+270,y+215-(int)temp,x+330,y+215);' e) L7 b, Q) |/ ?$ d
    t = (float)wai;& V3 D: t! O& z. N4 c
    temp=(t/101)*150;
    ) S* U9 w1 B' W6 ufillrectangle(x+270,y+415-(int)temp,x+330,y+415);5 s# J, a* \2 Q. ?4 O0 O1 O1 Q
    t = (float)cha;
    - e; ?: y7 [3 ltemp=(t/101)*150;) d( E0 V% ~" {  z
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    ) F- m( Z# Z$ H- i% g1 hfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    ! @6 Y/ D6 q$ c; |8 q# ^+ G{
    7 s9 J: u5 H, p, oline(x+650,y+210+210*i,x+1150,y+210+210*i);! `! I0 I0 x% d7 m  n+ J! {
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    ' [' `& T& }6 i) z9 l7 ]- Cline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);) S6 ]/ e# H/ i

    0 ~. N/ p/ @9 s4 n9 c" ~line(x+650,y+210+210*i,x+650,y+20+210*i);; h& Q3 H# K4 V: [$ l1 M/ J' P
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    9 Z" f- U9 y3 _7 ~1 I3 i0 Wline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);; L2 K( J3 P$ C' O) D
    for(j=0;j<num-1;j++)
    $ b9 D8 Y/ x( y0 W{1 @5 w& s0 j4 A/ |
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);% H2 }" v2 [5 n
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    2 `0 ~; ?. J$ }  i; J4 d6 P4 [" i  iline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    5 v% k* t( D3 d}* B9 d7 x; m& @" @0 t/ [3 Y0 z
    }
    % r/ O/ _6 Q4 H5 F}- Q0 Y) ?! P% D+ ~
    7 m  `1 g* J: Y$ H
    7 [* `! i& T  x
    return 0;) @& R4 j. b9 |+ y% K  Q/ l% p
    }3 ]/ N; P& b  E! n0 x9 V$ h
    int drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)) P/ Y* ]: X% z4 ~1 j) L  @* b
    {( j  C/ C1 g# E% l  J* ~  G& ~2 `
    static int info[11][3],num=0;
    9 @3 s8 {/ E' ]: y7 Wint i=0,j=0,pos[10][3][2];
    1 G; q1 E; A* b6 P+ ^7 Z+ ffloat temp,t;
    $ |5 p# ?. r, F; Kinfo[num][0] = com;
    8 R9 a. ~# i; _8 D" l/ g5 @info[num][1] = wai;" d3 s  ~1 [) j3 b- N
    info[num++][2] = cha;  r/ C3 f7 x: Y
    if(num>10)  //存储10个点
    ) U! P/ u" z8 s! T' K{
    5 `. B% T9 h3 C: r0 u% z% _1 S7 e) N  Vfor(i=0 ;i<10;i++)& y+ m/ p9 A, \1 l
    {
    5 e$ I8 W3 X0 J/ v; y# d1 Y; oinfo[0] = info[i+1][0];
    . I2 y  R5 Z9 H5 f& z+ linfo[1] = info[i+1][1];6 |# w7 @" z  l
    info[2] = info[i+1][2];
    - E. z0 B+ d: R}
    # M  t/ r: ~3 ^" Qnum--;1 v1 {7 j$ B2 A# u1 `' x3 f
    }: @. n) @$ h8 W0 i
    if(FLAG_show==0)
    # O1 n, h) P* c. [5 q* C4 l* xreturn 0;7 W" J2 M3 @4 U5 X) |
    for(i=0; i<num; i++)3 T" M; K+ ~0 M1 n9 r' U, u
    {- p# p. Y/ }! L/ w. N* @. e
    t = (float)info[0];
      n5 q# X4 r3 V  e9 P# u# K5 ~8 X; Qtemp = (t/101)*90;
    % P3 t- ^9 t5 V& @% h5 @5 _pos[0][0] = (10-num+i)*25+x+100;0 N5 p; J8 m; ]. _
    pos[0][1] = y+110-(int)temp;
    2 d& i5 |! I  N/ i  E8 @7 I  ]+ Zt = (float)info[1];) F5 f# |& Z" Q" N0 p
    temp = (t/101)*90;
    3 ^) k+ R3 H& F3 u" Y8 x/ spos[1][0] = (10-num+i)*25+x+100;+ M7 o; `& C' Q5 ]$ H+ {# v
    pos[1][1] = y+210-(int)temp;0 m4 H6 u1 V1 G( i$ A6 l3 U$ A8 ?
    t = (float)info[2];7 K! I( K' {& ~" E  m4 S
    temp = (float)(t/101)*90;, q) I; g3 @8 B- h
    pos[2][0] = (10-num+i)*25+x+100;
    5 g* d0 N) g- f2 J  P' w. rpos[2][1] = y+310-(int)temp;
    0 A% L0 s6 |, U  i$ P: `; y+ T}) ^6 V" F+ ~# Z" T8 S
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    ; J1 i9 e5 C# H9 x; q{
    5 v4 l9 J- K* R8 P; ]$ `* Yclearrectangle(x,y,x+400,y+315);
    # ?/ _! Z% K5 Dsettextstyle(20, 10, _T("楷体"));
    0 W* s! G$ F0 V9 i1 krectangle(x,y,x+400,y+325);3 f5 Z5 i; E5 |  I3 n
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    + O3 Z7 ?5 S! g# Y; a( {' Bouttextxy(x+45,y+10+100,"IO");
    * m/ L' n$ e2 Z/ Oouttextxy(x+40-15,y+10+200,"change");* S' H/ H3 p4 X+ U* r
    rectangle(x+35,y+30,x+75,y+110);5 S% u0 F/ ]0 v8 W0 w' L
    rectangle(x+35,y+130,x+75,y+210);4 o0 Z+ I- Y$ x# _+ L
    rectangle(x+35,y+230,x+75,y+310);
    ! i' m. \8 ^' i% ~4 N5 couttextxy(x+180,y+310,"HR");8 o. g5 @( |, t+ [2 k4 ?: c' J# T
    t = (float)com;
    / \( H/ y$ f) j+ G& _3 mtemp=(t/101)*80;
    2 F# j  l4 d  Q! i5 s9 C7 Ifillrectangle(x+35,y+110-(int)temp,x+75,y+110);* z" [$ K$ i  r% R1 Y  y; ?
    t = (float)wai;
    & n" [* P* j& t7 E2 C1 l: C  Htemp=(t/101)*80;
    ' A2 f! ?$ C; y% J! g& m) l2 Vfillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    5 j( V) K- d" |) W+ M0 zt = (float)cha;( `8 `' h' t* K3 ?- F# I# z% b
    temp=(t/101)*80;
    ; I$ ^* U9 M2 rfillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    ; q2 m  k  N( W, lfor(i=0; i<3; i++)   //画坐标   high=90,length=250, q, @% a" o% s3 U' R
    {
    - y. [9 _4 j3 @/ o5 x+ a, ]& Rline(x+100,y+110+100*i,x+350,y+110+100*i);
    , Y: t, d2 [2 S9 P4 H+ l+ e7 ~line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    3 O( S3 t1 ?* S4 w/ oline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);( _, f, J' ]1 f8 o8 g& f) ~. E

    7 @6 _' V. d2 O0 g7 }1 [- V% q8 nline(x+100,y+110+100*i,x+100,y+20+100*i);7 v, @% T% V: O3 r
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    ' p7 P1 M" L8 U6 L- Iline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);4 y3 B- |' i1 D* u2 H
    for(j=0;j<num-1;j++)3 K0 D$ B! Y9 \8 q3 d
    {5 w1 m- W0 f/ |$ _2 ~
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    " N$ K1 b6 f# }* Wline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    " K9 q7 I; u. S. Y, V  W" n/ Yline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); . u$ q+ D' w$ _! n& K
    }! N3 _% Q$ Q" _/ U5 O# e- H: R
    }
    % T" [5 h4 c% I}
    % ~+ k: q7 g5 h: Z' n0 \  m7 velse if(FLAG_HR==1)
    6 Q7 A  t7 k; H{' o6 M' `7 N# `: i1 e3 W6 q
    x=0,y=0;
    . O& V& l3 L, _" h# V! ?% T5 cfor(i=0; i<num; i++)
    6 J9 @7 N5 w' k  _& o{% B* z4 N5 I4 o& D# H: k
    t = (float)info[0];
    3 C. k5 V3 }! E5 etemp = (t/101)*180;
    ) j9 S; h. m* h4 w4 j# U+ `7 opos[0][0] = (10-num+i)*50+x+650;9 W0 ~( h4 F; \$ f! l
    pos[0][1] = y+210-(int)temp;
    6 `% F6 {- s. y. H# D9 H4 W( j& F" ct = (float)info[1];
    8 ^( M4 W5 q9 h, C  o: Etemp = (t/101)*180;
    ( X$ [1 g- i& I9 l' h3 K! apos[1][0] = (10-num+i)*50+x+650;
    % ]" v! X1 M+ ?pos[1][1] = y+420-(int)temp;( y  T6 m# L" x4 M* o
    t = (float)info[2];
    1 Y6 l( [) X+ u9 E4 G- L' @temp = (float)(t/101)*180;7 Y/ {9 j0 e7 ]9 t
    pos[2][0] = (10-num+i)*50+x+650;$ W8 _+ u8 a- B$ C3 ?
    pos[2][1] = y+630-(int)temp;" M( a+ H" H; _/ [, s1 ~
    }
    & @) u* M3 p- Bclearrectangle(x,y,x+1200,y+650);
    2 C. Q, |" |% O6 w/ w" x( xsettextstyle(40, 20, _T("楷体"));
    ) i. ~% q& |0 N  Q; z/ D# t+ _+ oouttextxy(x+50,y+50,"HR");2 S5 V$ p, f& `8 S( E* h! l
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    + @. A: o9 U' Gouttextxy(x+285,y+20+200,"IO");
    6 W. h& x0 i  m) c& O4 U+ ]/ Louttextxy(x+250,y+20+400,"change");
      l( l+ l) Q* z; N3 Zrectangle(x+270,y+65,x+330,y+215);& d- I6 q( e6 E1 I& b5 _
    rectangle(x+270,y+265,x+330,y+415);
    + D9 x1 ~; B1 W2 `1 _3 Srectangle(x+270,y+465,x+330,y+615);' W3 G3 {. Z+ o, `: w
    outtextxy(x+290,y+620,"TT");3 E- w3 U) r* d" }3 p; V0 m
    t = (float)com;( M4 P% E. I! B8 d5 \- k
    temp=(t/101)*150;6 Y& J' J- g/ D4 e
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    0 S1 T. K% a1 ft = (float)wai;8 \4 l+ j2 X3 u1 F; J
    temp=(t/101)*150;: T9 e; ^8 x2 F# G- v
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    " f( a4 f' |6 G$ St = (float)cha;
      M/ }5 a5 [) L. I+ t  otemp=(t/101)*150;( y* H& I, Q& o# W3 q8 c& e
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);& e8 }2 d$ Q& ]  [2 L$ C5 w
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    ! j/ f0 O; j! N% I& x, C5 i{* s, p- z2 C6 U4 U
    line(x+650,y+210+210*i,x+1150,y+210+210*i);# b5 f& P$ j6 J! v$ X
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);8 g: n3 [; }8 K/ i: X8 [
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);) N5 E5 A- B$ U% o9 ]0 b/ `

    , y& D$ u/ _! b! |( [) rline(x+650,y+210+210*i,x+650,y+20+210*i);
    ; S: U1 |: h% o( Gline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);3 J5 S2 p% x, B- ]
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    4 n, a! l5 t! a4 H& P5 B0 rfor(j=0;j<num-1;j++)$ r9 f6 |% [8 ~6 M' b" J7 e) u- {
    {
    ( l$ @" ?0 p; qline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    3 ?5 P9 U9 k0 U; mline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    ( R1 X- c% I# T& V7 Gline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    4 ]3 @$ ]" Q. f$ g7 b}/ M9 r; G8 V# E4 C1 m* U
    }
    & r8 k: g; A& L7 `- H( @}1 J- H" `, w3 [; {9 f

    ' S% Q6 |, f. T( Q" o, c
      V9 w( f/ L6 q# h. h9 b' Rreturn 0;
      E- }* ~$ \. a; [' E- n}
    ; a& |5 x4 V6 P. }1 w, ]! Qint drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)
    3 ~( u! J; }. T6 P9 y* l7 {{
    $ ], q0 L* ^& t3 Z6 astatic int info[11][3],num=0;
    ' T+ O& e6 @* ]% k& O3 r* |int i=0,j=0,pos[10][3][2];
    : E+ c7 A# h) D3 }+ Qfloat temp,t;
    , K/ n/ h$ u  m9 Jinfo[num][0] = com;
    7 _* R0 P% b3 q1 j& binfo[num][1] = wai;7 F9 f: r4 F2 z5 p" c/ }/ t; b
    info[num++][2] = cha;
    8 g  {. S9 P. A1 }1 x* H7 I: X  F; jif(num>10)  //存储10个点( Y% v1 J  s3 U4 {- G
    {; u# E2 a! `/ H% g9 _: l
    for(i=0 ;i<10;i++)2 C5 M. [$ f5 s" R
    {
    $ m- s0 Q' O1 K6 C  ~info[0] = info[i+1][0];
    ; p9 {; D' b0 j% I/ ]$ l$ Y! Minfo[1] = info[i+1][1];
    . a6 U/ k" W! ?! g$ ]7 ^# s: E! minfo[2] = info[i+1][2];
    , m6 f/ b; X' q  ~; F; a( s* A* S}
    4 }% Z' C& [6 T1 V; c# H2 Snum--;% }$ L8 d8 f1 p, j  I  C2 K
    }$ G7 I7 \- P. M0 o" e
    if(FLAG_show==0)
    ) y' X' m/ h* N$ P* w4 freturn 0;' N/ A1 E. m" l$ c+ H9 J- [/ p
    for(i=0; i<num; i++)$ i. _+ r8 o' H4 P0 c% j* i: k
    {5 C" J" ~6 b, F/ R, q' j0 }. H0 x
    t = (float)info[0];8 B9 ^4 u2 S1 d9 l) k$ a; ]" F0 b
    temp = (t/101)*90;
    ; l8 z8 W6 s4 e# R: A" i5 `1 Jpos[0][0] = (10-num+i)*25+x+100;4 y2 f% \& w/ f& v1 \
    pos[0][1] = y+110-(int)temp;( }# B- s$ ~$ E0 l) \
    t = (float)info[1];
    / w6 M/ G: a8 jtemp = (t/101)*90;
    + \: q" a9 p, Q) S9 m. {pos[1][0] = (10-num+i)*25+x+100;
    4 K! B% J: j7 H7 F9 q- b, Dpos[1][1] = y+210-(int)temp;5 D) `& b) N! ]& t  R# s
    t = (float)info[2];
    $ M  W! r; V8 G) A* ~$ r# f! i8 Ctemp = (float)(t/101)*90;+ K% j- D6 H% e0 o
    pos[2][0] = (10-num+i)*25+x+100;' W5 A! S( b. r2 B- |) C, g$ y
    pos[2][1] = y+310-(int)temp;
    ( C' P& }& [' S% y" w' u  p8 h6 d}6 P2 G8 @# N9 ^
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)/ T1 Z( [% Y  {/ H$ Q
    {
    2 v6 H) e+ Q8 M5 jclearrectangle(x,y,x+400,y+315);
    , w+ S0 [: h. b' _6 O) i+ R# Y' msettextstyle(20, 10, _T("楷体"));
    8 |0 p3 \" m+ I  Q' A5 z# nrectangle(x,y,x+400,y+325);3 y7 [) p4 J5 l% B
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    ' F+ ^( E: c, _3 Q7 a3 uouttextxy(x+45,y+10+100,"IO");
    2 b1 p1 `( [8 _( [) p6 routtextxy(x+40-15,y+10+200,"change");, c, W) b. O# n9 E
    rectangle(x+35,y+30,x+75,y+110);  j/ p3 [" w+ i7 z
    rectangle(x+35,y+130,x+75,y+210);! I" J7 F5 k; \" s8 X
    rectangle(x+35,y+230,x+75,y+310);( w  z# t+ R7 b$ D4 U# F
    outtextxy(x+180,y+310,"TT");5 i6 g$ L7 W  k2 j
    t = (float)com;/ z* [4 M, Z" }! j" B$ O
    temp=(t/101)*80;
    1 F8 k7 Z- f2 I" j+ I4 ], Mfillrectangle(x+35,y+110-(int)temp,x+75,y+110);& ?8 p' S- Z2 ^' O' z
    t = (float)wai;
    5 c- \2 _- z! K4 x' r9 Jtemp=(t/101)*80;
    . n" }& K* }+ J3 tfillrectangle(x+35,y+210-(int)temp,x+75,y+210);7 [& O  ~: Y5 O9 i  L7 l: W# J
    t = (float)cha;
    1 \& H# Q" }- v5 s1 @8 otemp=(t/101)*80;* \0 ?3 {) h: j. R( c# b# h8 q
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);/ ]% _8 ~' Z/ @8 s
    for(i=0; i<3; i++)   //画坐标   high=90,length=2506 t2 [/ Z% q7 {
    {
    0 C/ g  m9 d3 t; T0 Yline(x+100,y+110+100*i,x+350,y+110+100*i);% a6 S! T: x" H8 h3 t2 ]6 }2 J6 D0 O
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);' u/ z4 Z# \' ^9 X8 }" X1 Q$ j! Y
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    ! N- B( s, S! ?( U; t+ x
    + f, Z* h( @  f7 {& H9 fline(x+100,y+110+100*i,x+100,y+20+100*i);
    " I6 y' D* F+ h; B- f" Z- kline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    + r( X3 {5 n) l- Cline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);: x4 w( K. M9 v& G1 E: G! B
    for(j=0;j<num-1;j++)
    ' Y- X' L  ]" p  p0 J: g$ f{; b9 N4 Q' t7 ]9 B$ q7 Y
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    , j1 b, \+ G# gline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);& L4 O0 t1 P6 |* v
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    ' I& Z) @% B7 K6 J( r}3 f9 s1 L# z4 B9 R9 ~4 O7 y
    }
    % @; c) k8 p7 S9 ~- h; S* ~}
    $ }/ v) }; r. kelse if(FLAG_TT==1)" v2 A: u8 m; y; m. J
    {# G: d4 t% M6 d9 c$ E2 I
    x=0,y=0;
    ; G) {& E. G. J& Wfor(i=0; i<num; i++)4 Q% C( ~: S! \
    {6 I* m* W3 V* [8 m' ^/ x/ s5 K$ ^
    t = (float)info[0];8 i  a6 c/ F" [+ ~  [  t0 [
    temp = (t/101)*180;6 |6 V6 o! C; U) R+ t6 P
    pos[0][0] = (10-num+i)*50+x+650;
    & b% U+ k1 i' B- f: |0 }' \pos[0][1] = y+210-(int)temp;
    ' a2 t7 P" X7 X! ct = (float)info[1];
    , `# C- {& f! D7 u) y# s, P6 w0 {7 {temp = (t/101)*180;" X! J( E6 R8 H, Y( Z: `3 X) ~
    pos[1][0] = (10-num+i)*50+x+650;
    4 k" x! }1 v, G4 T% ]# D2 ypos[1][1] = y+420-(int)temp;& x9 z6 T6 H" y1 ?1 i0 Y
    t = (float)info[2];
    * ~8 ~  ]' W+ R* mtemp = (float)(t/101)*180;
    4 ~: v9 e* [+ ^0 m' v# tpos[2][0] = (10-num+i)*50+x+650;* {( B( M! z2 _9 [6 ]# ^
    pos[2][1] = y+630-(int)temp;' w- N% {( S5 G, H
    }
    + `  C6 M. G8 _( s7 L$ L- Tclearrectangle(x,y,x+1200,y+650);% S3 v- T4 X1 l4 @
    settextstyle(40, 20, _T("楷体"));
    ! X: w6 T' A! `7 m* i( Iouttextxy(x+50,y+50,"TT");
    % U" k7 R. P1 M8 |0 E; F" w' Touttextxy(x+280,y+20,"CPU");       //画柱状图
    ) l4 s1 Q4 h6 Pouttextxy(x+285,y+20+200,"IO");( F5 d" U% P1 H! r, M
    outtextxy(x+250,y+20+400,"change");. B# l/ W+ K& H. L. p0 P' O
    rectangle(x+270,y+65,x+330,y+215);
    9 _8 j5 M8 l4 R0 W# k! H* lrectangle(x+270,y+265,x+330,y+415);
    6 A6 a3 g# u. s0 u! U4 nrectangle(x+270,y+465,x+330,y+615);
    ! X5 Z/ W; g7 p, R0 J" N6 b$ l( Jouttextxy(x+290,y+620,"TT");
    5 d3 K! }0 |$ y4 n/ ~: rt = (float)com;
    + `3 `7 H5 t* \1 qtemp=(t/101)*150;+ x$ n5 B: H; i* u7 S% b
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    5 c: L& x: G, B2 x8 mt = (float)wai;4 `6 }0 P0 G+ @
    temp=(t/101)*150;) E) M$ U0 _+ M' z% z% i4 m& @# H) B
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);; B9 |1 F6 A/ ]! W% V& g, h0 F; o
    t = (float)cha;
    % O* k8 R( i+ Otemp=(t/101)*150;
    0 D# x" l2 ]# T) H+ j$ ifillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    , e/ n9 r. ]% P" c4 }for(i=0; i<3; i++)   //画坐标   high=90,length=250
    2 C1 Y; X" j  i* {{
    & f+ M2 A) u7 q0 qline(x+650,y+210+210*i,x+1150,y+210+210*i);
    0 i; j$ C8 E& h- P* \$ B8 @line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    " h! J2 }) U* W1 [line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);' s# O" \: W1 \4 m
    ( t( [$ e0 g- p4 |  D
    line(x+650,y+210+210*i,x+650,y+20+210*i);3 |5 U- q0 f! }% G
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    / F* B9 b, H! Q5 L4 R+ _line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);+ y& o) W9 |, o
    for(j=0;j<num-1;j++)
    3 ~  Y+ k  g: Q) |/ u2 X1 W{
    9 s) c: `8 E1 ?3 x7 Hline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);% ]+ D/ ~0 T$ ~5 I' E: U' q
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);2 h- A+ m: `) V7 C& ^
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 4 v1 d1 z0 U% t. Y
    }
    : F: l5 V, v7 o+ I- \}
    - x# B3 n, q! |% }: u6 U2 S}$ c5 h" t: [5 E8 E( {
    ) V) V' k9 j/ k: h* s
    / _- T. e- K) c- B' [7 b( i
    return 0;4 h( z$ g4 E1 Q# y* J0 K0 x" s
    }- I8 g: X7 a, n3 _
    int drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)
    / U4 l$ l) u5 X9 ]# f" J{
    / h5 s. w% }1 p  K% O1 b( astatic int info[11][3],num=0;; g8 l$ z2 I5 q+ F# x# s7 }8 c. k
    int i=0,j=0,pos[10][3][2];
    & t6 S2 h% H/ mfloat temp,t;- T3 D1 k: N( p  l2 S. A
    info[num][0] = com;' b3 P; p  H; D3 C% s* l8 _
    info[num][1] = wai;
    + q  o" u  G, I5 binfo[num++][2] = cha;
    ! L1 {" d& H- ^. ?if(num>10)  //存储10个点
    7 K# I% j0 \9 W- w8 |0 S$ T{
    8 b4 L+ k5 v0 h9 N9 u6 U$ ?for(i=0 ;i<10;i++)
    % v* s1 L/ P+ z+ F+ B{! m* f9 |+ M. l5 m$ @
    info[0] = info[i+1][0];
    : s+ K' m! I1 _, x- Dinfo[1] = info[i+1][1];4 L' V$ A6 Z6 w0 c/ z
    info[2] = info[i+1][2];/ M, `7 g, s; Z% }
    }
    & [9 T& \' h  Y& e" p0 nnum--;1 y( k; j- r+ h- ^- A8 S+ W3 A
    }
    # U$ ^; [1 }2 |if(FLAG_show==0)
      l7 F$ j) r/ `! ereturn 0;
    5 y; B7 R4 \: jfor(i=0; i<num; i++)
      d9 h) d$ x' ^/ k  b+ X6 X8 A, @{
    9 j3 P/ i" k: S' u0 N. c$ l( [t = (float)info[0];: Z* D& o5 K& I
    temp = (t/101)*90;
    5 r- K: E" w/ o2 B4 n- hpos[0][0] = (10-num+i)*25+x+100;  J3 s$ Y  i7 G2 g% i! B, s5 ?
    pos[0][1] = y+110-(int)temp;7 e$ C9 }# b" s, a1 J6 N
    t = (float)info[1];: \8 k0 u5 n/ X: W: D8 A
    temp = (t/101)*90;( a7 y& I0 g& Z( \( l9 E
    pos[1][0] = (10-num+i)*25+x+100;
    . x8 @3 u) w! bpos[1][1] = y+210-(int)temp;1 m) S  Y4 [4 u5 ?7 f! S7 ?
    t = (float)info[2];* x2 |7 I( l" g3 J
    temp = (float)(t/101)*90;
    ! r" S& g# S- ^. cpos[2][0] = (10-num+i)*25+x+100;4 `- |( U% N. ?2 Y: X. ^+ E5 m8 J
    pos[2][1] = y+310-(int)temp;
    $ E4 g; ~0 P% D1 I3 w}
    ( q) d4 k8 L3 h# |4 Oif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)7 z' R9 `+ D! P' r/ d
    {7 }9 ^# C* Y( }/ k9 _4 }
    clearrectangle(x,y,x+400,y+315);9 S% V# ~* U7 O6 y8 N# B
    settextstyle(20, 10, _T("楷体"));
    3 y% J( [, y" O* \: hrectangle(x,y,x+400,y+325);
    $ t' u! o$ e7 o. O! N4 F) aouttextxy(x+40,y+10,"CPU");       //画柱状图
    + @* @3 y3 K) X  Routtextxy(x+45,y+10+100,"IO");8 s: ?3 G2 v( _& t1 I
    outtextxy(x+40-15,y+10+200,"change");
    * {3 k  s) N4 o; ^5 qrectangle(x+35,y+30,x+75,y+110);& d6 I% S- @, x: Z. z" D/ B8 \
    rectangle(x+35,y+130,x+75,y+210);7 v$ i8 g- A7 I0 a
    rectangle(x+35,y+230,x+75,y+310);
    9 l5 S0 L& {0 L( S9 s" Vouttextxy(x+180,y+310,"PF");4 `1 v* @9 \( |6 V  s
    t = (float)com;) r% D: Y" z+ |3 m/ B
    temp=(t/101)*80;
    $ w& Y; Y# b+ E& W  L" E% y/ qfillrectangle(x+35,y+110-(int)temp,x+75,y+110);7 E, H, G/ d# d
    t = (float)wai;
    0 S2 T; z8 J6 }7 Z! D0 b# @6 N. Xtemp=(t/101)*80;
    ) H% M4 e! W# ^4 qfillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    5 R$ `0 d; T8 S7 @5 i9 S5 \* bt = (float)cha;; p# _2 d4 j- d
    temp=(t/101)*80;
    6 [4 [) z* w' b3 \* B+ ufillrectangle(x+35,y+310-(int)temp,x+75,y+310);  q1 `1 m6 d+ C$ T; O& @
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    ( Y0 k# o+ q$ h) F+ h2 x# A{9 W) o. `# F6 m6 G" r" V# H
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    - l1 I; G" n; bline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    " g  x& T3 i+ E7 L2 O  n4 ^line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);7 k/ |, m. f- ?& [* H$ @
    ) e2 W1 A0 n! B
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    % K) S8 x4 r0 m& J# R# Qline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    4 Q" P7 l7 r. w9 ]line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    7 m6 `& k: }! ?2 {4 B1 qfor(j=0;j<num-1;j++)- P7 N( c/ J+ }' x% r" @# R# z
    {
    * |, J: y7 F; @! H! Z* H" ?line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    " r1 Z/ P* n/ g: w; Gline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);/ M) C8 J0 E- X% w0 P
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 5 J. Y4 B1 U1 A
    }
    0 B% T: M4 b& T}% a* c6 F4 X) e' U# i* j  n
    }
    ' |; s; N* Z8 ^7 F, d; p; Oelse if(FLAG_PF==1)
    $ T! Z0 d# M; }/ j6 p. A1 O3 s: D{) i5 S0 C+ E* Y
    x=0,y=0;
    , n9 Q. g" W6 Y3 jfor(i=0; i<num; i++); E! D3 [2 z0 k  V4 |! r
    {
    + @2 {' \& C% {% bt = (float)info[0];% {0 A( v8 e4 Z8 |# k! I5 r# M
    temp = (t/101)*180;
    % x0 n  ]7 C. u. P4 opos[0][0] = (10-num+i)*50+x+650;$ v. D% D2 n7 V& ^; c
    pos[0][1] = y+210-(int)temp;
    3 M; C5 ]" M% ^t = (float)info[1];
    1 r! w+ i4 H( n) j* |temp = (t/101)*180;
    8 A* |- j5 K9 G/ Vpos[1][0] = (10-num+i)*50+x+650;
    ( o, `: a' K: ?+ F/ X1 ppos[1][1] = y+420-(int)temp;
    0 q& I' F$ P5 d3 I3 |t = (float)info[2];
    ( _2 H% e* J. r9 Y" u, Ltemp = (float)(t/101)*180;9 H2 [: f7 ]% V4 j+ h6 j
    pos[2][0] = (10-num+i)*50+x+650;! I! R6 e- G! E3 [' P: R2 K+ Z
    pos[2][1] = y+630-(int)temp;
    9 @5 L( \% V( Y}
    * S% l. X" d$ m% b+ \5 xclearrectangle(x,y,x+1200,y+650);
    6 d  D9 u3 x  y. O; y' Tsettextstyle(40, 20, _T("楷体"));
    2 G0 P+ Q% ~) A2 wouttextxy(x+50,y+50,"PF");# G! d& e0 i) i( c2 v$ W
    outtextxy(x+280,y+20,"CPU");       //画柱状图
      @, ]" o# x1 p" Kouttextxy(x+285,y+20+200,"IO");1 {, o3 f, d* A" j0 U- ^
    outtextxy(x+250,y+20+400,"change");
    % e- L9 w( H$ k" X9 I8 Y& Irectangle(x+270,y+65,x+330,y+215);
    4 W( l( z" O- q9 Qrectangle(x+270,y+265,x+330,y+415);
    0 B5 M" O# w5 j: J$ s3 Zrectangle(x+270,y+465,x+330,y+615);
    6 K" i4 B6 \. ^outtextxy(x+290,y+620,"TT");
    1 r/ Y5 R9 d+ u$ m% e: `t = (float)com;) A; e# U7 [6 w! i# m
    temp=(t/101)*150;
    . h- T( d! `: ?7 Vfillrectangle(x+270,y+215-(int)temp,x+330,y+215);. L2 h2 [. B6 h9 q/ v- V/ ]
    t = (float)wai;
    9 d9 E! m, D8 e- {. Ptemp=(t/101)*150;
    : d/ i- C, p) ~% N7 e3 T- Efillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    ) @4 J/ A% ^) |$ p# nt = (float)cha;8 `( l* \& o% T* x8 E! Y
    temp=(t/101)*150;
    ' R6 H4 ^' u9 p; m( d/ Ufillrectangle(x+270,y+615-(int)temp,x+330,y+615);4 G8 j" F' X* ]) Q) [
    for(i=0; i<3; i++)   //画坐标   high=90,length=250/ \6 J1 J( u  [' c* @
    {
    * U0 c3 ]5 z$ B5 u# s8 p& t' gline(x+650,y+210+210*i,x+1150,y+210+210*i);2 t5 R. v* [6 y" W- B
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    - F7 H: m, m( Z: j& i# s( kline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    ) [( T  b- }  w  s/ o
    7 R, q. q0 a& L  i4 W+ Gline(x+650,y+210+210*i,x+650,y+20+210*i);; u% C* b9 K$ P2 K* P1 P. |
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);) q, \+ \: ^3 y4 j
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    , {  c9 d( V: K; ]4 Qfor(j=0;j<num-1;j++)" x. O) I! d4 p
    {
    ; Z$ A! a% i8 d# c4 E: w, Zline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    ' ]6 E: N4 X+ j( q, |% u5 Gline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    ! }, f) E$ S5 L. S' wline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    9 ~% M; s; s  M; \8 L}
    9 F6 ~. P: D5 X0 n: L$ Z! v}" ]) S3 Y: C  P3 ^+ b: p
    }
    * a9 k) ~* s: ^& x4 F3 m% V# n8 Vreturn 0;
    3 M0 _6 R+ G. j/ ?}
    ' H0 t( u9 r' E0 Jint drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha)
    : C" Z  o7 F- A5 T) n{
    ; k7 V* a8 x! J  g1 y; R! estatic int info[11][3],num=0;
    / C8 H1 p6 Q" [) u: b2 d  H* Aint i=0,j=0,pos[10][3][2];) [$ W- X# I/ k! N2 b  P
    float temp,t;
    / p9 k% h( o' h7 O7 ^3 W+ q1 i* i) ginfo[num][0] = com;
    : j6 H4 b6 u+ _% n9 m7 |info[num][1] = wai;; W& Q9 q4 B' n/ j1 @
    info[num++][2] = cha;
    # x3 s2 _& J" `; _+ N# ]if(num>10)  //存储10个点# b3 n8 h) i- x9 d
    {3 o+ ]" w0 s1 ~( [0 h
    for(i=0 ;i<10;i++)
    # p) d& s" E8 a7 F$ p{
    4 ?" X) i* z: |* m3 P# h2 _info[0] = info[i+1][0];% c- \7 @4 u) J
    info[1] = info[i+1][1];* n  E2 ?7 \2 [
    info[2] = info[i+1][2];3 {6 y! L: W6 c) [5 z/ x3 e
    }
    % ]  i# o9 Q' S5 p, B: y) ~num--;
    5 `. N' h( u3 S' ~) V}$ w4 y! E6 \& r$ X/ P9 L1 l& X
    if(FLAG_show==0)0 w( Q4 m" @& d. i8 L- h* B$ ?
    return 0;
    4 J, K' L  D' ^/ f$ Q/ Zfor(i=0; i<num; i++)
    8 A" V# k% I5 Z{, R" v2 b) z# \0 Q
    t = (float)info[0];
      v3 o! k/ R2 r! |! C% T( z% otemp = (t/101)*90;) e3 Q8 M1 h( z6 S4 {9 `
    pos[0][0] = (10-num+i)*25+x+100;
    * g$ k4 a+ y7 g: B; |pos[0][1] = y+110-(int)temp;" Q& A2 K* C! p6 x5 T
    t = (float)info[1];
    ) Q5 u9 T2 O  P% ^( btemp = (t/101)*90;
    4 w2 r2 A6 B' L) b& n7 `0 kpos[1][0] = (10-num+i)*25+x+100;
    5 T  Z% F( p% z( _pos[1][1] = y+210-(int)temp;; i" u$ S% D9 L3 V  T( Z$ g
    t = (float)info[2];
    % s/ C, G! _- ftemp = (float)(t/101)*90;* C1 J, _. x; B9 k0 D* }  f! m
    pos[2][0] = (10-num+i)*25+x+100;
    ; z9 x) J6 u# ~0 X4 upos[2][1] = y+310-(int)temp;" ]% V" b3 B+ _# F6 A. V# `! |
    }7 k# k' P4 C' z3 q; n+ p
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    - x3 ]3 w' ]. o+ ~" w{ 0 O+ c! r- S8 q: D. k, O/ }
    clearrectangle(x,y,x+400,y+315);
    " @5 C# f& ~* c6 I' L) J' B/ qsettextstyle(20, 10, _T("楷体"));* {6 |# u+ e' n4 p# c$ I
    rectangle(x,y,x+400,y+325);( ]3 \5 c" ?2 _! g0 s, [
    outtextxy(x+40,y+10,"CPU");       //画柱状图4 N% @* J* V. I2 A* Q6 C
    outtextxy(x+45,y+10+100,"IO");
    # P: k5 x% L; U4 G' q3 I( A* M1 Eouttextxy(x+40-15,y+10+200,"change");
    3 Y( u* A4 E0 Q+ ?  {6 x! trectangle(x+35,y+30,x+75,y+110);; W! O6 B4 O  R8 `6 N( p
    rectangle(x+35,y+130,x+75,y+210);
    , ]% p6 h! H4 z& Rrectangle(x+35,y+230,x+75,y+310);
    / L7 t' V5 h! E1 aouttextxy(x+180,y+310,"SJF");
    3 |* J7 |! i! C! a& a# n' O0 Et = (float)com;! S" R) Q+ T& b# P
    temp=(t/101)*80;* D# R8 C$ k/ I2 w& @4 w9 o
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);3 P3 u1 @# c% E/ }' Y9 x
    t = (float)wai;
    , t. P% p' k: q6 L6 D/ D% Gtemp=(t/101)*80;, ~" w; [# b% q+ l4 w) O8 O8 {
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);3 i. w+ W1 z. Y, c
    t = (float)cha;
    ! K+ t* a* u6 B/ A$ q3 A6 htemp=(t/101)*80;
    / e& {1 j, {! q, K$ c$ t; x# Wfillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    5 L  N& q) R7 b; w9 R, }for(i=0; i<3; i++)   //画坐标   high=90,length=250/ y$ O: X9 c" N; \" U% k
    {
      @( A8 i) C/ i, T5 O, b* Q$ ?line(x+100,y+110+100*i,x+350,y+110+100*i);
    9 a, g  e2 b7 o* _& x8 Qline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    ; [/ z2 l! ^0 i% Vline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);% g! y3 V) [! ]
    $ {! }3 \" E4 t; \  x6 v
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    6 _* ]. u. k# J! @7 _! W8 C7 q, Z) oline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);/ n. |5 Q6 T# d) s/ e
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    & j  s6 Y: B! E! ?) jfor(j=0;j<num-1;j++)
      u! X6 K% m* T/ Q( a% G{4 O& N. B% A! R+ d  N
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    : n3 o, Z. @/ b% l/ a, J+ f* l, }6 Aline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);& O9 e/ j; v, Y& d
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 3 o5 ]* l3 n" I" [/ R
    }
    # L3 A" T6 w+ w9 x5 K}
    0 `0 L: z9 u" b0 d}
    ( s5 z6 ]  s: ?$ Selse if(FLAG_SJF==1): H' `2 y: r3 r% i; k/ y
    {
    / w( E( @  S. ~. yx=0,y=0;
    , }. S+ |1 i2 \for(i=0; i<num; i++)9 [2 c- c  [* R( |/ i6 N" O0 S/ Q
    {
    * \2 @3 w2 v4 |8 l% Dt = (float)info[0];
    % T$ a& f: l0 S. W& n" Atemp = (t/101)*180;
    2 w! p7 `. Z3 O- S: hpos[0][0] = (10-num+i)*50+x+650;. N* L2 G, h/ p2 u4 y+ W
    pos[0][1] = y+210-(int)temp;
    5 u: u( E& Q. X2 A% dt = (float)info[1];
    ; @; U0 C  e# D0 Y6 vtemp = (t/101)*180;
    + Z$ |$ W( [% mpos[1][0] = (10-num+i)*50+x+650;
    / T2 I2 d3 p9 a; u* R7 i- U: K1 opos[1][1] = y+420-(int)temp;
    6 r6 t7 i: @! Dt = (float)info[2];
      P7 J# `4 i* `+ s1 Ptemp = (float)(t/101)*180;
    : L7 i" w0 f' H3 X! S/ x8 hpos[2][0] = (10-num+i)*50+x+650;
    6 K( ?9 |6 r& P, ^2 Vpos[2][1] = y+630-(int)temp;7 g" J2 ^$ b* D/ _9 v1 r! H  Z
    }
    * ]- k/ I4 S% w3 l( ^clearrectangle(x,y,x+1200,y+650);  X: p1 a/ N, w+ Z7 `0 [
    settextstyle(40, 20, _T("楷体"));
    / t4 \* T7 a/ ~, M3 Jouttextxy(x+50,y+50,"SJF");4 K( o5 u9 s7 z! F+ U; b8 @$ O! H# L4 c
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    ! ?. O# t7 i; I  wouttextxy(x+285,y+20+200,"IO");- D' f! w7 M' T  F. M4 B
    outtextxy(x+250,y+20+400,"change");/ `- f0 @( C; t
    rectangle(x+270,y+65,x+330,y+215);8 q- O0 ^5 D( n$ X9 t  O1 q8 H
    rectangle(x+270,y+265,x+330,y+415);
    # f  @- `, _' }4 Irectangle(x+270,y+465,x+330,y+615);/ L; c- G3 ]2 T* F( A' y
    outtextxy(x+290,y+620,"TT");
    1 G  R" ~5 b! P0 W$ Xt = (float)com;
    & ?% }. O; }; ~: Y2 Itemp=(t/101)*150;
    2 b1 j0 t/ I; K! c* q1 K' \  U" ffillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    7 h) `9 u8 r: ft = (float)wai;) O7 D9 q* W& b6 q  O# I7 G  j( r7 K3 X
    temp=(t/101)*150;! ?8 }* }+ l; V* M) R" @
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);" \' b) H  ]) ]2 G  z# C3 Q
    t = (float)cha;: b+ ?$ D) W; X$ x) E2 U5 d$ V
    temp=(t/101)*150;
    - p0 @) I* U2 y. Y8 Nfillrectangle(x+270,y+615-(int)temp,x+330,y+615);5 q  `! e" s- I  k* N; ]+ x
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    6 [% U; e1 W0 ^{
    8 o# E9 E- Y2 {0 K6 ?( Hline(x+650,y+210+210*i,x+1150,y+210+210*i);
    $ A. N* k2 @  V* d) N6 kline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    ( r- l9 ]  q* n8 P# c0 g) t: [line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);4 z8 v% D3 {$ b+ n# T

    - R  x( j8 e0 ]+ r& w% N6 Bline(x+650,y+210+210*i,x+650,y+20+210*i);
    ! T# {3 O8 }; u9 s6 {line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);: c% T5 ^  X; g
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    & u6 c* q/ e* u. Tfor(j=0;j<num-1;j++)
    " [7 T! ?' D/ w* U9 O: t{$ g* S  b: n6 ]
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);4 F. g. }# J, F- u! [6 }0 b8 G
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);$ b* V1 ?+ f% X9 \
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); , y2 D5 `, s4 T$ {2 i: W. J
    }2 V% z5 X$ A" S+ x# W2 y
    }* Y+ L" ]7 S) F) h9 f% `: S  B
    }" X( M# j3 V# n1 }+ u( @( g
    return 0;
    ) R# k- A9 h) j* @4 h* e3 b% s. s}5 D# r! x  A% D" \, ]
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)% V, X5 [, H4 @8 f0 q. j6 b
    {
    ! I6 d4 M7 k8 M- u# ustatic int compute=0,waitio=0,change=0;
    % E* i9 {% O$ l, U5 U7 \+ X! K; Istatic int computeLast=0,waitioLast=0,changeLast=0;
    4 g6 h2 f; z# m% O" T- Vint i=0;% ?- _( C9 e' O
    if(draw==1)
    . B3 _5 e" q' l% o* c{
    1 V4 T. S' \: B' G* {" l1 ^//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    ( ?9 K! G3 W9 M* J$ ]drawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);& N: G" U& V. @( D" R# i
    computeLast=compute;
    , R; P: P# m+ Z; w$ Q4 {0 SwaitioLast=waitio;/ |$ v' m) k) |+ g
    changeLast=change;3 _6 P+ Q. }  X- t. R. s5 Y% j( T# I
    }
    * Y1 `2 H8 @0 A+ h7 J5 d. u5 Tif((* memory).p[0].flag==ready)) A9 ^8 i( O, O; X
    (* memory).p[0].flag=computing;
    6 e7 u4 l! f; _( o% t6 oif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)3 B4 Q# n8 C1 `  ^1 k
    {
    ! v. Q2 [- X  ^! l: h* Y5 yi=(*memory).p[0].computeNum;
    # D/ Z/ h: s5 z: Gif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed, V4 Z- |0 I6 k# j& X
    {; y7 W) [$ p2 ^: ?3 P+ c1 ?
    (*memory).p[0].flag=IO_waiting;" q# C2 h2 M2 a
    (*memory).p[0].computeNum--;4 E( m7 `1 P4 q! r# y: p; O* H/ }
    change += exchange_IO_Compute;/ Q* ^$ F9 c- n# R6 Y; X
    compute++;# W& o" h! P) s1 E" a! J- s* \$ e- u
    }
    % C2 P2 s% ~) W! I) M: ielse9 ~( n( ^  g0 G5 R) D& M( `0 S$ v
    {( l; i  M. R2 W$ @5 s2 L
    compute++;
    $ h8 W* h8 l4 U* l1 J}( ~( _! z. B; B/ [) V3 p
    }- z6 Q7 L- l" y# ~
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    ! @7 |! Q7 y( P9 U( o, d{
    % b$ _2 a% F* s; R) U/ ~* \
    $ c; `$ I" W5 B2 f6 ~0 G6 oi=(*memory).p[0].ioNum;
    * D. X5 N& H; i# i$ [; |' A" f; Pif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    ) d# e! V1 \( [2 J{
    9 F8 Y" _" u6 G; a3 m! S/ U% K# k(*memory).p[0].flag=computing;
    2 W8 t- a' i8 P/ J( W0 R' z( B+ G(*memory).p[0].ioNum--;
    ( V; R: u  H5 t$ ]8 Wchange += exchange_IO_Compute;- l& g, w; p8 x- }2 t! n4 M
    waitio++;6 L* n  ~$ H+ W
    }' S$ Q- u' M. C4 y; u5 q
    else
    6 c. B$ ~# ^" d{# f3 n4 f- I2 Q! P" ?
    waitio++;
    ) b0 T+ m* Q- G) V6 x  ~}
    " q0 q: ^; i% d; n}
    + _4 C) Z7 L' q4 o' X) Selse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    # @! P7 T& E$ p/ `7 e1 \* O{+ b4 A4 N* O  {" H' I
    (* memory).p[0].flag=IO_waiting;2 I, \4 [6 q: v1 s; G7 S# S
    change += exchange_IO_Compute;
    / G1 c: o. s- f' ?}/ u, j2 q+ d$ ]* e) p
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    ; y! @  s5 H' i* }4 a$ b( {, Y7 t4 x{
    ; @5 U3 s. ]9 w& X7 O" ?  o(* memory).p[0].flag=computing;0 F$ m" {6 ?- a' ]- |4 @. f! l* d
    change += exchange_IO_Compute;, o! s4 X8 N$ A; [
    }
    : Q3 r& t6 U5 @# }if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成( b  }: [7 [* p: V
    {/ h) L$ }. X' t  i6 y/ u( I
    (*save) = (PCI*)malloc(sizeof(PCI));1 r+ m2 f- K# P, C' o
    (*save)->next = NULL;% a2 O$ N( D, ]
    (*save)->processID = (*memory).p[0].processID;
    ! H2 H: n0 o4 n: v6 o5 y(*save)->comeingTime = (*memory).p[0].produceTime;2 p- @& @; i0 G3 v2 _  F0 Z
    (*save)->askMemory = (*memory).p[0].askMemory;
    3 S9 f0 M! w( W8 l8 @! ?& s(*save)->compute = compute;) R; k& B( Q1 I7 D
    (*save)->waitio = waitio;
    0 y& m9 |6 K- {+ b2 W(*save)->exchange = change;
    3 Q4 _) ?3 j7 C9 {% P2 p(*save)->completedTime = systemClock;$ c1 [/ d' Z3 ~7 r4 Z% p
    (*save)->runningTime = (*memory).p[0].runningTime;
    - j+ {: h3 R7 u/ A  `- [" n1 C*spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;
    1 j4 n* h0 h1 P+ c7 D1 mcompute=waitio=change=0;
    + d" w  W6 H- CcomputeLast=waitioLast=changeLast=0;1 s( {+ W8 f7 P; q1 U" J2 `
    High_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);
    ) O8 P# `- q( a$ F7 T/ gchange += exchange_process;
    & e2 B& n8 T4 q$ k& hreturn task_completed;
    * X8 y/ g! c4 j! H9 S}+ S; C0 {- Q& M
    else
    + j* k; U( q* \' E; S/ {return task_not_completed;
    4 q- c% V( w9 c1 Y1 R; U/ b1 o: c}/ r2 ]' c# F5 d* j' s/ p
    int High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch)
    ! h& |3 J5 \% s( T2 n/ j{
    1 r. h/ v+ t# a$ K% [static int waitTime[initProcessNum],i=0,j=0;
    ( m( v: I  N! x) a3 ~static double HR_ratio[initProcessNum];
    4 S4 W8 K9 _/ E: Z& bif(flag==0)                    //初始化数组
    # A; U0 c: ~  Q, {{
    . j+ {; c. R5 k, G; p$ v& pfor(i=0; i<initProcessNum; i++)& S7 X) o' M) ?3 G6 h, t7 k
    {, {7 T8 A0 Y# X# A) W/ z; w  a. d) K
    waitTime=0;+ I! I. Z, ]. `/ t" z
    HR_ratio=1;- U7 F) t4 x" _# U
    }; W0 Q! K1 ~) x0 t
    }
    * m) P% L8 d# f" L0 Z. K0 Pfor(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比9 _# W/ G7 ^( _* H4 A  d: A
    {
    1 v4 x# k( d9 d. CwaitTime++;5 |4 n; t' ~! ?- l; @% W
    HR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);5 _3 ^- J/ U! T5 _; X7 z8 h
    if(HR_ratio > HR_ratio[j])
    & a( {  N: Y& V3 a8 a4 \% lj = i;
    ) K% Z# P, X' H. N}/ C8 j# Y9 r/ Y
    if(dispatch==1)                    //需要调度一个进程到内存中执行; }% m  E* F6 ~. O5 i
    {
    2 O" S& d- e) y6 B: J$ Eif((*storage).p[j].askMemory < *spareMemory)* i2 ?+ |* k) b
    {
    1 c' \3 s  `* f1 {' C% H3 v, y4 q(*memory).p[0].askMemory = (*storage).p[j].askMemory;9 B2 _+ b7 V, P- E9 y4 e
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;1 Q7 N& n' r* D" j- l1 j/ a5 E" B
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;6 q4 ^8 K: C/ J
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
      H- Q! r7 ~+ B% w# E(*memory).p[0].processID = (*storage).p[j].processID;5 S7 e3 l2 Y: s: S' S' T: \
    (*memory).p[0].flag = (*storage).p[j].flag;
    9 n9 {, k& F9 t' V# z- h( w(*memory).p[0].ioTime = (*storage).p[j].ioTime;
    ( i+ _8 v- }, ^* y(*memory).p[0].computeTime = (*storage).p[j].computeTime;: {% z6 y, k& V
    (*memory).p[0].runningTime = systemClock;
    + _3 Z3 g. d9 F# e* u: m- G3 W(*memory).p[0].produceTime = (*storage).p[j].produceTime;3 q$ b5 |2 {* L& ^9 G
    for(i=0; i<(*memory).p[0].ioNum; i++)  ^3 x) j' i# O& W3 Y$ ^
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;) H  h! |) Q3 s, S' h& `! Q) X
    for(i=0; i<(*memory).p[0].computeNum; i++)
    $ L$ B0 `. R& C9 u& }(*memory).p[0].computeClock = (*storage).p[j].computeClock;8 `4 O& {+ A$ w7 Q
    (*memory).proNum=1;
    / u5 {4 b+ H& [1 u/ m$ C! ^*spareMemory = *spareMemory - (*memory).p[j].askMemory;) o  [# G3 w! o: V, ~  t+ T
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程" E5 o' R. |' O% ]
    (*storage).p[j].produceTime = systemClock;
    . ]0 [* e4 ^1 Q3 Z' ]MAX_COMING_TIME = (*storage).p[j].comeingTime;6 z$ X5 _8 N$ Y8 L/ ~
    waitTime[j] = 0;
    * x* ]- S4 ~0 r% h1 l: THR_ratio[j] = 1;  O- z4 L0 h0 [$ C) q" p1 i
    }; ?; `" K( u5 q1 j9 w$ T+ s) O
    else9 C! {' E5 t% ^7 W1 w, B
    {
    % L% }$ h, S# e  B1 nprintf("A process ask for a memory overed the system capacity\n ");
    0 \1 t4 t1 T* S# n) x7 o2 ?exit(1);8 Q% v0 l% v+ Y& o; X/ }
    }, |$ N# v% i; g+ Z4 K! e& l
    }" X& ~, S" g5 u# k. w
    return 0;
    + c5 o! }& G2 h0 X  E}
    * }# Y/ b2 O, j( `  Eint PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)& t0 {5 N0 d. ?/ i  i' I
    {& Z  o5 V9 P/ Q4 `
    static int compute=0,waitio=0,change=0;
    $ [1 f* p7 D! {7 K: b* m# Hstatic int computeLast=0,waitioLast=0,changeLast=0;1 \: o, E, V3 G) N. x  K+ X/ }4 M
    int i=0;
    5 u9 K8 a- Q0 X. hif(draw==1); g3 S" _3 `" P! B& B, I
    {
    5 r, f4 n$ p: G! M% I% x! k//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    : {1 I" V  t) l1 V# ^drawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);% L' l; H6 Y/ {0 [; M8 c! x; J' D
    ; x3 j- _+ a  y% ^
    , |, ?7 k% T' ?7 m( ?( l
    computeLast=compute;
    ; f) E& ?4 A! ^" bwaitioLast=waitio;" J8 s! W" j+ z% M! X1 x3 H4 n  ]8 |0 K
    changeLast=change;( h+ [" E- v- |: z9 ~
    }6 X, C3 G! T% x
    if((* memory).p[0].flag==ready)
    , m$ e0 e* j+ _- g(* memory).p[0].flag=computing;: T% j: p4 l7 E; z2 A  g7 s
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    7 k( A' T* W- ?7 ?{8 K0 N1 b- s! w0 l! z. u' U7 G
    i=(*memory).p[0].computeNum;3 ?* _8 W# X. g/ f2 m% x( @
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed3 c8 x0 b' Z; H0 w/ a
    {
    8 Y# A3 `! q0 ^: O3 m; K7 @3 \(*memory).p[0].flag=IO_waiting;
    5 Q  r# D( `/ B) B: E  ]  N(*memory).p[0].computeNum--;7 S4 I' J/ g; F1 U: L1 Y
    change += exchange_IO_Compute;* ~# i4 l6 N+ X! M  G
    compute++;
    & U+ m8 |$ h9 y( c5 p5 k- Z}
    # ?1 L* N2 j3 [  C' celse
    ' T8 K9 {4 c# X: V& w) i% g: T4 K{
    - R- B+ R  i- D* S% m8 J/ Y- }! u8 pcompute++;; J" T$ G4 }( {* j( r- H
    }4 c2 V1 Z* U. j; W" {6 W
    }
    / z) x) ?, G1 [1 zelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)5 {# y7 k1 c; X8 a0 z
    {
    5 F( C2 |' S  Y- Y
    4 W) S' ?1 O7 X( A" g) t4 Ci=(*memory).p[0].ioNum;
    1 z; \; ]; ~$ ^' g  \& Aif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed+ s7 b4 w7 c; e: g
    {; ~6 C  _, Y2 e0 e, \- b1 D' I$ O
    (*memory).p[0].flag=computing;
    # u; P9 ]( H9 J(*memory).p[0].ioNum--;5 _+ \( W. ]8 N) V
    change += exchange_IO_Compute;
      I3 L4 I, g; C. J9 V& Pwaitio++;2 d/ _1 {/ v" ~  q6 O; d: ?7 {$ \
    }$ a9 W0 B4 F" R) w7 O( k7 e, ?4 u+ _
    else
      E" \: d1 z3 w; S: a{, L" j9 C- Y$ M7 d
    waitio++;6 G4 b& L$ K7 e& ?' G
    }2 N5 Y( L1 q2 W* ]5 Q
    }- m5 f& \4 ]! J) G( B2 i
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    % P6 H0 N1 c& t" T{
    # X3 \8 k) B8 V: R(* memory).p[0].flag=IO_waiting;
    1 ?1 t! T% T: M: F0 ^change += exchange_IO_Compute;9 J! g' g. `; [) |
    }  J. c5 E. a$ A9 |7 ~; p& f8 L
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)1 `2 ^8 n; V5 c# w2 U) q
    {
    0 `4 U& i+ i* `(* memory).p[0].flag=computing;
    & B( }' w% m5 @$ ^change += exchange_IO_Compute;3 v4 ]. M" K( e3 x4 k- @# _
    }
    2 n( s3 u- T! i) vif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    9 r( i/ H/ N- p7 t{9 P  R4 Q- t7 P* m9 ~; {
    (*save) = (PCI*)malloc(sizeof(PCI));
    : L' K2 a* r" \: d' a4 D4 k6 c& z(*save)->next = NULL;
    5 D0 \2 |6 R1 d7 ~& A(*save)->processID = (*memory).p[0].processID;) k# G# s# S* I6 j$ w3 K" G8 T
    (*save)->comeingTime = (*memory).p[0].produceTime;5 z2 _5 Q2 `, P0 l6 Z& D# n5 z
    (*save)->askMemory = (*memory).p[0].askMemory;0 _% u7 j" F4 V
    (*save)->compute = compute;6 ^# Q5 @. `# W4 e; a
    (*save)->waitio = waitio;
    ' E: O* Y2 k& \1 _) T- Z* W(*save)->exchange = change;- ]; J. ?( `, x5 F
    (*save)->completedTime = systemClock;/ V& T6 s( ]+ Z
    (*save)->runningTime = (*memory).p[0].runningTime;
    % d5 p8 Y" f2 T5 |  j7 V1 r*spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;
    " F- y# ^8 |- {* Z+ a- B* }. Scompute=waitio=change=0;+ P" ~/ X( p' V
    computeLast=waitioLast=changeLast=0;
    2 U0 `# n" V/ b3 u6 BPriority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));
    2 E: v1 N" v' y+ bchange += exchange_process;
    8 h, u0 `0 g3 W, Y8 areturn task_completed;
    0 ?' U8 x' w7 H: {}5 u# C1 N. r' |; b
    else
    - `; I6 G1 ]1 Q) ureturn task_not_completed;
    : V* h. [. U; _+ @* e: O5 b, M}1 A1 X; u  ~& a* i; k: Z# W4 b6 s, q
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)
    3 F. c3 j) V) u+ b% p$ Y{
    ! F/ R8 c5 H3 j  U- lint priorityNum[initProcessNum],i=0,j=0;8 r3 f. Y+ a0 u
    double temp=0;
    1 O0 s. t+ `" K- {. H& Xfor(i=0; i<(*storage).proNum; i++)    // setting priority to each process9 ^6 x# Q6 }/ K$ |
    {! G( W7 T6 Q; o
    temp = (*storage).p.computeTime/(*storage).p.ioTime;, h9 {9 S0 Y) y
    if(temp > 0.8)
    ! h, c$ T  J$ }) i) M& W8 g4 m" tpriorityNum = 6;
    - _! o1 g  R4 k/ ^- melse if(temp > 0.7)
    ) k" e( G" y; F9 y+ {/ epriorityNum = 5;# f" l" l. f5 E
    else if(temp > 0.6)
    4 v  g; W: `; v0 ^) }# J. kpriorityNum = 4;
    $ b: G9 p8 B3 m! d) @else if(temp > 0.5)8 a/ R2 w8 l  b0 f! V: c
    priorityNum = 3;
    + ]. E0 v) U4 E  |else if(temp > 0.4)
    / y( a+ G% b" r" upriorityNum = 2;% R% D( M; E) J
    else
    " f" K- }0 K6 Q4 l9 y$ @8 f7 ypriorityNum = 1;& [( `3 s3 P# ?* [. Z! F# b
    if(priorityNum[j] < priorityNum)% t- S) V% j/ b
    j = i;: v( s# d. P; g6 x) u1 V& l
    }1 Y$ Z7 H, P9 c1 ^& M" H: a* r% _
    if((*storage).p[j].askMemory < *spareMemory)
    6 y( L9 `  s$ y- R. `0 \{$ c3 L: B' d! m% O2 @8 F+ i5 q
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;
    ( M* R: M5 T4 G/ e(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    0 q3 M, T# r1 _) z2 [+ X9 S& j(*memory).p[0].computeNum = (*storage).p[j].computeNum;  ?. x5 L' \$ |" n4 L
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
    2 E4 H# ?- u+ }+ h# ?- X( Y(*memory).p[0].processID = (*storage).p[j].processID;7 t# Z1 l" d  b& n
    (*memory).p[0].flag = (*storage).p[j].flag;& q$ R3 o( _8 t4 q/ _, F' y, v6 M& {
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;+ D0 A  G+ v+ h, N
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;* d: B4 e4 c, \2 g4 V
    (*memory).p[0].runningTime = systemClock;; a) q6 _  n" Q- G3 B
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;  Y, n3 T' _' I9 z! y/ M. W
    for(i=0; i<(*memory).p[0].ioNum; i++). W$ [& _) Z+ s  }8 p/ o: x
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;
    , m1 W5 H/ D1 H6 l& mfor(i=0; i<(*memory).p[0].computeNum; i++); T0 R, `1 k: c0 s& ?6 [
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;) B# D1 F0 U$ D4 V. z
    (*memory).proNum=1;
    7 O% A, t/ r* T% F1 V) {8 ~7 P*spareMemory = *spareMemory - (*memory).p[j].askMemory;
    6 z, D, B! {& w/ [0 c2 _produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    : N2 l. j+ u! U3 q5 xMAX_COMING_TIME = (*storage).p[j].comeingTime;
    . N. @: R  e; e- k}; ]8 p1 S# F9 Z( k/ }& t2 C, ]
    else; ?0 \% h( v/ b
    {
    ( C% w1 d/ t) N8 E% j  w3 S8 Zprintf("A process ask for a memory overed the system capacity\n ");/ {! b: G! n" t2 o2 X
    exit(1);
    $ Y: M. S! g2 ]2 P5 q) _+ k}4 ]! p4 ^2 T, n# ]* [- k
    return 0;
    : s8 G+ F7 L: K3 b5 R}
    2 e$ k, o+ r, \) t0 `( A6 qint ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    - `5 N. M% `+ v4 Z{
    2 w. j! }% _, {& y5 J* |static int compute=0,waitio=0,change=0;8 M% R# s7 F0 `# J, m6 x
    static int computeLast=0,waitioLast=0,changeLast=0;9 o' M$ K2 O. J
    int i=0;
    1 N+ P! D4 c+ O7 C* v0 Q, c  iif(draw==1), h+ A# Y8 I, Z! H
    {" P) B$ r% t! _) S
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);+ |  P& G( R3 E* }! W" w5 P6 G
    drawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    , a$ ^2 o2 X& Q8 K( S' |
    2 E/ m" G7 k$ J; R, ^4 ^: W. x. M9 M: o3 q2 A9 ~
    computeLast=compute;6 E6 Y. K  p& a/ j# Y
    waitioLast=waitio;1 F* i% f3 t5 @6 {9 l+ ~
    changeLast=change;/ ^8 w+ t1 i0 {* }' c8 \
    }0 e" e8 Q# ?& n& I+ \- y
    if((* memory).p[0].flag==ready)
    & o$ W. X# k5 |(* memory).p[0].flag=computing;
    & c& ^( Q( @! s  Cif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)% Q( G, y9 p2 d, Q; k
    {* t& }# T- \+ Y& N
    i=(*memory).p[0].computeNum;
    ; Q! ?) F) b( T$ Lif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed& p' f( a/ Y7 N: E' [
    {
    : @" P! ^/ F8 }3 \. t(*memory).p[0].flag=IO_waiting;
    7 q8 R# H  s7 Y) }. C* I# f(*memory).p[0].computeNum--;
    8 B" P, `5 e% N' c$ @1 R' _( H) S. Hchange += exchange_IO_Compute;% c& k2 v9 t# Z  z
    compute++;- v6 z  F% J3 W9 w2 `
    }
    / G) l, {1 X) ^9 gelse
      h" Y7 Z! D6 B{* O" g! h, q( m' t2 m' M
    compute++;
    ' _" ]: E% r; O# u8 x0 Z( `}
    3 F6 P0 q( G+ l$ j1 W  i; X}
    / n' l5 Y: ~& @) ?3 X$ j& Helse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)+ m0 l7 {- S# b* X. J- U
    {8 n* n! y" i+ {5 p; I

    ; K/ U# H8 `. `% v4 d3 Ii=(*memory).p[0].ioNum;$ u2 K: a$ e6 N8 O6 c
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed" ?- M# f' k( v0 c
    {8 m, J! o6 j5 R+ S
    (*memory).p[0].flag=computing;
    7 z& }' O" `1 W+ t/ i* b0 |2 F(*memory).p[0].ioNum--;" ?) v8 }! J" S# ~6 G; `) D( e
    change += exchange_IO_Compute;) W! Z1 r8 k  k( E2 E9 f+ ~$ Y
    waitio++;
    # z) R2 v% o6 \: D}6 [& d5 d+ j/ o+ c0 q  {- x
    else9 \7 `" b; Y2 T; r3 j
    {
    % X& ?" Q' ^" T" u) Z7 Z9 nwaitio++;3 E  h5 \; l9 `% q
    }
    $ S  |$ \9 i3 F3 B7 J}
    0 K# l# ^/ p- C  t/ Velse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    ; R; `- e2 n$ e{
    & K  w) z4 Q8 Y: c0 p(* memory).p[0].flag=IO_waiting;
    : I/ m; ?( `6 l. T! {+ H5 Qchange += exchange_IO_Compute;. P6 d8 }4 `( T! o; e
    }5 M$ U6 t, F5 G$ \( i+ F% P
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
      Q/ |, \# a- {. h{
    : o" }# I3 Z8 j7 z9 R(* memory).p[0].flag=computing;
    , a* j  c. l7 }6 ~5 P& _change += exchange_IO_Compute;
    1 v! z* `0 X) ?$ X0 f" m2 s}
    : T: v) M1 v' v# x' k0 Qif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    7 u* c" W3 ?( `{+ ~* r7 |6 r# N# n% i0 {: j' e
    (*save) = (PCI*)malloc(sizeof(PCI));
    ( @9 @/ _. e  \: p& P1 t8 {: O. [(*save)->next = NULL;
    8 V9 C" Q3 G0 G- W(*save)->processID = (*memory).p[0].processID;# D6 w& T3 S( g5 J, K7 t2 F9 e
    (*save)->comeingTime = (*memory).p[0].produceTime;
    1 D/ X% t3 w9 d6 b) Z3 A2 Z4 L4 Z(*save)->askMemory = (*memory).p[0].askMemory;1 b) o$ j, u7 Y- n  ~3 G
    (*save)->compute = compute;
    8 I" d: ?% v, }  S- f$ ~/ z(*save)->waitio = waitio;5 o: ?9 v% ~! E: x7 t/ b  N
    (*save)->exchange = change;
    * _! J7 v* o% D4 |: \(*save)->completedTime = systemClock;) c8 m% f/ m! _$ C* Z
    (*save)->runningTime = (*memory).p[0].runningTime;
    4 w2 c+ ^  V3 P3 s*spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;
    0 c- d7 H# D7 zcompute=waitio=change=0;
    ) v& l+ b. G9 J, O, d) qcomputeLast=waitioLast=changeLast=0;0 L& i0 z- s* |: T* F
    SJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));/ N0 F$ [  Q& {/ B0 j: C
    change += exchange_process;
    - \* |: {  E/ _; Y$ z+ K# \* Z- r! U8 vreturn task_completed;  S& \, e% @, D0 f$ B
    }
    * {0 n5 q5 k+ \$ Selse& B2 ~1 T4 W& j5 \( n6 O
    return task_not_completed;; g* k! U, m4 f2 H/ y* x- V0 q
    }
    0 S8 w/ U5 ~5 y/ X# z" ?. J8 P1 qint SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)
    ) G# T2 Y8 f0 m0 H7 n0 ]' l# d: B{
    6 u0 _1 _5 `0 H2 n/ Bint i=0,j=0;
    ! m5 w; Z; X) O- m! ]for(i=1; i<(*storage).proNum; i++)
    ; u) q* s: |/ O0 T) F4 H{, y. F, l: ~. M6 j
    if(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime))
    " W( ?2 f+ t( _/ q' v4 M6 Vj=i;
    9 S& ?8 V" y! B$ E6 H3 V}
    : O6 R! G6 D. Z$ r: Wif((*storage).p[j].askMemory > *spareMemory)+ I# b% ]9 ?+ ]6 t3 z/ P; t: h
    {
      a9 u: d7 }3 h& q5 p( _( vprintf("The memory asked is overflowed than the system memory.\n");
    8 o- c+ D; D/ c  _' m, Qexit(0);- i0 P- L# O+ \$ o
    }
    * z: w8 i! N0 _2 C7 G" g% J: |( Ielse- J% {2 l/ ^  c7 L
    {  U# K0 w$ |. V* @' V# q8 d' G
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;
    % k) T; N) J, Q% f' C! j1 R(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    5 A, I, R% C/ t(*memory).p[0].computeNum = (*storage).p[j].computeNum;. h6 q! M" ~+ ^
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;' ^' a+ S( E% M" {, t4 w1 p
    (*memory).p[0].processID = (*storage).p[j].processID;/ M3 x- x$ S; o: Z% u! f
    (*memory).p[0].flag = (*storage).p[j].flag;* C4 \, D  k* O+ B1 A+ {! |6 s9 c
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;
    8 ?; M" A) P) c: @/ h. y(*memory).p[0].computeTime = (*storage).p[j].computeTime;' l& f4 W1 T9 P  _5 A  M
    (*memory).p[0].runningTime = systemClock;0 y/ p, [9 q+ C! E6 M3 x
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;  I4 E( w6 Y0 h7 q
    for(i=0; i<(*memory).p[0].ioNum; i++)4 n3 I. B0 f; k3 q$ j
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;8 e4 X2 ~) y& B1 u# |
    for(i=0; i<(*memory).p[0].computeNum; i++)  {. ?% a) o& ]( r2 J
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    - L& T5 M% V4 M" ]2 ]  t(*memory).proNum=1;- Y; D. A: V0 g
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;& x. w3 _0 ^  N
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程- U7 r5 `' H1 c1 r- H& L
    MAX_COMING_TIME = (*storage).p[j].comeingTime;5 l! g0 D: N3 c5 ~1 k! O
    }
    # B( ^# w/ v, x; l) yreturn 0;
    9 @9 O( P8 h6 K5 E4 d- u& l$ }}+ U3 n, X  F; o- W
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)8 M0 ^9 @1 z$ \% O" H0 B& ^
    {
    8 R: X. r) i; T. n- Lstatic int compute=0,waitio=0,change=0,clockSegment=100,poi=0;
    1 G7 f8 t' ]6 {# t, I/ p5 vstatic int computeLast=0,waitioLast=0,changeLast=0;( Q4 X: r2 A9 {3 P# a
    int i=0,j=0,k=0;
    - E* ?8 ~/ F1 Fif((*memory).proNum<=0)
    4 F4 g: P  I2 GTimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);3 k& a7 i, ]0 m' W
    if(draw==1)
    % m. I+ I3 w7 O& V! j{( p0 I/ r) R3 F6 Z7 b' e) j3 O) z
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);# F) D6 d1 N" V" u4 o* G4 }3 B
    drawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);+ h& t/ A# L9 k* v( n9 P
    ) d. I0 J& f. H: h
    7 i5 m: D+ }" ?1 U) `/ c( L) ]
    computeLast=compute;
    3 d" ^/ n0 L( M) p7 _& `waitioLast=waitio;
    - O) g& i+ J& S4 xchangeLast=change;
    - K( {* W. ?& @( F4 l}
    1 H  T  C- |+ |4 K7 D, N0 [- fif(poi>=(* memory).proNum)
    8 g- Q+ d. z& Wpoi = 0;
    $ d6 [  z$ u( m  u4 V" s6 X% {if((* memory).p[poi].flag==ready)
    $ [; a" |+ Y' D" Y(* memory).p[poi].flag=computing;
    , R# x3 z% v% \# N% L3 W, Bif((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing)
    * m" h* R, e7 D- y{
    # p5 V* G6 b& q% [% {' f5 Ri=(*memory).p[poi].computeNum;
    ' J; W9 |; q1 p3 ]0 C7 q5 C# ~8 Uif(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed0 C! G1 c0 Z% k- t
    {
    # {7 O/ B& s$ {: ]1 m/ U9 K; V9 _(*memory).p[poi].flag=IO_waiting;9 ^8 ]9 ?+ k2 H) \
    (*memory).p[poi].computeNum--;8 p, B! ?3 x8 b. q+ j
    change += exchange_IO_Compute;9 b: U5 {; j% h2 w, g
    compute++;
      y% k/ g% c; i6 K' z/ M# B5 k( K}
    # A4 J9 p+ [& [2 `8 P0 Gelse
    ' H& O6 i7 H% r# {; c{5 y2 x- D2 ~* {7 C0 @1 a- }' \
    compute++;% u9 S9 h3 L3 _, `
    }2 v: [3 ?' T/ O1 Y. H
    }' \" u' ~$ q* I" F* [0 v8 i) C) r
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)
    # ~7 ?% V9 N6 e  U- y# @1 ]* _{5 E& \9 _" E9 M, o  O2 N& a5 a
    4 j7 [6 ]; k7 R( s6 m
    i=(*memory).p[poi].ioNum;
    2 R' z! a3 L0 ^, eif(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed
    % K. V3 [3 f2 m! B8 G+ z+ w7 u{6 B" i1 W/ U9 y- x
    (*memory).p[poi].flag=computing;
    * j$ v2 j( R2 M5 b3 b' Q/ H7 w(*memory).p[poi].ioNum--;. \: t- B6 W* f2 M( [
    change += exchange_IO_Compute;
    2 ]9 k: a! p: C8 n4 m/ {' s7 [waitio++;( Z8 z4 |8 \$ v) J0 [) R3 Z" M
    }  j( i3 G6 r2 J* c% D
    else
    2 _, }% N" a, j8 v8 w) N% T& p% x{( a9 [% N6 R& d6 E& T2 h$ _: Y* D6 B
    waitio++;
    + C# F1 S3 H7 r. [}8 l- R/ F4 P, c1 }6 g% z
    }+ A0 I7 }! o0 q$ E4 [6 P( w
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)
    : c; M, [# `; \7 Z" q! c{
    # y/ @, a. q/ u* T, o$ A6 s, i(* memory).p[poi].flag=IO_waiting;
    8 O5 d3 h! M9 @9 W% nchange += exchange_IO_Compute;
    8 _% ~' E; ~2 ~- e2 z( R6 L" J}  ]' W5 a. ]/ X
    else if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting)
    3 ]1 V/ [8 X) A{8 p9 ~0 J: \& Z  C6 |! D
    (* memory).p[poi].flag=computing;5 E# a' M6 G2 `) z
    change += exchange_IO_Compute;( D0 a: U$ G  A4 z+ m
    }
    9 ^1 U2 Y; ^% V: |for(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进+ ]4 j% A3 a, {1 S( G3 \+ y% E" i
    {
    4 \4 ?) ^8 }8 Z% \7 p4 N- H6 zif(i!=poi && (*memory).p.flag==IO_waiting)2 C( h1 f/ R5 p, ~2 p7 [
    {, }4 v( ~4 f, K, p1 Q+ G
    j=(*memory).p.ioNum;+ d9 S3 [4 j8 }
    if(j>0)1 p1 J! z* R4 Q( p
    {
    0 C: T! u+ c" d6 |" z( ~' m2 Hif(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed
    ' o" ~7 K: ~' p) [, \4 j# u{: D4 O: S6 o3 ]" x
    (*memory).p.flag=computing;: k# h$ D; m# S8 c
    (*memory).p.ioNum--;. I- t! ~: A2 E. x0 A
    change += exchange_IO_Compute;
    + y" ]1 l/ I9 v. O% i8 K}
    7 m  |2 |7 h& l9 h}1 V3 r' ~, ^3 w  W' e% W! j
    }9 t8 O( l/ ~& a
    }+ |  \* M# k" @( f
    for(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程- z6 |0 Y1 g; Q* z# Z
    {8 {. a8 ]- S; a  ^# z9 Z& s- s
    if((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed, n. b0 w2 V, H1 D( ?
    {
    # k# t7 P/ [3 m3 c- u(*save) = (PCI*)malloc(sizeof(PCI));
    7 Q7 L& b7 m' [/ U/ M& B9 q& U(*save)->next = NULL;
    3 G- e5 n* Y4 Q- e6 H       (*save)->processID = (*memory).p.processID;( L2 ]- z( r: K  ^
    (*save)->comeingTime = (*memory).p.produceTime;! Q* `0 @! f- N' Q1 y0 x# E
    (*save)->askMemory = (*memory).p.askMemory;
    4 T8 o. j% B, `7 d8 I( Z* Q) K$ S(*save)->compute = compute;" J1 _* F  }2 M1 {2 g
    (*save)->waitio = waitio;; l3 O3 Z7 x2 t
    (*save)->exchange = change;4 [$ H- B) I: w# Q# g4 u5 y& o
    (*save)->completedTime = systemClock-(*save)->comeingTime;
    1 l/ h( e  p! h7 Y3 I(*save)->runningTime = (*memory).p.runningTime;
    2 K6 R. w4 Q3 y# p  ](*save)->completedTime = systemClock;
    6 S5 V5 M1 v( N: q  o% g% V*spareMemory = *spareMemory + (*memory).p.askMemory;
    / X7 G2 K% C2 q" c2 mcompute=waitio=change=0;  ?& r7 I% W  }$ p% u9 M5 ^
    computeLast=waitioLast=changeLast=0;
    3 s4 s1 ?' N5 g+ q6 T( J6 O: eif(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入
    ! l+ p. t9 Z' g. G; I/ U7 a; P{
    " n; w2 u6 t( G1 Y' P: Dif(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程
    5 C4 n& i( m! t# {( i{7 ^- V8 N5 J6 J2 I
    poi++;
    % ]3 e' q/ Y- z$ O6 @1 m  }   clockSegment=2000;
    ; r; n& k3 t5 g4 P# ^) A5 q+ B0 T3 _}
    5 j$ D1 X7 O/ T( H}
    " Z" {5 S9 |! C: y! _5 V. velse  //没有足够内存调入新进程
    . _5 e9 x1 N  {( f6 r1 R{7 U( ]  L" @  w9 w+ Z" N' k$ ]
    if(i < (*memory).proNum-1); @3 ?( h; R5 }( }/ F# x
    {
    - \; H4 a1 d0 c6 hfor(j=i; j+1<(*memory).proNum; j++)
    ( ~" @) {" j  K7 E) Q{. Q  C# p; K6 q
    (*memory).p[j].askMemory = (*memory).p[j+1].askMemory;& J, S9 Q6 W9 C) ?+ b. h$ M( a) ^
    (*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;
    0 c: z( F: \) |. `8 N* `: g(*memory).p[j].computeNum = (*memory).p[j+1].computeNum;
    % i" B+ K) G* }5 J3 c(*memory).p[j].ioNum = (*memory).p[j+1].ioNum;
    - T" K  d! _( T( G5 O* q(*memory).p[j].processID = (*memory).p[j+1].processID;
    8 r5 r, l, f! h* v(*memory).p[j].flag = (*memory).p[j+1].flag;
    " O, Z: k6 p, c2 W( S/ r(*memory).p[j].ioTime = (*memory).p[j+1].ioTime;
    / n) c' o; O/ r; e- m  F  q(*memory).p[j].computeTime = (*memory).p[j+1].computeTime;5 W, L; E. H6 I* A* U3 S
    (*memory).p[j].runningTime = (*memory).p[j+1].runningTime;' ~2 W4 w1 B; c4 e) z) z' g9 V- g5 a
    (*memory).p[j].produceTime = (*memory).p[j+1].produceTime;
    0 r+ Z' g3 }4 k$ M: D2 [9 o/ t(*memory).p[j].completedTime = (*memory).p[j+1].completedTime;8 \# K1 P% f6 Z! _+ j: C
    for(k=0; k<(*memory).p[j].computeNum; k++)% i# d+ N7 v0 U8 I2 c, _* d
    (*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];
    6 |$ q% e5 V. i  b2 ofor(k=0; k<(*memory).p[j].ioNum; k++)- |- D/ @1 U; q( X( `' g
    (*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];0 m- X  k2 k3 b/ m8 v! I' h, O) U
    }
    ( {4 R- Q3 M! }) bif(i<poi)0 K/ X( u% y# `
    poi--;
    3 _  n; K5 l( u3 F5 K* oelse if(i==poi)
    0 B) W; V- ]* _% Z1 t& aclockSegment=2000;
      ]8 U1 ?" m5 N! A1 i}
    0 y5 z1 t& Q9 E$ S0 y5 _+ w. i, ci--;9 S2 ?3 p8 l0 M6 @% R! R
    (*memory).proNum--;/ M  j$ L: G, f% D6 R; H
    }& _/ Y  \$ t+ E6 b$ v- J. R2 ~
    return task_completed;# a) w' U6 u" B3 f! M5 m. I# k, ]
    }. M+ k3 p. D! ]2 _: D; w8 I+ K
    }! p% C7 B: Z. _7 T6 O3 ]0 e
    --clockSegment;
    ( ^* I5 x. h  U7 V2 Nif(clockSegment<=0)
    6 ?# {- h: H) I{
    ! {6 C% L: M3 `poi=poi+1;
    & B8 [+ f9 d3 t- M% Sif(poi>=(*memory).proNum)
    + d; s. C- D% ?5 b7 _( hpoi=0;# o  Y4 F6 k' w  u  ?
    clockSegment=100;6 Q+ p/ r2 ~& r
    }
      v$ H6 z( r9 i& }return task_not_completed;
    " x/ @! O/ Z$ o/ f}
    6 B3 `" p1 X0 S5 H$ C+ Q& iint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos)
    - z& w/ d/ y" V2 [/ X{6 a6 l7 o& U6 s1 L/ J
    int i=0,j=0,k=0,flag=0,translation=0;' M- O! X1 K; H1 J0 e; v' h
    for(i=0; i<(*storage).proNum; i++)% k8 C+ X3 o, F5 V# L
    {
    9 R, E9 C: J  ?" q& M% J# @if((*storage).p.comeingTime>MAX_COMING_TIME)
    : V. g. b* g1 I. l4 TMAX_COMING_TIME = (*storage).p.comeingTime;
    & m- R  g( H- q}1 @" b& `. s  r9 L+ j# ]: i; P" ^  X
    if(pos>=0)
    " @1 c2 a" r/ {6 V3 R! x9 O{9 @7 R1 V$ N* D2 c0 W
    for(i=0; i<(*storage).proNum; i++)
    / H1 ~$ e$ P7 P: x; m$ `$ ~; ]{8 y5 m' G0 N- A; |6 C
    if((*storage).p.askMemory <= *spareMemory)
    ; [+ e* }* _9 n& Q4 H: ?) M{  w) {! C8 {1 b) D
    j=pos;; T7 ^% y; P: y& E. B: n" N
    (*memory).p[j].askMemory = (*storage).p.askMemory;
    . x6 \1 O4 ^3 m3 O5 j(*memory).p[j].comeingTime = (*storage).p.comeingTime;
    , g. c4 g5 O& x( m5 U* J: h+ X(*memory).p[j].computeNum = (*storage).p.computeNum;. L+ I0 u; b& b$ g
    (*memory).p[j].ioNum = (*storage).p.ioNum;. M* U. \! m2 a+ @' f
    (*memory).p[j].processID = (*storage).p.processID;
    + S3 R- t  i0 O3 Q9 N(*memory).p[j].flag = (*storage).p.flag;
    - N8 b3 ]) X' r% G% p4 G# x5 R(*memory).p[j].ioTime = (*storage).p.ioTime;; |% T4 o$ g+ s! e
    (*memory).p[j].computeTime = (*storage).p.computeTime;% L; d3 k$ t# l, [! f* z  u3 g
    (*memory).p[j].runningTime = systemClock;. }+ P  g5 N" @& z2 r$ k: U
    (*memory).p[j].produceTime = (*storage).p.produceTime;
    $ X- N1 R7 x" v' A" F* wfor(k=0; k<(*memory).p[j].ioNum; k++)
    + }% E9 A/ ?$ ?& m6 C(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    ! i1 Y# ]) R" `6 d( D2 ~$ V) ?for(k=0; k<(*memory).p[j].computeNum; k++)6 d+ i0 u' I, H# Q# m) b0 z
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];8 o) M7 `  S5 [) ^2 _; B
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    & Q  a2 @# A8 Y& Iproduce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程) ~8 W' G7 t4 [6 J" m
    MAX_COMING_TIME = (*storage).p.comeingTime;
    9 J. A1 T& A! Y/ g6 ptranslation=1;
    ' O! v! [0 _$ y8 V8 gbreak;; v" {6 k) p& F% z* G8 w
    }
    + `7 i" G/ L# c5 S, C) N}
    & k* K3 j% M, e6 \6 l( S6 O: k+ I}
    # l: e1 D  q  k6 J8 qelse
    3 J1 Z  k+ l$ B{3 J4 p% O6 C% b4 n" o) X7 p
    while(1)
    / M# \) Y/ ]2 B! X0 s' z  |& p{
    / P8 }% {8 l/ s& a" B, o4 Yflag=0;* p7 S; i2 e$ u* [
    for(i=0; i<(*storage).proNum; i++)
      A7 F( j$ A8 u4 L) G{. D0 c7 ~' @9 k* B
    if((*storage).p.askMemory <= *spareMemory)
    2 [6 w5 [9 X, G. S; h* S4 b  l& b{
      b; E; d: ?$ V5 r  h9 n! Yj=(*memory).proNum;9 Z1 G) T' e5 g1 f9 k! ~/ [2 D) t3 m( j
    (*memory).p[j].askMemory = (*storage).p.askMemory;
    2 r; A+ I1 P9 w7 G- z: f7 _7 U1 m(*memory).p[j].comeingTime = (*storage).p.comeingTime;
    # d" [" h- Q' \. R* M4 l(*memory).p[j].computeNum = (*storage).p.computeNum;
    . ^, a2 L4 D2 s2 I1 i(*memory).p[j].ioNum = (*storage).p.ioNum;2 T6 Q! q# R/ U8 c) e+ D
    (*memory).p[j].processID = (*storage).p.processID;
    6 h# a9 q8 S: R(*memory).p[j].flag = (*storage).p.flag;
    6 J# y% e4 d) S1 u6 T* _(*memory).p[j].ioTime = (*storage).p.ioTime;
    2 @+ p$ ?; K2 k/ C(*memory).p[j].computeTime = (*storage).p.computeTime;
    % H. e( j/ x2 c4 R: j) A. Z(*memory).p[j].runningTime = systemClock;
    4 G" n0 }* Z2 }& p/ Z(*memory).p[j].produceTime = (*storage).p.produceTime;% P# f# F$ K/ o( t2 c: ^: {2 x
    for(k=0; k<(*memory).p[j].ioNum; k++)
    6 E$ E7 P2 {" f% s  ?3 h(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];$ [1 m. V. k( g
    for(k=0; k<(*memory).p[j].computeNum; k++)
    2 U$ `% A3 b8 h. h9 `, ^0 |( u(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];
    ' d# `7 p0 K) s) ]  E6 x(*memory).proNum++;" E. {6 Z; \- u
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    ' }+ B% N* J$ S2 v) Z3 l- B! Sproduce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    ) V0 E& U  e) M, W5 ]MAX_COMING_TIME = (*storage).p.comeingTime;7 m& a" j9 V0 g# Q& x
    flag=1;1 C8 U1 O. }' `) \1 E- X
    translation=1;
    / Q" L8 `- M" V7 s9 \}$ Q- v) v$ C7 e5 I& L( ~
    }: x) V/ O/ `+ Q( Y$ h
    if(flag == 0)8 }) y( [3 \) N5 {
    break;
    0 ]) Y9 O  q* T, T5 o}4 i+ O4 i1 h9 n, e: M# R- w
    }
    * i5 U3 F6 t: H/ ~+ ^return translation;
    / G$ `* J4 r# ]7 @2 I' o8 y}' k7 L- C( E& f- j8 L3 X2 c
    int FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)
      z6 H2 S1 |$ s( Q* [8 {" P{* R* _+ {0 I; l
    static int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;
      i% L! `: R0 }3 _; `static int computeLast=0,waitioLast=0,changeLast=0;
    % `' f+ T* T: J+ }8 L) Nint i=0;( g1 C: X( o5 E! _
    if(draw==1)6 U' G% H2 x% `; J$ `: F, {. ?
    {
    " |2 R( V# I! F//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);8 g, e, M0 T$ ^* y" V
    drawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    / q% P" a6 M& D0 `
    0 y6 l6 r% [0 E% N% W' ^0 _( o9 \! M9 f0 H  S6 c0 r9 [
    computeLast=compute;, L/ B1 ^5 Y6 z$ H0 T- c$ g8 o
    waitioLast=waitio;+ P& v! |: N3 \3 `
    changeLast=change;
    * ?* Z' _( H* |3 s% G}6 j( `# d+ c) m4 t8 _1 U
    if(flag==1)  
    . p# v) m/ [8 j0 _  \{
    . @% @5 |4 \! `1 uif((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed3 V0 L2 g4 Q" t5 ~4 p& l( Q
    {
    . J0 ^/ B- f+ r$ z( |if(flagiocpt==0)   // implement compute% Y+ r1 Q" E. N: u8 M4 o% G
    {0 O) j& W. t% c; q9 b; ~7 O
    i=(*memory).p[0].computeNum;$ @: U$ V" A) P/ \; g  Q
    if(i>0 && (*memory).p[0].computeClock[i-1]>0)4 @* b1 Q5 L4 v2 d9 z5 W& e; A
    {9 D' F  S; I! ]: g
    if(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed
    8 n( u! A* |: J: F8 G4 Y2 Q3 d% M{* T' M4 Y( Y) [' ^9 p
    flagiocpt = 1;6 K9 T) V# v2 H* w& w
    (*memory).p[0].computeNum--;! Y) ~; |- e6 N* m3 N: S+ D3 `
    change += exchange_IO_Compute;5 U+ H! Y1 B8 {0 i) h
    compute++;
    : ?1 F9 p; T8 w) H; A: e, X7 V}; C2 o( j" G, i) c2 B2 k- x
    else! B4 x6 }' q9 i; A3 f" @; Y
    compute++;
    1 a; ?3 u7 Y, l, D3 t; y
    ( e9 G4 x8 X6 W* [5 z}
    7 F1 |: I6 D: N$ q+ w; E' Gelse/ a! N# L" S" q6 D! k
    flagiocpt = 1;4 e1 h( g' s; L" i* r5 r3 H
    }
    4 L; A7 f& }! M' u( selse  //wait io: J& D1 P, u% b
    {# Q) q: ^4 X! `9 w- H% N/ W; Q& z0 ]
    i=(*memory).p[0].ioNum;
    7 K' K2 Y2 a, W! N, l: Rif(i>0 && (*memory).p[0].ioClock[i-1]>0)' f7 k1 G0 s/ |4 P
    {
    8 O8 i& x' F5 O& ~if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed7 c+ A1 h- i! c, S, Q9 z
    {
    : c- e2 L# r+ A: P" E+ Nflagiocpt = 0;
    3 \5 i4 [& T0 C(*memory).p[0].ioNum--;( n9 p4 \0 f! T, J
    change += exchange_IO_Compute;
      @' R$ K. ~& B$ B4 s4 Iwaitio++;
    $ ^% @+ q4 C, y. b- Y$ a. E1 ~: A4 m}
    ; g  |* P! j8 C" g. }4 y5 y% m/ U  ]else# k& o3 v7 o; v  N6 A  m5 ?
    waitio++;/ |! r' D$ I2 Z( S1 R" A
    7 a' M% a% R( K! u
    }# v. B/ z3 \9 R6 t* ~. J7 H3 i& j$ W
    else  v5 a; X1 `# x% k+ F
    flagiocpt = 0;
    # y, A# N8 ]6 D/ C}/ |( I. O* o# c3 h! j
    }1 j; b4 G  k( X3 t
    else  //task is completed$ e; j" z2 a* \0 c5 F! X' e3 R) }) A
    {
    , Z' n5 R+ P1 q" j1 ](*save) = (PCI*)malloc(sizeof(PCI));
    - K$ s1 D. u! a) K% @(*save)->next = NULL;
    % |  e8 r! A! {( \  u; Y       (*save)->processID = (*memory).p[0].processID;- R( z* |$ ]- E& `/ _3 s7 Y
    (*save)->comeingTime = (*memory).p[0].produceTime;  V5 ]( W0 k0 k8 o7 p. r3 M
    (*save)->askMemory = (*memory).p[0].askMemory;0 _' @+ F# N7 c
    (*save)->compute = compute;
    # a4 `, c9 m8 T7 c4 q- p4 V(*save)->waitio = waitio;+ F. |  K/ {, k0 w' _( I
    (*save)->exchange = change;
    ( B2 K/ e4 X9 m+ t3 ]5 V3 s(*save)->completedTime = systemClock-(*save)->comeingTime;
    : H0 v" L( c4 J  ?) d(*save)->runningTime = (*memory).p[0].runningTime;
    & L2 B3 u0 X3 u2 j$ \8 y2 s  v(*save)->completedTime = systemClock;- v. y2 H8 K$ s" R7 s; K
    //*spareMemory = MAX_MEMORY;  J3 i3 p" S3 `. n
    free((*memory).p[0].ioClock);
    3 ~# x0 I0 e' ~free((*memory).p[0].computeClock);
    : T; ?0 w# A' Q% lfree((*memory).p);$ W7 Z: J- C" P# c9 `
    flag=0;$ `0 j9 R) z! p: ^- c# L
    compute=waitio=change=0;( V! s1 a  G9 A* c7 r
    computeLast=waitioLast=changeLast=0;( R( D$ M! w# D) @$ L3 Y. V6 e
    return task_completed;+ R) o4 }, A( J7 d; {' T8 O" C
    }& ~$ U9 E9 Z- a; Z" |3 r' H( G
    }
    $ f: R* P; T% P! n/ K9 uelse         
    # y' `6 _+ n2 b- L& Q; y2 z, v{
    7 J- w8 S5 m. J) d! O# b/ dFIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));
    2 g# ^  E0 j. @+ s( c! tchange += exchange_process;' U4 H% t" ~- C9 @
    //*spareMemory -= (*memory).p[0].askMemory;
    " O. P  W4 p7 j- I! L; f- t  y0 pflag=1;
    ' a0 |$ @* b8 o$ c; U( t' J//showProcessInf(*memory);* H8 s/ u) {+ j3 _- ]
    return task_not_completed;: j# k. v- R8 l. j/ \
    }
    : M2 p# n1 ^* r. p6 b7 T$ xreturn task_not_completed;
    ; T. v2 N2 h2 v' G}
    6 ^7 N- a! I9 f1 v- ?6 Iint FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)
    3 s$ O4 ^: c# T8 W1 G0 s+ X{, Y" w& f; P" J  I4 A
    int i=0,j=0,k=0;
    * m; l9 H; ]8 F' lMAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;
    . }& Q) n" x1 `/ f+ J" X! T(*memory).p = (process*)malloc(initProcessNum*sizeof(process));; ~+ N4 d5 M8 G" W# L2 p
    memory->proNum = 1;4 K5 h$ k/ W$ N3 P
    for(i=0; i<initProcessNum; i++)5 T1 T. O% W# h: L5 C
    {, [# \7 \. z1 b1 F
    if((*storage).p.askMemory <= *spareMemory)
    7 Z: z5 T, s$ \) W- t{
    " w  n% @2 g, |8 |(*memory).p[0].askMemory = (*storage).p.askMemory;- Y: B# W, }  M2 M2 ~8 I* \; j
    (*memory).p[0].comeingTime = (*storage).p.comeingTime;& j& v6 s5 Y7 f; F- [
    (*memory).p[0].computeNum = (*storage).p.computeNum;# m/ p2 v7 i7 T
    (*memory).p[0].ioNum = (*storage).p.ioNum;
    ; e( W9 w- a9 A(*memory).p[0].processID = (*storage).p.processID;
    : s. L1 i0 X5 `3 I  j- |(*memory).p[0].flag = (*storage).p.flag;, s, b; {3 G+ B+ O! O! Q9 S" T! W* a
    (*memory).p[0].ioTime = (*storage).p.ioTime;
      f5 @2 j$ E7 X. T(*memory).p[0].computeTime = (*storage).p.computeTime;
    / P! J/ i7 b& ]) G4 t, d/ u2 q* L(*memory).p[0].produceTime = (*storage).p.produceTime;& q( ?0 u: |! p
    (*memory).p[0].runningTime = systemClock;$ p7 N" l! G' _! }! X8 O! }
    (*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));
    7 g" E7 x. T+ D5 j(*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));. ]8 a+ \3 k, g
    for(k=0; k<(*memory).p[0].ioNum; k++)
    7 t. t3 x- B) `# ?(*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];) F, X8 p2 ]/ v2 j
    for(k=0; k<(*memory).p[0].computeNum; k++); t+ V* u9 m6 I
    (*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];9 e: U% x7 A1 F/ ?
    break;
    7 w2 Z+ p' F; l8 ]}
    1 g) r5 @8 _9 N" Q, C( A2 D6 x$ p9 y}; L4 ^6 b/ V* P  q$ ?
    if(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入; C( w. Y* m. i6 ?* x6 _
    {
    ( V- H2 g7 T7 V2 xproduce_one_task(storage,i,ID_FIFO++);
    ( T0 H( |& z; v5 i/ BMAX_COMING_TIME = (*storage).p.comeingTime;6 M8 X: M7 X+ v& N
    sort_by_comingtime(storage,i);
    3 M8 B5 h3 x% d7 `  S8 Q}0 a  G4 n9 h, W5 A0 g
    return 0;
    8 ~7 J9 A' L! s; k7 ~* x}
    ! {1 L2 o0 E$ D6 l' f/ v# vint sort_by_comingtime(processPool * p,int pos)
    8 X+ z, h  k" {{- C3 p# m' o% B; L0 q
    int i=0,j=0;
    / R" A2 L. o# H8 }+ `. {. F, hprocess temp;7 T! Q. i8 ~& q* x" \& g+ O' D9 ~
    if(pos<0); @# O: Z! Q& I+ [3 Q. C
    {
    & Q' C. e2 x" Z& L% F' u5 E5 wfor(i=0; i<initProcessNum; i++)2 V" r6 N- w, A
    for(j=0; j+1<initProcessNum-i; j++)
    , Y" U, T5 v1 q; k2 ^5 L{/ W  P1 K* a9 {# b' ~# N" w
    if((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)
    ; U6 a+ M( c# Z/ W{: x; m/ v2 }. a! C
    temp = (*p).p[j];
    ) A0 h) C2 F: p9 q0 S0 M8 X$ D' O(*p).p[j] = (*p).p[j+1];4 T1 S9 D9 z6 T0 w. R& e
    (*p).p[j+1] = temp;" d8 A% U8 z) C  A& \
    }+ V5 A& X# |6 A6 Q# o+ t. L5 N
    }5 E% ~) }1 O) C" l3 v
    }
    - \$ r9 _. p6 z& ]  F) Helse if(pos<initProcessNum)
    + W" q+ X* \$ o% M3 _( A5 C0 V{
    7 W3 ^) Q' S% s" Z: v* ^for(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--)
    $ s# i$ }8 k  x4 |# a( ^1 R$ s7 Y{/ w  u, T) }2 v& |
    temp = (*p).p;
    2 A1 o( }5 M' Q7 ~  J- J(*p).p = (*p).p[i+1];
    & Y- e1 P) E' R$ ^) Y: W6 W) k(*p).p[i+1] = temp;
    5 }; S& z: m7 b+ X0 j1 U7 v! G}. u/ u3 ]5 q2 _4 u
    for(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)7 H8 d  x) V* X. @
    {  s( H( B9 `0 |
    temp = (*p).p[i-1];6 W: m) d, I) ~! v' V) D
    (*p).p[i-1] = (*p).p;( M0 b7 ]6 r8 d' ?
    (*p).p = temp;; k( u8 K/ r6 u9 u) U3 u8 A, h
    }+ K7 o) n9 [: p2 O$ ?
    }' t$ Q* R  r' ?" N; ~
    else
    % i' f7 A7 ?- h8 d( Eprintf("position eror\n");
    : K+ P; c- R1 q, y* L4 xreturn 0;# I, z/ i3 o& D) W% a
    }
    / B7 O" C4 y1 q; ~/ c* a( {; F; Tint InitPool(processPool * p)* Q7 q' M- N- I9 l+ E
    {1 r) i$ t. `  N/ C; J
    int i=0;
    . R# ~) G2 O0 ?$ Q: D(*p).proNum = initProcessNum;% u% q3 I, S( ]
    (*p).p = (process*)malloc(initProcessNum*sizeof(process));
    - P2 k- E9 P/ ?. b7 D: H; h1 gfor(i=0; i<initProcessNum; i++)                                        //init process information9 y3 I. p3 F2 `- ]- ~6 k
    {
    % J8 f8 C. N9 X- C5 M(*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));
    0 y7 C, F; g/ I" c+ f; A! J(*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));3 u8 f5 l! ^) ?7 p& e) @/ f
    produce_one_task(&(*p),i,ID_FIFO++);
    - S6 \2 T6 e( v' f( s}' ~8 j9 ]# G6 A: x- T, I
    return 0;; R" U0 G! A. f: C: h
    }1 d, v: P1 s' r; x: }7 h
    int produce_one_task(processPool * p,int i,int id)
    " Z  L# u) w5 [; e- K{
    0 s9 k& E; {, c" [7 w3 x4 gint time=MAX_COMING_TIME,j=0,totallTime=0;
    + H& ?3 O/ B' Q6 ~# [5 m2 {(*p).p.processID = initProcessID+id;           
    ' ~0 K5 A0 `- F(*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);
    - D3 D: s  t' k4 y) a, }(*p).p.produceTime = systemClock;
    8 A+ Q1 J5 _% T1 c5 e(*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;
    0 P' o+ }$ D; [/ w8 d+ N1 g(*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;2 P. `7 G+ q+ ?4 T. h( E/ a2 |3 `
    totallTime = (*p).p.computeNum  + (*p).p.ioNum;% p7 [4 n$ z' `" p0 ?3 K' U, y0 ?
    (*p).p.computeTime=0;
    1 L5 h3 ~6 u3 p. Z# i: g7 Xfor(j=0; j<(*p).p.computeNum; j++)
    + s5 }" p" C# ~6 u4 r% F{
    ; o- x" D* V- r2 |4 y  r9 D(*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;
    & G* P/ {8 B3 E1 y9 f4 y(*p).p.computeTime += (*p).p.computeClock[j];
    # h9 X) {, R7 J3 P1 K* ~}
    ; t( d6 G' u1 O(*p).p.ioTime=0;8 \" S8 |  F& a  C: @
    for(j=0; j<(*p).p.ioNum; j++)
    6 B7 c* |# Q7 O% ~! p% a" }{5 A" ~+ Z. J( u6 v7 ?
    (*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;
    4 y& [6 T$ D3 N7 i(*p).p.ioTime += (*p).p.ioClock[j];; r0 h& H+ u, Z- z" @2 E% L
    }
      T5 x5 W4 k  o4 i& N3 s. B(*p).p.askMemory = rand()%(MAX_MEMORY/4);
    5 u& G' c9 G7 N6 l(*p).p.flag = ready;5 Y2 z8 ]' M7 a  ]4 \- C
    return 0;: i- E; ^0 Q  Q- I. E; f
    }2 D% V* Z/ M! w3 p
    int showProcessInf(processPool p)3 I! t* F$ b+ D2 n; f0 T
    {
    5 l- \' H! J  y% s! E8 dint i=0,j=0;
    1 g" i( V# e3 V5 C! c. o8 Zfor(i=0;i<p.proNum;i++)
    6 I! B4 f- h  O7 u{) Q( g4 S/ `9 |6 l* ^+ I
    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
    - U6 ]$ M8 c( S' A,p.p.askMemory);' T/ Q; h) t+ b# I
    for(j=0;j<p.p.ioNum;j++), t' ~( i* M. Y8 W8 Q$ z
    {
    ( \0 n; F9 p$ j+ S! ^% J6 aprintf("%d ",p.p.ioClock[j]);8 ]* y0 L7 a6 ~/ P
    }
    / U4 F( z' K/ Qprintf("\n");
    ) F; U3 c( Z! S2 y) x9 Nfor( j=0;j<p.p.computeNum;j++)
    , q) y# Q! f* q1 O1 ~0 E! @{
    + _" P: h( i. @printf("%d ",p.p.computeClock[j]);: ^& y* b! C8 M$ Q5 N; T
    }
    1 X8 Z& x4 N% d, bprintf("\n");" N$ d7 Y/ I  _9 L; }
    }9 V9 W# Z/ {/ O
    return 0;
    7 t. @0 k' w6 b& ?}
    9 A# e% M! p- L————————————————+ u; r* [; w/ g% `, R
    版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    # E- v+ w& k$ s1 N0 s  @, y原文链接:https://blog.csdn.net/wang_dong001/article/details/47843519/ G$ o0 A6 p" s$ g7 N# U$ N
    ) t5 s/ H4 U! K1 S0 Z( A4 r
    4 t2 v# h+ N/ i
    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-6-15 03:29 , Processed in 0.326175 second(s), 51 queries .

    回顶部