QQ登录

只需要一步,快速开始

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

    + ~7 A4 ]- S. {% A1 `! K经典任务调度算法的模拟程序
    * @8 `2 i5 Y6 K. J' X本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。
    ' M4 u. b* t+ Z5 K+ w6 C1 Y' D# n0 n! U6 e1 _/ U& N; B
    编程平台:VC6.0+EasyX图形库环境。
    0 y8 ?' ]* G4 k$ ~8 h. j4 X* }' ?# R7 s' @2 R* e6 G; [
    以下截取部分程序运行图::
    ; f# u- \. E: r8 L" _* ^9 J% k2 M2 l% ]& m
    源代码:3 V( A/ {+ i$ j* Z  O

    ( Z1 H% y9 l8 w  _9 X& c4 f4 M1 z#include<stdio.h>
    # o7 }/ Z- ]; d  P7 R. N" {9 Q5 U4 e9 F#include<stdlib.h>
    / g/ P  y2 s8 n( H7 o9 [$ m: w#include<easyx.h>
    3 W* V. N% V9 i8 ?1 [#include<time.h>9 a6 ^8 j+ d2 Q1 M$ d
    #include<conio.h>
    / v; Z2 ~. o! N% i#include<graphics.h>
    ! S8 ?$ [0 m/ i#define initProcessNum 10) Y& T0 b4 k$ K6 x. m
    #define initProcessID 10009 X- m  B) T1 ^
    #define MAXProcessRunTime 10000
    9 j6 L1 X2 G  p6 r% L1 W% [8 G#define MAX_MEMORY  4000
    . O" \8 [% A: u' S" ?" e8 Z#define exchange_IO_Compute 10" s9 @5 _; s5 x0 {
    #define exchange_process 25- a" M: n/ V$ L4 b1 ]9 ?
    #define task_completed 1. W; F$ k5 D3 M3 M. _
    #define task_not_completed 0
    " ?8 y& V) I2 Q2 P0 N% Z#define initclocknum 100/ g8 L' o+ g; }$ g' ]
    enum condition  s" _4 r! b5 b7 q/ q" R7 i8 }
    {1 k1 V" G* _- ~/ K! n
    dead,computing,IO_waiting,ready
    1 [/ n% k* {; n5 l3 x};
    ; l& {7 i$ L  c4 Y- `+ _" _struct process  b$ X/ u; D( E3 Q0 R" i" j
    {
    7 N( K; f# g0 G' Aint processID;
    : s; o  A( u) c( H) a& `! Vint comeingTime;
    0 G9 c" f6 I( t4 W* \( u, |. Lint ioNum;+ z! ^7 n0 n- D$ N
    int computeNum;7 d6 E2 }) v5 D1 x6 ]9 ~
    int * ioClock;, I) D7 L7 b* T
    int * computeClock;
    ) @8 {/ i0 `5 nint ioTime;
    6 K5 A0 Y! p9 }  Y9 Sint computeTime;# V. [, L8 C5 i
    int askMemory;
    0 i/ S& ]9 G6 C! z7 fcondition flag;! w( g3 w& q/ J( d- u8 [
    int produceTime;  //生成时间,以下三个数据成员用以计算相关性能
    7 B3 }) ^/ \9 T  V+ E* vint runningTime;  //第一次占用CPU的时间8 p9 G! G; q7 w
    int completedTime; //进程完成时的时间
    $ d) y6 p6 X- I: l# F6 H};; h$ I7 o* @" N7 m
    typedef struct processCmpletedInfo  //保存完成一个作业的相关信息
      B+ R( c& f% J9 k8 L{: D$ I- P/ T/ @5 Z9 d
    int processID,comeingTime,askMemory;
    . w0 n$ p7 T  v) t; Dint compute,waitio,exchange,completedTime,runningTime;& ^2 _- o5 p; W  W0 e/ E* x& [2 ~! p
    processCmpletedInfo * next;
    9 ?0 J8 A0 f' X; U. j9 a}PCI;
    1 z& Y1 B$ c3 E1 m8 N' a0 |struct processPool, F: d+ T. d* K$ @, O3 r, S
    {2 R. i3 Y" F. q" O1 I7 v$ [3 @
    process * p;
    7 y; ~! E6 M. H& u) ~% R; Uint proNum;4 e% K1 G" d+ P
    };
    , U2 t# [' D. N7 X, U/ h* @  F8 iint 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;
    0 U$ K! t+ g9 \& G2 gint InitPool(processPool * p);& B: A# k8 g6 _$ _0 D! _" Y
    int produce_one_task(processPool * p,int i,int id);
    & F0 s6 a+ T# A( R# Fint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);
    6 W! l  M% u1 A% \- @9 j! @6 ]int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);( P' M1 v) |: d  `3 L
    int TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);1 q0 p2 B+ y- v: B  _
    int FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    7 c' {7 {" M" Z/ Cint ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);9 }( V$ y+ M5 W& M: a, x
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    ! d  T2 j- g( l' N2 n0 T& pint PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);/ N/ Z( t4 m- I
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);7 K, Y: t. V/ C: P$ S( V
    int High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);
    $ d% ^+ _+ S3 v: t" N4 c0 w# Oint High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);" l5 W. c# S/ j9 @" Q
    4 I& ^+ D, }1 v% I/ \3 T% F8 m

    % i& p; w' t" P! a& N4 M: oint sort_by_comingtime(processPool * p,int pos);5 R' a. w+ ], e  N. I
    int showProcessInf(processPool p);
    , u$ a8 b4 x: p8 T6 S2 }$ {int drawPerformance_FIFO(int x,int y,int memorry);4 n. x5 l/ \# q) w( `- @+ \
    int drawPerformance_HR(int x,int y,int memorry);
    0 l  a$ m5 D% {" {! Eint drawPerformance_PF(int x,int y,int memorry);( X5 T$ W4 y% }+ U8 k
    int drawPerformance_TT(int x,int y,int memorry);! `6 \3 Q: F4 m+ m6 I2 \
    int drawPerformance_SJF(int x,int y,int memorry);( d. B& G! }' L3 J  t+ \" v
    int MouseListening();" x( y$ J( P4 P8 @$ p9 c$ q
    int MouseListening2(int *flagShow,int * showTime);
    8 Z1 m& s5 N7 q/ V0 P  @int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);7 v/ ^! i% ~) o3 W1 q
    % D' N$ b1 v. z3 _, _
      N' q# ]/ Q0 ]) u* ]8 L
    void main()
    + y' w1 H' N3 B! G% H, z$ y& n{3 q4 Y* _. Z2 Q9 {3 y
    PCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,& M( X( ^8 m1 r' b- s, I8 I
    *Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;
    9 @* S0 F0 D. ~, d4 l' tint i=0,FIFO_memory=MAX_MEMORY,count=0,Timet_memory=MAX_MEMORY,SJF_memory=MAX_MEMORY,Priority_memory=MAX_MEMORY,HR_memory=MAX_MEMORY,
    5 a0 h! z8 N& ?& S% y0 L  e% c5 cflagDraw=0,showTime=100000;
    $ ~7 ^) u, j7 p; E+ M, S( `processPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;
    6 Z" h( }5 S- V2 e' |' \FILE *fp=NULL;
    ' [, z/ k  c: }' ?. g- Q5 a) f3 _& ]//processPool HR_p,HR_mmy;
    6 I; E, l6 E# W! t& C9 {# |8 ]) q+ B
    : T# `7 O& \& F) h+ C8 c$ o- k# F2 F+ \: Q4 R( r8 v2 B" u, D
    srand((unsigned)time(0));
    6 V* c- l$ s* J& rsystemClock=0;- m' y% A# c; a
    initgraph( 1200,650,SHOWCONSOLE );
    + g. D# T6 Q- G9 V& K/ _settextcolor(GREEN);
    % }. S* K9 g) V, }3 G0 ]% m9 tsetlinecolor(GREEN);
    " d! u* t- e  w( T$ j, Osetfillcolor(GREEN);8 a& w3 o9 o: Q: b
    InitPool(&FIFO_p);
    4 E3 {* c2 `8 ^9 X( m* ?sort_by_comingtime(&FIFO_p,-1);8 }! G, B) n: o- t7 n) l% y' E
    InitPool(&Timeturn_p);: ^( s0 Z/ R% b4 n" K) Y1 t1 h
    InitPool(&SJF_p);4 O8 D# P- a* d7 l
    InitPool(&Priority_p);
    1 a: Q' g: ]9 TInitPool(&HR_p);1 v9 W' L( c; L  U
    //showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);& k8 Z- B9 R% @! Z9 I
    //Sleep(10000);
    $ @/ }1 m- @" @; x; f  P  o0 d4 z, r
    4 l/ a6 J  N, O/ h6 \* F0 p! x9 o  Y# F/ V( T( V4 v) H
    Timeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    * [5 l$ _$ B$ \3 E. A) U# kSJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    # l9 C- q2 y. p/ N0 PPriority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    9 e" ]( i. l# f+ e8 Q6 lHR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));4 g* x9 j: N9 w
    for(i=0; i<initProcessNum ;i++)8 R. X8 h6 \; e/ r& ^0 F5 a* i
    {
    ' a2 G2 u7 O8 {, c  W- ?* A1 Z: ~Timeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));  J8 |2 \; [: [6 u" S
    Timeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    6 e: o# {# \! L2 YSJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));: X$ h5 _5 F: H9 x) c( Z% R
    SJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    ! Q1 @! l6 {& Z) ^; [, BPriority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));! s- l) E2 j2 G1 Y
    Priority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    : w0 f% W6 k) v2 j: QHR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    - e6 V: I; y" MHR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    8 P$ `5 G+ O( d" j# B: r7 t/ t+ v}$ g! R8 p5 m# T) @& u* _
    Timeturn_mmy.proNum = 0;
    , V* h( p# \6 ?) A+ F% sTimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);  t; c' ]6 g3 y* B3 T
    SJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);
      n4 ?& {* |$ Q, b* _) R- uPriority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);
    & G: P" d+ y3 ~$ g3 d9 ]High_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);$ T* s9 u: n+ W4 u) F
    //showProcessInf(Timeturn_mmy);; @4 n2 B# z- e: o! i2 T7 L
    FIFO_pri = &FIFO_save_head;
    $ E! G/ x3 J& B: oTimet_pri = &Timet_save_head;' P# K3 o, s7 t. I+ L  k
    SJF_pri = &SJF_save_head;3 j+ Z0 e" W" m; M1 S/ L
    Priority_pri = &Priority_save_head;1 ]2 T' k# |. x. _) i/ C3 }" j
        HR_pri = &HR_save_head;
    9 P& p2 ~( y, _; Csetbkcolor(WHITE);
    + U. n; j+ u- y( P2 uwhile(1)4 E4 n+ W5 ?# {
    {) l4 P. W2 e6 K6 e' K
    if(MouseListening()==1)
    3 y! Q- u5 t0 s7 {4 @5 t, zflagDraw=1;7 t* V+ J' l, \2 v1 W% ^# x
    if(count==100); C5 P7 v4 l- r+ b
    {
    " t) R% J! E0 M1 E% ~if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed)
    3 `0 V$ Q3 j5 W{
    . V" t( {) K$ DFIFO_pri = &((*FIFO_pri)->next);
    5 a- A$ |* k) [/ V& A0 V* y
    6 Y5 i6 i: c+ U  C4 J! J) v- d5 B! I//printf("hello");3 R+ e/ e: F4 r8 a
    }
    - K& [* `# i' n7 v, \2 A0 \3 i' p* yif(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed)
      w6 Y! Q, q  ^  F* A# D* f& \{( r( d" p. @0 o
        Timet_pri = &((*Timet_pri)->next);
    8 Q% b1 Y1 H. `//printf("hello");
      ?* `$ h. I% u}0 U: W) m" \4 Z# S8 x. P
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)9 Z. M1 |8 a! D! m7 d, K
    {
    1 F9 T( r/ S  ZSJF_pri = &((*SJF_pri)->next);
    ! d7 }7 Y$ m6 T/ }" ?, m/ D! v//printf("hello\n");
    . |# z" I& u, M}3 O4 g, h9 s6 k/ p% Q0 S3 y/ v+ C
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed). `5 f. \% C# D' f
    {
    . `, \, K& C, [+ s$ UPriority_pri = &((*Priority_pri)->next);
    0 M) {+ n' P0 v( W% [6 O7 T//printf("hello\n");3 F* R" t; j- s% A" w/ n" q) `
    }: [- J  X0 I* r* Y
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed)
    2 n) H+ g, Z3 K{" K) _7 p% u2 ], E9 G
    HR_pri = &((*HR_pri)->next);& h% F, E+ T1 h/ [8 Z7 o
    //printf("hello");2 Z. a$ |4 e0 h+ |/ ]$ A4 |
    }9 N+ c, T7 `# j3 T; C( S
    count=0;% Q" _5 a& T! R- L: [! y
    }( @/ q# V! E- I. `, W- S' b1 P
    else
    5 y+ I& _  Z/ _3 V8 J$ q{
    ! }$ O- Z9 x6 o, {# a2 k: Sif(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)
    5 G  g9 [0 ]1 M, ~{% J: [0 p0 O$ x9 i  N( v+ b
    FIFO_pri = &((*FIFO_pri)->next);( M- w0 c& g( ^7 r- C* V
    // printf("hello");0 `% a: E5 E2 K) l  V7 ^$ I
    }
    " W! ?  s) _2 j( K) M' q7 n7 fif(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)
    # f( S7 w; q/ i* A4 o3 T0 N- C{
    # S, [- [& K) ?4 R# aTimet_pri = &((*Timet_pri)->next);
    * s- y0 g) P$ |8 Q// printf("hello");8 G$ l( R, `# ^
    }$ f3 B: L% R$ {+ Y! ^) i
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)
    0 R0 F# P. Y. C$ m{# ]( |* |/ t! l7 h( U
       SJF_pri = &((*SJF_pri)->next);* O7 i# p5 N; f# C" f! H6 U+ \
    // printf("hello\n");
    # a8 W  ^! Y8 E! K# D! f, F}
    # v7 g3 z% q  l+ {1 p4 @if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed)
    , g2 ?% ?8 N/ V6 M* Q8 M  G" {9 V{2 ~3 N% `: M1 t' j; @1 H
    Priority_pri = &((*Priority_pri)->next);
    5 h0 ]) s9 p4 Y& \' V0 }5 U" N//printf("hello\n");  A6 P, c  }1 r
    }1 |8 q6 \  b# N1 N6 T
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed)" d- Q+ d0 {- u3 K# A! Z$ |
    {
    ; E2 j/ g1 ?0 e% A0 K  G- IHR_pri = &((*HR_pri)->next);
    4 J7 ?$ }0 q9 D- ?1 t, Q//printf("hello");6 |( X) h2 n) ?9 R/ x3 F
    //Sleep(1000);& v0 a9 ?$ m/ O
    }
    . \& d& J( `0 M) u1 i: {! Z# ycount++;: B: _  k5 @) L6 c& J, ~( \. H
    }
    6 `& W! X, |) Nif(systemClock==showTime)  F; Q' t0 j4 Q: N% o
    {
    6 ~; ]3 x, \' B/*PCI * p=FIFO_save_head;
    : h1 L0 j8 U5 n; |- Jint i=0;
    8 h1 x; e  v& {5 X  ~9 e3 r. gfor( ;p!=NULL;p=p->next)# G, I. c! S& H) p" _! Q
    {( J  \9 c- K- x7 q9 g# T3 t, g
    printf("Id %d\n",p->processID);
      r. _, w* V* ~9 R0 Wprintf("comeingtime %d\n",p->comeingTime);
    0 V4 l1 t1 [! D% H; ?+ X" oprintf("runningtime %d\n",p->runningTime);1 z6 N1 c) a% b1 I
    printf("asdmemory %d\n",p->askMemory);* c5 ?& i; y+ x
    printf("completedtime %d\n",p->completedTime);' O$ K+ l6 @7 I9 Q: \, e) L4 X4 V4 r
    printf("compute %d\n",p->compute);
    ( @5 R# D# h' yprintf("exchange %d\n",p->exchange);6 F: k6 j% z4 M  v
    printf("waitio %d\n",p->waitio);6 H3 m0 J  n8 P+ }$ X1 {& C) Y
    i++;
    , x  N! ]; w  `
    # [4 h9 R, ~& M- c
    3 ^2 H$ q' \1 ]# g}8 a; X: l: z& ?4 @1 E
    printf("%d\n",i);*/, Z5 Q, d0 z+ s& |( w
    if( (fp  = fopen( "data.txt", "a" )) == NULL )6 w9 [$ `2 X* P0 ]
    {; q3 B& p* V: I
    printf( "The file 'data.txt' was not opened\n" );0 L$ E$ W; _) D6 l. y4 F
    //return 1;. x- w! D0 D0 X6 X! C1 u
    }
    % l, b6 F0 a4 p! Ielse, w) m- ^$ {" t2 o* X! [
    {
    ' ~0 q3 a* \' t1 dfprintf(fp,"FCFS \n");
    ) F# J8 h7 [) i; Ifor(p=FIFO_save_head;p!=NULL;p=p->next); x1 X) e. [) \% ~2 E0 M! T# Q
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    : Q: v, l: i6 F6 }# r1 ip->exchange,p->waitio,p->runningTime);' Q; d( \7 w0 Z
    fprintf(fp,"\nTime turn \n");* g5 r8 `8 U  K* f7 O" b
    for(p=Timet_save_head;p!=NULL;p=p->next)
    * ]5 B- \  s& s1 X# s, t) u2 |fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,- ]( O9 R/ ^; ~9 [+ R- j
    p->exchange,p->waitio,p->runningTime);. F  t% x1 `7 F" ?4 H
    fprintf(fp,"\nShort Job First \n");/ N* B7 s, Z0 o$ ^6 ^: H  B+ U
    for(p=SJF_save_head;p!=NULL;p=p->next)
    ' ^. m& U* G$ }* q* J4 A8 n8 H1 Pfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,/ q$ q- k" v" S
    p->exchange,p->waitio,p->runningTime);
    + d$ e' i- n- f5 i4 rfprintf(fp,"\nPriority  \n");
    ' I0 |$ I1 _9 X# ~7 x4 B+ Ifor(p=Priority_save_head;p!=NULL;p=p->next)3 N5 v, i# H' l7 R5 N
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,% m+ x; q! \8 g" o9 n; D/ }
    p->exchange,p->waitio,p->runningTime);
    8 r- R, Q' L5 s$ j8 M; ~; t! K1 K$ e! hfprintf(fp,"\nHigh response \n");
    # l, c# }  k  ]7 _5 }for(p=HR_save_head;p!=NULL;p=p->next)' @  ?0 x3 Y7 W+ w$ `$ s) V+ Y- Q3 g
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    ; ?- N3 j6 @' X& d9 I6 }p->exchange,p->waitio,p->runningTime);2 u; n" c: C7 p# `$ L' l. A0 W
    fclose(fp);7 H9 u+ h5 g( J/ d/ U- @  F1 r
    }; a0 c( @% F$ s  W' ?4 u' a6 @( e
    showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
    / P% x! u9 `9 J8 s( b* PMouseListening2(&flagDraw,&showTime);8 N/ ]. G! H: D/ N( y9 H  B
    }6 w5 r: ?# E  t8 ^0 V# ~
    systemClock++;1 b. J* J2 y: d7 i  p
    if(flagDraw==0)8 I5 z2 y8 t1 R  u
      Sleep(10);
    - m% p2 G4 s4 [6 Z}
    + A+ n, W9 V1 q% T$ C
    - ~. t' ?6 Y1 ?9 U7 w% d( s' s9 V6 ?& O1 A3 g$ v5 k$ v9 Y5 n
    }
    3 B8 S- N5 y# [& hint showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR)
    * @/ ^8 o. M% I. _{- k; Y( C' S6 i$ C, i6 e) k
    PCI * p=NULL,* name[5];
    & x; h- h$ p* O4 B+ [  C0 z+ u8 h9 _int count=0,i=0;# U7 j0 C/ X1 y2 ^0 J+ `
    char ch[5][10]={"FCFS","timet","SJF","PR","HR"};5 j5 `  W2 f2 Z9 X+ F* I2 J" x, O7 O
    double turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};
    5 z/ l/ f& m  J- |: v6 Istruct info
    , \: ?. E  Z8 X* d{  E" s0 J1 w3 r4 |
    char name[10];5 b! F6 [. U* |9 H
    double throughput,turnover,wait,CPU_rate;
    8 `9 s; f1 o" d) b% m0 G, O}inf[5];
    0 u) D2 S9 e* Y3 tname[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;
    8 Y# b$ ~4 _; V3 l( Nprintf("调度算法..........A\n");
    2 p8 [! Z/ J  Uprintf("吞吐量............B\n");
    8 w# ~* o1 S1 o% s) [1 [2 }printf("平均周转时间......C\n");* i/ v: A6 X2 J! {( J
    printf("等待时间..........D\n");- ]: X7 g8 w3 T
    printf("CPU利用率.........E\n");
    ' U3 w; {9 ^) s; C* Yprintf("A\tB\tC\t\tD\t\tE\n");6 y' M3 u9 V$ k' r
    for(i=0;i<5;i++)' V# ]+ Q9 J" s0 a! B3 w
    {& O1 [" i& T7 u* _# M
    count=0,turnover=0,wait=0,c=0,w=0,change=0;
    7 d- A- d5 \% J9 Lfor(p=name; p!=NULL; p=p->next)$ p+ G6 O- i6 o* F/ v  y  S0 j$ z: j% P
    {
    ; W' X. R. K8 Z! rcount++;$ r% u0 u- B6 d
    turnover += p->completedTime - p->comeingTime;" l8 b6 d. _+ _& o" [5 P# O
    wait += p->runningTime - p->comeingTime;
    6 ?1 M  d; u& j8 Yc += p->compute;
    4 [) `/ M' _2 b7 bw += p->waitio;& y9 O2 N0 {3 {5 p- n4 `- k
    change += p->exchange;2 i0 G4 {. s! b! o7 ^: W
    }, A7 T7 r. \$ {! |3 n% a6 ?
    turnover = turnover/count;
    & X* W  m5 d# x* X* J7 M# Hprintf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));3 i2 ^% I7 T6 W; _; N% {* ]2 [  c4 ^
    strcpy(inf.name,ch);: Y" N2 b+ k% u9 \: V7 n$ m
    inf.throughput=count;1 |1 g7 j6 v4 ^& @, }
    inf.turnover=turnover;" V$ j. H) V8 U% W1 g4 |2 j. M
    inf.wait=wait;
    3 T' `  |7 E  _" Rinf.CPU_rate=c/(c+w+change);1 E! b: u& k6 Z0 M- N
    }
    ) l1 f( `+ F5 E) H7 x) {//画图( j/ A% M( ?" D7 m
    //cleardevice();
    ; Q8 l. u8 t- g! Lline(0,600,1200,600);
    3 G/ |/ F$ x) z+ w! sline(10,600,10,200);/ O- ~2 e: ]7 r. j9 L1 \# _# {, E7 L
    line(10,200,5,205);
    8 E7 e$ e" G1 l7 qline(10,200,15,205);# k2 [* C, b5 e. [  D
    line(310,600,310,200);
    : @1 O+ X4 |  G" u' x& ?line(310,200,305,205);
    6 a8 @% M: P1 }) H8 Sline(310,200,315,205);
    % `0 S9 |' Q# R2 R% oline(610,600,610,200);& J5 Y8 s6 f9 J8 V- A1 E: r  a
    line(610,200,605,205);
    8 B! V: C+ \. S  [' B7 ^, C- xline(610,200,615,205);0 W4 b9 g7 v+ v8 M
    line(910,600,910,200);0 g- \0 q+ t: {8 f+ i) i
    line(910,200,905,205);) t, x" H7 h' K
    line(910,200,915,205);//最高的长度400,宽度均为40
    " P- k! }; K- x8 E( |" v$ ifor(i=0;i<5;i++): h+ n$ M+ O" Q. D
    {2 n& O  y+ `8 H3 @- U+ |
    if(inf.throughput>pos[0])1 D( y6 z" S! H( B
    pos[0]=inf.throughput;* K5 @' \5 p2 W  c5 j7 d# w' i
    if(inf.turnover>pos[1])
    7 v$ C" j' _) B$ `7 Opos[1]=inf.turnover;
    ) R# Q, s2 Z% R) ^" ~0 Vif(inf.wait>pos[2])
    ' Z+ K" m' E% e4 Lpos[2]=inf.wait;3 q0 N8 l8 [9 j) L; v  w
    if(inf.CPU_rate>pos[3])3 ]3 O3 i. z8 K- P: D+ |
    pos[3]=inf.CPU_rate;8 g2 O6 N4 q8 f* `3 t
    }
    * O! W7 ]6 t! |1 |% c1 Wsettextstyle(30, 15, _T("楷体"));# D2 e8 C% u& o! `9 ?( T
    for(i=0;i<5;i++)- s+ F* |$ f4 v- Y7 H) y. M+ ?' \
    {, {; J% C8 a, E3 w
    switch (i)* F: h( |3 ]$ C
    {  E# Q4 V* j, d$ Y6 x2 e
    case 0:, y( M, m1 b, k+ {4 n
    setfillcolor(BLUE);
    4 U9 [& R7 |# Y+ b. ?+ c* Ifillrectangle(100,50,150,100);7 f- p0 k$ \2 x  G( Z5 @  R
    outtextxy(160,50,"FCFS");
    7 K* l: s+ y0 `  X3 W5 h( vbreak;
    ) D! w; K# z2 |case 1:7 U4 @7 o2 f& |
    setfillcolor(RED);
      v) j% d9 g! Y" Z  W  mfillrectangle(250,50,300,100);
    8 W1 |) L% R' d' I, m2 h- \9 B1 j9 \outtextxy(310,50,"timeTurn");  \3 p6 z; S& Y  B) k2 Y5 |
    break;
    / l, F% Q% l# c' q3 N6 acase 2:2 R* l. U$ k) `0 q
    setfillcolor(YELLOW);
    2 l$ m8 k% s. d5 p5 Ufillrectangle(450,50,500,100);
    / i7 P3 S' y% V4 Wouttextxy(510,50,"SJf");
    + v, P9 S% J8 Y( |9 qbreak;
    0 ~: D% n$ [+ g8 [0 scase 3:
    7 h5 r0 O4 \9 R) {8 H# Asetfillcolor(BROWN);* p5 N. z5 |' \3 z# P3 ?/ N6 ^
    fillrectangle(580,50,630,100);
    ) \6 N  @# H+ I  v, A5 G2 O% T7 Youttextxy(640,50,"PR");
    $ T" R8 E: F6 c5 o) I! r1 {, k* bbreak;& U1 D# N$ h$ l% E9 e5 `* O
    case 4:6 n8 e' [' J1 ?+ Y( J. P  _
    setfillcolor(GREEN);3 f; @  t" n$ q; |4 U$ K# j
    fillrectangle(690,50,740,100);
    $ c( S3 W9 s( Y- Q5 q6 |) U2 G: j6 Pouttextxy(750,50,"HR");
    % s: r" c, U8 H4 d% K" Kbreak;# h# D, ]9 ]6 Z+ V' p. |, J, d
    }
    ! x1 C4 d: s/ ~7 y/ K3 \3 e9 Vfillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);6 }! c# {. z9 K& O
    fillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);
    ( T* h* R, _3 ]$ s$ J! }fillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);
    - @1 U# N0 [6 V0 }fillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);
    9 B- `8 c) A& ^4 N$ D# H3 f6 o
    - Q: s& c5 x) O  I4 T7 x  d0 m9 b, T1 W4 V
    }: I% B8 y/ p0 u
        outtextxy(100,150,"吞吐量");
    * ^, T! E8 @8 vouttextxy(350,150,"平均周转时间");
    " ?# Y, v' t* B% A1 youttextxy(650,150,"平均等待时间");$ p8 q4 w6 r; D8 b, {
    outtextxy(950,150,"CPU利用率");- F0 _; \) H8 j6 f
    return 0;* x, `. O1 A$ T0 G
    }/ _$ E1 S- H+ O% r$ I
    int MouseListening(), t8 f# v7 _" p0 N$ r% ~
    {
    ' v$ Y) v5 _$ T6 mMOUSEMSG p;, [6 D# J) b' q) H4 Y4 Y2 U
    if(MouseHit()); v# d" u3 T5 ?7 e) }* l7 a# l
    {3 v+ M% l) B! r6 L. ?
    p=GetMouseMsg();
    ; N; Q9 {$ D& E9 P' Q. Sif(p.mkLButton==true)
    ; H" K; `, O# n5 Q  M0 k& Y- r{
    % ~7 n" t5 L9 fif(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    % I! O8 @( C0 l' k$ K9 C1 y. n. [) NFLAG_FIFO = 1;9 D: ?+ w  w5 f$ V6 |
    else if(p.x>400 && p.y>0 && p.x<800 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
      F( E+ k  m9 p* X, e3 dFLAG_TT = 1;' ~$ O* n" S1 q3 X
    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)' n2 Q* t1 B* H' M3 w4 z9 M
    FLAG_PF = 1;" V( ]1 o9 N, j* E; h
    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)
    3 B, a5 X) Y4 l9 [+ pFLAG_SJF = 1;
    : b) w) i6 L& T1 z9 O4 Relse if(p.x>400 && p.y>325 && p.x<800 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)/ k0 N5 @( t2 o% }# w9 Y* H
    FLAG_HR=1;0 K9 J3 H# k7 X& Q0 k
    else if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)+ T+ m: X" |4 E+ X$ O; ]6 e
    {
    . d; P6 d' f0 [/ ~FLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;
    ' g! J1 m  y3 u: F5 `clearrectangle(800,325,1200,650);6 n4 C3 i7 r6 _# F5 y  Y
    }$ E6 X% ]4 b2 ?4 r4 t) a4 j
    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 )
    ) L. @& e' ~; k{
      C3 b  f5 O7 C$ h+ Q+ k2 }' HFLAG_show=0;
    $ ]( O: M8 P1 }7 A8 H( \cleardevice();
    7 j! t* U, ~! m2 J, q+ F' e3 _return 1;
    6 [6 `' l$ i/ T* q}
    * S3 A3 ^% }) e4 L8 u' S- M}
    * {9 m' E+ ^" M3 i0 L) m}
    * k/ z4 y1 F" ]return 0;% L. l4 q8 S" @3 u3 X  x
    }
    ! R7 u0 `/ ]0 _- y7 C, y9 W3 Xint MouseListening2(int *flagShow,int * showTime)6 w* d) D; Q1 W8 i
    {
      q  R9 }( R/ u9 V0 KMOUSEMSG p;
    $ t% h6 b& o) H; \* |rectangle(1150,0,1200,50);
    8 w8 _) Q, Y0 P( I( ]( ?6 douttextxy(1160,10,"X");4 Q5 [& w0 s  I# \) y  c
    while(1)
    + n. x1 P* X$ ]{, E5 h  N4 F7 C5 V; h: _) W/ }
    if(MouseHit())
    ) N. S8 p: O/ q- O0 B/ A5 t{
    ! Z- \$ E/ l& f5 _p=GetMouseMsg();
    6 D2 W4 E! ]2 q0 V' O3 ]if(p.mkLButton==true)6 G/ K5 Q# Q2 r& I. o3 ^6 Z
    {8 p" j! z" r" A/ k1 i3 X/ }
    if(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 )1 u# Q" t  t& _$ a7 z* e
    {
    + k" P  Y, A% C+ \! I2 }, G% b(*flagShow) = 0;9 |& E3 L: }, J: ~4 K$ Q$ d5 X
    (*showTime) += (*showTime);
    9 K, d3 v9 q) Z7 {8 v% q) QFLAG_show=1;- l' S; c  S; X5 q1 R
    break;
    ! t5 @4 f1 H; L9 a) Z& [/ [}
    0 E1 s. M8 q' v& H) U
    1 C* y2 e7 a4 v. g7 O! O}
    . ^3 Q- x9 O+ Z4 n& _4 r}
    * Z0 a2 n; i& bSleep(20);" C  A7 m7 H$ f* t  K' w: F6 q/ X
    }( L) l( g) D$ C) d" G# q9 s
    cleardevice();2 o/ t1 E7 z" L, ?+ v& b; r
    return 0;
    % |2 U* g3 M/ I& }9 r+ D- ^}8 o: G  y0 g5 ~2 ]% y1 d8 T
    int drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha)
    $ d1 m) x5 o/ c" c{
    ! m# C4 I  c4 n" ]& Lstatic int info[11][3],num=0;
    6 p& m+ `" v" H" n" oint i=0,j=0,pos[10][3][2];
    " a$ m  [/ G: |7 ^1 ?* N$ gfloat temp,t;( S1 L( H: B% D& S! A
    //画按钮,不属于FIFO图的范围9 u+ z# k& ^5 h# U* s. A
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)0 k/ }; o8 o" Q: a: z0 }
    {+ S3 Y0 B4 R3 F" T  H7 K6 ?
    settextstyle(30, 15, _T("楷体"));
    % n, E* U/ B- s1 U) m0 @4 xrectangle(890,455,1110,510);& w0 j% S$ u1 H9 |" A+ g
    rectangle(900,465,1100,500);
    3 Y( N7 C. A! t# Youttextxy(910,468,"查看运行结果");" r1 ?8 @7 D  ^% v
    }
    $ b& p  e3 ^) z$ n1 o//结束画按钮3 N$ [+ t; S0 r7 d1 I) R
    info[num][0] = com;
    1 z# G6 O4 A7 D( ainfo[num][1] = wai;
    . S4 u# ]1 u# Minfo[num++][2] = cha;
      c( B* n- e- }2 f, L# k# w7 eif(num>10)  //存储10个点
    % w8 q: k) N( r- ^. n; Z{6 y9 A: T8 c/ Y1 o6 k
    for(i=0 ;i<10;i++)4 ~; E, e7 I& `& Q$ A5 @, q
    {
    " E  w  }# Q5 d8 o6 r1 yinfo[0] = info[i+1][0];
    ) z. [2 a. @7 N- uinfo[1] = info[i+1][1];" _8 {* o8 o2 p0 b) D7 W7 f. R
    info[2] = info[i+1][2];. h% S0 s3 G) i2 Z$ G6 g
    }% D$ k% Y/ p/ u2 t+ W
    num--;
    , M; r9 D3 Y4 ~1 E5 x3 }6 H2 k}
    : ^0 L+ f- {+ v8 i! r9 U1 Y1 \- lif(FLAG_show==0)
    & S' b1 I) Y4 g' Greturn 0;
    . @- I6 x+ Y( u( Q% D# Kfor(i=0; i<num; i++)
    3 h6 K. Q* o3 M, v& Z- w8 S' ~# ]{
    ; P1 y/ O' G  N, Z, pt = (float)info[0];; N) H- W/ r% u6 c" _" M
    temp = (t/101)*90;% b1 z2 L7 Q9 i  N" V
    pos[0][0] = (10-num+i)*25+x+100;! J6 ~# ^- G6 R: @( ^! }& s; }8 h
    pos[0][1] = y+110-(int)temp;- [$ R! N" Y& S7 {" y
    t = (float)info[1];
    % f/ u* |: }7 [7 W' Wtemp = (t/101)*90;
    # g6 ~% |5 q% ]$ s) x0 p! Q' _pos[1][0] = (10-num+i)*25+x+100;, S: c5 B+ X+ {6 R0 `0 j
    pos[1][1] = y+210-(int)temp;
    5 l% b% q7 o* w: V# m$ Q' it = (float)info[2];
    ( }4 n2 ^+ b' O4 ~0 |temp = (t/101)*90;, k( {8 d  l6 X7 A. ]/ N# s
    pos[2][0] = (10-num+i)*25+x+100;
    " m' _% E: S, |* N% f) opos[2][1] = y+310-(int)temp;
      V5 I) U! P: r; r" O. G, ?}
    4 Q2 I6 @- g& e5 g2 ]& z5 m% ^if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)) o, e* Z5 \# e- p( g
    {# y4 S9 i# d- J- m8 x' \  E: E+ X
    clearrectangle(x,y,x+400,y+315);: g- q6 O. g; w- I8 O6 i4 P0 A+ Y+ P
    settextstyle(20, 10, _T("楷体"));
    2 `9 J& [1 V/ _5 e6 r, [rectangle(x,y,x+400,y+325);1 u# ]3 s. o3 f$ w) h* o
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    . P  y1 O6 N; O$ z0 I4 Pouttextxy(x+45,y+10+100,"IO");0 {0 Y* L$ |* X" A
    outtextxy(x+40-15,y+10+200,"change");
    , k) {( F& e# o0 x8 e7 \rectangle(x+35,y+30,x+75,y+110);
    ! \0 @3 s# z* Z) f1 u# ~7 b& O/ z% Grectangle(x+35,y+130,x+75,y+210);) K. d# ]/ Y; ~, U& v; }0 H
    rectangle(x+35,y+230,x+75,y+310);
    7 M0 L/ u. H* T( e, a- l7 P( q/ iouttextxy(x+180,y+310,"FCFS");
    8 Y4 q: [/ s6 W$ q+ s* it = (float)com;% z+ j: |- ~- \- q* ^) V
    temp=(t/101)*80;  q8 ~# @. \, Z+ b1 Q2 Z5 w! I
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    8 s8 w% D/ o5 v: h& g- Y, ft = (float)wai;! P8 B4 S: ?) V
    temp=(t/101)*80;: ~6 {2 m7 u$ o" S
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    / T( w  l" G3 [' a2 C. x  q  Q, Z2 Rt = (float)cha;7 {1 V* v- z; b" L: a
    temp=(t/101)*80;# }% |3 K* G9 I
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);3 O0 S- k1 h" t
    for(i=0; i<3; i++)   //画坐标   high=90,length=2504 e& R' t( d' u# I3 X
    {2 C8 K9 J" r0 G& y$ x0 M, K. Y
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    ; N- o8 I. N) wline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);% ~1 Y$ X  v" _1 s7 i) e  e/ C% f9 s
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    " P7 J" ]) Z+ H9 R! e6 I  k; E: }. {( m% t) o, x) ^; Y
    line(x+100,y+110+100*i,x+100,y+20+100*i);$ V; q# X, q% h  D. ]; }
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    ( C2 j2 u1 U( u. @2 nline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);% e9 h+ o, W. Q, }
    for(j=0;j<num-1;j++): P# \9 r* d) @4 s8 F# x
    {. ?  r" y8 D1 J2 g2 g
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);1 i" Y( D% F$ J2 ]
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    3 B1 W  ?" v) M; Q: Z+ [: }* Eline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    $ Z% E4 v, [  @& t) [. Z6 _2 w% Q# ~}, G6 w; B0 j0 }9 ^! e( |- f- T
    }
    , l2 v& i+ e( I}
    7 X# b& ^/ U7 a+ Q7 Qelse if(FLAG_FIFO==1), x5 U8 }, N1 N! ^: I# C
    {! ]9 J2 a& o# ~- j# B' b/ _
    x=0,y=0;8 r. k" [4 Z; X! E8 I: Q6 }
    for(i=0; i<num; i++). t$ f/ P* q) n$ `, s
    {
    3 R: |6 q, U: t$ j  l# Gt = (float)info[0];
    3 l2 g# W* U6 {/ E! ?7 V  Ptemp = (t/101)*180;4 t/ P) L' C% s* N: Q) J& {
    pos[0][0] = (10-num+i)*50+x+650;! T7 r# [8 l- T! f" ?. G) m9 J
    pos[0][1] = y+210-(int)temp;/ b& _; F1 N* n0 h( I1 W
    t = (float)info[1];
    7 Y" v& {2 `# u9 N0 y. r6 w1 Etemp = (t/101)*180;
    7 f* z8 m2 v) s6 S; ypos[1][0] = (10-num+i)*50+x+650;$ C$ t8 ]+ C7 S  ~) v
    pos[1][1] = y+420-(int)temp;. _; j( t1 K# G! Y
    t = (float)info[2];
    ) h; y/ v3 m/ f) jtemp = (float)(t/101)*180;6 V- N/ ~6 B' O9 Y8 I
    pos[2][0] = (10-num+i)*50+x+650;
    5 I- }# M' W/ e1 @" W+ epos[2][1] = y+630-(int)temp;$ [7 j. s5 c; X8 K1 {
    }0 ?. n: P( Z2 L7 r
    clearrectangle(x,y,x+1200,y+650);
    2 u0 q  g5 j+ L' R8 i5 A, wsettextstyle(40, 20, _T("楷体"));5 i3 t+ j1 J7 v2 R) |  C* j
    outtextxy(x+50,y+50,"FCFS");/ h( J& O' Q7 x( P  ~8 z
    outtextxy(x+280,y+20,"CPU");       //画柱状图; w0 V( |( R: \- C& S
    outtextxy(x+285,y+20+200,"IO");
    / c- r* j3 @" W1 xouttextxy(x+250,y+20+400,"change");3 }: `5 S) ~$ P0 L' p0 R# ?
    rectangle(x+270,y+65,x+330,y+215);
    9 G, J8 p; w5 Q7 |& B( Y: B& qrectangle(x+270,y+265,x+330,y+415);
    & d& x2 q4 E& H- U4 z# z% grectangle(x+270,y+465,x+330,y+615);- Q8 A0 u9 O" w% \" G
    outtextxy(x+290,y+620,"TT");
    1 B- r' G+ V' f$ B6 o2 bt = (float)com;
    1 H! K. E$ Z2 P6 u: h2 xtemp=(t/101)*150;
    ( o  ^; y: g; n# M) `* m: Q3 P" efillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    0 K. U7 u6 W  R7 ~& ]  ot = (float)wai;
    0 L9 g* s, w& Z* R( Ntemp=(t/101)*150;! [% I7 c7 O, t' \
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    : n$ U/ t, [2 k, Nt = (float)cha;
    ) k% R! D; m& A  _: rtemp=(t/101)*150;3 o, Z1 q# w/ S7 M' D2 p
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);3 B9 c: a3 G7 w  A& ^/ _
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    % c! S" B; j, i% Y; N{
    # ~4 ^9 S8 K: P4 n5 jline(x+650,y+210+210*i,x+1150,y+210+210*i);! j1 [1 O+ ^. \7 }
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);# ~: T) W+ L- [5 V* G6 B
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);) A7 X# ?. f! z2 K% P0 f

    8 W7 u0 A5 c! y& n$ ~# g! _% p# zline(x+650,y+210+210*i,x+650,y+20+210*i);
    # E. F0 \9 v2 L9 \! x, d4 lline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    - a2 t& `' p) k% H7 B$ z$ Z& oline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);/ C  ]: Q, ?% p6 H, M1 ~6 M
    for(j=0;j<num-1;j++)
    3 Z7 C7 Z& f' F6 _$ Y{
    0 x5 m1 e  K, N' y  [- f: rline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    * Z) ]$ V* z9 z1 j4 Hline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    8 f" l- Z) p( I& T; J7 r% f0 [line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); , V/ R6 Q$ Q' q) D1 o& {
    }. F4 M. _! q! B$ |) [/ [
    }
    " y3 a9 B4 \( B}
    & ?, ?. y/ H4 p2 y& S& C6 c/ r* H
    ! S9 {$ j! N9 P8 O1 I. Y1 f7 e
    ' M! \4 q2 O* i& E/ c! \7 W, ?$ Treturn 0;
    ; |& w4 }+ \8 Q5 E" L# i4 w+ c! D}7 Z, H; O# C$ v) g1 r: A' c
    int drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)$ k" S, s6 {' @
    {
    ( e& e' F8 @" {5 |! O' H; ~/ ]static int info[11][3],num=0;4 X  q6 C+ {  `) X  m6 F
    int i=0,j=0,pos[10][3][2];
    ) M9 i7 |+ |, I8 s7 v- @float temp,t;6 W- m7 x( T) K, T  `
    info[num][0] = com;
    4 Q) W, p1 _+ ^" C7 Minfo[num][1] = wai;) V- A5 N' s; O# \% T+ D
    info[num++][2] = cha;5 \7 R* u; U1 |4 x
    if(num>10)  //存储10个点
    ! X% ~. q  l% |5 n8 F  f; c2 ^{
    0 D0 \8 L+ }6 G* Z( i3 bfor(i=0 ;i<10;i++)" B8 n7 V) t5 r+ B* \
    {7 u" D9 v4 w# J( |4 L) I
    info[0] = info[i+1][0];; J( ~; u4 s% D& m3 J
    info[1] = info[i+1][1];
    7 ?6 I4 H& B- h- o( ~. ], ?& o& G7 i9 |info[2] = info[i+1][2];
    ) B9 c- O3 G) [/ a4 U}5 X% n- ?& @: [2 Q% k+ o
    num--;
    ' C6 t/ e9 e) }6 s& s3 R}
    ) X7 j: N: D: q3 ^" U/ Nif(FLAG_show==0)
    : f+ Z7 Y8 [# P( g) L: P0 Lreturn 0;
    4 K0 y/ b6 J$ q( G5 {for(i=0; i<num; i++); c' G3 i' i0 ?
    {0 k$ V- P. p, A" H% }
    t = (float)info[0];8 q8 x' c8 ?# L
    temp = (t/101)*90;9 k* l0 h: o! j+ i( L/ x( C
    pos[0][0] = (10-num+i)*25+x+100;7 Q& x3 D& h4 J0 X
    pos[0][1] = y+110-(int)temp;
    9 g, G' O* K8 s7 bt = (float)info[1];/ T% R7 b8 m. j+ c. x
    temp = (t/101)*90;% Q% B. d" U3 |7 `. i
    pos[1][0] = (10-num+i)*25+x+100;6 n% I) w! D! b$ Q* a) q% n
    pos[1][1] = y+210-(int)temp;6 u& j+ r: l: O$ y$ T8 R; V
    t = (float)info[2];
    ) {  _4 j0 M. O  t# otemp = (float)(t/101)*90;5 v/ V4 ]6 Z* |% a
    pos[2][0] = (10-num+i)*25+x+100;1 N5 c) D" i# Y8 o, U
    pos[2][1] = y+310-(int)temp;
    ! ^2 |1 o6 W0 i6 }}
    : Q" M# C$ v& o$ g$ j: ?+ Dif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)9 `& o) p. B: Q9 [; b
    {! \0 C' v  Q0 X* z( J9 d1 |
    clearrectangle(x,y,x+400,y+315);
    2 c. J- z( r, U2 v* i+ @settextstyle(20, 10, _T("楷体"));
    " f1 X- N) i# E% O2 X+ M1 R+ orectangle(x,y,x+400,y+325);
    ) D5 c% h# h. ?% h8 h6 f) wouttextxy(x+40,y+10,"CPU");       //画柱状图
    1 C7 q, l/ L6 ]( }) ~; _& }outtextxy(x+45,y+10+100,"IO");: q" ^' n$ q2 w
    outtextxy(x+40-15,y+10+200,"change");
    ; f. R  v4 A  Wrectangle(x+35,y+30,x+75,y+110);
    % d, d1 P1 L! s( Z; }rectangle(x+35,y+130,x+75,y+210);3 y, j9 D( ^' C7 U
    rectangle(x+35,y+230,x+75,y+310);
    & V* q- m- v+ h/ O1 x+ e. I+ touttextxy(x+180,y+310,"HR");
    - p2 }! D# _! jt = (float)com;: B/ o5 }7 O1 a& q
    temp=(t/101)*80;& g4 z! ^, b# {. q% `4 X0 Z+ P/ {: r4 h
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);2 P- N5 M" T2 b# D- {5 U0 i9 ~
    t = (float)wai;
    & p3 O! h) o, i" e# |temp=(t/101)*80;9 d) @+ q4 Z. f3 D  @6 c" |. n7 u
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);, z$ Q1 u( Z: [
    t = (float)cha;5 h; ~' @1 i, `
    temp=(t/101)*80;  d+ ?* B- l  J. J" A
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    & N  f9 m+ i; hfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    / d; i; }' ~; o" H{- F/ s+ _; O& k+ t7 r4 y
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    . Q9 ~. z& F$ v) T9 _1 tline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    ' u. B+ y9 g" r9 X/ Oline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    2 Y# l& q3 G0 ^  w9 S% j& h+ {
    # I7 E6 D/ C( E- S9 [6 \line(x+100,y+110+100*i,x+100,y+20+100*i);* d; j4 G  n- o; J) V7 V# Z
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);) o* Z( h/ S3 u/ B
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    / l/ ^+ `( [) `2 z  [/ N1 }8 I, @for(j=0;j<num-1;j++)" B$ q9 S- x+ e' m1 a/ H
    {0 H; O8 F5 i- Q" e& o2 K
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);+ k( Y- F3 i: u, V# L( c, S) m/ S
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    4 Q# v8 R8 y; q8 m" g- u3 |line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 2 R0 ^" E* t( c/ X' \
    }
    ! j, X; |$ J6 E) ?! |( ?: G}
      n0 P6 {4 ]* h6 e/ ?3 {- m" r}' e# x" J3 n8 u6 o0 i" h' w
    else if(FLAG_HR==1)
    , ]8 O2 X$ |- w. m5 T. ^# `{& p! i. `9 {& J% u* {+ ?
    x=0,y=0;" ~  [1 c  b  R
    for(i=0; i<num; i++); A8 X9 Z8 ^. X- y1 X2 b* }! f
    {7 p1 e/ R! ]7 r5 v0 a/ g
    t = (float)info[0];$ j% \$ M4 u* r- v  T
    temp = (t/101)*180;, r6 ]& s" g9 q1 ?' e, ?
    pos[0][0] = (10-num+i)*50+x+650;7 r( D# y  X! O! T
    pos[0][1] = y+210-(int)temp;9 \; X! p& R0 ~% p# @( g
    t = (float)info[1];
    8 W/ g9 @) Y+ ltemp = (t/101)*180;
      S6 S: O; j  C) ypos[1][0] = (10-num+i)*50+x+650;
    0 c* [" j- R8 y! x/ ^pos[1][1] = y+420-(int)temp;
    $ s1 i! q# y7 }4 r5 \0 g; `t = (float)info[2];$ H; z, z, Z1 {- t7 L" m3 T
    temp = (float)(t/101)*180;
    . @( D% k( ~& [/ h( h6 L7 Z5 Ipos[2][0] = (10-num+i)*50+x+650;0 K' f) P. |; G0 F
    pos[2][1] = y+630-(int)temp;
    6 r0 K5 K2 ^. z$ j( `' e5 C) H, f}
    ( s. G7 h; P. R4 D& l. mclearrectangle(x,y,x+1200,y+650);+ `& I* a' M& g& H
    settextstyle(40, 20, _T("楷体"));
    & y+ @# t+ P! u7 Pouttextxy(x+50,y+50,"HR");- S5 k# ]' P4 `2 w) A
    outtextxy(x+280,y+20,"CPU");       //画柱状图- F# k: d0 x' w' f2 C1 u5 _4 Q
    outtextxy(x+285,y+20+200,"IO");9 N1 u* ^& \  E( |( T2 N1 d" b
    outtextxy(x+250,y+20+400,"change");+ W" J/ l& m0 b' c( J0 b; k1 j+ c
    rectangle(x+270,y+65,x+330,y+215);
    ! Y; W9 U; B4 Lrectangle(x+270,y+265,x+330,y+415);6 X( X1 |8 d, w: r+ e
    rectangle(x+270,y+465,x+330,y+615);
    , `* s7 q% E% ]* |% b' Wouttextxy(x+290,y+620,"TT");! Y' [3 J. b! m' c" `
    t = (float)com;& [. |/ Z  m( n6 S" q+ k
    temp=(t/101)*150;' Z( @$ `: k: y: N& S5 V) l# d
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    ; @4 M5 v% Q3 @4 p% e2 Q& O5 ?t = (float)wai;
    ! {# J7 u0 @0 Btemp=(t/101)*150;
    # ^; p% h- }( {9 p* T. Vfillrectangle(x+270,y+415-(int)temp,x+330,y+415);. a. k: Y, e0 z3 J; L7 w3 D9 o4 [
    t = (float)cha;
    + w9 @1 e) g7 l" ztemp=(t/101)*150;
    ) I. N: l1 {% ^' afillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    2 |  x; k; _$ M' v) Ofor(i=0; i<3; i++)   //画坐标   high=90,length=250
    + ?8 \  x: N9 B{
    9 m8 P; Q" J" _* |" x: f( Dline(x+650,y+210+210*i,x+1150,y+210+210*i);) l0 u, U- F& {, m$ [* I* `
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);# e  P5 a+ o! i2 C+ x0 I
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);  A& t9 M, ~' q* K9 x  C9 v
    ) H& l+ y$ z, Z3 @! F/ Y' l
    line(x+650,y+210+210*i,x+650,y+20+210*i);0 K. z7 e7 i$ M( m9 A1 u! Z
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    2 F7 u8 R9 ^4 Mline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    ! s: ^; w( _* Nfor(j=0;j<num-1;j++)7 g, B# Y1 ]4 X# C0 g/ O
    {3 D3 e* {7 O$ {7 V8 S% N
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    4 _. J( u6 O* H2 N: O( G' @3 Jline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    . |% b" b& @0 g* |, j! P+ a$ M. m. }! tline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 8 b- ]7 f# O9 W( [. ^" Z; [
    }2 O. l6 T; a/ z$ g. D9 V
    }: H" L! G6 x3 Y2 ~- d& p# A3 m
    }
    4 x! F+ W* q" w" i3 Z( N* G/ }6 ~! s5 {" q% a5 ?" H( |% _5 N) O5 h

    ' V/ [3 l1 _2 c) X, mreturn 0;  h% |/ O! \5 F' B' x
    }: X) H" x5 r8 t' s; v
    int drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)3 {. B; @% T3 g! S! D
    {
    4 L3 }. O- q" r# \: V7 s, Astatic int info[11][3],num=0;
    3 k0 {, U5 i7 k' L( M8 Sint i=0,j=0,pos[10][3][2];$ s- i( B! ^/ V6 E
    float temp,t;
      O" _5 i% J1 V! m! Kinfo[num][0] = com;' B' R9 Y7 ^9 e0 ^( r! Q' I' y
    info[num][1] = wai;
    - J9 }+ B! k* y" s) Ninfo[num++][2] = cha;
    9 ?( g7 w4 y3 @% Z; e+ Uif(num>10)  //存储10个点/ C4 E7 x$ ~' g. B7 Q
    {& U: [* e, _' V0 o3 d- A! l
    for(i=0 ;i<10;i++)5 ?, f% g, `: ]9 R! u0 A5 ^
    {1 b9 ^0 A, _; c
    info[0] = info[i+1][0];
    6 \% N" a; W- Q- rinfo[1] = info[i+1][1];* u6 }( [9 M' w8 ?- M% |' s
    info[2] = info[i+1][2];" C' ]/ N  W2 D; T2 E
    }0 r( V9 b3 J" ?
    num--;: J5 h( Z1 Q) A. u% N3 m  x4 k
    }' {3 S$ n0 s1 v# d8 Q' X7 ~
    if(FLAG_show==0). \$ F( \7 k8 X) U) @
    return 0;
    ( G5 U- U0 W7 o$ o# Y& |for(i=0; i<num; i++)
    3 |( y9 J# W% [; E9 v{/ s- o# F" n# h( s3 [+ I0 O: F! h
    t = (float)info[0];6 O! b8 D9 l# g- I: X: ?. t
    temp = (t/101)*90;9 `: F) s4 f  \4 x0 ?3 q
    pos[0][0] = (10-num+i)*25+x+100;
    % H( w0 u4 X( e* ^( B2 apos[0][1] = y+110-(int)temp;
      e& ~# o; F3 {  J: it = (float)info[1];8 L' Q+ U6 C1 F
    temp = (t/101)*90;
    ) C# _; l& F  Z. Y. x  [8 q2 zpos[1][0] = (10-num+i)*25+x+100;% ]0 ^6 q  s. X
    pos[1][1] = y+210-(int)temp;
    4 r- l! A4 F4 R( z# [5 m8 Ut = (float)info[2];
    % t2 ^: q: n4 f4 J8 Qtemp = (float)(t/101)*90;
    1 n3 E) S. P9 Wpos[2][0] = (10-num+i)*25+x+100;
    ' M( C" ]2 {% T: S% w9 n3 s! ypos[2][1] = y+310-(int)temp;# D- v8 K  C' c7 h: K
    }
    ) X6 {6 [1 G% m+ v% F9 nif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    / U$ g, d8 m4 M' M3 }5 c% g{
    $ B- p; r+ P2 U; B' e6 h& nclearrectangle(x,y,x+400,y+315);8 U6 B' s6 G7 A% o8 w$ f3 P! ^  V
    settextstyle(20, 10, _T("楷体"));5 L! D9 I8 r) d: x) I
    rectangle(x,y,x+400,y+325);; \% A! n; j9 B+ u, |& m
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    8 n2 L$ Y3 p1 r, c2 L" ~outtextxy(x+45,y+10+100,"IO");
    . G4 H1 o9 T; fouttextxy(x+40-15,y+10+200,"change");
    # V/ S9 c& ^( y  `" yrectangle(x+35,y+30,x+75,y+110);
    8 S4 S7 s( B3 W; T  O" @rectangle(x+35,y+130,x+75,y+210);
    4 \. e0 g& ?. y4 n3 i% ?: S: T' Brectangle(x+35,y+230,x+75,y+310);
    7 V6 r- x: u- x+ jouttextxy(x+180,y+310,"TT");
    # F. s2 C" |! o4 @! q, Gt = (float)com;% G7 |. `* }; j: S4 P
    temp=(t/101)*80;
    + n! I, n( M, Z4 G% Cfillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    % ~6 R9 M) t9 E5 b1 W! C. J1 f& ot = (float)wai;
    5 [: g" f- B4 g. rtemp=(t/101)*80;: h& q5 W! j3 |7 I' y& H" r5 T4 S
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);" l( y2 {- d# Z+ Y2 I% J
    t = (float)cha;
    4 Z$ E1 b! t( K7 m: k5 }temp=(t/101)*80;
    * W) S, A$ J+ T6 y7 Kfillrectangle(x+35,y+310-(int)temp,x+75,y+310);  W1 e2 a7 _8 K1 _
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    ! }' J0 E8 F+ K3 G5 p{
    4 h" D# E: ~) k  s, \' Uline(x+100,y+110+100*i,x+350,y+110+100*i);1 ^, M- a$ U2 s8 T8 f4 o8 k
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    # c" v: w  t( H4 K' Mline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    : S0 [9 A; K* i, G' h: W+ Q9 T
    / J. y# Q% }! p( Vline(x+100,y+110+100*i,x+100,y+20+100*i);
    6 g: Z* w9 P' ^0 g+ }% k' Dline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);6 J9 V) N3 C9 y. I0 i4 x1 l& n
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);( A4 Q& x: _% g6 h
    for(j=0;j<num-1;j++)
    * i  {1 @4 o( D6 `2 `' \{
    ! F3 b9 p2 s, n- D1 \! rline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);; e4 {0 |+ t7 x5 E! b% ^/ [7 Q7 [' A
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    " `% W% j6 l6 W/ C: L0 ~line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    2 S. i/ P, `2 p% J* `, A$ a}
    $ Y0 M. _0 s; g) c}
    0 J6 J( J  B6 ^}2 E6 y7 t! p! @/ ]- S5 T& A
    else if(FLAG_TT==1)8 Y5 g/ B# T7 D% {8 l7 H1 `( `
    {
    - i3 f7 ?  U- Px=0,y=0;
    + z4 _+ N4 x$ Y3 \& xfor(i=0; i<num; i++)' O8 p5 j. I6 y0 f3 P. A; T9 I
    {
    " X, C5 D6 o+ i0 e/ m; Dt = (float)info[0];
    , a. V# V5 s1 A8 y( p3 Z! qtemp = (t/101)*180;" f2 ]+ M0 C6 i6 J& Y4 y5 J  g* R
    pos[0][0] = (10-num+i)*50+x+650;
    + v9 K& Y* C; r* fpos[0][1] = y+210-(int)temp;
    0 Q* `  w8 F, U$ m* V, Ht = (float)info[1];
    , F# F4 T0 a( u7 ~temp = (t/101)*180;
    2 L& T" b( x  p9 u" dpos[1][0] = (10-num+i)*50+x+650;
    8 a" r* g5 l% B7 U( \6 f* npos[1][1] = y+420-(int)temp;  `2 ^: |! g0 E' s' r
    t = (float)info[2];, R2 {' Y- y7 y% f3 |, A6 d
    temp = (float)(t/101)*180;5 X8 K9 G0 ?9 s" B' d
    pos[2][0] = (10-num+i)*50+x+650;- Q2 _! \/ @& A0 w) T/ k
    pos[2][1] = y+630-(int)temp;
    8 S9 i$ T3 N5 x. G0 i$ y$ ?}  s" U: b; D7 R' \0 b* q& q) [
    clearrectangle(x,y,x+1200,y+650);
    : |$ V7 Z# q- B) X! [settextstyle(40, 20, _T("楷体"));7 [5 G) H; G( V! y  h" o
    outtextxy(x+50,y+50,"TT");9 T0 m1 f3 z6 }6 }& a  `1 r
    outtextxy(x+280,y+20,"CPU");       //画柱状图* [! f; N+ c) N4 Q* U' s
    outtextxy(x+285,y+20+200,"IO");
    & }, d0 @  V/ D+ v& Y% zouttextxy(x+250,y+20+400,"change");) [' y3 b$ X; o, Y2 \9 o1 l
    rectangle(x+270,y+65,x+330,y+215);
    3 K% U: n* u2 [( [/ rrectangle(x+270,y+265,x+330,y+415);
    2 {% u3 X0 G+ crectangle(x+270,y+465,x+330,y+615);8 e, @; K' j+ X) Q) x8 @! |% U+ q
    outtextxy(x+290,y+620,"TT");( S+ T' z* {# N* `1 c& p$ O
    t = (float)com;' W  l2 ], s" g3 l% B
    temp=(t/101)*150;
    5 B. l( d, l- _6 P7 L' w, bfillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    1 Z: P$ z- }( b. Pt = (float)wai;
    5 ^' J$ D2 z/ M$ ntemp=(t/101)*150;
    4 C2 W3 C8 q1 [- |6 \; y' Ifillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    + J; [2 M, n3 J' H( N8 at = (float)cha;* P( {! R1 R: t6 o8 P) a& }
    temp=(t/101)*150;, `* n$ {2 ^" f, p
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    2 ]2 p7 q' O5 q4 f# \! p2 o' ffor(i=0; i<3; i++)   //画坐标   high=90,length=250
    & [( [1 S) j% }( h9 S3 v1 I6 j{" ~1 A) i0 o3 d2 b, B
    line(x+650,y+210+210*i,x+1150,y+210+210*i);
    8 C; K8 C& y5 H, R0 `line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    : h, C: k9 _+ dline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);& P# b$ P& I) Z$ h; t1 e- ~
    & M& h( U" p4 q& B: Q( Z4 L, Q, z; G) Z
    line(x+650,y+210+210*i,x+650,y+20+210*i);) k3 g- Q6 v' C7 k7 ~( l, n' Q
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);# Q5 t! H3 r& |4 k1 {) W
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    / U7 W1 ~1 X1 N# _% jfor(j=0;j<num-1;j++)
    0 Q2 j& K9 H$ p  i" H& \1 C( i{& r4 d' f7 ?! r! {
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    5 E) z8 D. I) J( Uline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);: h- \4 H8 ?3 o3 o8 U8 I6 I
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 2 D$ p/ _( C# O
    }* ?/ v7 U/ o' X0 L$ Z0 N9 o5 X9 F0 _  s9 d1 o
    }
    4 V1 u! n& m7 ^  u}& a& M9 m6 [+ f, A
    & |' q4 m1 j8 k! R: e) ]

    # l. G: L% ^$ z8 dreturn 0;4 D$ `/ V& U( W0 `
    }" c: g% [5 q; H: K
    int drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)
    9 l. f8 N3 Z+ ^* T. t/ V{$ E  P* E' ]: I, {( G9 Q& x
    static int info[11][3],num=0;
    7 ?4 O& W- w' {int i=0,j=0,pos[10][3][2];! P- q. m1 k/ K+ _# n+ k
    float temp,t;
    * [0 a+ T2 o: f7 @6 finfo[num][0] = com;, _) _+ C5 k3 K
    info[num][1] = wai;. u' k$ F6 f. g0 ]
    info[num++][2] = cha;
    # d2 q* D/ Y# i  Iif(num>10)  //存储10个点& u+ O' L/ k; C" d+ P; S/ g1 E/ Y" t* J
    {
    2 D9 ]- W- c& [( cfor(i=0 ;i<10;i++)6 T/ p! T* E7 x7 V/ q9 {" P
    {
    : N4 T2 c* K& E# A* b; L7 Ainfo[0] = info[i+1][0];2 C7 A! G' t; o$ V% r( ^5 |
    info[1] = info[i+1][1];- ~( N& [5 w" h1 ]3 F4 {' h
    info[2] = info[i+1][2];
    5 H4 F4 L5 z- a& B" w# P6 P}! S1 R6 \# w  |0 m
    num--;3 ]  u+ C. \( c2 X4 E- G. c& V
    }
    1 S2 `1 W" O! R6 _3 @9 a; xif(FLAG_show==0)
    ! J# p9 R7 c0 lreturn 0;# d5 M) J! F1 q4 _% c
    for(i=0; i<num; i++)* X/ L1 S- S9 g7 u! ^$ U6 B8 e- v
    {* ~3 ]  F( ?( J, o- ^
    t = (float)info[0];  |3 a  `2 R5 q
    temp = (t/101)*90;
    9 J* u6 ?2 W. N$ B! y1 }pos[0][0] = (10-num+i)*25+x+100;% y4 `- f/ G; T* A. ]
    pos[0][1] = y+110-(int)temp;
    ! C: L' Z3 ~% @. t9 Xt = (float)info[1];7 n/ Y1 N: F7 Y& @+ Q. _# N
    temp = (t/101)*90;8 z$ I8 q# U# j& f8 `% |
    pos[1][0] = (10-num+i)*25+x+100;) M( k$ a$ ]+ i: B2 ]! d$ c
    pos[1][1] = y+210-(int)temp;
    1 ]: _8 j6 F( [1 P7 ?" v! Vt = (float)info[2];: P% d* C; n& W9 K% p& |3 ?' n) ~. @
    temp = (float)(t/101)*90;
    4 Q2 K) r) `. g1 s$ D/ b! vpos[2][0] = (10-num+i)*25+x+100;
    / w, k; c, @0 Q3 Ppos[2][1] = y+310-(int)temp;
    + h3 z  Q; B3 P}
    & U# c$ e3 E- f* G( L8 I4 s, Jif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)$ u& r' l% o( {8 e. x9 L
    {, X# C5 E' H: l3 _) r4 X- i
    clearrectangle(x,y,x+400,y+315);
    7 \% a* r3 c! D1 Z7 B. ^+ m# x% H( Esettextstyle(20, 10, _T("楷体"));1 P( H3 |5 ^: M- \4 }3 ]) {6 H3 i
    rectangle(x,y,x+400,y+325);9 a2 B2 f9 H) w0 Y; z' R
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    1 R# l4 q6 C* [: A* L4 Couttextxy(x+45,y+10+100,"IO");
    4 q/ R8 y9 a( O3 t& D2 ^( m% D1 Mouttextxy(x+40-15,y+10+200,"change");  c- a1 ?( X5 G9 E+ k" m2 O
    rectangle(x+35,y+30,x+75,y+110);
    1 u- I: J+ L9 h7 y+ T; H8 _9 {rectangle(x+35,y+130,x+75,y+210);* v$ i, C0 @( Y1 f! D
    rectangle(x+35,y+230,x+75,y+310);
    1 Q8 \( F3 T$ A7 e& iouttextxy(x+180,y+310,"PF");
    0 V9 }9 ?( x3 t# `; J: Kt = (float)com;8 d, M/ Z- [8 v, A3 O
    temp=(t/101)*80;
    " s) Z% N/ i3 A4 T& G; Cfillrectangle(x+35,y+110-(int)temp,x+75,y+110);. x9 h& N$ D4 {8 K& \& S
    t = (float)wai;9 p8 _  R+ X; J2 i( Z# N" }: C
    temp=(t/101)*80;, `& ?& H! q' m' ^/ m
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
      h- h- i8 b6 r# e: [% Z3 pt = (float)cha;4 I+ J$ {4 c9 S$ Z3 d' V2 W
    temp=(t/101)*80;! D8 _; ^! k+ ]
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    " y& a2 I" e* x0 X* o" {for(i=0; i<3; i++)   //画坐标   high=90,length=250
    + i9 G5 n" |9 q. \{
    5 V% @/ y) e; J: [& Yline(x+100,y+110+100*i,x+350,y+110+100*i);
    ! s$ m* a3 o  t( G  `$ E+ |! Kline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);7 B# h& `& t! U! t3 ~& K6 i* z
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);- w+ z5 r. v( A/ _6 b1 c- T

    & O' Z* M* A* u' @. sline(x+100,y+110+100*i,x+100,y+20+100*i);' o& a' B* E+ a; y" `- c  T
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    $ e9 Y# Z! h0 i2 C5 M8 p4 Nline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    9 s/ K, @: T) s# j  Gfor(j=0;j<num-1;j++)
    4 _3 ?+ r* h2 s; m! n{: R; u! Y) x4 j
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);6 A; ^5 d( i' q% n% n1 M
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    ( c& {4 Z  j! i5 \* |line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    0 S$ g  r; {# X0 H1 D! y/ J}0 Z. I5 |$ N! }) Y7 {( c
    }
    9 d/ ~. G5 b. R}$ V4 f/ ^, D! K& k: B% s
    else if(FLAG_PF==1)
    3 ^8 _$ {: P: q6 b{
    2 C* `& ~/ B0 v2 Ux=0,y=0;2 d; E# E0 o7 O- \  V/ E$ N
    for(i=0; i<num; i++)+ g5 \  v$ L$ [
    {2 O7 v5 g1 x2 F/ i! D( m% @3 y5 w
    t = (float)info[0];- z; Z7 R) t0 E: _9 R( N/ ?" ~
    temp = (t/101)*180;
    , I( a% w: \2 `" _0 Opos[0][0] = (10-num+i)*50+x+650;* K  T5 a8 T  y. F4 h$ f
    pos[0][1] = y+210-(int)temp;
    , Q4 @# ?$ ^8 E- z2 J9 ^t = (float)info[1];
    " j1 P0 Z5 [8 n$ y6 Ctemp = (t/101)*180;
    0 }& Q$ M' a5 V& v" t! Dpos[1][0] = (10-num+i)*50+x+650;, D0 [+ X) t9 p  k
    pos[1][1] = y+420-(int)temp;7 n: R% I# ?0 U& t5 j
    t = (float)info[2];
    / k' X4 y* U0 |) ]temp = (float)(t/101)*180;7 \! O- ^8 I. c; N
    pos[2][0] = (10-num+i)*50+x+650;
    2 |$ c# h& j0 K% V2 t; Opos[2][1] = y+630-(int)temp;
    2 u4 Q" k; u( n% S7 u* S9 R}
    # n; w9 T' U0 x% \# Bclearrectangle(x,y,x+1200,y+650);# u3 p9 o0 q, H+ y" Y; d0 W
    settextstyle(40, 20, _T("楷体"));: Y3 l' a  t& b7 P" z
    outtextxy(x+50,y+50,"PF");3 R  z+ U6 F4 o" H( X
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    ( @; e7 ~) L* {' Iouttextxy(x+285,y+20+200,"IO");) [* L" z( {2 ?, @, ]
    outtextxy(x+250,y+20+400,"change");
    3 C/ i. W) y+ z5 q* @, y5 arectangle(x+270,y+65,x+330,y+215);' x0 h- ?$ B; ?3 |
    rectangle(x+270,y+265,x+330,y+415);2 S& ?; s! }/ y" r6 ^8 ]
    rectangle(x+270,y+465,x+330,y+615);
    % ~6 h8 C8 b$ K) E: gouttextxy(x+290,y+620,"TT");. ?# O/ f( t7 a" B% G8 ?' t: H
    t = (float)com;
    2 s: B$ x$ j7 N3 s1 Qtemp=(t/101)*150;
      @% j3 Y/ A+ b3 y7 f/ ~fillrectangle(x+270,y+215-(int)temp,x+330,y+215);7 j, y+ I% M; X
    t = (float)wai;
    - b( H6 [5 |5 m) x) l! d+ otemp=(t/101)*150;
    : |" S) f* n6 A' {7 [& ]" t( H$ K( efillrectangle(x+270,y+415-(int)temp,x+330,y+415);; |$ I: v+ m( m% C' \
    t = (float)cha;
    6 I7 x: I4 {0 F8 j/ |temp=(t/101)*150;
    5 A- e% L$ R7 cfillrectangle(x+270,y+615-(int)temp,x+330,y+615);$ }* Z2 l! u1 Z; [/ p5 \8 M* I
    for(i=0; i<3; i++)   //画坐标   high=90,length=250" M( A+ D3 {$ s% o+ \0 n
    {
    1 {! ]3 Q+ j5 `1 J! Dline(x+650,y+210+210*i,x+1150,y+210+210*i);5 C* S; P2 a4 o' o. X; z$ y2 T
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    " }9 x2 {! I/ w, ^2 R7 rline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    % x* V9 x  m9 w) d) p8 N# q: ~4 T, {4 [
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    & x% }' e$ ^! P, ]" jline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    1 `, `& N0 M! `6 W0 qline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    " ^! I+ v! l* u' o; F1 zfor(j=0;j<num-1;j++)% h% V) G$ I7 {( Y/ L5 o# e2 M5 {& j
    {" @; j4 p& Q) `! G) ~. i6 o
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);# f. |0 q- L  a/ Q! f
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    2 G7 B2 V4 a+ d1 a1 U8 jline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    8 l% f; G. P+ L3 b; y" f}. |  ?! y2 P- F% k' u! {" x
    }9 L$ K& c" _% B2 f2 q
    }
    9 u% @4 [( V* u1 ~0 [9 }% w6 }return 0;7 U' R5 r3 L7 B' h. q. v; t0 I6 E* q
    }
    + S) V0 Z3 s+ T2 v* Qint drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha)3 E0 Q3 s7 Q2 M. |- J, z
    {
    7 y6 T) e. H+ M  ~. T) hstatic int info[11][3],num=0;/ r, t& s: k: m9 F( A: B" B$ u
    int i=0,j=0,pos[10][3][2];
    5 v; s+ L7 a' l+ Hfloat temp,t;- t  U1 m9 M# m' N/ s# {9 A4 r3 T9 f
    info[num][0] = com;
    : g8 q. \4 [. v. }info[num][1] = wai;  K. c+ B$ I1 ]0 \7 {6 A
    info[num++][2] = cha;$ D; Y: e, y* F) z: @
    if(num>10)  //存储10个点
    5 [- \& l5 U7 J* }5 n. K& ~{, p( l- }0 |" M2 i7 P% X2 f. z5 [
    for(i=0 ;i<10;i++)
    ' p- {8 A1 _9 Z$ z{$ a! u1 q$ F: q! K
    info[0] = info[i+1][0];
    : N- u9 m" G3 V& H' ]info[1] = info[i+1][1];* r# f# Q2 B8 W( p3 c1 A4 A
    info[2] = info[i+1][2];9 B; ?4 \- _8 e* b* |$ O( d
    }
    3 y) @5 t7 m* q# p! C& mnum--;! ~( I% k4 _# ]
    }- V4 d' z& l. G
    if(FLAG_show==0)
    2 ~% d6 W) O- @! B+ H3 R/ Kreturn 0;
    : b1 a: k9 u& u6 @. d+ Kfor(i=0; i<num; i++)$ ^( N" d3 b" m
    {' z% ]# Q  g" d: V( s
    t = (float)info[0];
    ! {  z" j; c, j2 f- v3 btemp = (t/101)*90;
    + t7 k9 ?  y6 Y  jpos[0][0] = (10-num+i)*25+x+100;0 G- j% ]4 y8 c, k
    pos[0][1] = y+110-(int)temp;
    - Z; r* l# S. }3 k" {t = (float)info[1];# o$ X& ?7 P1 O% ~1 u- o$ |
    temp = (t/101)*90;1 y* V! j4 q  k9 X0 N
    pos[1][0] = (10-num+i)*25+x+100;- W! s% |- M4 U* {0 t
    pos[1][1] = y+210-(int)temp;
    4 ~0 I) d" g2 ^4 V! ]% Dt = (float)info[2];6 a. X% z8 u2 L' s
    temp = (float)(t/101)*90;
    ) @+ l& J  o& `& spos[2][0] = (10-num+i)*25+x+100;
    5 E0 \7 ]  P* A) n" `- J4 {pos[2][1] = y+310-(int)temp;
    # @$ |5 E' Y) n& }* r% ]5 `5 V( M' x}0 `% s# x$ X" I0 Q
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    & e6 k  e5 s  H7 B% N; t6 L) E2 f{
    5 s& @) U* `2 K7 }clearrectangle(x,y,x+400,y+315);
    % V" t* `: E: X7 ^settextstyle(20, 10, _T("楷体"));3 G) |- |6 {6 r; e3 K1 p0 u  G/ {7 c
    rectangle(x,y,x+400,y+325);
    9 x& r) [  ?; B( ^4 @2 iouttextxy(x+40,y+10,"CPU");       //画柱状图/ j. a, ]& l0 y+ h! c, ^
    outtextxy(x+45,y+10+100,"IO");0 L* E0 u; H" _8 M: N( _( [
    outtextxy(x+40-15,y+10+200,"change");& ?; v1 a6 s! d. Z# u
    rectangle(x+35,y+30,x+75,y+110);$ x5 ?$ G8 w4 \
    rectangle(x+35,y+130,x+75,y+210);
    ( e: u/ l$ t2 Q5 y1 arectangle(x+35,y+230,x+75,y+310);* Q$ f/ m% T3 k4 A
    outtextxy(x+180,y+310,"SJF");
    ' Y9 r6 V2 G# O5 x- ], G) W" Et = (float)com;& z& X4 d6 D& D( G
    temp=(t/101)*80;
    / A% o9 C8 J. J$ l+ r7 n6 A$ zfillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    2 c. O' E' E3 R+ z, W/ a; ?" ct = (float)wai;7 F* Q7 }+ ^/ G0 Z$ d9 z
    temp=(t/101)*80;
    ( t0 J1 N. B. ~fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    * k: T+ @7 v9 e! |% ht = (float)cha;
    + O8 W+ Z8 \# N% btemp=(t/101)*80;
    2 \, o8 C5 b( o$ O4 X4 Yfillrectangle(x+35,y+310-(int)temp,x+75,y+310);( ~9 M6 q2 n  Y5 b. t
    for(i=0; i<3; i++)   //画坐标   high=90,length=2502 H# G3 J: ]2 i7 `1 u, |  B
    {
    ) W$ _7 R0 |# Kline(x+100,y+110+100*i,x+350,y+110+100*i);
    , R8 }8 n4 R( g; tline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);# J+ j1 V4 u( i: x
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);: x  [$ M" J/ t- Q) O
    6 c0 i6 p6 x5 u, }% t+ I
    line(x+100,y+110+100*i,x+100,y+20+100*i);4 m. b" p8 o" x7 u$ Y5 x* E+ @
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    & {8 U7 T! w. A, O, X0 Y. j7 uline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);- Y' ?; D, u. V1 C4 `7 q2 ]3 x
    for(j=0;j<num-1;j++)" _- k! H1 S+ Y+ q8 P! m0 c
    {4 k! d* n- j8 Y3 z
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    3 p' Q3 V, D9 vline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);, ?7 K2 a( v/ C+ e0 P
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 8 Q0 W1 S- R0 c( z8 X& v8 S. P
    }" X- u# `5 d: v/ t4 |! ^7 V6 K
    }
    * Z9 q1 s' j6 s) w: K}0 J: m. q' v0 D. D* W' a% _( D( u
    else if(FLAG_SJF==1)4 ^" }& V5 }& G! @/ {
    {
    ; B7 W/ f# V! sx=0,y=0;1 ]$ s* W/ ]# r3 o
    for(i=0; i<num; i++)
    % T' w" m) a0 H6 Y& K0 w" R# }5 Q0 C8 k{$ A% H7 n7 d& M# \
    t = (float)info[0];
    4 d( P/ T! r. \% m3 h, U/ Etemp = (t/101)*180;) Y' R2 B5 f; R- i* i
    pos[0][0] = (10-num+i)*50+x+650;
    6 U; w( t9 k+ c* q/ i" Opos[0][1] = y+210-(int)temp;
    4 K! @" n% L7 L6 f9 E: U4 A& mt = (float)info[1];7 t9 a) X3 R; `
    temp = (t/101)*180;" T3 L7 V& z8 c$ B4 `
    pos[1][0] = (10-num+i)*50+x+650;& K4 M7 E3 f7 P* M7 K
    pos[1][1] = y+420-(int)temp;. H9 T( p% Z8 w7 \
    t = (float)info[2];: q9 b3 v* f' [& s3 A
    temp = (float)(t/101)*180;
    9 e: k2 J% z4 ~7 e- {* ipos[2][0] = (10-num+i)*50+x+650;
    ' R) a" B9 t; c9 zpos[2][1] = y+630-(int)temp;
    - q- m" Z$ e' b5 q. m}" C1 _' b- k* O7 S
    clearrectangle(x,y,x+1200,y+650);0 q7 w6 W+ V8 y1 _3 [5 `
    settextstyle(40, 20, _T("楷体"));3 Y6 F6 F/ s4 G/ e: n3 Q% p2 f
    outtextxy(x+50,y+50,"SJF");! i  b+ ?) h' h$ x$ b
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    * c9 S  B. K" Y% ?" t* Oouttextxy(x+285,y+20+200,"IO");8 ^0 l& h5 Q; F6 m  k
    outtextxy(x+250,y+20+400,"change");- @, f, @! z  _9 R" Q2 M6 y" S' e
    rectangle(x+270,y+65,x+330,y+215);( b, |, Z1 W4 w' R
    rectangle(x+270,y+265,x+330,y+415);
    + H/ l/ b: h; j& C, trectangle(x+270,y+465,x+330,y+615);* ^1 s7 v9 U& W. B
    outtextxy(x+290,y+620,"TT");
    ' n1 P( w8 L. T* v' Et = (float)com;- r7 p6 y. S8 A* f. J) L
    temp=(t/101)*150;
    , O% S5 ]+ h1 C* X6 nfillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    " _, L+ ^( x$ _: a! Tt = (float)wai;! k) Z) b) {+ l0 c0 |; G9 ?5 V9 y
    temp=(t/101)*150;/ Y% @! E: I! ^0 M. ~. I: E& r% M
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);4 p7 i& N9 I+ F' V' r' u+ }: E
    t = (float)cha;
    # c, }0 n; Y7 R1 o0 M& Jtemp=(t/101)*150;
    0 w! |  w' p; K) k$ H/ ?fillrectangle(x+270,y+615-(int)temp,x+330,y+615);5 @# L# ?  X, k6 u2 N( M
    for(i=0; i<3; i++)   //画坐标   high=90,length=2509 [$ ~8 l# o) a5 [7 j1 L# K: G/ ~1 b1 I
    {
    8 X+ b0 j0 O$ X* b4 bline(x+650,y+210+210*i,x+1150,y+210+210*i);
    - [" _( f% C+ r* V5 Kline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);) g" L% C1 _, ~; f: x% L
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    * x' [+ h3 h6 ?& m1 S/ L8 `0 J8 P; }# A: N7 J3 h  B* C
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    2 k  v" x# g3 L+ O9 W7 i( iline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    . E4 V4 S( W3 Rline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    9 x( r: a: O/ efor(j=0;j<num-1;j++)8 x! U3 [/ U. {# k( h2 @
    {
    ! d6 n4 R7 {5 |/ Mline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);8 y' E! L- u+ \* G9 [
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    # U0 s. \8 B7 g/ D5 a$ [4 K! Tline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    2 ]- E8 z( T5 ^" o) ~}
    ' l. @4 x( V, x$ y! a}
    , G1 N" X6 D. L& a}
    * @# X) c& g' @return 0;9 [' _% S0 c) Y& }( t
    }
    5 z! M* V. g% N- B8 X4 L" Tint High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)2 t" O! _  J( _& H+ S* L+ X8 I5 {
    {
    7 _8 g6 O2 T4 ^8 fstatic int compute=0,waitio=0,change=0;
    5 Q8 c9 u3 a9 b9 ~* H- Gstatic int computeLast=0,waitioLast=0,changeLast=0;. G9 X/ P0 H3 e
    int i=0;9 B# B, h3 o$ J( Q, t3 g
    if(draw==1)# r( K% d3 X) S, v1 V
    {
    + f% Q% {' C; ~//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);" P+ b$ f5 O- C! N" h3 y
    drawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);4 m: ~' U1 w$ s
    computeLast=compute;6 l5 o+ u8 k; }* P5 l
    waitioLast=waitio;: s$ V; a2 F) }& A% x' L
    changeLast=change;! J, L& \" J* c! [: o+ n+ E% p
    }
    . t4 g: h( u4 ^, `- zif((* memory).p[0].flag==ready)
    ; j) O$ D6 {- A3 a1 H! d1 _# v) \8 W(* memory).p[0].flag=computing;6 S! M: {3 S/ a. O
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    5 n. @4 B  [. _{6 _$ `) [+ M7 W, C2 L3 b& n
    i=(*memory).p[0].computeNum;
    5 L+ B1 |& s  Q: Wif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed
    / M0 j2 ~  g: f9 ]; f{
    & N# h6 o  }8 X+ @(*memory).p[0].flag=IO_waiting;
    & R8 C% ^" E  p! x(*memory).p[0].computeNum--;
    ! c4 X3 ^9 w+ ?6 ^change += exchange_IO_Compute;
    4 {% X, ~: H1 pcompute++;$ d8 i1 ?2 v' d/ ^. N* S6 ]
    }
    3 E+ G2 I1 o4 i% O. w) U- Qelse
    + o, S1 x; T4 Z3 c. n5 H{9 J" Q" [3 {8 [* T
    compute++;( Q6 Z: z* }8 ?! W% R4 F# a' t
    }
    . Z9 z! G! h. p( A& C" G  E}
    1 z- c/ T, N8 r9 j! [9 }else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting). I) s# A- L6 \, z% ~0 t
    {
    ) Y2 o9 r5 \- T# R7 i
    4 f% s( b4 H" J- a8 M2 @% Ki=(*memory).p[0].ioNum;2 d7 R. _2 R- F7 ~' }3 b. q
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    0 ^5 N/ F$ k6 g$ ?" t2 m& h{' [/ M9 O7 t9 |, {/ a& B: w
    (*memory).p[0].flag=computing;
      q7 E7 ^1 r7 W3 `. |. e2 l(*memory).p[0].ioNum--;& J' N* j4 h) w, U) ~4 s; _4 ~. r- {
    change += exchange_IO_Compute;
    ( e% L& Q- q8 O! Swaitio++;. ]; N) W( x0 g3 ^
    }+ B0 j4 I/ g* h- n
    else
    & r. Q! z: q6 x- G9 ~{
    4 M, \; ?4 t8 y5 f) [3 Z' I, Lwaitio++;
    / y0 O2 N5 A; @2 ]) W; W}
    ) {! L  U4 D& Z% ^  _1 O}3 @9 ?- b# R, F/ n$ o
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    8 g# V- q' ~: e! Z{; Z% }9 }+ ~! |: R4 C0 m4 n
    (* memory).p[0].flag=IO_waiting;
    / A* @: \0 S  J% i& c$ J) Uchange += exchange_IO_Compute;
    : V0 E' H5 d, X- W}4 w7 M6 u  m$ ^5 x$ n( _1 N" q
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)8 A% K# p* Q- D  I3 S
    {
    3 a9 S; b) I/ t- e& o+ b! S(* memory).p[0].flag=computing;' R, Y' O1 s6 ~: [8 i0 B( s
    change += exchange_IO_Compute;7 c7 B+ Q0 `- s8 i7 B- G
    }
    & Z) H2 Z6 s- {) vif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    8 H1 T" O: V; O/ ?( [# y{
    % d& z* o0 [( I(*save) = (PCI*)malloc(sizeof(PCI));
    0 p) F# J9 [2 ~+ I1 L4 i(*save)->next = NULL;
    8 Q' m  @/ H5 m) f1 c- X& i- s* C7 b" @(*save)->processID = (*memory).p[0].processID;! f4 K# z. P' K- m) w
    (*save)->comeingTime = (*memory).p[0].produceTime;
    ( q  R7 i9 o' n4 E, E6 @8 G(*save)->askMemory = (*memory).p[0].askMemory;
    ; m7 P/ P) V' N: z5 f- S: e. n- h' u1 p(*save)->compute = compute;
    , a0 u/ o" O' s4 T' m" g: _0 @(*save)->waitio = waitio;
    & x6 ?- I$ k2 A2 s! e(*save)->exchange = change;
    : _# C% ?0 W5 J(*save)->completedTime = systemClock;
    9 A5 f/ _5 Z! S0 ?2 z(*save)->runningTime = (*memory).p[0].runningTime;, z2 G" a4 m8 G4 b9 Y3 y4 T" Z# Z
    *spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;5 L0 S3 U" K! e9 _5 @) w. U7 d
    compute=waitio=change=0;
    . I) j2 e: \" ZcomputeLast=waitioLast=changeLast=0;" K8 t: t5 K- x. r" [- q6 t
    High_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);# a4 W6 N8 ^0 N4 p! G
    change += exchange_process;
    2 G8 w8 H/ h% h$ ]+ u  ireturn task_completed;8 T" |9 ?) S- e
    }2 |+ Z5 n& d: ~& ?$ I7 W
    else
    4 d, c, b( y! r7 Z* T0 w) c3 I4 Ureturn task_not_completed;% ^8 P/ g# f, p8 i
    }
    2 z" Z0 h3 ?* D( eint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch)
    4 b  B+ o) H$ O' S" n; P* S{% P' }( _% @. p9 y1 K/ d  K
    static int waitTime[initProcessNum],i=0,j=0;
    1 z! E" A! H4 g/ q1 h" [% J2 Bstatic double HR_ratio[initProcessNum];
    . ?! E8 C. b: b' K9 j& `if(flag==0)                    //初始化数组# T0 v% \- M/ [! N. N5 N
    {
    % \% R: W8 K! H% {+ ?' zfor(i=0; i<initProcessNum; i++)) C' q$ j  r5 S2 G
    {
    ; X) |! m* x% owaitTime=0;
    " W" n5 f( y/ P. r6 \6 W8 p& mHR_ratio=1;
    $ O! s5 n! w* ~6 h3 Y}
    $ g. T1 c1 T7 i" F- z}
    5 {! i# a# ?$ f+ }for(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比+ f+ O7 q; g  X7 E9 }- R* f  Z
    {
    1 [/ L) ~: `' G: {* c5 QwaitTime++;
      |- I' X" U$ H5 w+ iHR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);
    $ W0 I* k; ^7 Q0 m: u" hif(HR_ratio > HR_ratio[j])
    4 M3 ^- g# e& e& x& l# u$ Jj = i;
    5 z  o9 E7 ]0 Y# e, ?( U& H}: V4 K9 X# g6 H8 g8 k
    if(dispatch==1)                    //需要调度一个进程到内存中执行
    / A* m% Y! M6 m& m8 O( J) e1 ^5 o{8 X$ F- ~& O$ ^  _; U2 f2 R5 m
    if((*storage).p[j].askMemory < *spareMemory)8 K' R" C' E; k$ ]
    {' A% m& h' X5 n
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;
    & A: d( @9 b/ Q; F3 k) v* x6 A(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    4 l) `9 |1 A' O! E( \(*memory).p[0].computeNum = (*storage).p[j].computeNum;) Y/ {5 W  a& H' Q4 T0 j- z
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
    7 r* U: a1 U- J(*memory).p[0].processID = (*storage).p[j].processID;- l& c/ ^. u; m/ e- ~8 _+ \
    (*memory).p[0].flag = (*storage).p[j].flag;
    " W8 P! ]( u7 L+ D1 h" l(*memory).p[0].ioTime = (*storage).p[j].ioTime;/ ?9 \  a) O$ Y. ?* Z: s% d, n
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;" W& N; O4 U3 S' j( ]
    (*memory).p[0].runningTime = systemClock;6 \( A) a1 {: B* K& w; h8 Y
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;
    6 M" v) W9 G  nfor(i=0; i<(*memory).p[0].ioNum; i++)
    1 l8 R+ `  M; A. Q0 W5 y(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    5 E! @8 |7 S, ^) K1 cfor(i=0; i<(*memory).p[0].computeNum; i++)- Z+ s% n; h# n; o1 n9 z4 n
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
      R8 K- I: H, Z" w; c( b7 h1 j& g9 `(*memory).proNum=1;$ A6 Z2 w6 e( Y( {0 P1 L) r" p
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;' B9 y" [2 T. M6 E- D
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    ! \5 P8 {$ Y( F2 T- t8 `(*storage).p[j].produceTime = systemClock;
    9 i! ~* d. Y" w# ~9 \MAX_COMING_TIME = (*storage).p[j].comeingTime;$ {% E6 g6 Q' @& |) B
    waitTime[j] = 0;
    ; E; n1 e9 I/ DHR_ratio[j] = 1;! J. y, ~; V1 g0 p) w5 u. N
    }
    2 ^5 S4 F& \- Delse" ^% f# l8 p9 t, D
    {
    5 s* U3 e+ m8 bprintf("A process ask for a memory overed the system capacity\n ");
    / _) S9 Z! A3 c/ G3 h- Rexit(1);
    . N! k  ~( v2 `}
      z1 u( k& u) c* u( Y, ?2 C$ i! o}  ^; {5 t( X0 E
    return 0;
    " r/ B- \2 U1 ?0 k}
    % o4 [7 }- x' x8 {" ~$ G5 W4 `int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    + F$ `' J, ^- U3 @{) b: |# G# ^8 Y' F2 i
    static int compute=0,waitio=0,change=0;$ @. g1 H+ M$ `4 F5 }/ O6 @
    static int computeLast=0,waitioLast=0,changeLast=0;  e0 ?! Y) O% R
    int i=0;
    & |* J0 z, P4 H" F# sif(draw==1). E& D3 T& ^1 u" C5 b+ t
    {! U8 ~. @1 P& n/ w) ^, \
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    6 t! B5 ~" r8 a8 d- c; |drawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    3 P. p0 S6 v" e4 ]3 d% M9 S7 E% n2 T1 T

    5 b5 v& ^: Y+ a. }8 V( l$ acomputeLast=compute;/ U1 u% ?9 J% _) j( I
    waitioLast=waitio;
    , W) ^8 q, C2 _changeLast=change;
    9 B! _' ?' L) ]+ ^3 n1 w: E& A}3 ~! @  u9 L4 a/ X8 L
    if((* memory).p[0].flag==ready)0 a$ `) w% o" {& r9 R9 E
    (* memory).p[0].flag=computing;
    # c# b- @+ u1 l: f* Dif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    9 S7 ^2 K) Z6 d( W{6 }/ g6 o0 r7 ^% x4 T- }' R
    i=(*memory).p[0].computeNum;
    / Y! `  `, O& h0 E% p" |8 ~6 O" zif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed! n/ F) z7 T# V! X
    {; ?( |" U$ N- I1 [! s) U, `
    (*memory).p[0].flag=IO_waiting;: P2 Z( M2 Z( L
    (*memory).p[0].computeNum--;( H# q2 t) H% n" e! p$ [
    change += exchange_IO_Compute;% g: y2 L6 a) q1 `+ @
    compute++;
    2 P: J/ W+ S- N' E}
    ( ?( Y+ s/ W9 S# X* T+ Z  kelse& X6 [$ }' d6 K% U
    {  c& h1 [! R7 H& b+ j+ a5 G8 Q
    compute++;
    + G: Q- B- R0 s}
    - k3 `. i- I/ S}1 ~0 v) I. l& Q9 k
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    ; X' P% g& m& i; c! k{
    % i$ f/ O* }8 `) j; b/ V; N/ a* B0 g  \# }/ w3 Z: G
    i=(*memory).p[0].ioNum;. e- D" E  ^# H& }, l6 U8 m
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    2 |" q! ]) q% A; ?* H$ Y+ @, i6 `2 B{
    . Q' p! U! ^, o7 _(*memory).p[0].flag=computing;% p2 T$ d# N2 D6 f& C  j" ?
    (*memory).p[0].ioNum--;) w# X1 w9 p; ~' P: M& u' s
    change += exchange_IO_Compute;
    9 S1 {9 r2 ?+ y! M) o* ^waitio++;  o' S( E3 I; f/ Z: {
    }
    3 [1 ^) o9 x# ?8 h( l  ]else7 x/ r% r) R- F2 _9 d% M# h
    {
    # b7 l4 `4 X0 ?. K5 d. Twaitio++;3 M) e9 U% R& X# o6 n# U
    }  w, C; y. h/ J5 q
    }  j% E. ?2 b: ~- M
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)/ [2 F9 F2 F0 N5 Q/ l1 m/ M
    {
    , |6 u% x# z* J; ~# q(* memory).p[0].flag=IO_waiting;
    5 I1 R) I* Z) d. }change += exchange_IO_Compute;
    $ G" u$ e  S4 B}2 D  K- C& [9 H% p% O( f
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)3 S9 @/ n, R1 L9 U1 v9 h6 L
    {3 M2 @2 F/ Z' ^6 d  G8 A
    (* memory).p[0].flag=computing;
    2 _9 h4 \2 L' C6 h+ a+ m; B9 xchange += exchange_IO_Compute;5 C" U  l  N: U+ ?
    }
    & ~: N3 f; o6 b1 h) _if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    " o3 ~9 [! }! `: u4 }: E{0 U+ T7 r) h' b' O4 g- h; C- [
    (*save) = (PCI*)malloc(sizeof(PCI));
    9 U4 g2 x8 S8 q7 C2 P2 ](*save)->next = NULL;
    ( f3 t9 I9 S& f4 D7 |7 e" U/ S# m& `(*save)->processID = (*memory).p[0].processID;
    & H, Z2 N! N1 x! U  e(*save)->comeingTime = (*memory).p[0].produceTime;* W. I- W/ \0 O" o7 L$ C8 ?5 }' c
    (*save)->askMemory = (*memory).p[0].askMemory;1 ~9 T8 V  r9 }, |0 }. \5 A
    (*save)->compute = compute;
    + y! b" M3 Q0 ~2 B7 O1 A0 v, v(*save)->waitio = waitio;4 f( u, X; b$ L$ k4 W+ G5 W- W
    (*save)->exchange = change;* c/ J0 M; o/ a; ]
    (*save)->completedTime = systemClock;
    + e. w: v1 \# R$ H(*save)->runningTime = (*memory).p[0].runningTime;- _- [) Y+ w6 H  O- G
    *spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;' ?( z7 X# X# L+ X- J- D2 W
    compute=waitio=change=0;( s) n# G0 Y3 A! Z
    computeLast=waitioLast=changeLast=0;
    8 ]0 T5 S3 R3 M9 Y+ C9 KPriority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));9 ~0 V- w  ~! g) s3 |* X
    change += exchange_process;4 p0 W* |1 L( K- x" S$ m$ S
    return task_completed;4 C5 a' @+ x4 d0 V! ], j0 w
    }' P% F# F" U! G# G+ a
    else
    " s+ [" H: [  t1 Zreturn task_not_completed;* h' O' W) X. s2 l
    }
    - ?! r/ _& n! q+ u3 X8 `int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)% x) i" J; H  @- u# `- u/ l
    {' L1 P: {5 M6 B8 M" T% |
    int priorityNum[initProcessNum],i=0,j=0;
    8 L$ F+ M. A5 z3 d' r7 ydouble temp=0;$ q0 ]5 Q6 {7 {8 q+ \3 v9 }# f
    for(i=0; i<(*storage).proNum; i++)    // setting priority to each process# l; D5 ?9 {' g! d" }
    {
    : V7 ?9 h, O- \2 A7 k! n& F0 y/ k- ]temp = (*storage).p.computeTime/(*storage).p.ioTime;1 n' S5 }" g3 a+ b4 o; o5 ~$ t# U
    if(temp > 0.8)+ y! o- X% K# w5 K  m
    priorityNum = 6;
    - @* C1 V+ Q$ ?else if(temp > 0.7)! B) {1 A' ~  P1 W( S" q
    priorityNum = 5;
    8 Y6 t+ Z4 Z. U) J$ m# |' B7 i2 }else if(temp > 0.6)- m- {* m# D$ N- O: a- T( M! U
    priorityNum = 4;
    + ?8 ~( C( c& J! K2 ielse if(temp > 0.5)
    $ T- P% w3 c8 N9 q. {$ V+ j. b0 QpriorityNum = 3;: S% p( T: c" q4 |9 Z
    else if(temp > 0.4)
    6 @7 z% b# g' tpriorityNum = 2;3 ?3 B! J) S8 J% n6 V" ]
    else( ~3 S3 {4 |; N
    priorityNum = 1;
    : d" k. F0 `% T& C3 M$ L4 pif(priorityNum[j] < priorityNum)
    1 O: @# X' C+ j1 v1 W9 Nj = i;
    - P! _* |* ~% M  [+ @. B}
      I, {- {) a$ K% P8 bif((*storage).p[j].askMemory < *spareMemory)% N0 x! G- H4 R9 `6 m3 y* C/ Y# n
    {
    / Y# T* r) \! x( c* Y(*memory).p[0].askMemory = (*storage).p[j].askMemory;) J( m) [) i3 s6 t3 k9 x5 x
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;* c& s- F( V1 J0 T6 a2 @  n
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;/ O- _& B3 s( }  T" z1 R
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
    $ j; B! D# {' L$ W% Y7 o0 |0 Z(*memory).p[0].processID = (*storage).p[j].processID;+ U2 f8 L) b3 O! r
    (*memory).p[0].flag = (*storage).p[j].flag;
    1 M* w' W6 G/ R+ u# U, \5 y; @(*memory).p[0].ioTime = (*storage).p[j].ioTime;
    * N6 R9 A* v! ~( g8 x(*memory).p[0].computeTime = (*storage).p[j].computeTime;
    9 B  h0 r& e3 e" G8 w# e(*memory).p[0].runningTime = systemClock;  I/ i. s1 U  \$ {" b
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;" a! E- c& w. S  q5 Z
    for(i=0; i<(*memory).p[0].ioNum; i++)0 r( E$ Y5 U  B+ ^* ]4 F+ z
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;
    6 s; {6 I0 m" O" C! m# Pfor(i=0; i<(*memory).p[0].computeNum; i++)
    0 d2 q( _- y& X& g5 d$ a(*memory).p[0].computeClock = (*storage).p[j].computeClock;
    1 {0 K& A1 k( F* E5 k& ]( t(*memory).proNum=1;
    ; H6 T2 a4 J, T8 i/ z3 k% P- T*spareMemory = *spareMemory - (*memory).p[j].askMemory;6 {- O1 P" h" |- M# D, Y7 N0 W
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    " k" M2 R2 W$ Z# LMAX_COMING_TIME = (*storage).p[j].comeingTime;
    " ^5 t& _8 [; L* s! i/ j+ S/ {}
    ; V/ J+ P2 _+ J* c6 Eelse
    2 m; e! b! q+ Z7 P8 Z{% M* @0 h8 b7 T/ d. ]: p1 c, S
    printf("A process ask for a memory overed the system capacity\n ");+ a' p# m* O6 ^& q; j4 H
    exit(1);
    8 _2 ^: Z# J( z$ m5 v}
    $ ?3 y3 z7 L1 K6 A! preturn 0;
    . n; ]$ U/ o  O& E$ ]& c4 L}- F( ^: G& w+ R: d3 e1 ?7 r
    int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)& J4 ]& H  M1 s% L; U7 A  N
    {
    4 D; s% P0 P& m! ~static int compute=0,waitio=0,change=0;" i' W" U1 q, k- P
    static int computeLast=0,waitioLast=0,changeLast=0;
    6 A9 w  z1 w& F0 x' F+ lint i=0;5 K4 z% X% c7 W1 O+ ]. Q- u& y
    if(draw==1)
    3 Z4 o$ ~8 h/ k/ a' p3 Y8 r4 A{+ U/ u# C8 L8 R* F2 W
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);2 y: O% l$ @# ?: I( v# c' ^% w
    drawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);, v" C- \3 e/ S9 @, k
    # s/ c( D8 E$ A% Y0 ^( v8 e( Q5 m
    $ o, {, E* b: ~5 X+ H* Z/ d
    computeLast=compute;
    & P5 ]9 L8 ]+ Z1 [/ q; j6 M5 ZwaitioLast=waitio;( o7 w0 |$ I) T7 F( l% ^
    changeLast=change;8 D4 n, A; H% i% L
    }
    3 t) u4 U& J' R# Y# {8 R" Oif((* memory).p[0].flag==ready)8 W# K# i6 C5 v" m
    (* memory).p[0].flag=computing;0 ~2 S! r# v8 Z: l$ p7 U4 A; c7 s& I% m
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    # p( L% B. ^$ z0 K) f{/ A' Q! J4 S( z  P$ L/ C
    i=(*memory).p[0].computeNum;
    / d/ d* |5 `( {8 A7 |5 B/ T+ |  ~if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed
      S8 {6 b: a& M+ q1 B3 l{* v$ Z& O# Q  \+ ^8 K; {+ r; e* N
    (*memory).p[0].flag=IO_waiting;! E/ v4 ^# `# B3 T1 w) `
    (*memory).p[0].computeNum--;( T8 i+ t0 n! b" n
    change += exchange_IO_Compute;- w; j: @7 W3 x6 v# X8 r0 @5 n
    compute++;+ J! m9 r  o! w# }2 }
    }& ^" h- B( L; C) _3 s+ m
    else' f* H5 h' o/ h  k
    {
    : R8 ]; F# P1 {  B: }compute++;
      X) K4 {  F3 s# S% M3 ?}
    , }) w6 v, G& D5 {6 w0 }}  k" F6 O7 H& a* v& _
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    " X7 l. Q, N& `6 S$ f  w{4 g1 w% O1 \$ m' ~

    2 m$ G' b4 }6 f9 F8 i8 n; E) b! n" |i=(*memory).p[0].ioNum;8 A  Q( b3 c1 Y3 r/ o" D; i# s; y
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    ; n1 @4 ^& x/ X+ `{
    % U& R) c: X9 g5 {/ A(*memory).p[0].flag=computing;
    ) z6 _' v' e7 O: b(*memory).p[0].ioNum--;
    1 V% h8 v- J* a/ ~4 t0 P* Y& Lchange += exchange_IO_Compute;
    9 I6 q! k/ b5 H% u+ H1 vwaitio++;0 T  a. b5 e: F7 d1 [$ q
    }3 i$ U5 d! V1 l: m$ n. X
    else6 n- N. M% ~' l" }, }: h6 U
    {3 C5 y% X0 ^5 f0 v
    waitio++;- A6 g- m" q" k  s
    }
      [" I, c$ a- J+ {' f}
    ) Y- x% L. h8 V3 Ielse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    ; x! S5 J, ~. z4 s8 ]$ ?3 f: B( }{
    . V1 n+ q2 a$ ^(* memory).p[0].flag=IO_waiting;
    , ^, B5 c3 z1 w% d0 [) rchange += exchange_IO_Compute;) L5 M3 c5 w. @3 j
    }' J8 c  ~9 h; z: f  o. q3 P
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    " L7 s! f( }% ?{
    % J! U/ e. V8 `, N7 S, \(* memory).p[0].flag=computing;" G" G% ^8 x5 w0 F+ k2 Z$ u
    change += exchange_IO_Compute;
    0 I4 k' A$ b) V* ]8 E) P) ?/ ^. _! L}
    2 w: Q1 T+ _' M, u  r* }if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    / ?" w. `9 i  \$ e. r{! x  I6 r6 ?$ @/ M5 t. g
    (*save) = (PCI*)malloc(sizeof(PCI));
    + B; w# `2 B: @( w9 W(*save)->next = NULL;5 b2 n+ E% g8 p$ P" t
    (*save)->processID = (*memory).p[0].processID;
    " W! t# H+ k8 C+ j+ ~8 h1 g- \(*save)->comeingTime = (*memory).p[0].produceTime;& x+ T/ E8 \6 E1 C! J8 |* T# }
    (*save)->askMemory = (*memory).p[0].askMemory;
    ; v# S& _- c; s(*save)->compute = compute;
    ) ?% L) B' X( B3 K2 {; d% K+ `(*save)->waitio = waitio;$ X8 ]" p1 `% a! |) h; ~6 f
    (*save)->exchange = change;
    * r1 Q- q0 `* F7 `/ i) v$ x(*save)->completedTime = systemClock;
    ( L" c5 ?" p3 Z) T. w- f, @(*save)->runningTime = (*memory).p[0].runningTime;4 Z$ _( M' A. C  r; @) h  Y
    *spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;/ z+ w" j5 y8 R' ]
    compute=waitio=change=0;0 U5 i- C$ s% x7 n' o
    computeLast=waitioLast=changeLast=0;
    * }0 B, W3 h2 ]3 g& L+ ySJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));& q% Z; \( ^4 L7 b: Z! s
    change += exchange_process;) v/ X. I+ c$ b' T& N/ I
    return task_completed;7 j3 t" _( i4 ?  S( h1 _
    }; f# P- s$ T6 e  F
    else' L' a- Y+ W; }  ]
    return task_not_completed;  |6 T. v4 k) Y6 \) s8 v3 Z# h- K
    }9 N! y; e* {$ E2 G
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)! ^( B" C7 c, c" `
    {/ G& N- s* m; r
    int i=0,j=0;
    , n4 u4 \5 @# c) S! d1 Mfor(i=1; i<(*storage).proNum; i++)* Y; F# W' }* b+ P% F" i; S( [
    {
    7 p: _$ O* q' x( c) Z1 Sif(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime))
    8 [; ^4 `" P9 R. H2 K1 Q2 ~j=i;' |1 q5 z) Q* x9 @* Q: C; z' R
    }
    . h& S2 J: T8 L: V- q8 c- [if((*storage).p[j].askMemory > *spareMemory)
    9 \3 T2 ~! e7 X: v# J# f8 q/ E{/ H, c3 o$ W* A. [/ ^, a
    printf("The memory asked is overflowed than the system memory.\n");
    ; t! D+ b, U' `( l$ y. V% D  Y: Rexit(0);. f3 q- p* k& s. J! m
    }
    % m/ O! W( j6 ]else0 i  X1 h, x9 p, C9 N
    {
    3 i3 z$ H" F" d4 {# R(*memory).p[0].askMemory = (*storage).p[j].askMemory;' O4 z5 s  B0 p$ [: C
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    & L& z3 T  l$ c% m: s% U9 T(*memory).p[0].computeNum = (*storage).p[j].computeNum;
    ! q' n. q6 k5 B  j7 c6 E* _! N(*memory).p[0].ioNum = (*storage).p[j].ioNum;
    : L0 j( Y% F2 y(*memory).p[0].processID = (*storage).p[j].processID;# Y) \* i4 [5 }+ c
    (*memory).p[0].flag = (*storage).p[j].flag;
    / v; S1 t; g3 B7 i+ w8 h/ e(*memory).p[0].ioTime = (*storage).p[j].ioTime;1 u+ x& N  J3 |* v! a( j
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;3 d! c5 y3 ~5 d# d! G/ I
    (*memory).p[0].runningTime = systemClock;& _2 O) x, r/ ^, q3 f1 M2 V: K8 m
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;4 l0 ^- r3 l3 |0 b
    for(i=0; i<(*memory).p[0].ioNum; i++)
    & Q, y+ }  c- {' K6 p5 B5 w(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    # ~  V1 B0 G( g. X/ n  Kfor(i=0; i<(*memory).p[0].computeNum; i++): g; ?, W3 K/ z, C: m& a" s1 C5 M
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;( |1 r! r5 K' B+ o; @* s
    (*memory).proNum=1;
    9 Y6 L3 h' @6 d. H* L7 B) ~*spareMemory = *spareMemory - (*memory).p[j].askMemory;
    % C* v# B4 F3 d, ]8 g# `produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    2 K! u  U: O. l- L( PMAX_COMING_TIME = (*storage).p[j].comeingTime;
    " Z5 r; W1 u' C- ]! r0 h0 W}+ {4 ?" n4 [5 V/ i
    return 0;# |& y- i% _- r. k1 M$ d
    }4 M1 Y8 f3 u  o- S
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    4 \- [! w0 d9 e3 N. h! Z( L{. ?& `) Q. l7 g% H/ Z4 q% D1 X
    static int compute=0,waitio=0,change=0,clockSegment=100,poi=0;: C- h& I" D3 A+ ]  j7 ^8 c
    static int computeLast=0,waitioLast=0,changeLast=0;
    $ @# d$ B+ r- y. Y/ vint i=0,j=0,k=0;
    ! ]/ x( }4 T3 d: Aif((*memory).proNum<=0)9 l( G/ |  e# d2 W2 p
    TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);
    $ H1 W) T* @: w+ O- \if(draw==1)" R8 l0 ?) l+ K/ q! t
    {
      T7 S! C+ r$ j  \; G//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    9 i5 e% m, C3 G+ z- z" \+ B# K  xdrawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    4 |& N- A  w4 u$ m* \! ~" f- f  O1 t: d9 C& }6 }. k4 R: e) J* A* m
    3 x# |2 ?1 ^" n( L$ O
    computeLast=compute;
    9 |4 `8 J# s  v7 r9 p0 VwaitioLast=waitio;8 Z$ U6 e0 |$ N8 `6 z  Z- S
    changeLast=change;6 T; J4 k' k  M& }7 ?
    }
    * `- X4 y7 j2 _& Gif(poi>=(* memory).proNum)
    . \! @4 h- c' x( s7 apoi = 0;" r: N2 G2 A5 n" t3 v( Y
    if((* memory).p[poi].flag==ready)
    . X2 b- O, V. l0 D(* memory).p[poi].flag=computing;
    + @! z( J( e" A& Yif((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing)
    7 ?9 q& A2 b  I1 B' I{$ z; Q* U& r9 H5 ]8 i2 i
    i=(*memory).p[poi].computeNum;
    2 K5 ]! P9 y: H6 N; W" ^if(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed, I# {7 w1 x1 ]' o7 Z
    {( H6 H0 U8 e6 J
    (*memory).p[poi].flag=IO_waiting;
    + }2 E+ B" l! u, l: a/ W$ H. n(*memory).p[poi].computeNum--;
    & j4 E; K, C6 m; R4 n- Tchange += exchange_IO_Compute;
    9 C! A* u% l' d5 E/ scompute++;+ }2 j* N5 n; c) h
    }
    : e& B7 }' h0 U& ~, pelse
    + i! F5 X$ y' h{
    . b0 z/ J4 u0 k* B+ k& e( m) \) Zcompute++;
    " t0 a9 l3 U" l, E4 h6 X}
    & v# i$ y! h8 E% j7 Q9 o}
    9 s; ?) N+ ~0 ?7 X% e9 Q8 b; Celse if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)
    0 L& E! |( f1 c% K! u{
    0 B5 q2 q- X: ?: I
    , W" [/ i. R3 B) F, [i=(*memory).p[poi].ioNum;
    7 Y% l9 [3 l1 I0 Oif(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed" f' Y/ J( n" w. O& K- ]
    {7 ]. l* ~: b- f( m, l, w- [( y0 P
    (*memory).p[poi].flag=computing;
    & q% t6 U# H* h4 ](*memory).p[poi].ioNum--;
    ; E5 S0 a" ~! I8 A7 x2 E- j2 _1 cchange += exchange_IO_Compute;' c/ Q% K/ B; g: T' o# o
    waitio++;
    & ?" b0 B8 i& T}
    . L) Y$ z* m) i$ v6 xelse4 ~* _. B9 e6 {" c
    {
    " t7 r; @# a' z/ [waitio++;  S) u% M3 R1 c. L2 c
    }( d) o& Q9 B& t6 D0 Z3 \
    }; o3 ^9 Q- S( g& S( P1 J/ v
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)7 O# D' m- j8 {1 K
    {
    - C6 u8 s! A8 j9 A/ Z(* memory).p[poi].flag=IO_waiting;# S* ]4 L* n1 }6 Z. ?3 l
    change += exchange_IO_Compute;
    . B; v, y( i' w}  b8 c! z8 T# F: S; w
    else if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting), P9 e3 x& U; K1 O4 c( k& h( A- m0 u
    {5 F. V; q2 M1 q8 M2 |+ C
    (* memory).p[poi].flag=computing;4 Y& }0 D1 j7 \7 W+ N' O+ I
    change += exchange_IO_Compute;& x; O  ~' I, _( }' \* ]* p
    }
    5 {  |; a% I& @: u9 |. Yfor(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进3 {* z& Q: n5 |5 c5 c0 h; ^
    {% |9 u5 @" k, M* ?  c
    if(i!=poi && (*memory).p.flag==IO_waiting)
    / Q- I% Y6 N$ h/ |- n{: k3 {+ Q, R. o. a$ h
    j=(*memory).p.ioNum;; f4 b/ X4 j" [: n, s
    if(j>0)7 z; g* q$ n: J; B0 e
    {3 o# L! s8 E# c: T* Z
    if(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed' e. T" J5 k# e4 z; m5 Z" N& `
    {
    & o, _* i+ d4 i+ s" c(*memory).p.flag=computing;
    ; L9 M# Y9 w. D( t* x& H; [% ]& Z(*memory).p.ioNum--;: L" s$ E" I5 f& b
    change += exchange_IO_Compute;0 C+ P- b+ V/ ~: l- R& E
    }
    8 f- _& T, I+ {1 W( s+ g}8 p$ N" F) ^0 K" |# X6 a
    }5 l) v) u; x' Z/ O3 J
    }: s. Q2 k. e1 j/ g. i6 s
    for(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程" \& J( q% T, \! m, m& u" d+ ?4 z
    {  e8 e" c& j4 [! ^# E0 q
    if((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed
    ) g4 v* d5 ]6 \1 ?9 |/ o" K{
    3 r; S8 e; F5 c1 @(*save) = (PCI*)malloc(sizeof(PCI));
    7 U+ f6 C: e. |/ w; L0 e(*save)->next = NULL;
    * g( D- R' ~2 W& F       (*save)->processID = (*memory).p.processID;) N! Z) j) V2 ^' f2 k  V1 C
    (*save)->comeingTime = (*memory).p.produceTime;2 u$ O, L, n& C" f
    (*save)->askMemory = (*memory).p.askMemory;
    % N; p3 c! o1 x9 K) ?(*save)->compute = compute;
    & e6 s! o' m, X8 B9 C% i(*save)->waitio = waitio;! j% E( ~7 L: @: `$ {) V. q
    (*save)->exchange = change;" z$ G7 s, {+ u; F( ]/ M
    (*save)->completedTime = systemClock-(*save)->comeingTime;
    , c( }9 M' N3 B5 G' Y) r/ {2 U(*save)->runningTime = (*memory).p.runningTime;
    8 r8 T. Q6 Q% e2 \(*save)->completedTime = systemClock;& W4 G# Y+ a$ d! @" W
    *spareMemory = *spareMemory + (*memory).p.askMemory;
    , A0 S9 l  L7 ?  m. p; n8 Q# ~compute=waitio=change=0;5 v9 T7 Y: i/ Q" F' Y+ h/ ~
    computeLast=waitioLast=changeLast=0;; e' v  l/ H4 S) }0 F0 {
    if(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入
    0 W% |' Y5 d; }: }9 V# S7 G+ c& Q{- e! R+ X$ {3 S8 b) R; _+ L
    if(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程2 i0 W  [* o9 t
    {
    2 F# E* @- H$ x. Lpoi++;
    ( ]. [1 P3 ?7 n! h0 `+ m9 ^) u  F. n   clockSegment=2000;3 v% C8 g" v1 Q, @( r5 Z
    }. m7 o% q4 ~$ U$ s
    }
    ) M7 ~. V0 L8 w& `; h1 ]else  //没有足够内存调入新进程$ k; C3 ]) x- ?+ X) t$ m. c
    {
    3 M4 D( ~5 X7 _# G3 oif(i < (*memory).proNum-1)# g4 |) z& v  C$ c6 }: u
    {& T. K: L$ Y' J* r
    for(j=i; j+1<(*memory).proNum; j++)
    # P3 Z, F7 l" X* Z) |4 r+ L{; O* r6 E; ?* J3 D' i3 g/ C
    (*memory).p[j].askMemory = (*memory).p[j+1].askMemory;( W: r& X6 b3 D6 Z
    (*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;# U2 u) D% Z$ k# e* |% c; \
    (*memory).p[j].computeNum = (*memory).p[j+1].computeNum;
    ; K7 \: D. ]& a& e0 j+ g3 d(*memory).p[j].ioNum = (*memory).p[j+1].ioNum;4 D, Q7 F0 t" z4 G; P
    (*memory).p[j].processID = (*memory).p[j+1].processID;
    * j4 w' r; V: S5 e(*memory).p[j].flag = (*memory).p[j+1].flag;
    " H3 u; X& P$ ~6 G$ m(*memory).p[j].ioTime = (*memory).p[j+1].ioTime;+ `  D# N7 M( _3 Z& _
    (*memory).p[j].computeTime = (*memory).p[j+1].computeTime;5 e6 o! p4 b2 \  M; K) x
    (*memory).p[j].runningTime = (*memory).p[j+1].runningTime;( h6 r+ u+ r% T( Q
    (*memory).p[j].produceTime = (*memory).p[j+1].produceTime;. a8 P3 d+ y( w  r7 b, L
    (*memory).p[j].completedTime = (*memory).p[j+1].completedTime;
    # e' H) f# p; Q1 J6 sfor(k=0; k<(*memory).p[j].computeNum; k++)
      t! {) _. N0 ~9 ?/ ?+ [4 X" z(*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];; K4 V: o; l6 l! c# z3 T8 o
    for(k=0; k<(*memory).p[j].ioNum; k++)8 q! s- Y& J. z( H
    (*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];/ R9 T& r# X8 a
    }3 A8 Z/ w1 D; z- m
    if(i<poi)4 I5 [9 o; m- L3 p+ q; l
    poi--;
    ( v8 T4 n! W5 |5 o$ s) I/ kelse if(i==poi)& I( b1 x9 |1 }6 ~1 W- K% I% L
    clockSegment=2000;& v/ {4 j, B5 e0 d
    }% \$ R: ?1 ~. P: ~0 r5 a4 s
    i--;
      V' r6 c  D+ |* p# m: b(*memory).proNum--;& K& e) K% e0 g0 d
    }% h0 S3 g; P7 x8 w: G6 B, A
    return task_completed;5 B  H* q: P9 Y8 f, B
    }
    2 C- w* R0 O( K4 }- U8 D0 }$ q0 t}
    ( E/ b- V8 t9 j0 A7 m& i--clockSegment;
    6 M0 B+ ?8 ~5 L0 ]if(clockSegment<=0)
    3 L5 H$ J: w  E3 f{
    . b' ?6 m" E% r8 ppoi=poi+1;7 b2 {2 ]" [' [/ ^. g+ F. J4 ]
    if(poi>=(*memory).proNum): s/ k, e. W) a1 P7 g5 ~0 R+ x
    poi=0;
    + H; h* o2 X6 j" z) }' P' MclockSegment=100;
    / ^. d+ F8 c1 J# X6 w1 o}! `( C4 {) b' H1 x2 {, j) j+ T$ I! v
    return task_not_completed;3 m% u2 ~; O5 c& I; [
    }
    7 E- |* @5 h8 H' Lint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos), |+ ?9 L, Z7 r2 ~
    {
    5 D* Z7 f) `8 H* j" O8 Mint i=0,j=0,k=0,flag=0,translation=0;
    : ~" G7 G5 p6 i. Mfor(i=0; i<(*storage).proNum; i++)# ^  H+ M) ]# \7 K) L, I& V
    {
    5 }6 h! Z, G* N9 B; bif((*storage).p.comeingTime>MAX_COMING_TIME)
    - C# f9 G; T8 {7 J/ Y+ V- NMAX_COMING_TIME = (*storage).p.comeingTime;
    4 F" G( [! W6 `5 M/ i( g, I}
    1 J, L4 G2 @0 C% z  |# W* S) ^) uif(pos>=0)
    & q/ H- `# X/ ?; Z$ }{
    " {. w4 m$ q" v; Bfor(i=0; i<(*storage).proNum; i++)
    ! P8 C4 r8 |/ h1 G( q{
    . ^% B4 H$ }# ^: N$ s" ?if((*storage).p.askMemory <= *spareMemory)+ D3 v6 |9 O4 _3 V! Q0 V
    {
    8 J* T7 A# o* A5 [0 T& P4 xj=pos;
    2 u$ }, j; W: G: |' ?(*memory).p[j].askMemory = (*storage).p.askMemory;  b6 Q3 y. `7 P0 V; M
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;
    3 ^' [- P* A/ ?- V% }7 R(*memory).p[j].computeNum = (*storage).p.computeNum;
    5 @; w; [# J% f' p- c(*memory).p[j].ioNum = (*storage).p.ioNum;: v1 ^, U' J/ ]( g. |0 ]
    (*memory).p[j].processID = (*storage).p.processID;7 ]+ B. b  g# i+ B
    (*memory).p[j].flag = (*storage).p.flag;
    ; d* ^( r5 C0 L. C$ \(*memory).p[j].ioTime = (*storage).p.ioTime;
    , H" u( {$ A1 m/ S. O/ W% D(*memory).p[j].computeTime = (*storage).p.computeTime;
    4 Z7 M  Q. E, o5 P3 n6 y( i(*memory).p[j].runningTime = systemClock;
    / u# D8 A# {7 ~5 B& n8 {(*memory).p[j].produceTime = (*storage).p.produceTime;
    7 S$ A6 k( E" R+ N7 vfor(k=0; k<(*memory).p[j].ioNum; k++)4 [/ k' q) z4 n% y) P
    (*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];! ?7 X. F5 y: B5 `) H' F; [2 i
    for(k=0; k<(*memory).p[j].computeNum; k++)
    4 o3 v! ?$ K- j) Q(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];
    % r% R) }9 q  _' \*spareMemory = *spareMemory - (*memory).p[j].askMemory;5 o( s& M$ _2 U* q
    produce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程# m2 p7 G' X5 u/ b( I8 q
    MAX_COMING_TIME = (*storage).p.comeingTime;. c$ C( `, m  z" X8 T) m
    translation=1;- y- Z0 d5 T) M1 c& y0 t. F
    break;9 Y( H1 ?( ?" m* E' a4 U
    }
    2 T$ D2 o* y0 n}
    1 t* c3 [8 t% T, c, Q}
    " X% d. k" b( |1 felse6 E% B' ]$ S; V, S: ?9 d
    {8 U* j# a" E* P) h6 O$ t6 I
    while(1)$ ]4 w& E4 ^+ J) }8 Z
    {
    ( G* b. Z$ u! W3 r4 T& Xflag=0;
    2 d- m9 [6 M& i. @1 Q. S; j" _for(i=0; i<(*storage).proNum; i++)
    * t  |! W3 H! i% T2 J5 I{
    - C: d2 \8 k) B& S7 z3 X) Cif((*storage).p.askMemory <= *spareMemory)+ k6 x& K. s, N2 n4 f2 ]4 m8 Z
    {
    * [- Y* w! V/ F6 y8 \. J9 G4 yj=(*memory).proNum;2 H) V7 Z* e( F; u) ^! `0 N  z
    (*memory).p[j].askMemory = (*storage).p.askMemory;4 c" k1 s! |2 }6 R3 Q3 t- t& N
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;2 M# A7 j+ l7 T- @+ M( c
    (*memory).p[j].computeNum = (*storage).p.computeNum;6 h. N: M6 |, r! M4 Q
    (*memory).p[j].ioNum = (*storage).p.ioNum;  W/ G1 U% r/ T# Q0 I
    (*memory).p[j].processID = (*storage).p.processID;  o0 O* S0 ?$ V& ^! W. n
    (*memory).p[j].flag = (*storage).p.flag;
    % t2 W/ k. B2 O(*memory).p[j].ioTime = (*storage).p.ioTime;
    8 f8 F# u; l" Y(*memory).p[j].computeTime = (*storage).p.computeTime;) W. p" _9 d& d) c9 q
    (*memory).p[j].runningTime = systemClock;& a2 x# j0 L' r
    (*memory).p[j].produceTime = (*storage).p.produceTime;8 s) z) z* {& l
    for(k=0; k<(*memory).p[j].ioNum; k++)% {( y  r7 X9 p: ]
    (*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    3 m7 B' Z" t# Pfor(k=0; k<(*memory).p[j].computeNum; k++)
    0 \/ W" Y+ Z3 ^6 c: i" l9 {2 U* D4 h, o(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];
    ' u3 T, B) c1 x- G' K' M9 U(*memory).proNum++;4 u& C. \( l1 x# x  S7 e' e
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;9 X# X8 y& Q) w- L
    produce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程+ P2 s& ~3 e) |) _8 @0 f
    MAX_COMING_TIME = (*storage).p.comeingTime;- g9 u& m. [5 e3 p
    flag=1;
    - L& L4 }" C7 C# L- b, gtranslation=1;
    8 p' D* B9 Y7 d+ N6 k, Z4 d) m}
    5 a4 L$ j% x& G4 {+ l( O}
    ! d9 A/ e* E- \' wif(flag == 0)
    8 ]3 h# L' n+ }( `" K7 F2 Dbreak;
    1 d: I$ |0 \5 ~  d}9 V0 [; C( c5 s, ?0 ~- E4 N
    }
    * A; r" S9 B9 lreturn translation;
    " B; `- S, I) I4 j}
    " z5 P+ w+ b8 zint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)
    5 o8 ?( _: ]. m$ U: r{
    * S) }  G! v5 L/ c7 u& |% rstatic int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;8 O9 i  m9 ~2 Y( d- Q  a+ }4 Y+ X
    static int computeLast=0,waitioLast=0,changeLast=0;
    * `# j# W5 o4 Y  \+ {' ~8 R* ]int i=0;
    ' G2 J# F' N1 d8 d4 {$ yif(draw==1)1 l8 W3 r/ F" V, n
    {0 |$ d0 F0 A2 Q( V( U  R& [& x
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    ) s: \1 P) B( S* E3 T/ }7 ldrawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    6 M% L; @2 z: i2 e: K; X+ \7 f6 K3 y& E5 _6 O; x  c+ y& V$ b' P
    ( k$ w+ |# U$ T7 f) A
    computeLast=compute;
    " N: {3 h2 q/ b7 X" K/ ?2 cwaitioLast=waitio;
    / x+ W( \! i3 J; Y6 x- y9 TchangeLast=change;
    ! B, E3 f  M* ~, C; Z3 m. I4 @}
    4 N, n9 l. D) P2 dif(flag==1)  ! j6 c  n' s; u0 Q2 j& R2 _2 N
    {$ e- S* C$ h0 K0 j, `# r7 q+ ?8 k% n
    if((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed
    + i1 u. Z+ y  T{  A; O/ u' U/ i
    if(flagiocpt==0)   // implement compute
    , W, q  ~  i  k8 [{
    $ }' w7 h5 h0 u5 ^6 `i=(*memory).p[0].computeNum;6 T* m  Y! u& W) J8 L  s; q
    if(i>0 && (*memory).p[0].computeClock[i-1]>0)# Y1 O/ _6 r) ^$ q
    {
    - X9 A& G+ E: n; s, X* f. Tif(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed( d2 {6 s4 x' l: ~. Q
    {! T! L( @& B# w0 N
    flagiocpt = 1;
    - P: U3 n: V- N/ [3 `! m/ f(*memory).p[0].computeNum--;
    " }. j0 x5 V4 n( p, dchange += exchange_IO_Compute;
    * t( j$ O2 X. v: v; m- a8 Jcompute++;1 M2 b3 Z6 l! h- u( C$ Q/ r
    }/ T& t3 m) p  H: O  G$ G' w# c5 u; e
    else( P' d+ i+ ]5 x/ {. D2 e( ]0 g
    compute++;
    9 ^' Q" I4 |# _* c3 n
    # T4 i3 i0 U& w* D}8 c/ B( n% i) u
    else
    6 X# s* F) Q/ `. g3 r  Qflagiocpt = 1;
    ; \* m9 G/ h, [+ y6 r: B7 x* [}
    * x0 E; k  i" Welse  //wait io; L$ M& v/ ?9 u
    {
    : d# ]' Q+ G( gi=(*memory).p[0].ioNum;
    ; q. t3 J, h4 E6 u' w- Fif(i>0 && (*memory).p[0].ioClock[i-1]>0)
    ' g* ?2 e. ~- o) t/ Y1 L! V{# @, ?) S7 q4 p% N6 k4 m7 M8 e2 Y( G
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    . o& f$ m3 n, ~/ j; n/ \8 B) X{
    6 w8 A, N  a1 t6 s% Wflagiocpt = 0;
    9 ?+ x" S$ O" c9 O(*memory).p[0].ioNum--;( ^" E2 A3 W' {% h
    change += exchange_IO_Compute;3 q2 i$ n% m: |& e( o
    waitio++;
    1 d8 s% P. A# ~' u& g5 K}
      ~* s% x: U0 g/ I6 Nelse, v9 A3 Q0 x1 y* Q: k; p, F4 X
    waitio++;5 w3 \) @0 ?9 Z, Y  @

    ' ]6 V! m. s4 l1 J, n, I}& D; I6 x. d# w0 A% p7 K9 {# {
    else
    6 j+ E7 S0 C  q9 T) ]: Qflagiocpt = 0;
    / h1 o6 j3 q8 D8 j}
    6 o, v5 T$ M% I* v& n8 |* ?* k+ v}- y4 U( E  |1 ~$ O' B
    else  //task is completed
    * T4 T& c- v2 b{
      Q- A3 W+ B* G(*save) = (PCI*)malloc(sizeof(PCI));. \/ B' N- o; e8 N" w
    (*save)->next = NULL;0 ^& C2 I- a' T. K8 {; q# \
           (*save)->processID = (*memory).p[0].processID;
    * z1 p3 B) z1 o. ]& u  J) D5 n(*save)->comeingTime = (*memory).p[0].produceTime;! {6 y. o( s, p
    (*save)->askMemory = (*memory).p[0].askMemory;/ R; Z0 k7 J, {1 B7 m+ i* z
    (*save)->compute = compute;
    8 n. k8 r- _4 f3 Z(*save)->waitio = waitio;
    & e; z6 O8 _! T(*save)->exchange = change;" n8 P5 t8 d" c# h+ W: f8 `
    (*save)->completedTime = systemClock-(*save)->comeingTime;. L6 {6 t- f+ B$ ^
    (*save)->runningTime = (*memory).p[0].runningTime;
    ; @" t; ^: i* K6 {: E! t6 N(*save)->completedTime = systemClock;
    , ]' h* i  w; {# P, u//*spareMemory = MAX_MEMORY;
    / K, N) k7 {/ ?  q  mfree((*memory).p[0].ioClock);+ a- M& F6 X3 W+ H2 i
    free((*memory).p[0].computeClock);
    6 o" ]* _( _: j0 Ofree((*memory).p);0 R6 X6 |# y/ c
    flag=0;
    ) e3 h5 j" i& \: ]9 N! ocompute=waitio=change=0;
    8 M& t4 V) k! @% {* B4 {) [computeLast=waitioLast=changeLast=0;
    ! N9 X: L  W# c0 Sreturn task_completed;
      s) v8 o5 Y/ S+ z7 J, k$ C}
    . i  ~2 _% Z/ D* ]8 m}
    7 G6 O; Y. H0 Y) ^- Aelse         8 X8 {) p' }! W! G
    {
    ) l9 c- h7 p7 G, LFIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));* O: H! }5 B2 {! j, W
    change += exchange_process;
    $ `; P* _1 }/ @* v' U% M//*spareMemory -= (*memory).p[0].askMemory;
    / }- h" Y8 w( s- |- a  Rflag=1;
    ' L: e8 ?. Q9 X2 m, P+ K  b" D//showProcessInf(*memory);0 n7 j9 q  q' W/ |
    return task_not_completed;% `0 W% @( O$ t7 \& n
    }
    , s' O- p. ~( freturn task_not_completed;
    8 M& a  ~9 d! H  x; X  _' ^}
    , G, K1 s7 R9 [; a5 e  Iint FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)
    # F. c5 p7 ^1 L8 {$ j3 F* f5 X{
    5 w- p+ e& O9 j' Uint i=0,j=0,k=0;
    7 Z- \. T) j( ^* ~/ x% zMAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;' ?, i9 o7 c# P- k1 D
    (*memory).p = (process*)malloc(initProcessNum*sizeof(process));
    ' c( s; n- U( Q6 Vmemory->proNum = 1;
    + c. l/ h" q* ?, F. U" W" |for(i=0; i<initProcessNum; i++)  N* Q. c* |& G0 E6 v' [/ r$ L
    {
    + e( v- B% W. Eif((*storage).p.askMemory <= *spareMemory)5 h& b. x* F0 b" v4 O1 F9 C
    {
    " {% L$ F1 q5 l: B(*memory).p[0].askMemory = (*storage).p.askMemory;7 [) f8 A1 a/ |: G2 ^' V5 f
    (*memory).p[0].comeingTime = (*storage).p.comeingTime;" H# e1 J4 e9 w
    (*memory).p[0].computeNum = (*storage).p.computeNum;) I; M" {9 N: U" x% k
    (*memory).p[0].ioNum = (*storage).p.ioNum;6 a1 J) W0 w/ s6 b5 |
    (*memory).p[0].processID = (*storage).p.processID;
    7 i4 r  ^: l% K9 V' c# f1 q3 h9 j(*memory).p[0].flag = (*storage).p.flag;' J% X% P$ C3 W. N7 y5 p. s& Y& L
    (*memory).p[0].ioTime = (*storage).p.ioTime;
    % ~- h* r5 x, y6 O: f' G; \' X(*memory).p[0].computeTime = (*storage).p.computeTime;
    - X. r* }+ _: u(*memory).p[0].produceTime = (*storage).p.produceTime;1 T0 ~4 j" @1 a; U2 ]3 D
    (*memory).p[0].runningTime = systemClock;
    , X; o' T5 ^- I! ], s(*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));
      G+ q+ \  ~* p; @+ ~; R+ L9 k9 Z5 ~(*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));
    8 }: W$ s% o4 \2 Xfor(k=0; k<(*memory).p[0].ioNum; k++)
    % D) e) L1 f5 v- U$ D(*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];
    % [$ s% K2 w5 W" U; V( V" t0 v: Qfor(k=0; k<(*memory).p[0].computeNum; k++)
    0 S3 D; |2 y+ ]- I/ e6 p+ E% i(*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];
      u# r8 ~- `7 |break;
    ( N2 G/ [# {9 Q* B, G4 y+ V7 \}
      W: `& F' K4 N) K}
    & u4 C" M3 z* i, B; Sif(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入4 ~) z( J2 W5 J& o" m$ t' W5 q
    {8 Q, \6 k! ~" ~1 e
    produce_one_task(storage,i,ID_FIFO++);1 {8 \) p6 w; d/ k# ~( n
    MAX_COMING_TIME = (*storage).p.comeingTime;
    3 `2 I9 x- ]: Fsort_by_comingtime(storage,i);! i- ^! E) V' R' J3 Z
    }5 s9 E% T7 Z, {
    return 0;
      b8 }) ^( y" U9 q}
    6 q) G1 Z; F) _5 _; \& y3 p0 R& v: `int sort_by_comingtime(processPool * p,int pos)
    . e; U6 n) |0 ?( X- Y# S{
    - }( K( L" T, [/ \; jint i=0,j=0;
    ; q9 F1 E; Q8 fprocess temp;6 w4 U: \( R- ~( F# p1 S6 i) F1 S  m
    if(pos<0)
    & s# a- g, K  a+ j% z7 }{! m3 @+ R$ L& t2 i" j) a9 i# ^
    for(i=0; i<initProcessNum; i++)% z8 b& h0 o$ K$ M/ R* O9 K* m
    for(j=0; j+1<initProcessNum-i; j++)
    % k) U2 M6 L) C3 [9 }$ W{: J$ n$ E7 T, T9 @& @
    if((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)
    ( `6 q1 s" d9 n- v9 ~8 x{
    4 ]+ s, l3 c$ p2 O! ztemp = (*p).p[j];9 c- z5 U* K. k* ?7 N/ f( S* Y
    (*p).p[j] = (*p).p[j+1];2 ?/ j% M8 A& ]* ~- y) K, j+ J
    (*p).p[j+1] = temp;
    ! `+ \: F- }  x}
    % k: A* a% l" q5 `' B+ q# @" q}/ \8 T  |1 n$ J5 g- p5 a
    }0 S+ O0 Y! n7 \* |- V& P
    else if(pos<initProcessNum): A' ?# X3 h9 D
    {
    5 F+ Y" f% H4 H4 C  l. o# s; B  O7 wfor(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--)
    : D* g, L. o. H1 w{
    + ^6 Z( ]9 x# B1 y4 Ltemp = (*p).p;& ]( T% J# m" d" x0 r7 {. P5 h
    (*p).p = (*p).p[i+1];+ I" Y  @" k' B/ N) S/ H4 v
    (*p).p[i+1] = temp;6 @( I  [/ h" n" l& @. b
    }: X+ t% C1 G1 \: v1 N3 l/ E
    for(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)
    9 L& r1 v  f% l! K' Z" i{
    % ]2 C# l2 @* W2 \# M- i" y/ Ytemp = (*p).p[i-1];
    4 t0 i/ H. i; T9 v(*p).p[i-1] = (*p).p;
    9 j3 u1 q7 x9 R% K( s9 N(*p).p = temp;
    ) l0 T. X4 E" V- S8 g}5 F) ]" j/ L+ S+ h
    }7 W7 l. b  D; o
    else
    % J! E& a. m5 ]: bprintf("position eror\n");& v8 J4 Q8 U" Q7 U: ?: m
    return 0;
    " G( |  M6 A9 |* a* {}7 R# _6 G2 p7 Z$ e# A3 N: b; W& \
    int InitPool(processPool * p)  f) B" `3 @  L) X8 E' u
    {
    ) l8 z/ K. B: D" ^/ {int i=0;* a: D: L- D& b0 D
    (*p).proNum = initProcessNum;& H, @4 ]9 q9 f0 e) Q. J
    (*p).p = (process*)malloc(initProcessNum*sizeof(process));* P9 n- A7 c5 y* K- E9 p& ^
    for(i=0; i<initProcessNum; i++)                                        //init process information
    & n& C5 O4 k7 b# Y, F{
      z" S7 ~( g  n9 @# k1 t(*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));
    $ W3 w7 x4 @0 [8 B% _2 J(*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));
    ) ?' z, V* `! M2 S6 l% Eproduce_one_task(&(*p),i,ID_FIFO++);
    ; ~: K' S" {/ C}
    - R6 b# L% [( c3 L4 ?: {+ l" I) b- ereturn 0;) h) |& P" X' N1 k) ?
    }
    : n. M. J/ }3 _. g5 b5 bint produce_one_task(processPool * p,int i,int id)) r/ X" A0 N$ a/ z7 m3 m
    {
    ) g& Y9 c. }$ z( A& |8 x4 _7 i5 kint time=MAX_COMING_TIME,j=0,totallTime=0;- `7 y+ R/ ~. x4 Y/ c; B
    (*p).p.processID = initProcessID+id;           , j2 J0 Q5 C+ {$ L6 ]" m8 Q
    (*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);
    # e5 k# V6 J- k; w: `4 L(*p).p.produceTime = systemClock;, m- F3 g2 K1 N' \" R( \: L
    (*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;
    % f& ]5 [8 G; |) t! Z; @(*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;
    * H  q; H7 x; a  ztotallTime = (*p).p.computeNum  + (*p).p.ioNum;' f7 ]9 A$ p% U6 A2 M; N
    (*p).p.computeTime=0;
    # {2 A: x5 |1 @. ^) h2 ^1 ffor(j=0; j<(*p).p.computeNum; j++)' v6 o. l! B% Q1 [0 n; b
    {
    ! f7 d/ ^( W) o$ ^& g: h(*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;- A" Z; {, Q( }4 _: [* p
    (*p).p.computeTime += (*p).p.computeClock[j];
    % [! V, _! I" U  x}
    ; x: Z: D( [+ Z4 h/ b! |(*p).p.ioTime=0;
    * i, h1 T5 X. `- p7 D4 M; C8 mfor(j=0; j<(*p).p.ioNum; j++). }7 |' z" I2 C  N: R: v
    {- c+ Q7 M) P9 g6 n* k0 }, R; p
    (*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;# `7 h' V8 |* J; X
    (*p).p.ioTime += (*p).p.ioClock[j];& b8 v" h+ L; Q3 J
    }
    # W1 j  x. x, G" L/ r(*p).p.askMemory = rand()%(MAX_MEMORY/4);/ L: Q* W! b' C+ M6 O4 v4 `
    (*p).p.flag = ready;
    ( w5 D- z8 q; n2 s6 |( k) Creturn 0;3 b2 f- ]. `2 c# K# [
    }# O* u# d0 ?- }! p
    int showProcessInf(processPool p)
    ; j& m2 m6 {- E{9 k6 h7 m( u* J2 g2 h& l8 p6 j/ ~
    int i=0,j=0;
    7 p4 G. E, f" F9 P) R% B& F7 U7 pfor(i=0;i<p.proNum;i++)
    0 K2 g% t6 Q' M8 |+ \& _{
    & L+ _3 S, _0 j/ |! |# q+ W! iprintf("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
    8 S  B# _3 e" Z% @- a9 k* W4 w,p.p.askMemory);
    / N  R  r) z: {4 @  S+ n# i. Tfor(j=0;j<p.p.ioNum;j++)
    % @8 n+ b' T% X. R{1 _/ N3 P! r: S, d% z) j0 i& B0 k( ~
    printf("%d ",p.p.ioClock[j]);% }7 G5 K, u  n+ H! a
    }9 p% @9 U) e+ c( Y. p/ V3 [
    printf("\n");
    2 ^' ~9 x7 u1 A0 dfor( j=0;j<p.p.computeNum;j++)1 o/ n8 K7 a3 T2 B
    {& i/ p  \6 x! U- Y
    printf("%d ",p.p.computeClock[j]);
    ; c% e# H8 u$ ^3 S5 S3 n( C6 d+ S}2 `0 u1 a4 V+ _0 S. o; [# j/ I/ o  y
    printf("\n");; o# f  e- B1 D; y5 P/ [
    }
    3 k+ [: e3 ~9 v, preturn 0;5 F1 p" ]+ x, `7 W% `! B9 Z8 m
    }" g. ~7 I- i" Q. O4 I9 S; Z
    ————————————————
    . ~- o0 _5 D" W* a( x6 u* y' B8 L) C版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。# L% p3 \1 f) f
    原文链接:https://blog.csdn.net/wang_dong001/article/details/47843519  a2 _2 K& e% _+ K$ V& n

    : N# i% e& z  s  T7 B. E' g. g. B% u: K) H5 p4 B3 w& {
    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

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

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

    蒙公网安备 15010502000194号

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

    GMT+8, 2026-4-20 14:00 , Processed in 0.468379 second(s), 51 queries .

    回顶部