QQ登录

只需要一步,快速开始

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

    ( S8 q0 c7 y' l经典任务调度算法的模拟程序$ @7 t7 K3 h7 l* h2 |+ C
    本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。" I5 L/ V! M% Y5 _4 O& q

    ) R2 }7 h, X# G, |6 f编程平台:VC6.0+EasyX图形库环境。. _% m, M9 o& E# x* a6 n5 T
    * A* E; h! Y  A6 m: {
    以下截取部分程序运行图::
    : Z7 p! a' ]: ~( C( C5 y
    ( h3 O$ ?5 O( ~源代码:
    ' a' r( ~7 ~2 s4 ^) a5 q' }- J+ i, h( m! ~- J% M  c$ g2 z
    #include<stdio.h>" v/ v; j. Y* h7 L: t( j+ T
    #include<stdlib.h>
    , J( q7 B9 c5 Y$ G#include<easyx.h>' T0 `2 P! }3 c4 ?6 E
    #include<time.h># _6 |5 \+ Y% j/ w2 t( w
    #include<conio.h>: e1 C, F' F9 N. D- u9 n
    #include<graphics.h>! |0 A" @; _, T8 T! t
    #define initProcessNum 10
    # H9 s* d2 w, u! E5 s#define initProcessID 1000" E  G2 j/ \- s: i) ~( l! A5 {0 |) c
    #define MAXProcessRunTime 10000+ S( y& {  D; W, W
    #define MAX_MEMORY  4000
    ) D2 t, Y3 a7 V! k; `$ h7 }#define exchange_IO_Compute 10; P* v4 `, Z% W4 s6 i/ F: a
    #define exchange_process 25
    : D: H( M% C( M! {: ?* [4 ^+ w#define task_completed 1
    . o. a) C" [8 e4 R# Q( n  o#define task_not_completed 0. P( z3 L% ]3 F3 i4 {
    #define initclocknum 1004 N) C4 k) `6 \- g! L) Z
    enum condition" x! a$ I' ~7 d; G8 G
    {7 w- n" n% W8 f& ]1 H3 Q2 r$ o
    dead,computing,IO_waiting,ready
    ' c% |( [# x8 E& U& o+ t};$ p& f" v1 X( S1 @+ Q" d
    struct process5 r; P& y8 p9 V0 n
    {8 l( |- e& _2 C5 l; [5 H2 N
    int processID;2 x1 r3 E! D1 x9 [) l+ E
    int comeingTime;
    : W. g0 R- M; ?! P5 P' Bint ioNum;
    $ z, {" B/ K  Yint computeNum;/ ?7 |, X- A* ~- F4 }) P! i
    int * ioClock;
    5 w9 O) c0 h6 }, d' X7 lint * computeClock;
    ' u. G) Z' ?5 U8 L# D4 Kint ioTime;
    $ J1 f3 L( U0 A/ Mint computeTime;
    + Q. ?1 x( ]. j3 B4 T( b4 iint askMemory;
    # B3 S8 G* N- V- C1 [0 Vcondition flag;$ R. l3 w, K& S, Z9 D- C
    int produceTime;  //生成时间,以下三个数据成员用以计算相关性能
    ; H( n. W9 L$ x0 t) B% jint runningTime;  //第一次占用CPU的时间
    9 N2 y2 z8 f9 B  _: k/ yint completedTime; //进程完成时的时间
    % |) _# c( o+ g4 V$ B( F/ K};6 e: O+ M# a/ d7 l% m
    typedef struct processCmpletedInfo  //保存完成一个作业的相关信息9 |8 A) }" f) i( n4 w3 v" J
    {
    9 I) C; B" I! rint processID,comeingTime,askMemory;* d) C* K  r' l3 R% ?3 V/ X
    int compute,waitio,exchange,completedTime,runningTime;) I$ u8 M" X) r2 Q" g$ e+ i
    processCmpletedInfo * next;& M& k2 P- @* n) P  J
    }PCI;. D3 z6 z+ D+ o  X/ x: J
    struct processPool
    ( ^8 [8 n, G0 x{
      a* e% J2 {# d5 `* Fprocess * p;" o* y: M9 ~/ ?( f. b9 R
    int proNum;
    9 P4 ~$ H% m) N4 i4 R9 g4 G  U; B/ R};
    6 s" y0 a: }: Sint 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;8 b1 q: G4 \. |+ ?: X0 J
    int InitPool(processPool * p);
    3 y9 w% z2 {( R3 S: kint produce_one_task(processPool * p,int i,int id);
    3 y# R; {8 ?7 Aint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);
    8 M+ I! }; C) s, B8 w, Oint TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);' L' w# E& f/ ~+ W& C9 d6 c
    int TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);
    6 Y; J) W8 M( Wint FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    ' e' y0 I+ G0 S" g" W* ]9 p% y7 @6 ^int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);  i% y& y% y& A. r
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);  G. i7 w1 D/ J. f" l
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);% w% h% l# u. K7 D$ S0 A
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    3 E: C" y/ A: l; Xint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);* F6 {$ }2 ]$ L$ I% }- N0 P
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    - ~9 ^% W! w4 H$ U
    ; S0 u- x' S$ C, s9 O; p6 i: ~" V3 `( Y
    int sort_by_comingtime(processPool * p,int pos);% G2 Q. P) _- I8 N+ j
    int showProcessInf(processPool p);$ s6 I2 K% p( ?8 \
    int drawPerformance_FIFO(int x,int y,int memorry);
    2 a) u; t( ?- ]. e7 E0 Lint drawPerformance_HR(int x,int y,int memorry);. ^& y9 ]! f1 j7 B3 u
    int drawPerformance_PF(int x,int y,int memorry);; J( M" J) s4 A% F% i! ]: I+ j
    int drawPerformance_TT(int x,int y,int memorry);5 Z$ v6 |3 E! @$ o4 T1 F
    int drawPerformance_SJF(int x,int y,int memorry);- c! ~: D7 y$ N% B8 i7 D
    int MouseListening();, j2 `& k4 `% w: g& }
    int MouseListening2(int *flagShow,int * showTime);
    & @3 y+ C/ `+ C# b' l/ \. v! y; _int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);
    8 }2 X# n( P2 f4 a$ R) S. J. c; b' O9 Y9 ^

    " J1 a* ?3 j$ ?) |void main()7 |5 U6 |: c% d
    {6 g: {7 q6 B3 R4 w4 a
    PCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,7 m$ O9 J+ C8 t" r. c7 K
    *Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;
    $ ]* T: Y- v0 G: Z$ x1 u  X. ?3 w0 j# W4 Hint i=0,FIFO_memory=MAX_MEMORY,count=0,Timet_memory=MAX_MEMORY,SJF_memory=MAX_MEMORY,Priority_memory=MAX_MEMORY,HR_memory=MAX_MEMORY,; s  q9 |1 V) H. A" m8 }+ {
    flagDraw=0,showTime=100000;
    % }1 [  D' ?% D6 q: t) UprocessPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;' \7 e% `! p  U/ W
    FILE *fp=NULL;
    6 H9 i; M6 r# ^  a  U//processPool HR_p,HR_mmy;
    - A. I$ l/ t. z, m  a
    3 h: m8 `& C2 u6 g. M' W8 G& n  ~; l7 C( r) D; ~
    srand((unsigned)time(0));3 |5 e- Q# B* s
    systemClock=0;
    2 `3 N$ a. Z) N( ~3 Z0 M. ^initgraph( 1200,650,SHOWCONSOLE );
    1 ]: o/ g5 L3 C  w  Q" Msettextcolor(GREEN);
    0 k  U7 A- ]% o$ D7 b! s% usetlinecolor(GREEN);
    ' ]+ o; c" B+ f5 Q6 {setfillcolor(GREEN);1 s  k7 I. I, n, g
    InitPool(&FIFO_p);
    9 R  c1 H2 v  h& u. [: _* k1 p  psort_by_comingtime(&FIFO_p,-1);1 v5 E6 p& Y. N  L5 k; y" S
    InitPool(&Timeturn_p);! X4 ^$ h- E) W. C0 ~
    InitPool(&SJF_p);
    ; w# |/ K7 s. D% _InitPool(&Priority_p);
    . q1 O* H# c3 MInitPool(&HR_p);
    1 @" P, r3 i! G- x, j  v//showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
    3 u3 g# T( f& g) t! P//Sleep(10000);" C% l; x2 [& _- d& p' k# L

    5 g3 J( ?1 L( |+ K6 r' x0 q2 ?7 [5 a
    Timeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));1 s; y% E! P$ i9 C& e
    SJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    2 g3 n1 K7 C' m3 C5 fPriority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    1 d# v$ ~) O; A) XHR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));1 _2 K% n  L! _# a. Z  [; y/ R; N
    for(i=0; i<initProcessNum ;i++)
    + N8 H  o, M7 y! B9 @/ {{
    # O& _$ K; _+ F2 ETimeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));7 ?6 j+ S9 t/ B& K$ ]# H" r- h) w
    Timeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    : w5 |; \4 n8 Y5 p6 Z: }) ?( eSJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    9 V+ m2 ]* l( w4 ZSJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    & j' g( x- \; nPriority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    5 o' ~9 w$ K+ FPriority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));  n7 X. P7 [0 e! E+ r, x
    HR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    - x1 X- U' q  x7 K# NHR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));8 t3 h" s" W9 U1 d  N; V2 K
    }
    . J9 b9 G% K2 H  ?2 I8 sTimeturn_mmy.proNum = 0;
    3 |" G$ Y0 _: X& I# L6 v2 I& S; ZTimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);
    3 L/ l& D% o  B/ gSJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);$ g' }$ p' h! ]" r, Z# w. ~$ t
    Priority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);, {+ k4 `$ }7 `7 }+ w
    High_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);# y: @3 L$ L1 y
    //showProcessInf(Timeturn_mmy);
    + [0 ?8 v$ |% fFIFO_pri = &FIFO_save_head;
    9 S1 A% o+ o3 k1 _' _4 LTimet_pri = &Timet_save_head;! s$ K. N: `" K7 V$ s) w/ P
    SJF_pri = &SJF_save_head;$ C1 C" ^! x/ ~* d+ k; {/ r
    Priority_pri = &Priority_save_head;
    2 Z. A( m8 {9 ^- b" \    HR_pri = &HR_save_head;
    1 ?, K3 Z( A% u3 nsetbkcolor(WHITE);
    " Z& s+ }" V8 ]* k5 R, }7 Twhile(1)
    0 C4 G  x% G9 U' q, ~{( `" F# n$ I7 ?3 w2 d% l1 i) N: ?0 r
    if(MouseListening()==1)' z5 a* \5 w1 z  c  K
    flagDraw=1;, f: p* V* C" O# c
    if(count==100)
    5 B, G# @7 _4 v7 X$ z# r{
    : o' N' {6 J$ e$ `0 H1 `# N0 Xif(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed)% W* B' ?1 H9 ~& n, q1 Q
    {
    3 p7 D. Z. k" S  X9 a. n  Y3 m: b* W3 f" r1 yFIFO_pri = &((*FIFO_pri)->next);
    , x; Y& O3 X1 C8 V9 g" U3 a; u% z3 Y; u' k
    //printf("hello");) p1 c1 m9 C& ], Y) u
    }
    0 J7 t% t& b- M" |: qif(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed)
    + o) C( L$ M% m1 I5 k{, a& Y; y- I0 J: I! Z/ u3 z
        Timet_pri = &((*Timet_pri)->next);( C+ O# z6 ~* m: d
    //printf("hello");
    9 o+ e7 Y4 ~* F1 g* G8 n}
    : ~3 h* {+ O. }$ B# [0 k' F5 vif(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)
    ; I3 ]9 o* T% Y3 G; k! @1 [{0 r" ^  M7 J" T! H
    SJF_pri = &((*SJF_pri)->next);# v- I/ x% x% X  Y' g
    //printf("hello\n");8 P: x( J* R) c7 C7 K. H
    }
    2 F' a/ C& v# Cif(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed)6 u+ j, d5 L# _3 F' n: [* H2 h* c' j
    {5 C, C7 o, Y1 h. Y& Q/ G
    Priority_pri = &((*Priority_pri)->next);0 `* t+ [0 E. D, a6 p: A
    //printf("hello\n");  P9 ~" U0 y" L$ ~' E4 }* ]
    }
    - r/ m/ {% `% [5 Dif(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed)
    ) [5 u/ d$ g$ M: M& w{1 G: Q+ ?7 X9 N' N+ ?5 \
    HR_pri = &((*HR_pri)->next);
    - r- Q2 ~$ T4 w& @) \//printf("hello");- W' R+ U; h( ?% ~! b. s
    }
    , [# C8 A: Y) m5 c" \+ K- Qcount=0;9 D# W' E6 i4 V/ T( _2 _
    }, W* }& t0 f) R$ ^* `, Y
    else
      B) N$ g$ m, X% ]6 v, j" @{/ `+ c5 a# R0 Z( o$ F! P% M8 T
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)
    $ {2 H& u/ v9 f{
    : }, y+ E) m" N9 xFIFO_pri = &((*FIFO_pri)->next);
    9 e) L$ v* ^6 _" w// printf("hello");3 P. J+ \* l- T1 ?; s
    }
    + z& T% m1 ?# ]1 cif(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)$ O5 r* W/ P; Z% l7 T7 U/ p
    {* B$ H; i; n$ o$ T/ x9 ~
    Timet_pri = &((*Timet_pri)->next);
    / ~7 {$ H' H$ R: @, s5 `4 P// printf("hello");
    4 K0 F9 {3 P3 g}; i, v0 C0 E5 }4 O5 h1 u6 \1 g5 z
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)2 ^. m8 U2 x. A
    {+ W* G0 a- q4 X& `5 k
       SJF_pri = &((*SJF_pri)->next);7 F$ I8 x% m& z! m5 }# ^2 N& x
    // printf("hello\n");
    " E7 V" l$ I2 Y5 Q}
    ) P  x* I" D2 d, F8 x8 y" Lif(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed). O+ k, z% J; ]2 S
    {
    3 t& N6 p" K* mPriority_pri = &((*Priority_pri)->next);
    * _! t. ?* _' k" l( ?- Z1 c4 }//printf("hello\n");
    2 g  v5 ]/ d  a2 [& T}
      z# b4 D$ r9 ]1 R- lif(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed)- h8 u$ Z5 @( ^8 Z
    {
    , i4 K0 l/ E6 U2 \* A8 G0 ]HR_pri = &((*HR_pri)->next);8 D( D. R6 k/ d' P* n# d5 ^1 y% {7 P
    //printf("hello");# q' P+ _7 M9 z* X7 g9 p* R1 s
    //Sleep(1000);
    & Z8 E! N7 A2 ]. W( K- f2 b$ k}
    6 E* i) q9 A3 [* L5 y, A$ O  Mcount++;
    . e3 @# Y. c& v$ \5 z8 Y& U}$ b, w6 z  D* F6 Z) |5 r+ r) a) A
    if(systemClock==showTime), d0 r, @$ z% ~3 T
    {7 f1 U! J2 y1 o" w5 _0 J
    /*PCI * p=FIFO_save_head;% L! N. v* n% ~" E0 m
    int i=0;
    7 i) ~/ w8 ]$ H/ a  L9 x' {- Ofor( ;p!=NULL;p=p->next)$ J7 D2 \& [$ y3 i
    {/ u( n: ~' D& M# ~! E  ?/ u  x4 }2 R
    printf("Id %d\n",p->processID);
    5 E& i& X: d" g& q! t9 jprintf("comeingtime %d\n",p->comeingTime);- m7 _- ~9 y! O' x" Y; U1 B# F
    printf("runningtime %d\n",p->runningTime);" i7 ]# O. n, C2 C' b
    printf("asdmemory %d\n",p->askMemory);
    - }* i2 C0 f0 y% a8 p# Fprintf("completedtime %d\n",p->completedTime);; Z! a: {  X3 ~/ |# [- s2 y. i/ J" O
    printf("compute %d\n",p->compute);
    ; w1 ~/ Y8 ?/ b7 Qprintf("exchange %d\n",p->exchange);
    2 J$ {6 ^1 h& ?: `+ Gprintf("waitio %d\n",p->waitio);
    - F. Z* f/ F6 n3 A- X/ W% `i++;
    3 @1 [- T. B3 Z  h( g( y
    + R. J* }9 Q- U& t2 ^) u" d0 x6 j
    }
    9 m8 v4 e$ |4 ]printf("%d\n",i);*/: O1 ^( {: m% j6 D8 n6 J
    if( (fp  = fopen( "data.txt", "a" )) == NULL )
    ' H2 e. Y' @: G  I0 I/ \{( q) U! Q2 I) d- x5 w( Y
    printf( "The file 'data.txt' was not opened\n" );
    0 H9 }# P. \; E//return 1;) d. N- C: P! g6 E
    }
    : b0 S; l: A9 Q5 gelse
    + T/ J  }! G8 m6 i1 I: H{1 E9 T: z! P$ C6 j& j" r" e
    fprintf(fp,"FCFS \n");
    - ^9 X& ?+ N9 X. R! k& k2 zfor(p=FIFO_save_head;p!=NULL;p=p->next)
    " W/ R8 h/ @2 n' tfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,8 O" h0 |5 E  j0 c
    p->exchange,p->waitio,p->runningTime);
    6 W9 M) \( z" ]3 Y: Q2 \fprintf(fp,"\nTime turn \n");$ A5 C6 l5 W: ?" n+ E
    for(p=Timet_save_head;p!=NULL;p=p->next)/ W+ k; g) c$ N
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,$ Y9 f' Z/ Y4 ~, b9 V- P
    p->exchange,p->waitio,p->runningTime);
    3 ^% R7 H2 a: f  cfprintf(fp,"\nShort Job First \n");! T* _% {% s. m' O
    for(p=SJF_save_head;p!=NULL;p=p->next)* m- @, h  S* Z  u; g- y7 _% W
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,  N+ w4 Y; H! x) d6 @$ K8 N
    p->exchange,p->waitio,p->runningTime);2 X2 x* s* m( t; n
    fprintf(fp,"\nPriority  \n");
    $ m# \9 W$ t" q) [9 [+ c3 pfor(p=Priority_save_head;p!=NULL;p=p->next)0 n5 F; I0 h2 ~2 Z2 W' d
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    + V& O  ?% S; C% {/ v, g& H: V1 Wp->exchange,p->waitio,p->runningTime);
      v( |+ i3 W- h+ [fprintf(fp,"\nHigh response \n");: {$ b) }% w9 K* X$ s
    for(p=HR_save_head;p!=NULL;p=p->next)
    ( Z4 p2 i, g4 O$ O' y( Dfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    : K, V( u: R7 o8 C* \0 p, ~& I' @p->exchange,p->waitio,p->runningTime);2 V# X, F/ X, E; K5 E+ w3 g
    fclose(fp);, i5 p! _; D/ T. L3 e
    }
    0 V- Q. S  ~3 wshowRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
    ! Z1 ]" a! \9 ~4 {- h! `# d% zMouseListening2(&flagDraw,&showTime);
    5 n. {: [0 J* ]3 q  x* D5 a}
    - W9 @9 e  k9 \systemClock++;9 L7 M: _3 V- A' w' h
    if(flagDraw==0)( B3 q; ?2 d" [' B
      Sleep(10);
    * G# [. l% z( f) K+ s}% A6 j8 N5 B) M7 ]' R% n8 J
    + F( g3 |; D( w/ b9 K

    ; e, f. t- H3 P}7 [1 y0 c* v% q  w
    int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR)
    ( {* e. I' M( p) C5 X{
    & h5 Y  \6 B! y9 O& ~* H1 jPCI * p=NULL,* name[5];
    " I  n# J! s! c; ^% V' d! W: K* Oint count=0,i=0;( j4 U* h, M* }4 q) w+ Q
    char ch[5][10]={"FCFS","timet","SJF","PR","HR"};
    3 y* }, O& `7 {' @+ E  vdouble turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};
    ( q0 M4 J; W; d8 M9 @/ o4 a. L# ostruct info. U6 q* K" E5 I
    {- @5 q$ I* Z; u! o
    char name[10];
    : V8 Z1 a( u6 B2 ~# t% ydouble throughput,turnover,wait,CPU_rate;, G5 g8 J0 C$ _
    }inf[5];/ l, E; }) X1 Y9 R) q: n
    name[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;
    9 j+ X: ]! D! V, c( Kprintf("调度算法..........A\n");
    2 m- d) Q9 ^9 l- |8 p+ Z$ ~printf("吞吐量............B\n");
    4 o6 P# d3 \( ?1 P, X4 [5 }printf("平均周转时间......C\n");* O& I9 z- V2 C, C4 q
    printf("等待时间..........D\n");
    / d& x% \- R. x/ z1 V. r3 A, zprintf("CPU利用率.........E\n");  n" u6 L- d& t" J
    printf("A\tB\tC\t\tD\t\tE\n");& `; L  ~3 |* [2 t$ \4 {- q: r
    for(i=0;i<5;i++)
    " z3 n9 U, o$ `4 t% N+ Q# `9 R{6 `; v4 x7 e( f; I$ |
    count=0,turnover=0,wait=0,c=0,w=0,change=0;, _2 m3 g: p& m/ j
    for(p=name; p!=NULL; p=p->next)
    - }* |" ?$ {) r' [{# h% i4 x7 l# k. {
    count++;8 j0 H, ^# z+ F" n
    turnover += p->completedTime - p->comeingTime;+ {0 H5 f" k- T: e! h( p& g
    wait += p->runningTime - p->comeingTime;' K0 V+ x% O3 n) G! H  g+ i4 _
    c += p->compute;
    " w% ~# X) n, P) V% s2 T8 [8 c) Ow += p->waitio;
    7 G5 ^+ `) a* c. Nchange += p->exchange;& z, G8 l' Q& Z8 e+ L7 t- i. X
    }
    7 ~1 n9 b% W1 Q7 ]4 Fturnover = turnover/count;
    - X$ d/ ^. O* {- T! W! Kprintf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));6 P4 g5 `% B) ~1 p" e5 V0 b
    strcpy(inf.name,ch);
    8 e" v  [7 q, ~inf.throughput=count;- @1 u' [! ?# W, t
    inf.turnover=turnover;
    2 ]5 t8 }: s, m) Q+ m; {) Uinf.wait=wait;/ b- _- s: c7 P. A. y, d1 {
    inf.CPU_rate=c/(c+w+change);8 B+ g8 ]" Y5 M  B" r/ R7 p
    }2 H  V8 N) @( L$ }7 r/ a; d% Y6 T
    //画图9 C1 `. f5 l' {8 G5 B" Z
    //cleardevice();0 _# Y9 V" G1 [/ V/ _, w" }- ?! a
    line(0,600,1200,600);
    ; C$ F: p; p! hline(10,600,10,200);* y8 m; V$ ^1 i9 O2 z9 P' i
    line(10,200,5,205);$ l1 Z& h7 v% O) k
    line(10,200,15,205);
    + {/ M2 M6 I, X2 f% d) V- Wline(310,600,310,200);
    ; r) {+ T, O. g5 b7 q1 m/ ]line(310,200,305,205);
    ( P7 L: ?+ s8 _1 B6 |line(310,200,315,205);
    . A" A+ ?- T( J: mline(610,600,610,200);
    9 T- r) X7 b& C) |% S. R! {! wline(610,200,605,205);
    & x. \7 m) X1 A% qline(610,200,615,205);1 S$ l7 G' @; o/ p; ^
    line(910,600,910,200);
    ! W- {  _' [, B) E4 |; ^- Aline(910,200,905,205);
    ; w$ Y1 W+ F3 x* G) eline(910,200,915,205);//最高的长度400,宽度均为40$ t# N5 T, {1 z3 ~# L+ r, U1 Y6 v
    for(i=0;i<5;i++)
      c. L& J' H" H" Z{
    8 F' ?3 \3 c( l8 ^; b3 Hif(inf.throughput>pos[0])+ p4 ^# R8 K4 |6 m! f5 i$ R
    pos[0]=inf.throughput;6 v" i8 j" ^) z: i
    if(inf.turnover>pos[1])% f; `3 L7 ~0 M8 u2 g  C8 @
    pos[1]=inf.turnover;
    7 c. H, [3 K/ C% I6 _3 hif(inf.wait>pos[2])
    + B+ F4 `* N) K; t0 }' Lpos[2]=inf.wait;$ c* ~% K7 \1 i$ z$ \+ T" \* c+ e! s
    if(inf.CPU_rate>pos[3])8 O! ~+ B6 h' F. u& J0 Y2 P0 H
    pos[3]=inf.CPU_rate;
    & S9 k7 |% M- a5 p+ `4 u3 p}6 Z% J: n+ j4 z1 R. k5 I  `0 C
    settextstyle(30, 15, _T("楷体"));
      Z3 F+ [1 r. Q. k3 `# C# jfor(i=0;i<5;i++)
    7 l! v( |. T# o- j) n1 U{
    4 @* I% n9 l6 I) C9 m* V, B+ kswitch (i)( r# h6 ~  |! J1 K( [3 Q
    {- i7 e3 [2 w% k
    case 0:1 {% N- r0 @5 w/ s9 A! Y1 u% d
    setfillcolor(BLUE);
    7 v2 v' Q1 S# }, ffillrectangle(100,50,150,100);; r# G* ^2 _# e0 y
    outtextxy(160,50,"FCFS");- s2 o# ^( U2 c% e6 ^
    break;
    $ ?* Q3 R8 x8 \case 1:
    & }) u& M7 u# L: v8 j. S+ [setfillcolor(RED);
    : x0 d+ h  ~6 ffillrectangle(250,50,300,100);2 X/ b4 w- Y1 c0 N; J* D
    outtextxy(310,50,"timeTurn");
    + J) A0 u; n/ J8 z- I' jbreak;
    , g4 n  O$ k$ i8 f7 L* M" `% _* Gcase 2:( `; w9 V) \4 {5 }+ ?/ J/ B2 h
    setfillcolor(YELLOW);
    $ t; ]( C0 L0 ~# N1 v0 \- Afillrectangle(450,50,500,100);
    . D$ Y4 U* x, z0 G& }8 ?% Couttextxy(510,50,"SJf");# B1 W3 M  d7 h( S3 P, s
    break;% J5 J& g7 [2 S8 }1 E% e; S
    case 3:
    + g. ^: @' x* l/ E& esetfillcolor(BROWN);& f( v3 K! G2 ^3 U
    fillrectangle(580,50,630,100);
    ! S$ s! A/ U! N. k+ a; x+ touttextxy(640,50,"PR");
    8 j0 Y" t2 H" Tbreak;2 w0 w& N7 ?4 j/ N
    case 4:" D; N' D" q$ I
    setfillcolor(GREEN);1 o6 w5 h4 a$ t4 M
    fillrectangle(690,50,740,100);8 E! F! @) j4 [5 P7 e2 V6 c& x& Q$ u
    outtextxy(750,50,"HR");! n; z$ q- {: p7 s  k: d
    break;
    1 ^) M" \! K9 I1 K2 w, z}  o. h7 U. e' k4 D3 n9 Y0 W
    fillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);
    ; R/ K( \2 o) y: C6 @5 ^5 k8 ufillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);: R  z; _+ \, L6 Z; `) ?
    fillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);
    $ H2 z! I# u8 P9 a2 ~& g' o# Jfillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);7 l+ \, V0 ]& x  m- N- q3 h# s
    3 L3 u3 X  B( S: c; K& I7 C

    7 L6 }+ G  @" S3 `}
    6 _" `0 _8 N1 u, p9 E& x    outtextxy(100,150,"吞吐量");/ P2 A8 w! O/ I$ n4 i, I& n
    outtextxy(350,150,"平均周转时间");+ H) T) h' x" e9 [& d
    outtextxy(650,150,"平均等待时间");
    & `; \+ P9 I! y, ^  V8 z6 vouttextxy(950,150,"CPU利用率");
    ; y, w( I$ {/ C3 ~8 sreturn 0;
    6 k; d) [; [" l# _( W5 I}7 K# H' N- V+ Q, r5 t, x& Q
    int MouseListening()* R7 e; |. i* ^, X. h
    {8 u1 Z7 Q& i$ O7 G; R
    MOUSEMSG p;2 t! u; T& O8 c, |
    if(MouseHit())7 D, s% w  I4 j3 Z; |( h% m- b: ?6 t
    {  ^1 ^* S  Q1 |; t: q
    p=GetMouseMsg();, f7 e1 J8 z2 E; w8 r4 J7 n. v, i4 `
    if(p.mkLButton==true)% S! E( v. O0 f( u3 X, q; z
    {
    # s/ D! [1 P& k* B* _# J) vif(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    * _- D; e/ ]& q, u7 \FLAG_FIFO = 1;) b# s  Y# Y0 J. B/ M
    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)
    2 E% Q# Z: Y+ bFLAG_TT = 1;! ]! @5 O  x7 d$ ]  k8 w: t9 V
    else if(p.x>800 && p.y>0 && p.x<1200 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    3 g4 l  `0 j0 k7 KFLAG_PF = 1;/ X3 |. }& _5 r7 R6 e
    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)" Q# w/ _  C$ N% T3 @) _: j" S
    FLAG_SJF = 1;( |0 {2 U( g) |5 r: L( F' [
    else if(p.x>400 && p.y>325 && p.x<800 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    ' U! F( R$ l7 X; O7 b5 S) ~$ e% n; oFLAG_HR=1;
    $ a: O+ u/ @% S" K, Gelse if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)$ B" C+ v& z" x. _( v, g# D3 e
    {  d4 t7 A) O9 w( u
    FLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;* o9 d* J3 `3 }' ]. Z) v
    clearrectangle(800,325,1200,650);- [7 o" o0 p2 U
    }6 V2 d5 v: ^. h  B
    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 )  s3 E3 k2 R# v6 z8 L" i
    {
    % P+ @: w5 N% m4 x5 LFLAG_show=0;  H1 `' s2 i- W; y" Q2 x* D
    cleardevice();
    ( v, A/ S! d% F' \return 1;: \, n1 F7 K2 U# ~0 K. A
    }3 l9 a9 S" _* w
    }
    ! T4 ?. m7 ?. L; X6 ?}9 |/ z7 k: j, K& W
    return 0;1 w4 F" R; h/ e# Z: t4 Z/ D  s2 q
    }# o% [: O( {: B; n3 D3 i
    int MouseListening2(int *flagShow,int * showTime)0 p7 e5 N* ~5 t6 m  Q+ r
    {" n- X  P% O0 `" d/ }1 f% [, W
    MOUSEMSG p;
    7 g  I; i* f2 i. {  u, Z5 Wrectangle(1150,0,1200,50);8 r8 f4 V: q& [6 x7 E: }
    outtextxy(1160,10,"X");- Z! N$ v: o( e% L7 v: d
    while(1)& Y+ J! O9 s' L* M0 e  q
    {
    ( J& y  h2 G4 w7 \if(MouseHit())
    * N5 K" H2 a7 G5 I0 n+ {{
    1 Y& V7 o0 C2 C. d' @! r8 G5 Xp=GetMouseMsg();
    4 Y, m% A& D1 x2 Tif(p.mkLButton==true)! W3 w6 T. B# x* E* [
    {7 h9 m% I7 \8 H: ]
    if(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 )
    . v  G. I) T; k# C. }$ I. {{" ^- Q5 h$ t6 R# K2 X( W
    (*flagShow) = 0;
    * N; E8 K' p) o8 R(*showTime) += (*showTime);6 W5 G' M1 ?6 r" H6 S  F  G& @
    FLAG_show=1;- `$ S* ~9 y" X& ~- b2 G: k( A
    break;
    2 Z0 z( r2 O% m* N1 I}
    4 C. x; G/ K2 V2 b$ w4 _9 C" v1 ~1 P5 J) Y) S! c; W0 B
    }! d+ r+ ]9 S. C0 g# y- H! M; h
    }
    2 |! j1 v! l0 ]  J' A! u2 }Sleep(20);4 r' D3 |+ C5 \" e# d1 Z3 {' e1 S$ i
    }5 ]' \1 [2 d+ f4 Z* k) K  s
    cleardevice();, h; z- ~+ F9 O  m9 x
    return 0;
    - b5 U, J6 t5 J* G+ m}2 E8 c: z9 ~! e: E! Y
    int drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha)
    " G0 ^1 v2 f  r6 n. I! N{5 O. x8 i+ Q+ b; D1 F
    static int info[11][3],num=0;! k9 R2 z4 R1 r! K9 M8 Q
    int i=0,j=0,pos[10][3][2];; f$ L" S+ o, F" }0 O1 o$ S5 S
    float temp,t;
    1 l  f8 c9 t1 p0 a( c4 _3 y7 r6 Q//画按钮,不属于FIFO图的范围& d* @. Z, t- q
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)
    3 s8 w$ d; {) @+ [% b{  b! S7 x9 Y8 T( a8 c
    settextstyle(30, 15, _T("楷体"));6 ^' F+ r" O3 H1 u3 s2 u8 K* Y
    rectangle(890,455,1110,510);
    $ ?$ h. o1 H" {9 h3 Trectangle(900,465,1100,500);
    $ [0 u! T2 w- I/ B% [outtextxy(910,468,"查看运行结果");
    2 ]5 w4 L6 c+ w& L}  Y' G8 d3 A6 u6 b, x2 o& p, Y
    //结束画按钮
    - O" f+ m( z) J" rinfo[num][0] = com;
    $ G. I! u) ^* P' @8 N- P( ?' m) Dinfo[num][1] = wai;
    - Q, J7 ~) H- Y, H, Dinfo[num++][2] = cha;# S$ a9 L5 x; y+ W& ^
    if(num>10)  //存储10个点
    : C9 c- U3 @0 j: I- r{4 B, m' a. H1 r6 F; z
    for(i=0 ;i<10;i++); V6 g) U- ?8 |! j; [
    {5 P- h% p8 z) Q- b; T# ~# q' k
    info[0] = info[i+1][0];
    2 [, t0 |& L9 G, S; L' |4 g0 @info[1] = info[i+1][1];
    3 J+ h, s2 _; o7 P4 x5 f' pinfo[2] = info[i+1][2];6 c2 S+ T; p  a
    }0 e. E5 w: T7 I$ ^1 k1 e
    num--;) W# u3 c* T' l
    }) B( b/ b2 f& H# L. q# y- F
    if(FLAG_show==0)
    9 J% F% l9 a: R, v# mreturn 0;! m9 M# `; K. d/ ]
    for(i=0; i<num; i++)4 k0 y% j/ u  c, {
    {
    6 j/ _2 y7 C; x, j; k. o0 Lt = (float)info[0];+ v! e9 f7 r; c# m! E% j; T
    temp = (t/101)*90;
    3 i2 p. Z. K0 s, r* R2 ]% z* Tpos[0][0] = (10-num+i)*25+x+100;
    4 i' ]: b; t* g, h% I8 i* b2 tpos[0][1] = y+110-(int)temp;
    : {1 U7 \* b! h3 @# f. T6 K6 At = (float)info[1];
      p7 k4 W* O( ?0 Ztemp = (t/101)*90;/ U' x1 i" I# V: Q
    pos[1][0] = (10-num+i)*25+x+100;$ G' W% D- j* `
    pos[1][1] = y+210-(int)temp;/ x+ o: N3 e- A4 ~  {
    t = (float)info[2];5 Q5 h( T. G8 a: L4 J
    temp = (t/101)*90;
    $ V% a5 V8 W( t9 I: k" g0 u1 Ypos[2][0] = (10-num+i)*25+x+100;' q& [2 X7 |  `' J$ z7 H! C
    pos[2][1] = y+310-(int)temp;
    ) _1 g9 Q: |& O3 \}
    - p7 ?- K! A  n  m" X$ `if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)3 t7 v( [2 f, M( W; b, i
    {
    & r! x& `: X% i, e6 q5 [# v1 Tclearrectangle(x,y,x+400,y+315);
    8 A8 T, u* s# R9 H) Osettextstyle(20, 10, _T("楷体"));; Q0 a1 y/ Y. G! y5 _' j( ]
    rectangle(x,y,x+400,y+325);5 E0 c) i# b) K
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    4 O2 ]& A& z- routtextxy(x+45,y+10+100,"IO");( C  F0 O, i6 A/ v6 X0 ~
    outtextxy(x+40-15,y+10+200,"change");$ g" \3 S4 K7 Y8 I7 ^' U1 V) ]
    rectangle(x+35,y+30,x+75,y+110);
    ) @1 i2 _# y' Trectangle(x+35,y+130,x+75,y+210);1 M+ `1 b9 J) _0 D1 f5 R8 A2 X
    rectangle(x+35,y+230,x+75,y+310);
    ) }: V' r; i: j7 {2 f) C2 B$ Wouttextxy(x+180,y+310,"FCFS");
    * K$ d" W8 s* J( H2 z1 W5 B. ht = (float)com;
    ( g+ q2 P1 L, s7 F( Ttemp=(t/101)*80;
    " G4 M, r7 E) ~$ f: P' mfillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    6 Z7 V7 ^5 ?1 y  `t = (float)wai;
    . Q% n( a& f! a' z8 Rtemp=(t/101)*80;
    & _; F* Q" U2 `) Gfillrectangle(x+35,y+210-(int)temp,x+75,y+210);# j8 p4 O2 h" _. w+ d
    t = (float)cha;  \; P$ n  _2 B+ i: C
    temp=(t/101)*80;+ i( t' ~' ~4 H! W7 e; f
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);$ [0 t* o" f1 I. @% M
    for(i=0; i<3; i++)   //画坐标   high=90,length=2500 G1 f$ o% ?5 F$ N
    {1 U% a" S4 d. G
    line(x+100,y+110+100*i,x+350,y+110+100*i);4 m1 p. R, z( m% ]3 \2 i% f
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);3 X6 K& ?! o2 a
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);7 M9 X8 n) B+ n* h% x) E

    * O0 e/ a0 x$ ]  o" i- k, Tline(x+100,y+110+100*i,x+100,y+20+100*i);
    # v# c+ S% @* P* Tline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    ( j  m, X& R( Qline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    . z) t+ ?8 k' Jfor(j=0;j<num-1;j++), F. z+ }( m" g- M. U2 K' _0 K
    {$ X! |9 O- B" W, j
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    $ }+ |" R3 H4 ^) I+ cline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    9 e' z% y# w5 b, F9 ?* Q! }line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    " ~9 X8 b/ Q; n, w}
    8 ]/ R1 C; t& r5 O1 t; M. C4 y}
    + c7 M7 T5 m  G}
    $ a* ?5 N- m+ V. B" melse if(FLAG_FIFO==1)
    ) V9 P% S8 V: r1 e  h0 M5 t; p- J* H{
    3 K. x" ]# }4 ^$ e  N2 s7 ex=0,y=0;
    , w0 ]4 E: n% z( Cfor(i=0; i<num; i++)$ h2 M7 @* G' t
    {
    / F+ i" |# ~4 n) |: e: _t = (float)info[0];- }  ~* h8 Y- [0 |6 q
    temp = (t/101)*180;3 y3 B8 `5 e' E
    pos[0][0] = (10-num+i)*50+x+650;% u: N7 @, A, L' R( ^& C$ }2 y$ q
    pos[0][1] = y+210-(int)temp;8 s# V+ F3 a0 B4 l! U: S, D
    t = (float)info[1];
    , A$ G3 S0 t' W3 a; c- Rtemp = (t/101)*180;
    ! w. ~' ^2 \+ ~pos[1][0] = (10-num+i)*50+x+650;
    9 Z; k, j& [( u( {; spos[1][1] = y+420-(int)temp;
    & q8 V3 Z- G- Et = (float)info[2];% u. W5 {; d+ G& h: E, ~8 `) p
    temp = (float)(t/101)*180;
    ' k% _( C* [2 W! R1 `pos[2][0] = (10-num+i)*50+x+650;- m' j$ n: ?7 q0 ^  x
    pos[2][1] = y+630-(int)temp;
    & Y. [$ }" t6 e- h1 a: j}; r7 R: k9 z3 G/ c; p$ s) w
    clearrectangle(x,y,x+1200,y+650);
    * g* g3 ?' B, x9 J- n2 ^' Jsettextstyle(40, 20, _T("楷体"));
    7 f: D0 i3 [5 I' W" a' \outtextxy(x+50,y+50,"FCFS");
    0 J& h" ?: J4 W3 c& o& Souttextxy(x+280,y+20,"CPU");       //画柱状图% R6 r: O: a, F+ }" @
    outtextxy(x+285,y+20+200,"IO");
    : f  x; N+ V0 R; I( xouttextxy(x+250,y+20+400,"change");
    % m/ g$ [+ t) Z! U& m$ d0 X( Erectangle(x+270,y+65,x+330,y+215);
    ! Q/ K9 D% ?; M( U2 V5 Orectangle(x+270,y+265,x+330,y+415);
    1 l  [) q# f3 A4 Z1 _rectangle(x+270,y+465,x+330,y+615);
    ( a9 X2 H! [# u4 ?outtextxy(x+290,y+620,"TT");1 d1 I: o% B" D
    t = (float)com;+ z, {4 N* b5 x* l% q" p3 n9 F
    temp=(t/101)*150;% d/ [: T0 j6 ^6 F5 B5 Q7 P/ v
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    8 A# ^+ F" D2 T4 ht = (float)wai;8 ^# ^2 V* ^( G0 f7 f
    temp=(t/101)*150;
    - l. {% x5 V1 [, B% o3 V& a; afillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    ) l0 w  `+ E( l0 |: X: ]1 V1 i. h* ~t = (float)cha;
    ' N( G: i# g+ e0 `6 q% v3 s/ Itemp=(t/101)*150;
    ; o0 i- b0 C% o" V1 n) M) o7 `) xfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    + `: w: w1 s) P  W" }for(i=0; i<3; i++)   //画坐标   high=90,length=250' ?1 F+ j: ^! P+ C5 l* c0 R8 Q1 ~) u) e
    {
    0 m4 R/ c8 A: W' E. X) s+ Oline(x+650,y+210+210*i,x+1150,y+210+210*i);
    " B3 K4 b# m$ {% \line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);# g6 G$ C7 S- n3 c* I( T
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);: D. s" m; r' J

    # c2 p1 c5 I6 e3 u  h4 M- {line(x+650,y+210+210*i,x+650,y+20+210*i);- T2 V# V0 K& J$ q" n
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);3 n* r+ O8 T6 m' k
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);0 f, z! _" w/ {3 X2 B3 g* v
    for(j=0;j<num-1;j++)
    ( t- H' q; A1 r: _* l{. a; Q7 K2 u: J8 j, d! w% i. b& X% d5 P
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    5 `& V+ o- Z% z. C8 m5 aline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    $ G! z% f( N& C8 i  rline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); + ^3 q6 F6 }! h) U, P- V, a8 A
    }
    & Y" ^) u0 f( G$ O2 K  v! d& N( L2 q}$ _1 B6 y6 L* A8 I6 B3 p
    }
    * A3 R/ U8 {5 E/ w1 A6 r3 s9 X3 K6 p" W# c" E, R6 L
    7 k6 N  N4 `" m5 I* m0 w; u  i2 s
    return 0;
    + b; W" D0 f3 w4 B+ c' _7 s; P}
    8 h" }  C9 P$ r1 s4 X, A  t: m% _int drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)$ b+ l4 m2 }8 s7 ]: K
    {  U* f' C% Y+ r1 v$ ?
    static int info[11][3],num=0;$ |& D* p, D; q6 B# U
    int i=0,j=0,pos[10][3][2];- x4 E1 x! C* d  u
    float temp,t;& ~3 c$ ?2 Y8 ~8 r( S) n
    info[num][0] = com;* _; u5 J  t6 D- p% k8 V9 {3 o
    info[num][1] = wai;& y$ }9 Y' {1 G1 i/ C! V" l
    info[num++][2] = cha;
    $ H- B& s" R9 U0 |# X) `if(num>10)  //存储10个点
    4 {  H) q6 g4 s+ w$ M{
    # y. i+ R- C" y9 t1 zfor(i=0 ;i<10;i++)" f. ^; b, L1 n% g2 q# [' y
    {7 E% i5 b2 J0 O- R: U
    info[0] = info[i+1][0];& j) E2 g# B5 V  ^* `9 B
    info[1] = info[i+1][1];
    ' W: }6 U2 u9 f  _0 ~info[2] = info[i+1][2];
    ( x$ O6 }* J& e5 y4 Q}& `2 v) l* @- O1 t( }" Q
    num--;3 `" {5 d  s+ I
    }6 `; V; A$ G" v3 i0 [  d1 n4 Q
    if(FLAG_show==0)
    3 z6 S: T4 e- B% Lreturn 0;
    # m; w. W0 a% e  nfor(i=0; i<num; i++)# t  U0 E, C8 W  l  O& f& W5 G5 F' ~
    {7 y' Y) Y0 {- N3 [( A# E
    t = (float)info[0];/ x. F& s% [( g& D) `/ S& k$ i4 K6 `
    temp = (t/101)*90;
    3 N; o, R* X! gpos[0][0] = (10-num+i)*25+x+100;8 s$ S/ I+ v6 W+ B5 Y) n
    pos[0][1] = y+110-(int)temp;( C  U- e7 N% p3 f
    t = (float)info[1];# q# R& y* o. |+ b( w
    temp = (t/101)*90;
    # n; q, v$ ?' e; Z/ k2 {# E; Gpos[1][0] = (10-num+i)*25+x+100;
    1 E: }3 C+ t0 H$ ~6 X& p" h$ cpos[1][1] = y+210-(int)temp;
    + F" k* f! b7 D8 {% ~t = (float)info[2];
    5 s; K! R6 c' U" {# c8 }+ a+ R% k, x- ntemp = (float)(t/101)*90;
    7 }5 J$ W- s- K/ r3 v5 ~$ D. m6 Mpos[2][0] = (10-num+i)*25+x+100;. B, R1 d  l. ^0 k3 @0 C, l" \
    pos[2][1] = y+310-(int)temp;
    * p8 k" I& t$ b# g+ z}- q4 ?' a3 k4 r7 s, J1 y0 D; P
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    " g* k# j% g! i9 A  |, t{. J- f  }4 m* V0 a, _
    clearrectangle(x,y,x+400,y+315);$ y- V0 A- S' x: r  R7 M( g
    settextstyle(20, 10, _T("楷体"));  {) B% y' e3 d9 z+ e8 h7 Q! h
    rectangle(x,y,x+400,y+325);
    : O/ e. {: C1 k9 X+ t& Y- Gouttextxy(x+40,y+10,"CPU");       //画柱状图* b2 j: ]8 y+ `, z% F* v
    outtextxy(x+45,y+10+100,"IO");
    . z' F6 a4 Q7 q- h) `outtextxy(x+40-15,y+10+200,"change");
    ; k3 }. h( t7 S" P. V' Arectangle(x+35,y+30,x+75,y+110);
    0 s. `9 d4 b1 g( m- |rectangle(x+35,y+130,x+75,y+210);
    / p' g7 s! P( e# Y2 yrectangle(x+35,y+230,x+75,y+310);
    % P$ n6 m9 x% i5 Louttextxy(x+180,y+310,"HR");
    ( L0 @7 C" T: f1 h# c8 s3 U+ P% X* ht = (float)com;# B; E2 `9 k/ \- Q, D! J
    temp=(t/101)*80;
    3 j! p' b# N9 m2 E  d, Sfillrectangle(x+35,y+110-(int)temp,x+75,y+110);) U/ H+ m4 }/ U7 W
    t = (float)wai;1 v' w, O- ?+ j: L/ z6 G
    temp=(t/101)*80;. l) F) ]1 d' e# P3 D: j
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    2 j% i+ r$ f- q. u7 U7 Et = (float)cha;' }; c+ v' F7 y, n
    temp=(t/101)*80;
    & W. `$ m' A. O  [6 ]" |fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    5 t8 _  F" u2 [8 O  P7 g; [for(i=0; i<3; i++)   //画坐标   high=90,length=250
    & a7 k3 i" X, y8 K{
    $ }1 n' l! M% G, S4 g/ H& Z) \line(x+100,y+110+100*i,x+350,y+110+100*i);3 Z5 Z- {$ U* k, c; w& \& ~5 C
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);9 s9 L% s! E& j! C$ @/ J6 }
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    7 v5 K! N) V' `
    6 E" w" ?0 o- x) n+ Kline(x+100,y+110+100*i,x+100,y+20+100*i);6 r  _! M% \* L$ D3 C1 M% A
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    0 c; O) Z: |) R/ P/ m' xline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);& G) S+ w8 F! y# l2 [
    for(j=0;j<num-1;j++)
    " r- \2 q/ R4 J: V* F% ~2 e{
    - y( {& A, g8 {2 F7 z, N" w( ?line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    ) `* T1 M  T/ @6 X4 iline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    1 a& m. @6 [/ Jline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); # N* k* c8 p, a" N" C  p
    }
    & O( k7 u% `7 P, d% g. h( b}
    & y, s$ c, f% K  q}
    ; m- t5 B' B9 U6 R* Zelse if(FLAG_HR==1)$ ~6 D: e5 s# z; `5 j
    {& O* H( m6 J8 A( \7 Q* p
    x=0,y=0;
    : k6 K% W' d& @for(i=0; i<num; i++)% W  a+ y2 Q, _! K6 z5 t
    {
    - _6 h* A9 B* q# p0 L8 zt = (float)info[0];, v2 C" ^$ w% u8 R$ V9 t5 e/ I
    temp = (t/101)*180;1 r+ b, ]" {9 `1 N; z: d
    pos[0][0] = (10-num+i)*50+x+650;
    $ G1 C( m4 F/ @8 \% |8 X4 Vpos[0][1] = y+210-(int)temp;& A- k( E& {0 i2 @- H- a
    t = (float)info[1];
    6 l' X3 t$ J0 Y  xtemp = (t/101)*180;
    8 V  ~3 Q: b' j6 \& `, a2 S" Xpos[1][0] = (10-num+i)*50+x+650;* M% n( y: u1 ^8 f( M) z# y9 q
    pos[1][1] = y+420-(int)temp;
    ; ~$ z: ?, U, M; a9 f& et = (float)info[2];
    7 g8 P9 R3 u  ]/ @temp = (float)(t/101)*180;" y8 e' T& g, J0 N. ]  Z2 K7 Q
    pos[2][0] = (10-num+i)*50+x+650;
    / ?( a6 b. x' E' P7 I. Ypos[2][1] = y+630-(int)temp;2 R* |0 Q; h5 h! V% x
    }
    # a8 `. w! g: Y8 X1 r( lclearrectangle(x,y,x+1200,y+650);0 [# {* a: o! ?3 ?
    settextstyle(40, 20, _T("楷体"));
    / ]0 }  E% J0 z: C, Fouttextxy(x+50,y+50,"HR");
    6 ]( J: U! }' v' @3 \" a$ B) Bouttextxy(x+280,y+20,"CPU");       //画柱状图
    6 @6 v) n6 E& ?7 N- |. N8 K# N8 _outtextxy(x+285,y+20+200,"IO");
    $ X. ^% f0 p$ H8 i  }outtextxy(x+250,y+20+400,"change");
    3 Z, V! j0 m7 r/ f; Orectangle(x+270,y+65,x+330,y+215);
    ' S, R1 Q+ y* P3 o, O, O5 Yrectangle(x+270,y+265,x+330,y+415);
    ' W( v, ]( @8 p# o) k& I9 Lrectangle(x+270,y+465,x+330,y+615);1 u7 t7 h. K7 \" s/ b: U
    outtextxy(x+290,y+620,"TT");5 e$ e; t& V' F6 M+ R2 A
    t = (float)com;
    1 Y4 o9 s; p* s' ]7 Wtemp=(t/101)*150;
    ( O6 m5 h# L8 @fillrectangle(x+270,y+215-(int)temp,x+330,y+215);( @2 U% `& |& C% q3 f9 r
    t = (float)wai;
    , E! v% S4 U( f: y- Xtemp=(t/101)*150;
    & k! l: K3 }7 D# U6 f3 jfillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    # `7 C9 ^  V8 t% t5 f6 N0 d2 e8 ^, Bt = (float)cha;
    * d% r3 T7 T' h+ v" U$ ftemp=(t/101)*150;" k# I9 O4 R$ |% E7 v
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);5 K- H- H+ v6 o& b$ k  d+ o
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    4 v2 K2 N( ?) o$ D& w{* @" l8 h& I' b( Q. O
    line(x+650,y+210+210*i,x+1150,y+210+210*i);/ a9 e; j: k, }9 m
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);& }9 J; U* t7 D( b% f
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);* M$ r$ d1 R' l4 O
    / `) R% l7 c+ j! U* b
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    , J3 B( i+ S0 W* e: l# Jline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);# \7 j8 L4 g" h: \' X
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    , ~( t% K" j: ~9 ]- d8 efor(j=0;j<num-1;j++)
    ! t' V0 p% \/ z4 Q( t, N{# n$ ]8 K- V- A; m
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);- a' y9 O1 R5 g! i% u5 j
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);2 |# R* X! D; |. O
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    5 q8 j6 V, W6 c}
    2 a5 {) L& X: I* R+ j# w& F}
    / ~) \3 x0 M" z+ |. E4 o0 [- [}6 v1 W. C9 i  k# `* ~

    7 r7 z+ ~; a, x$ R* T, b: t6 [% |# q" v: I* J: ]4 D
    return 0;. Q( c$ s) X, T+ J
    }) V2 o* O* T( L! ]
    int drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)
    ! \) A4 u' B/ W+ N4 a{/ a" p# u- K! X& X4 f3 J1 |
    static int info[11][3],num=0;
    , H; B& _- g# u* x( X! d1 F9 x5 eint i=0,j=0,pos[10][3][2];+ D, `; |, S' @2 h% u
    float temp,t;
    3 N3 K% W  |5 v# s# Kinfo[num][0] = com;; Y4 \3 ?* C- @
    info[num][1] = wai;
    . A$ U2 A& G1 h, @/ D6 v$ Ninfo[num++][2] = cha;0 z* j7 @/ T4 {: K
    if(num>10)  //存储10个点+ i" d' p, i7 `4 l6 ]7 A3 }
    {
    ; m. s8 e4 S. ?! p2 q4 u- Tfor(i=0 ;i<10;i++)* }$ Y, m, s1 L- p; |6 t7 @
    {
    5 V- c1 J8 N. I! d2 P0 c/ kinfo[0] = info[i+1][0];' V  t# S3 C* }: m1 g
    info[1] = info[i+1][1];
    - }% A- B! c' S* D6 tinfo[2] = info[i+1][2];
    2 ?# @. i2 v2 \# g" I2 O5 i}
    / k4 C+ ?0 \& t; h# c5 y9 cnum--;. f' _: K7 l" ]
    }7 @3 \. n) u' b
    if(FLAG_show==0)
    . j; n) U1 M/ k/ \) @return 0;
    7 B8 {$ C5 A0 ~; gfor(i=0; i<num; i++)
    % o9 \6 |# X* r4 X# ]{
    % K5 u" B- O" st = (float)info[0];  w% [2 F5 s! R, ^2 x8 K
    temp = (t/101)*90;" [! A; A0 Y  b  l- I$ _
    pos[0][0] = (10-num+i)*25+x+100;
    % G3 ]5 q( V3 ~; }4 |, \pos[0][1] = y+110-(int)temp;+ G1 x0 I  W/ i2 `" X- ]' Y0 O: Z
    t = (float)info[1];4 p. d8 i/ R" Y3 `! L! m, l/ ^
    temp = (t/101)*90;
    - a. V$ d. Y/ T/ L# ipos[1][0] = (10-num+i)*25+x+100;. z2 w5 I; O: [. g5 m
    pos[1][1] = y+210-(int)temp;. P% C; \. z; |( G, {/ J1 O
    t = (float)info[2];& J8 N% a- F' W1 C
    temp = (float)(t/101)*90;
    ! q/ ^( W. Q" Q+ xpos[2][0] = (10-num+i)*25+x+100;% W( }4 [4 g" @" y/ E& g) I
    pos[2][1] = y+310-(int)temp;8 L; u% H9 G7 |$ _2 `* ^. `2 ]" C, L
    }+ K2 r/ A& p. J
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    - b7 @+ @2 ]9 D) Z1 d{
    5 @5 k, U1 u- x* |( b6 Rclearrectangle(x,y,x+400,y+315);
    , Y5 Q8 N1 I) b4 @! s/ Asettextstyle(20, 10, _T("楷体"));4 L( W9 S! h. B- C; j/ t$ Y  O6 ]
    rectangle(x,y,x+400,y+325);
    ( z- v! b, P; C8 [outtextxy(x+40,y+10,"CPU");       //画柱状图
    / I7 L( O6 K/ couttextxy(x+45,y+10+100,"IO");9 f) `& u# L: k/ W9 o5 [
    outtextxy(x+40-15,y+10+200,"change");
    * ^: G# t6 u( ?5 ~2 d* s) t) irectangle(x+35,y+30,x+75,y+110);
    - N. j$ u9 m" S8 A" ]8 n* nrectangle(x+35,y+130,x+75,y+210);
    / K- v+ s5 y' m. B' Urectangle(x+35,y+230,x+75,y+310);/ g4 e, e4 e( r, R0 e
    outtextxy(x+180,y+310,"TT");
    ) \4 H0 J. _: u; at = (float)com;' g. m0 S5 \# _- _
    temp=(t/101)*80;% h& d: t6 Z* L+ K7 A* B; I; m
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    + r1 s8 Z* \4 A" k1 |8 Dt = (float)wai;
    . J3 l: z6 X6 I9 S! X- Stemp=(t/101)*80;
    # h* {5 P. s; V  R4 N8 Vfillrectangle(x+35,y+210-(int)temp,x+75,y+210);7 M6 u! J) P$ }* U
    t = (float)cha;$ E, I3 S6 N( V9 i- M
    temp=(t/101)*80;
      z* _+ x! t( ^( sfillrectangle(x+35,y+310-(int)temp,x+75,y+310);0 |* f5 ]4 X1 P6 [6 {+ d* U( R
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    " ?( ~& c+ g' n% @{
    ' p" p/ B  ^' m- k2 p- ~line(x+100,y+110+100*i,x+350,y+110+100*i);9 _0 t& x; P$ `. J9 d$ I
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    9 s$ k9 q7 o# W' u2 C. Nline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    6 W3 Q  ~) z. U0 w" P
    ( |6 F7 X! X7 Z+ k: eline(x+100,y+110+100*i,x+100,y+20+100*i);$ o/ J0 ?( [3 f0 p+ m4 o
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    ; f! \0 h5 b/ M) \7 F+ v7 y2 O+ Yline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    + E) w3 u/ T6 u8 a  Pfor(j=0;j<num-1;j++)
    * P  |5 A" f1 M0 P( v; z/ d. f{
    3 \) [6 a% ]* \; i, Xline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);( N6 K6 Q0 \8 U, Z
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    * V  V% Q0 `% {6 qline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    7 z5 @$ m: K, q$ d: ~! i}
    ( b' z' x+ Y3 j$ c& v; H}
    4 F' ]+ _2 G1 [2 Z' n2 N$ A}: @3 I! b3 S6 W$ i* }
    else if(FLAG_TT==1)
    3 Q5 ]6 y& B5 l7 s7 U  }  D{
    3 n4 T5 Q% E5 yx=0,y=0;
    . k4 _1 N* Q8 z/ J& ~" @/ efor(i=0; i<num; i++)7 B, I" y! o1 c# v1 _6 T  ^) q
    {" {( V# R# s+ C$ Y
    t = (float)info[0];
    ' T1 l9 \8 I! j. Y  ^" Etemp = (t/101)*180;8 u" c8 z% [. p4 r  g9 |, ^- C
    pos[0][0] = (10-num+i)*50+x+650;
    8 W% |  w6 p- x$ w0 ^pos[0][1] = y+210-(int)temp;
    # E# O- S* G9 _( L  @0 v# i( Rt = (float)info[1];
    * q# S# u; C, z2 c- p; u9 J1 Ptemp = (t/101)*180;( Z4 I# c/ ^0 f3 Q/ L
    pos[1][0] = (10-num+i)*50+x+650;  d2 _0 e# B4 Q0 u  I  s0 I
    pos[1][1] = y+420-(int)temp;9 [" U, g+ S8 \- m' I
    t = (float)info[2];
    * y& h3 L$ F$ D7 b% r5 mtemp = (float)(t/101)*180;
    * W. \7 y: b1 ~pos[2][0] = (10-num+i)*50+x+650;
    ) A6 W# T1 D; K+ U$ m4 j% D$ fpos[2][1] = y+630-(int)temp;* P% {0 ]8 H  H# O% O
    }
    # z) j3 l- N! U  ]  n; Nclearrectangle(x,y,x+1200,y+650);
    6 u8 F5 E% j$ y7 r# o. s' Csettextstyle(40, 20, _T("楷体"));
    0 G& e0 r  V. e# Q0 P6 B& l; douttextxy(x+50,y+50,"TT");- I+ n' g* T1 Y$ t6 }
    outtextxy(x+280,y+20,"CPU");       //画柱状图2 @/ `/ b, ~* r& v) N# d; y
    outtextxy(x+285,y+20+200,"IO");
    ( L" P! S# W- o7 u: t1 Iouttextxy(x+250,y+20+400,"change");# f1 i8 o" w; [( g" R8 U# d
    rectangle(x+270,y+65,x+330,y+215);
    9 ?$ t, j* O$ W6 Z% l9 z. O8 J3 rrectangle(x+270,y+265,x+330,y+415);' w! f7 j9 S& b0 S# E
    rectangle(x+270,y+465,x+330,y+615);
    3 C5 y4 E$ }5 _outtextxy(x+290,y+620,"TT");9 ~1 C6 \, n/ }9 ]" T8 y% ^* F* N  h8 k
    t = (float)com;
    ( F1 O* p) {9 s) ~temp=(t/101)*150;3 l& }  U! @/ y$ I* s
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    2 L% ^9 m# A* V- w6 Y0 `t = (float)wai;
    ) K- B5 p- R" W1 }9 i2 Ytemp=(t/101)*150;6 R0 `, o' |% n$ M- x
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);4 H' i8 \+ E9 Q% k7 B
    t = (float)cha;
    2 m+ X- g- B+ B7 atemp=(t/101)*150;
    7 p& n3 O& B  i* Rfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    8 q7 z0 `' F3 |7 \  afor(i=0; i<3; i++)   //画坐标   high=90,length=2509 x+ Q# Y4 s, J0 @- M
    {
    2 l4 ~3 d* i8 \; Hline(x+650,y+210+210*i,x+1150,y+210+210*i);& f, ~. Q% k) Y
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);$ X* t& `0 [- P8 S; E9 d; {+ Y6 d
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    ; w1 S* I) h" T+ U/ S# w' L& [3 d, x( C9 j
    line(x+650,y+210+210*i,x+650,y+20+210*i);; T* s5 e8 l4 T, u
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);, `5 N3 ?3 [, d  z9 }
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);1 t1 ^: R; n+ d. y+ L' U( s
    for(j=0;j<num-1;j++)* e* p& Z$ e- l8 W( @( h" Q1 D) E6 y' R
    {, Y5 U0 Y0 M: s, ?+ f
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    8 [: n3 }: z; F' yline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);7 h6 @2 g4 }7 h7 C. l  M# J
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); , o9 i- o$ C. b7 P& Q9 f5 g
    }
    ! [! B0 e- I" M" R}2 M" F7 W0 m5 G/ p) s# M
    }$ ~7 O7 D& _0 d4 h7 M8 a; j! c( ]

    % Y1 L8 ^# H) @0 |1 k
    6 }; t! q, T0 ?/ A" D# yreturn 0;. V, E2 q5 g9 ~3 T( [4 S
    }0 F# W! R0 `& f0 N% C! i# ]: m" Q
    int drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)5 n6 g1 e1 J) C7 S- w4 C
    {
    9 Q! y) r. R: T: ?1 ustatic int info[11][3],num=0;
    0 m/ z4 _" i; B/ {5 y% R9 u  ?int i=0,j=0,pos[10][3][2];
    ! b6 Y6 E* F1 R) @3 l) f/ O5 rfloat temp,t;
    " X* j4 ]% f, L4 K# q: xinfo[num][0] = com;$ s- p4 v& J3 j+ K5 K, v, f
    info[num][1] = wai;2 z' K& x6 A2 z
    info[num++][2] = cha;. h2 ~, {2 ]! k! n% i7 i+ a
    if(num>10)  //存储10个点# D2 Z$ D2 k! o: b
    {
    1 ?, a" X3 x, ^4 yfor(i=0 ;i<10;i++)1 t( L/ ]  M1 Q( }
    {
      i7 w( Y+ G; g0 |+ o) Y' ?/ ]info[0] = info[i+1][0];
    6 D7 i2 o9 I  J5 A! ^0 {! g& cinfo[1] = info[i+1][1];
    . ?7 s3 F& I2 }; A+ e- R1 {9 oinfo[2] = info[i+1][2];6 ?" M0 \# H$ u, v  _% s6 M
    }0 W! s5 k' h  l4 S) r
    num--;  n3 N! A/ m4 ^
    }/ R' }$ I2 y5 o6 [" z
    if(FLAG_show==0)
      x! t( s9 @8 _return 0;
    " X) d* W# H2 c, [, F4 U+ {for(i=0; i<num; i++)' P. n( P; S* @  s! z* x
    {
    # N3 a- Z- N8 m1 G+ Nt = (float)info[0];9 u0 O: U$ k$ o. K
    temp = (t/101)*90;. o) v2 t  K7 M5 C! |3 L
    pos[0][0] = (10-num+i)*25+x+100;2 n( l& D+ U' [7 G7 P1 s# K1 R7 ]( @
    pos[0][1] = y+110-(int)temp;
    * e$ H, A+ d+ u2 A$ F8 t$ ft = (float)info[1];2 }) A5 \, |; e0 b6 X8 C0 ?- D0 k
    temp = (t/101)*90;
    9 a9 O. Y# ?7 ]' h" p7 Apos[1][0] = (10-num+i)*25+x+100;
    ) d" V5 m, U7 l% p* `. a& [$ u8 g+ K# ipos[1][1] = y+210-(int)temp;- J3 z4 X. Q2 b- [* B
    t = (float)info[2];
    $ Q9 n3 ?* m  M7 G1 Y" b5 m, [4 ?temp = (float)(t/101)*90;
    $ h+ G! M* d" t8 s4 k% bpos[2][0] = (10-num+i)*25+x+100;$ u) V6 q/ v  P2 `2 p: c! X1 t
    pos[2][1] = y+310-(int)temp;8 V# }: C- L$ ~! |" N0 S; E
    }
    ) U+ G* t  f1 t, n! o; Z, \% pif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    5 x$ N8 F% K; C  S1 `; u6 c{
    ; q- Q0 D) J6 x; X# pclearrectangle(x,y,x+400,y+315);) `& k& z( O: a9 b  X" m3 e( A
    settextstyle(20, 10, _T("楷体"));
    # O6 @! s5 |! irectangle(x,y,x+400,y+325);4 F( N8 q% r; }/ ]0 `  c
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    - W  E% Q$ d8 t$ O! `! n" O1 V8 t2 [outtextxy(x+45,y+10+100,"IO");
    : [8 f* w* ]6 x, Z# h( }6 k4 @outtextxy(x+40-15,y+10+200,"change");
    ; u2 R: s" l- G, o/ arectangle(x+35,y+30,x+75,y+110);9 V1 {$ i, [$ b" Q
    rectangle(x+35,y+130,x+75,y+210);
    " w+ b. f5 s* drectangle(x+35,y+230,x+75,y+310);
    & a$ Q9 e/ x/ Q7 M, nouttextxy(x+180,y+310,"PF");. {# y4 R  H2 G) i8 S& [& k
    t = (float)com;2 C3 g, ^- ?. H8 v2 i1 ^7 v
    temp=(t/101)*80;
    7 g! f( E7 W' H* |+ Efillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    $ F8 g, k8 m6 V- W. ?6 t; `t = (float)wai;+ w! N% H- c# D# e& u, Z
    temp=(t/101)*80;
    & P& _; P" v6 ]fillrectangle(x+35,y+210-(int)temp,x+75,y+210);" l& j! E+ o9 j, B4 q; `2 Z- K
    t = (float)cha;
    4 j1 r, L  Z1 O1 I) Itemp=(t/101)*80;5 a. I: N2 _, t1 z
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    / q9 P, J% Z. {, n! Qfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    ; x; U! ?2 b" i7 v( d' R{
    / X( R. ?7 I* o2 e1 ^9 \" lline(x+100,y+110+100*i,x+350,y+110+100*i);
      G' D1 P, M5 ~7 Rline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);& e0 u! [! Y( {/ |: w
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);, x4 }" ~( F; _. U/ n9 S

    : i2 F1 M% s3 d, [8 Z6 ~line(x+100,y+110+100*i,x+100,y+20+100*i);
    # e: I: |* @4 E* y8 b5 nline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);/ |2 J; x8 @& l* f
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);7 F+ \4 E* G1 K8 C
    for(j=0;j<num-1;j++)3 s3 r5 t7 U1 Y  u3 q
    {
    1 l1 x/ V- q" w+ pline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    : J+ \5 }: \& b- ^9 L$ Wline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);: ?3 X. ]3 W9 z' Y
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    : D6 a# j$ Y% O+ c1 P" r9 e}" _, i# ?3 I8 @  V' G! S8 g$ {: `
    }+ h2 [0 {/ s  ~; |: B7 g
    }! T2 V6 g' }' |6 k9 b' y6 h3 N
    else if(FLAG_PF==1)# @+ l2 g, h8 N. m% R* E3 e. [
    {
    $ u! t9 [) ^: l: g6 m# w! jx=0,y=0;# m7 U) t# B7 @' x4 U
    for(i=0; i<num; i++)& @, H, @2 x: {; X/ \1 g
    {
    5 t& t% d0 V4 t9 ~; j% C' @+ Yt = (float)info[0];& l5 S8 i, W0 S& _3 t
    temp = (t/101)*180;& i5 |6 M5 i0 V+ W, T
    pos[0][0] = (10-num+i)*50+x+650;- ~0 F# \1 Y  E
    pos[0][1] = y+210-(int)temp;
    ; w  h2 w; ^( }/ Dt = (float)info[1];- F- z- ~/ L" U% [
    temp = (t/101)*180;
    " m( e  y% M3 Y5 a. V& ~pos[1][0] = (10-num+i)*50+x+650;
    9 L0 N/ a3 Z4 F. t& Opos[1][1] = y+420-(int)temp;6 o: j& O+ Z1 j/ I! X
    t = (float)info[2];: n! f. s- W( d0 c: b$ I0 x- {3 _
    temp = (float)(t/101)*180;
    7 J# V& k3 d, H/ D8 H) s- ?- {8 Gpos[2][0] = (10-num+i)*50+x+650;! \: u4 m/ I3 ?7 F
    pos[2][1] = y+630-(int)temp;
    2 N. {+ o# c' h8 b5 N) E/ s}( w# G. ~1 P. w3 U  D6 J' q& ]! x
    clearrectangle(x,y,x+1200,y+650);
    $ C+ T6 Y+ o2 K$ {. \1 c7 qsettextstyle(40, 20, _T("楷体"));2 c& C0 |1 z2 a
    outtextxy(x+50,y+50,"PF");
    3 O, [. ?7 z6 Vouttextxy(x+280,y+20,"CPU");       //画柱状图$ R; c/ G5 A0 a- d! L
    outtextxy(x+285,y+20+200,"IO");; b! D% }" a; j" q, A" k
    outtextxy(x+250,y+20+400,"change");9 x9 z; B5 E3 r. m9 i! h
    rectangle(x+270,y+65,x+330,y+215);
    ; C! i4 n1 D% {+ Jrectangle(x+270,y+265,x+330,y+415);
    ' ]# L' B- |$ A& l" Z  R0 t$ `rectangle(x+270,y+465,x+330,y+615);1 D$ O6 z1 D8 v# q: Y9 |& v
    outtextxy(x+290,y+620,"TT");
    , Y: ?1 m$ b4 C9 jt = (float)com;' T! {, h/ F0 ~+ U& W, b
    temp=(t/101)*150;% o: U' H( c  s+ U4 q, J' b
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);+ x0 t7 l" q; k: c/ ]) v! c5 d
    t = (float)wai;" l* L! r  A! q5 T0 U2 Q
    temp=(t/101)*150;
    $ u0 V2 z8 e4 xfillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    6 u8 B1 y' m7 H5 \# zt = (float)cha;7 P: s2 i+ `" `5 W9 }
    temp=(t/101)*150;" W  h9 |# H* Q3 V/ U
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);9 f8 N6 i- f2 \" c; Q: v, ~
    for(i=0; i<3; i++)   //画坐标   high=90,length=2508 U1 c% _/ W( B9 F3 z4 ]" g
    {& l$ H  M2 W! G( [
    line(x+650,y+210+210*i,x+1150,y+210+210*i);
      n4 k: F5 R7 d$ @0 ~  L7 O$ e3 ]! F6 ^line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    6 I1 [# R# I: Z; Iline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);, Q6 O. U* p. v5 s

    5 }; _9 b. z8 P) r2 O/ h  i5 ~5 mline(x+650,y+210+210*i,x+650,y+20+210*i);: V1 x/ V- @4 Q9 J! M; M$ g. u* B
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    1 u4 q, ]! ^/ L" s# U, T" x- }line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);' u9 P" x; K0 H! Z+ m
    for(j=0;j<num-1;j++)
    4 }# I$ S/ c, Y# n  Z{
    5 _; `# k( b; c. j) b& |; Gline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    0 k& S+ R* M: {% T4 v+ S$ ~6 Rline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);# F" @" p  y/ h$ Y7 q: d7 p
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); % W' m# s+ J" q* I3 J
    }, O) E& n! E( r( z$ D- m
    }
    $ {1 \2 Y3 q" I* u, F0 R}6 u2 f6 }) O: t7 Q1 O* E
    return 0;  x7 _+ }1 O" I
    }& K8 f0 b: @; L/ ^& Z0 S5 q
    int drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha)' r, l. Y/ O# z9 ^0 G
    {
    5 h5 m2 d# Z8 `/ q& w# r# istatic int info[11][3],num=0;2 z' W3 h2 ]! o0 L
    int i=0,j=0,pos[10][3][2];
    9 p& q- x8 I# Sfloat temp,t;
    * k4 ^* S% V9 B; }' H' n& P3 Z, ?6 v4 [info[num][0] = com;
    , \7 \/ c2 L3 B, a6 E' j% b% q2 L0 winfo[num][1] = wai;
    ) W/ K4 ]* U& kinfo[num++][2] = cha;
    8 J, K1 O9 ?) Gif(num>10)  //存储10个点
    7 C! g& Z) u, Q) [{
    8 s' P# o" t/ T7 Q3 ?* u' k% Mfor(i=0 ;i<10;i++)
    * \1 _4 P, Q8 K; [& Z' t: l{: m9 P: z1 w$ J+ K
    info[0] = info[i+1][0];1 e. f% E& c; k* n# L; h* p
    info[1] = info[i+1][1];
    ; G5 H; Q3 D" ~$ v+ N; ainfo[2] = info[i+1][2];
    5 i+ J+ |- Z6 n9 t* A}5 |, q# y; w$ ]+ l" W/ W' ?! e! B
    num--;
    0 ~$ x" B9 T% o+ t& Z) |8 Z( S# }}
    ( v* D. G/ N$ g+ y  H+ Hif(FLAG_show==0)
    # o/ v1 a, J' M6 r6 I/ Nreturn 0;
    . C/ Q$ |+ _  A1 \& k- ~$ D! efor(i=0; i<num; i++)4 i" m* l4 C- u8 w  m8 T6 y# f
    {' A" g* ]$ Y* p* Y* y
    t = (float)info[0];
    . P  \& S- _, \9 j. l7 stemp = (t/101)*90;) A! b' i: d* J# Y. ^
    pos[0][0] = (10-num+i)*25+x+100;1 n, D' y# W% i6 z3 V* e, n* a5 N  W
    pos[0][1] = y+110-(int)temp;
    7 t  V- X0 {+ w  pt = (float)info[1];
    & N7 q' V, a4 {  C" B: Mtemp = (t/101)*90;
    1 q% V( q' A9 _( F* wpos[1][0] = (10-num+i)*25+x+100;: U+ E: e/ e  b, P  _1 Q
    pos[1][1] = y+210-(int)temp;3 q; V. p4 T7 t0 L. g: |% n
    t = (float)info[2];) X: e" J- E9 o5 I
    temp = (float)(t/101)*90;
    # U' H1 ^7 e/ g7 P0 Epos[2][0] = (10-num+i)*25+x+100;" k" y6 J$ `/ q2 r( T. D& M
    pos[2][1] = y+310-(int)temp;
    5 }# _4 k) G5 [+ D2 f6 T}: K( d2 W4 h! E- U$ @! Z! o5 E
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    & W- \3 S4 q4 Z0 A, J{
    7 k7 q, }* v6 ^" t( Kclearrectangle(x,y,x+400,y+315);, f. F/ B4 R. o. D
    settextstyle(20, 10, _T("楷体"));
    , O8 S. t. [5 {& {+ S5 W. Qrectangle(x,y,x+400,y+325);
    2 y2 l# C0 {7 Z8 wouttextxy(x+40,y+10,"CPU");       //画柱状图
    # V/ k7 N( P- R3 s$ f& Youttextxy(x+45,y+10+100,"IO");$ J$ m3 t) ^, A( Q/ d
    outtextxy(x+40-15,y+10+200,"change");
    - |% [! t1 K$ g8 B* k! c5 srectangle(x+35,y+30,x+75,y+110);
    8 a2 R) P# i8 \) prectangle(x+35,y+130,x+75,y+210);
    ' Q: }2 S, r: u8 n7 Yrectangle(x+35,y+230,x+75,y+310);3 d  S( c3 }: i: h! c2 `  x
    outtextxy(x+180,y+310,"SJF");7 R% h; B3 i" [( j+ y$ \
    t = (float)com;
    0 c1 y7 B; p# p! F3 M4 Q9 Vtemp=(t/101)*80;9 }% x, W& t2 I: T
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    9 p/ t2 h9 l3 I) E# g+ n) r- l( pt = (float)wai;, ]1 E5 H5 V1 ^, X4 |
    temp=(t/101)*80;3 @# D- _$ l+ D0 {( s- w# M9 F
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);. g. p2 X8 e" f( f- q0 A3 p
    t = (float)cha;2 Q+ w  w8 _% d0 w6 K8 _* f
    temp=(t/101)*80;
    , A4 o5 C* m6 G% M# Y' Bfillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    " t$ l5 `3 l2 P% Q/ jfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    8 H% O* s; Y7 F- o+ r; B{
    4 J2 _0 I; B( `$ }8 R, Wline(x+100,y+110+100*i,x+350,y+110+100*i);0 u4 o$ H& C8 Q; g  Y! x5 l" V
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    2 E/ z1 `0 q' Z. y* `: i/ i3 `line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    0 Y( V4 Z4 z, @" J" G) W$ l3 {* |% }3 ?, Y% [* @. z
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    - h% X9 `  D; P8 ~' L7 l8 p" K: dline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    7 [0 l1 ^* x2 Y) g! bline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);/ v& q# B* C% i* [" ^+ F
    for(j=0;j<num-1;j++)' E/ I/ n; g4 g* M4 U
    {
    2 U! J/ Z& Y  S* J" Vline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    7 I+ J& K$ i  [3 Lline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);) X* R% R) x1 e
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    - Y3 q8 N* B  x; u}( B* k7 T' M5 O: Z$ Y
    }5 m- G  p& h6 [8 n; Y
    }& J' b# j) p; ~7 {
    else if(FLAG_SJF==1)
    & f# ?4 j) L  }/ Z/ E3 u{
    : k$ ~( E6 p$ ~0 Z: q! l  |: Sx=0,y=0;
    ; G* U$ x5 w$ c. [/ D) `; c' L# Ffor(i=0; i<num; i++)
    . P+ p( B5 Z  s) B9 ?/ r6 {4 u{
    + r+ n6 @3 m. [! A6 at = (float)info[0];7 f5 p- b: ?* f5 ?4 x
    temp = (t/101)*180;$ r7 ~# x1 L* N. X( N' |& x
    pos[0][0] = (10-num+i)*50+x+650;' O- I7 q: v" V/ }+ B% A, w
    pos[0][1] = y+210-(int)temp;
    / G/ i/ K9 o4 Y& ht = (float)info[1];
    * ~( }) R2 L1 g8 f( Z5 ptemp = (t/101)*180;5 ?! f6 j% D5 ~
    pos[1][0] = (10-num+i)*50+x+650;) q" w& [. {6 j( O4 W7 f
    pos[1][1] = y+420-(int)temp;: m0 N; E2 s+ d5 I
    t = (float)info[2];
    $ ]! A# p7 [4 \; rtemp = (float)(t/101)*180;
    0 s( Y' L9 }8 D. N( Mpos[2][0] = (10-num+i)*50+x+650;
    ( v3 g7 f' N5 c1 w- {: e' Bpos[2][1] = y+630-(int)temp;! J3 s* |3 `' r4 f
    }
    + [- ]" {. j7 k6 X8 m+ k: eclearrectangle(x,y,x+1200,y+650);4 n/ t- B) |* {
    settextstyle(40, 20, _T("楷体"));5 ]# N# p& x9 A, M$ x2 \% n
    outtextxy(x+50,y+50,"SJF");
    + T3 c# y5 e& v5 {! y  W: u4 d7 f: houttextxy(x+280,y+20,"CPU");       //画柱状图8 X( o0 ?0 o( N1 o/ E7 {: \" r$ W  H
    outtextxy(x+285,y+20+200,"IO");
    % \+ d0 e1 q9 ~& e3 s5 D! E8 u3 |+ Gouttextxy(x+250,y+20+400,"change");1 A- G; |+ y% w; n2 l
    rectangle(x+270,y+65,x+330,y+215);( K" K4 A$ B. P0 U) N" |
    rectangle(x+270,y+265,x+330,y+415);
    ( L& r( R2 i+ C+ X# a1 R- t' Krectangle(x+270,y+465,x+330,y+615);
    9 |) D% P2 o' p0 W6 i4 k) b% Wouttextxy(x+290,y+620,"TT");8 g' t8 ]% N  Z
    t = (float)com;/ |: C" |: l2 R
    temp=(t/101)*150;/ I% O, X' g+ s! }
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);( c8 H# V5 R; R
    t = (float)wai;
    : l9 Y: f$ T, otemp=(t/101)*150;
    4 {& r# x$ L' ?+ r; ofillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    4 N  Y- Q5 f, i$ s( Lt = (float)cha;/ V# q+ Z3 v3 P, r
    temp=(t/101)*150;6 P1 n* Y* t" [
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);) k1 v6 U5 a" M1 w4 ]/ ^
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    . T' w% {+ y$ _3 A4 y{
    " Z7 ]' L/ E: U) Q* V( pline(x+650,y+210+210*i,x+1150,y+210+210*i);
    , H2 e9 j$ t) B- \+ tline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);+ m1 I* g  L+ y3 r: a  U
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);5 J: e7 V# Y5 H$ i

    / m6 M' `/ \# B3 B6 M. `+ mline(x+650,y+210+210*i,x+650,y+20+210*i);
    ; ^& X0 o, G' ?1 r/ rline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);; L5 i* r5 c9 W! B/ f" t
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);0 `& H% c) d6 W+ ?( {2 T$ P& q: g
    for(j=0;j<num-1;j++)
    4 H$ R9 l$ w' C3 t7 o; |{
    6 D, r) b# Q$ ?0 T& W. G8 G( pline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);' ^" M: V) s7 \* U- e+ Y7 i
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);+ V1 {: F0 \" }) E' N% n0 t
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); , R' r3 K( K* D8 |
    }6 p2 e9 n# I+ o: S6 s
    }
    " Y7 Y& v$ l( H$ x}
    : Y" Q9 c' }% a+ o- n1 E7 breturn 0;; w, `, @( _1 v2 m. ^7 f
    }
    4 C2 l) [+ D& T! a/ [int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    7 s& @. t/ h3 X& v{
    ( H) a  W, K" W1 Y; f8 Fstatic int compute=0,waitio=0,change=0;3 @4 K. v" [; q" v5 \
    static int computeLast=0,waitioLast=0,changeLast=0;% \) u+ X' t6 z) `
    int i=0;
    5 p# ~' e0 @9 ^/ Aif(draw==1)" g+ O* A# ]( m. E# N$ n& A- C
    {4 t' g  A$ H% p# U+ }# ]% ^" |; m& S
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);( L. H" c9 Q5 M- O3 i
    drawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    ' }. @0 N8 B' L# e* scomputeLast=compute;
    1 s! Q  D' ~7 j; {waitioLast=waitio;
    ! O' a0 _0 e) o) n2 p& `, DchangeLast=change;/ }+ L+ H% G3 ^5 Q3 R
    }
    8 _+ a0 v9 T: i5 n- e9 Uif((* memory).p[0].flag==ready)
    ! Z5 `- H) N& B2 v7 ^4 k(* memory).p[0].flag=computing;
    * X& [0 c) }: h# m. X: uif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)9 o% S4 `+ `2 }6 U3 t( o
    {
    & l) p* L0 L+ a) P' r, y+ qi=(*memory).p[0].computeNum;
    + A4 _) g5 }) r$ V; tif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed
    2 ]4 c, M1 n/ J8 F/ ~2 m{* O) D3 V- B3 z: H
    (*memory).p[0].flag=IO_waiting;; _; i: r4 c2 ~: o" l, M; a7 \0 ]. m
    (*memory).p[0].computeNum--;
    : F  l4 B: ?: S8 nchange += exchange_IO_Compute;
    - p# _6 z* @* i4 {/ s; P- scompute++;# q( U0 w9 ?* N1 h3 b
    }, B) k' m# C7 K' r
    else  p/ O( a& j' P- ~
    {/ k1 h( ^: H5 ^- [0 Y' c& S% \+ z
    compute++;
    , D+ G% j$ }( y}
    8 {+ }* k. _" K' _$ \7 i3 ^3 [}
    & F" G; A. z3 i4 x8 k! xelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)7 G! Y, @1 h' m
    {9 K0 U& q1 A- x8 S' Y" W

    1 N+ j# ~2 E! P- l; }9 q! zi=(*memory).p[0].ioNum;8 ^2 [5 J( ^: P: I& ]+ X
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    # e  a8 F( g# W. E( i, p  w{  D4 {$ p5 X5 r  [
    (*memory).p[0].flag=computing;" M+ g- e+ L4 p8 q* \1 _
    (*memory).p[0].ioNum--;5 {( l6 j0 t+ O6 Q
    change += exchange_IO_Compute;9 N1 W2 z% t/ G1 e$ |3 Z; ?' a
    waitio++;" B8 z  s9 Y+ S4 [! q: n/ j
    }, ?' y: ^# M# C, D) r$ U- @  c% o1 A
    else
    $ y! k4 r- V$ g4 b5 d{
    9 c! P  C- d$ z2 x  d! bwaitio++;
    $ E, y6 l; d# K}4 w5 j; U2 e* Y" c. F
    }
    2 y- d( y$ y/ f/ {else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    : y7 |; i9 b/ c{
    ; t8 m  X1 D  T, g5 m7 a(* memory).p[0].flag=IO_waiting;
    3 L9 `+ ]6 s& ?% a2 P/ ?change += exchange_IO_Compute;
    # ]( n3 L  W- S5 w5 H2 l: {9 Z: O}' L/ G" W* }4 T/ g( Q. O; }' Z
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)/ j! z; m5 U# Q" d4 i* N. z; L
    {
    " a$ `8 O% m& Y5 O! `! s0 L(* memory).p[0].flag=computing;
    3 l, t' [0 O6 {, I+ Hchange += exchange_IO_Compute;
    , K' z2 {" [' A$ s2 i}8 ?. X4 ?3 }: X6 w% S
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成2 c  q% ~" }: J- _
    {
    3 @  M% i& @( C. A0 }(*save) = (PCI*)malloc(sizeof(PCI));$ s& G% T' h9 X6 e
    (*save)->next = NULL;
    0 _1 n0 }8 }5 d* U+ i8 v: i- ?(*save)->processID = (*memory).p[0].processID;
    ; w) y; j7 K! k(*save)->comeingTime = (*memory).p[0].produceTime;
    ( H# a9 `7 h5 _) Y1 P(*save)->askMemory = (*memory).p[0].askMemory;( A4 h1 W1 K. P/ j
    (*save)->compute = compute;
    9 v$ D" n: @2 \+ G" Q(*save)->waitio = waitio;
    2 |. V* v$ n5 R+ }(*save)->exchange = change;. u! i1 h/ w% q4 v/ X
    (*save)->completedTime = systemClock;
    ; `3 t9 G8 J- J5 f(*save)->runningTime = (*memory).p[0].runningTime;
    6 ]& X& W8 H2 s. q1 h! `$ a*spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;
      U- H6 Q5 T' X+ Y6 g1 L3 f* g& Jcompute=waitio=change=0;
    + `+ \/ C( j1 B) F; B3 e  T# lcomputeLast=waitioLast=changeLast=0;/ d$ ]5 ?% h4 T1 @1 C: S* I
    High_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);
    0 O0 W$ g1 R' k& y( G3 Q, f, Mchange += exchange_process;
    ' J5 q, O% y5 z# hreturn task_completed;, U# u: u/ N% |! V7 \8 t! ]
    }" N; U5 g1 @" O6 c3 z# @* X
    else
    6 }4 c7 H4 x. ~9 Wreturn task_not_completed;
    # U( s. h7 A7 q- k! w! I+ g}& b. g9 ]$ |- y4 Q
    int High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch)  Q, D0 m, P4 x# U" V' I# I
    {1 O. H4 x8 j/ [6 Z, g8 k
    static int waitTime[initProcessNum],i=0,j=0;' E# f7 ]* ?8 Q8 O
    static double HR_ratio[initProcessNum];
    - U" s/ R: c+ O$ n1 C5 |6 }if(flag==0)                    //初始化数组
    / }7 z; u% N6 J0 \5 |/ |0 ~- A{+ v! V( l. E1 B% }0 Y/ h7 |
    for(i=0; i<initProcessNum; i++)" {( _3 ~; A% c0 o2 t
    {
    ( C7 c+ ?! f% k3 rwaitTime=0;
    # \! `" H4 O6 Z# f8 p9 |" kHR_ratio=1;& d1 ~" b5 I4 _3 {1 y' X6 V0 r2 v
    }
    : D* n0 ]# F8 b/ W% n7 B1 e, y}# f* v& O' g4 c0 S0 t; v
    for(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比
    * e8 q/ Y& Y9 ^' _; S4 L4 w{( w, S% _; A  s- P/ H
    waitTime++;
    : o7 ^. M$ z: V1 O5 Z% r% NHR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);( r8 ?4 f& k# f' e+ i9 g* L/ a2 v
    if(HR_ratio > HR_ratio[j])
    ( v. i9 o; [7 O, P0 U5 Aj = i;
    / F9 z5 ]2 Y6 @+ \6 e9 R+ S}
    8 ^9 Z8 m0 W0 T" M3 [5 Jif(dispatch==1)                    //需要调度一个进程到内存中执行! q) h9 ^& j) _( H3 Z$ H
    {
    4 M# h: ~. S8 l* Zif((*storage).p[j].askMemory < *spareMemory)
    . M: c- I1 p/ r8 k1 S! W: j{: ]4 f7 y, i# _3 q! D% a, h5 H
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;5 i$ d2 a* w& n
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    ; `) `8 h* a; L; b& @(*memory).p[0].computeNum = (*storage).p[j].computeNum;
    ! q  ]; Q- m# o6 m+ f3 L(*memory).p[0].ioNum = (*storage).p[j].ioNum;* z8 M+ m) O& v7 |3 P
    (*memory).p[0].processID = (*storage).p[j].processID;" F' C1 B- }7 F: C
    (*memory).p[0].flag = (*storage).p[j].flag;) d2 x; j5 @" N6 x
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;
    5 f' {3 E; N9 `" z- v0 s(*memory).p[0].computeTime = (*storage).p[j].computeTime;7 P7 b+ u8 W8 g& }8 d' N
    (*memory).p[0].runningTime = systemClock;
    0 Q7 `' h( Z4 i6 `7 Z3 X4 g* R# v(*memory).p[0].produceTime = (*storage).p[j].produceTime;
    + U1 r& @- ?( G. p# kfor(i=0; i<(*memory).p[0].ioNum; i++)- L6 n% P! c7 f" w+ d' K
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;# h, [& B* X7 T* X( b
    for(i=0; i<(*memory).p[0].computeNum; i++)
    " ]* ^( ^5 r  }0 P' F(*memory).p[0].computeClock = (*storage).p[j].computeClock;$ _: z7 `; f, m. J6 c
    (*memory).proNum=1;
    ! L. p4 M! T& s  R; s3 _2 H*spareMemory = *spareMemory - (*memory).p[j].askMemory;. j- y7 J; i% V0 c* N& K
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程5 L, _; d: a! U% Z
    (*storage).p[j].produceTime = systemClock;
    $ i& g" h/ m& _6 g& UMAX_COMING_TIME = (*storage).p[j].comeingTime;
    3 g$ b, \% G9 c/ X& _waitTime[j] = 0;) l7 [8 a8 [* }( q' @" g) o7 [# V
    HR_ratio[j] = 1;
    2 l  |& f) H1 \, [}+ V' D# }# j) h0 q' M" w
    else
    & @; i2 _4 `+ Y! B{3 {7 V( ^, ^* w; U+ P
    printf("A process ask for a memory overed the system capacity\n ");7 w9 l( k( ]' e
    exit(1);* v) W* j9 {3 {) b
    }
    5 i: f; t+ K! L* |9 E}3 f# ?0 T/ E- p3 f3 J" U# s
    return 0;
    / h! I2 h  Q3 y  u* P# K# m" {- L8 f}( X8 V& I+ ?, G) Q3 N
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)2 c* N" I  w% T' d
    {$ h: B# S2 \) C. L' ?
    static int compute=0,waitio=0,change=0;
    % O" y1 L, p' H2 S( Nstatic int computeLast=0,waitioLast=0,changeLast=0;5 z( p4 v9 A1 r/ y* @
    int i=0;
    / i! Z7 p( i) U7 nif(draw==1)) Q% t# G! G2 ^+ w9 E
    {+ A- `: _: {7 {% H/ B
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    9 f5 R  o' w6 B$ d  G4 a, EdrawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);  @* f+ C5 k! O" v

    $ D0 \( i) [3 Q3 q. t
    ; a4 c* C3 q2 C& wcomputeLast=compute;/ b2 n6 y) ?9 e5 v0 l
    waitioLast=waitio;# t3 h- P/ Z1 ]; F6 ^
    changeLast=change;
    3 c; [- C0 Y' l, T}
    8 s3 H7 I8 o$ R! B& P6 Qif((* memory).p[0].flag==ready)& b* v+ u, [" w3 f0 q% R
    (* memory).p[0].flag=computing;) E0 N4 a$ r4 ]3 {9 B4 j3 P5 @
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)4 D7 T* `7 }+ @
    {0 P& [9 q) O9 o6 ~- ~3 i0 h
    i=(*memory).p[0].computeNum;0 U, Z, [, G% ~& S; i/ S5 z. c$ p$ a  F
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed- ^, q  i" K8 i! h
    {
    ' }$ I8 t% D& y(*memory).p[0].flag=IO_waiting;0 ?. z) y+ o+ ~1 l# ^: R# v7 Q" H
    (*memory).p[0].computeNum--;( m1 M; o9 B, M- N
    change += exchange_IO_Compute;* O7 b9 h; J# `# m1 F' {( A& y; [
    compute++;
    5 S# A5 ]" z" _, s}
    , \8 P) u, Z. ?0 C4 k5 _+ d0 nelse" t, i5 |9 i$ P: r2 H  u6 z
    {! a4 h: D3 q; g4 i, L8 N
    compute++;3 |  e/ C, z% u7 t# O
    }
    0 H( U$ T. u! o8 m+ b& P4 W1 L- L}! _* Z- ~: h5 p1 k0 V. t; k7 N+ L
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    ( I: n) v  G6 ^0 k$ o{% ]1 j+ R0 m" B1 h4 S# `

    9 c& Y' h) G2 Y) x8 U0 D+ e5 Si=(*memory).p[0].ioNum;
    6 {; x8 K- h+ d% s& Eif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    $ ], P" a8 P1 B# p3 ~5 S{* h: {+ c6 R# L) c0 A0 `9 n- d
    (*memory).p[0].flag=computing;
    3 `2 {7 F1 `$ I8 @0 V# ?% L7 q# K(*memory).p[0].ioNum--;# K* \  H7 a  ~/ x* p7 F2 ~! c  _
    change += exchange_IO_Compute;# ]0 u7 g- C& b" d
    waitio++;. O+ |' I6 M8 M5 P
    }
    # S8 L: v' ]: B* R% V/ R9 ^8 \else
    ' v: F3 F7 O2 u1 V4 n. H{
    4 [$ b0 m5 G6 q' Y- Twaitio++;
    ! A- J0 K5 g. }1 X% T. c}/ }) ?$ w; m0 L; `1 [+ n$ ^
    }
    ( g  z7 L! r9 ]  V4 A0 aelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)0 N; P* N" u6 y
    {) M: C/ N5 p+ S& f3 l& x: V7 ~$ {
    (* memory).p[0].flag=IO_waiting;* p. n: b4 V: |* R! x2 R  W
    change += exchange_IO_Compute;0 R: V( a1 E+ w; _7 ^  n
    }  r0 e% i' n. B4 C' R# _
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    8 `$ P2 `2 u% @: z  E/ C" ?{
    0 X3 b9 [/ `2 b" ?1 `: I  j! [(* memory).p[0].flag=computing;
    3 `& X/ C! X" v4 F+ ~change += exchange_IO_Compute;: B* D& U7 |+ O2 F9 J. d
    }
    , e1 E8 ]% @$ U' gif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成: b, ]! v* @9 p+ z) ^
    {( R5 R# F, m* x5 p6 v5 t: s2 K
    (*save) = (PCI*)malloc(sizeof(PCI));
    2 u% h0 v4 e2 C5 N& l6 b(*save)->next = NULL;" N- k+ i5 Q; p  P" M9 t0 P: {
    (*save)->processID = (*memory).p[0].processID;8 L( V9 @0 Q7 q3 D
    (*save)->comeingTime = (*memory).p[0].produceTime;7 a# k$ @  i7 c& E) {
    (*save)->askMemory = (*memory).p[0].askMemory;
    2 b  o% Y! M' W- r8 a) J(*save)->compute = compute;! D& k  E* E" p
    (*save)->waitio = waitio;9 C1 q1 }7 h0 }( D8 S, |4 T5 ]
    (*save)->exchange = change;
    3 }  C& Y* `1 l. A(*save)->completedTime = systemClock;" q1 ^  L3 m5 n2 U) E
    (*save)->runningTime = (*memory).p[0].runningTime;0 W0 C7 t( J" a6 y7 R9 F
    *spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;2 x# u4 f$ b9 X' E& F0 g
    compute=waitio=change=0;% U" k: \+ Z* G* F# f- X. \% w
    computeLast=waitioLast=changeLast=0;
    7 W! j) j# u" M0 x$ ePriority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));
      `7 F- P- i4 O1 u6 {# Tchange += exchange_process;+ a4 r! q; [: E- u8 s1 i" [
    return task_completed;$ Z4 X# n5 N3 v1 q
    }
    + C1 f8 y8 Y# m, a$ ~; P" g$ Gelse
    & J4 I5 U9 O8 A- Hreturn task_not_completed;" {% D0 B8 {. c6 }" p0 A
    }2 s5 o' m# J) h! G
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)2 L# \6 ~- `- g8 T
    {3 }2 T7 m& Y  K0 k
    int priorityNum[initProcessNum],i=0,j=0;2 \, C7 c# ?* L$ L
    double temp=0;2 I6 C2 o! B' T' P- F: m3 v$ A
    for(i=0; i<(*storage).proNum; i++)    // setting priority to each process
    . k+ H& d: J  J$ Q6 N# `{7 U* c0 r8 @$ U8 s! @% [; f" P" b
    temp = (*storage).p.computeTime/(*storage).p.ioTime;9 k" P6 S5 ?5 E2 c% S! e
    if(temp > 0.8), r" F: o' f- @, X5 S; C
    priorityNum = 6;
    0 @$ v# N! |) t$ A. M) welse if(temp > 0.7)
    ' Z! \7 D. N0 S& bpriorityNum = 5;
    ' z- Y4 e4 W8 L* O. \else if(temp > 0.6)
    : @  @4 Z( |6 t9 L) I4 O1 {priorityNum = 4;$ D4 |2 F1 M  Y+ Y& \: E
    else if(temp > 0.5)
    1 _+ g, ~7 \/ U; |" |priorityNum = 3;* m  |" |0 X& |/ P8 V
    else if(temp > 0.4)
    3 w" U+ I2 F  kpriorityNum = 2;
    / a2 e1 n+ F( pelse
    1 J: k: z$ K# n4 }: ]; ipriorityNum = 1;& G4 O3 H( \0 ]5 {6 @
    if(priorityNum[j] < priorityNum)/ ?3 n3 I; E  K, g1 ?7 A# s
    j = i;. U& Y; _/ `: {( |
    }
    $ g8 f" L* X; t' Iif((*storage).p[j].askMemory < *spareMemory)
      v5 k( J4 Q; m$ a{, P9 [/ e, n! b# I. X8 F
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;5 e* N5 u% v, l
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;# R. A; k) k$ h. L9 W- |
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;
    , |9 @% n# a9 M, m(*memory).p[0].ioNum = (*storage).p[j].ioNum;$ \; J! N; l$ s$ J1 Z6 w& ~
    (*memory).p[0].processID = (*storage).p[j].processID;" P8 A% D) J4 }/ j
    (*memory).p[0].flag = (*storage).p[j].flag;* l- l+ ~  O) X4 s7 ?
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;" C" W1 E9 s  Q; T( G: Y+ W! F
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;& U& m" ~, V+ e) r/ K* I2 ^
    (*memory).p[0].runningTime = systemClock;
    ! i" [" X4 r& P. R/ [" }, d(*memory).p[0].produceTime = (*storage).p[j].produceTime;: |5 |/ L" f0 d$ q
    for(i=0; i<(*memory).p[0].ioNum; i++)
    / b# ]! G' l: u1 n2 b  m' t(*memory).p[0].ioClock = (*storage).p[j].ioClock;. T, T( i5 c. C: W$ }/ I
    for(i=0; i<(*memory).p[0].computeNum; i++)
    4 l8 T8 p8 g/ j(*memory).p[0].computeClock = (*storage).p[j].computeClock;
    , r- |! p4 b) I) ?(*memory).proNum=1;
    ) b3 X% b  x1 w5 h*spareMemory = *spareMemory - (*memory).p[j].askMemory;
    $ [" F' _- q1 z! `5 nproduce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程( A  ]; \! p# `4 ]
    MAX_COMING_TIME = (*storage).p[j].comeingTime;
    * Y3 |6 J6 p+ f4 Y- G. L6 |}
    ( L( w7 C3 x5 O8 c7 i( oelse7 O' z# `7 {  E/ o
    {
    3 N  K0 s& H2 d0 tprintf("A process ask for a memory overed the system capacity\n ");6 X1 Z$ r8 Y2 h  z) i9 q3 l
    exit(1);$ p+ I; k/ C0 A
    }. y# G) v# \* s
    return 0;4 j0 t# t) e- S- i: m5 A
    }6 O* E/ J+ J" E, R
    int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    , c6 u% v% t) G" ]0 Q5 H1 ?! C/ L{
    " z, @" |- I% \6 [static int compute=0,waitio=0,change=0;6 z5 o$ ^& m& M' @% ?
    static int computeLast=0,waitioLast=0,changeLast=0;
    & G6 P1 ~# r/ Dint i=0;
    1 H/ s# d7 z5 ?$ J3 j' \1 h4 Eif(draw==1)
    ' H1 E, ^' e+ Y) u/ [9 V: _{
    % \3 j  X0 @6 N$ V6 C( _5 s//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);; k1 n, v6 |; b7 C+ H; O. N! N
    drawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    , p& @& a* P8 M! J, |
      ?$ m. N# w3 O1 j1 e% u) y1 m2 k2 @
    computeLast=compute;- x$ ^5 Y; N$ l: }6 T' ^6 A
    waitioLast=waitio;% ?5 }8 a0 Q  [3 C& J
    changeLast=change;1 S" P& ^2 P+ o4 S  F
    }5 t8 B1 A- x! f& p1 a0 a: r. \0 E  B
    if((* memory).p[0].flag==ready)
    2 d- U& h; |# p7 U/ ^" O: a& _(* memory).p[0].flag=computing;+ `0 i- C# a! K* U% O% _: A. y
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    1 o  V( ?, O( o# R4 V- U$ l{
    + |8 U$ P) q, ~0 Ji=(*memory).p[0].computeNum;
    2 _/ _4 y4 a& _" K5 }+ Sif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed# Z" J! G  c# r9 f1 ?
    {
    ) d# D2 A3 A/ t0 U(*memory).p[0].flag=IO_waiting;2 ?7 |1 Z6 }: @2 @+ }, x
    (*memory).p[0].computeNum--;
    0 V' t5 @$ u$ K6 p& N( [change += exchange_IO_Compute;
    8 n* s; J4 |3 t: Z7 X: dcompute++;
    $ n% M! B- |7 P: D* k4 `}
    4 }- [8 N+ _' ?" }1 m1 m2 velse, h9 q) B0 @; j( p2 H1 N& Y- D% t
    {7 J  k' \# e1 c& l% E
    compute++;9 A# t7 M3 j" {) P* o8 v
    }
    0 J6 b' e' V/ Y7 N  I% {+ T}
    & u9 M% h) Q/ e+ t- jelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    . y4 P& `. c/ M* t1 H{0 B+ a+ ?/ s$ d: d2 ?6 K
    7 r2 T; g( p. i" q" ?! P2 n
    i=(*memory).p[0].ioNum;
    % H7 r+ R+ T- j8 S, S+ T6 @( xif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    $ ~1 ^; P' _9 m+ z' o4 H, l{
    5 P2 |/ N9 G# u/ }7 j" S) e5 Y& K2 B(*memory).p[0].flag=computing;
    / t: V4 v, ~4 ?/ j/ T! r(*memory).p[0].ioNum--;. ?1 M: u$ d1 H* Z0 e
    change += exchange_IO_Compute;, W/ |: z' b" F* F; d. v% f
    waitio++;0 }2 s- v7 \' m9 u6 ^' v& G
    }7 P+ ^$ R8 R9 X9 S: P: ?
    else
    " s% O( n" a$ H+ B8 R{
    , s1 e& A. r# ^$ E9 b1 uwaitio++;
    ! p, t1 l0 m$ Q- [" o}" C: T! I/ p: ?+ R3 K
    }% r- G; \& m2 u/ J; }- x2 V  m& t
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    " s* q* L6 k/ I4 x/ c  p2 ~{) z) M, ~! v. a7 F: u6 B  b
    (* memory).p[0].flag=IO_waiting;
    % r$ [) y- v; O/ l# K6 I9 ?change += exchange_IO_Compute;
    $ p4 }2 r" y! b! \8 B& u! G  Y}  V3 F) D3 R3 t6 @+ T. g+ ^
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    ( i. \. Y+ I* j{  l4 C8 S) ]  L4 N! f
    (* memory).p[0].flag=computing;& Z; Z1 Z8 i2 c+ I/ A( K
    change += exchange_IO_Compute;
    8 I/ P: \' N. N# W! X}( ?; T6 G/ V, w- X
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    ; r) p: S. }; K$ r# J{
    ) D" i9 \' x0 V(*save) = (PCI*)malloc(sizeof(PCI));  r% R1 m% x- d2 y3 |1 _1 B
    (*save)->next = NULL;" t% K( O" }$ P/ g2 w
    (*save)->processID = (*memory).p[0].processID;
    . h: D8 `/ }) k(*save)->comeingTime = (*memory).p[0].produceTime;
    3 J( ]0 C6 ]; K' a7 F! z(*save)->askMemory = (*memory).p[0].askMemory;
    5 b4 N- X  q& K5 R+ ?3 l  t6 ~" l: R(*save)->compute = compute;! f' d4 M3 t6 t/ m' R0 h: R
    (*save)->waitio = waitio;
    ' D, T2 K# J$ k1 K(*save)->exchange = change;
    % ^4 z. l5 Z) n6 N- E(*save)->completedTime = systemClock;
    * W8 @, b: ?+ C; P- Y/ v(*save)->runningTime = (*memory).p[0].runningTime;
    # c# k; A: G+ c) |+ J/ V4 |7 {*spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;
    ' k1 j9 e* H- \1 Zcompute=waitio=change=0;/ z( x1 b  ^3 L6 ]6 s
    computeLast=waitioLast=changeLast=0;9 L# P& W: e2 @) R! X
    SJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));
    . B5 ?# e: N# |2 G" R5 ~change += exchange_process;2 X" b) F. {: ^! T
    return task_completed;, m) I$ A0 H* V
    }
    , B+ v# Y8 s! }! f3 G% J& q0 a% F# Delse
    % ^& }( H: b+ g+ a% g2 Xreturn task_not_completed;% f2 Z% u, _5 \, ]8 R) H
    }$ ~1 Z$ I2 F* e- q. z; P
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)4 R" s7 H' u+ L1 y. S
    {
      z5 |/ g' T- U( }. r/ k3 h' v7 {int i=0,j=0;
      `& A, I* Z6 dfor(i=1; i<(*storage).proNum; i++)
    / f4 R3 B9 C1 }4 @2 T{
    * s) T4 B  u# Y! M, K" lif(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime))0 Z* ]6 e6 B3 E5 l& x5 k9 o7 }
    j=i;" {/ j) C* }/ C. n# l% U
    }* v2 h3 w$ `0 v4 i
    if((*storage).p[j].askMemory > *spareMemory)( d0 @( n; [$ B; X4 ^4 a. N3 P
    {
    " W5 U! Q! }; P/ i% ?5 lprintf("The memory asked is overflowed than the system memory.\n");
    $ T+ O, p) h: T6 iexit(0);* A) _2 V, H2 G7 E
    }$ L; |: q! j, N0 Q
    else
      i, q1 w" o" F2 p8 Q' c6 Q* E{
    7 u7 p7 @& e. ^' f) F% o(*memory).p[0].askMemory = (*storage).p[j].askMemory;
    4 N+ @  }- m! p7 H7 p% W( ]3 T(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    * j  V# Z( ~: s* E4 o4 ^+ d1 T(*memory).p[0].computeNum = (*storage).p[j].computeNum;2 q4 m: O2 y; K
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
      w% H0 h+ b5 f(*memory).p[0].processID = (*storage).p[j].processID;
    " k' L6 f7 o9 h' o3 t( @& c(*memory).p[0].flag = (*storage).p[j].flag;& P. f! [% A( x% \  l
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;
    4 r- c1 j, H) Y  A5 b7 O4 a' k(*memory).p[0].computeTime = (*storage).p[j].computeTime;+ l0 @+ h; s/ [% ~9 q0 d
    (*memory).p[0].runningTime = systemClock;
    2 c4 P2 G+ K: i(*memory).p[0].produceTime = (*storage).p[j].produceTime;
    - a0 z  d% t6 I4 rfor(i=0; i<(*memory).p[0].ioNum; i++)
    * f' M' B1 ]: B(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    ' D8 T' p5 T* \( R8 [for(i=0; i<(*memory).p[0].computeNum; i++)9 q0 A+ @! F/ s$ W4 `. |
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    * r7 j1 ~: Q, b6 y4 e3 l, G5 Q(*memory).proNum=1;
    0 o, J4 {$ l2 y. Y9 Q# H0 b+ Q*spareMemory = *spareMemory - (*memory).p[j].askMemory;, w( H+ q+ A+ R1 |1 h4 }4 N! {- h
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    1 f! z8 }8 D" AMAX_COMING_TIME = (*storage).p[j].comeingTime;
    ! S$ x1 [) Q. z# k}6 [# Y6 f$ {: [) m6 O1 w
    return 0;
    , o4 |! c2 X4 f1 p}
    ' _% q& D7 y5 |4 Q$ U7 Tint TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)* Y+ l& d4 {6 J
    {
    7 ?( P. Z4 u% H4 |1 P7 Sstatic int compute=0,waitio=0,change=0,clockSegment=100,poi=0;
    & a* Y' w4 @9 ]& {% _2 estatic int computeLast=0,waitioLast=0,changeLast=0;
    . S$ u( x6 M$ C1 f- q% qint i=0,j=0,k=0;$ |6 K! Z+ Q6 Y5 ^. p2 g6 A( K0 A
    if((*memory).proNum<=0)
    # F# W0 W- |8 Q7 B( [TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);' u  V1 V9 j) i; D. G% _
    if(draw==1)
    3 e# J7 B9 g& O+ {( Z5 Q, W  o{
    - ~& i- J! ~1 v, W* n1 a: W; {//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);" |6 w1 K  y& Y2 c$ }
    drawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);- E! j! U# y+ n0 p/ ^( Y" r* Z. ^7 ^

    , O% T" i* I: h# w8 h, A1 q) D  v( v; t* o
    computeLast=compute;
    8 R: `" M3 ~) |2 YwaitioLast=waitio;
    ! `$ A& `; d8 O6 x$ u# dchangeLast=change;
    4 d& H1 Z9 K. |. i}
    & H) f* O$ m2 K0 ?. n& {0 Cif(poi>=(* memory).proNum). l$ y9 Z9 z. T2 {' U/ ?; @; }) }
    poi = 0;
    ! f3 v5 {. y6 z8 Hif((* memory).p[poi].flag==ready)+ ]+ ?) A" k: b1 s1 x) {' p* ~% i; Z
    (* memory).p[poi].flag=computing;
      o- p9 e% N: e7 N. oif((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing), Q! m  \& @0 L( ]5 z
    {
    6 i4 X; u2 A& ~# W, H( Si=(*memory).p[poi].computeNum;
    ( W# t# Q$ b9 x' b+ k5 oif(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed. R+ B4 V% {4 e3 U8 z4 l5 J! z8 ?0 J6 J
    {; n+ d7 |5 t- o- m1 _
    (*memory).p[poi].flag=IO_waiting;  T" O( e4 l5 a. d1 J+ O8 Q
    (*memory).p[poi].computeNum--;
    ( E- a6 f% O- @$ b" }change += exchange_IO_Compute;
    / }# W! g7 T* d2 i) C  m( z- j! Hcompute++;, i0 E+ H9 M) y# C3 F% g9 h/ }2 n
    }1 P9 r& y+ K; F1 \: N2 k) H# A, {! A
    else7 ]  o# e+ f$ F: [0 ?! o3 x
    {3 R* j/ V: v7 @% P$ S% h
    compute++;. L# Y7 ]' Y# \$ S: ?6 z* `, f
    }
    ' s0 S: u$ H8 }2 A+ h2 u}7 ?0 x0 p" B( k
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)
    0 Z6 f6 w0 n' n# ~2 S7 U- b# d  u{
    , G3 Z; ?5 T2 U5 d
    / r: @. ]' V5 T% o! H' Wi=(*memory).p[poi].ioNum;$ D( B9 w5 i3 _: `
    if(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed
    0 @4 x* Q7 W! ~& ~( f' s{( C1 G1 v# p- C* k/ T2 ^) _/ f5 Z
    (*memory).p[poi].flag=computing;
    9 z7 K1 i3 j: @* L" L& C8 i) K(*memory).p[poi].ioNum--;
    ' {( r9 H  ~, T# N6 ]# t6 P4 Fchange += exchange_IO_Compute;' ^" n* R) J- E* d0 @$ a* C
    waitio++;
    2 s) o1 J2 E0 g0 X* N}* C$ B# X+ \! U+ i$ c+ ]2 K* ?! c
    else
    : v) a, a1 @# b{
    # U: q1 b% A& i2 r+ X, Y; Q9 pwaitio++;
    3 z0 ~0 k& ^4 |2 h) t; c}
    ) b/ C2 y/ j: h. {1 M}
    # `! S" j! q0 F0 J1 \else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)
    + ?: ^0 N7 C& P) l$ n, c& t3 c; z. [{8 L) k/ f/ N& v" g& m: F
    (* memory).p[poi].flag=IO_waiting;
    # m5 U% c, q9 U: A+ x: ?9 _change += exchange_IO_Compute;
    + [# o2 n4 h* g' N' r' ?3 k/ ^}6 r3 B; \  a9 k+ \
    else if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting)
    + p" K8 A: g! L2 V" C{
    : Q- y% d: k% w8 q9 I4 d; ~* l  p(* memory).p[poi].flag=computing;3 j1 C( t! h9 @+ Y) W5 C
    change += exchange_IO_Compute;' |/ G. U/ \/ h. j& F
    }0 }, |0 O" ]/ R
    for(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进: {% m& B0 b; C* C( `
    {, Q6 J8 b8 ~4 c4 h7 ~0 n
    if(i!=poi && (*memory).p.flag==IO_waiting)
    & m, w' l) t7 i9 P; R1 X) N" ?$ @{
    / x- c" W7 K; j. W4 vj=(*memory).p.ioNum;  n$ A6 h/ G) `* I7 ]
    if(j>0)
    9 H6 i. \6 G4 E' W/ i2 o. E{
    5 E! ^: z8 n7 f. sif(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed, Z: F% n& i/ S1 v5 ^0 M6 k
    {7 x6 W4 E! {  ^1 d  P3 E5 w& D. d
    (*memory).p.flag=computing;8 J: x/ p. V$ O2 ]2 H
    (*memory).p.ioNum--;
    . H1 h8 V, S4 K, Vchange += exchange_IO_Compute;
      c. F+ S0 e) j}& x8 E* e( Q$ o3 x
    }
    9 I  @7 y' k) h, U6 T1 T1 L) t}
    $ o( h2 K. O7 w! b}
    ; K6 b9 Q) O9 U* v+ o' Z; Lfor(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程4 t1 ~/ w& \% i2 ]  i9 `
    {
    ) r" e  i* T4 D! z! e6 K8 sif((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed% b( f( `$ a' u# b% Y* X( a
    {0 l% [6 L6 L( e
    (*save) = (PCI*)malloc(sizeof(PCI));
    * n2 C. s( }3 G" ~(*save)->next = NULL;
    ' R8 k; Z+ j. |: `       (*save)->processID = (*memory).p.processID;6 k& U: Z0 J- x, D( f
    (*save)->comeingTime = (*memory).p.produceTime;
    1 f1 a  m; O9 p7 p$ V8 B6 H+ p(*save)->askMemory = (*memory).p.askMemory;& K9 Z+ _3 f. v3 r, c5 U
    (*save)->compute = compute;
    ' d2 [/ S& o, B8 M. F0 H1 K% s(*save)->waitio = waitio;2 M0 @  d' G2 d
    (*save)->exchange = change;- @8 k* t" P: E
    (*save)->completedTime = systemClock-(*save)->comeingTime;; F6 F! }  i' M# S) q' z1 {1 @5 K9 D
    (*save)->runningTime = (*memory).p.runningTime;. n0 C8 I2 k: X0 ~  z( X
    (*save)->completedTime = systemClock;& q6 I/ r' h: Q) X
    *spareMemory = *spareMemory + (*memory).p.askMemory;- A" d8 m4 ^! a% P9 n
    compute=waitio=change=0;
    . ]& ?3 p2 w6 R$ ]computeLast=waitioLast=changeLast=0;
    6 H7 ~" Z9 A4 P- k# ]" x5 Lif(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入6 ~7 E7 A; N; r0 _2 N
    {( s$ Y* y3 \; ^0 }1 m
    if(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程
    3 A9 _: X$ W* |' K" S{
    - @) J- I9 P; @5 U4 ~6 Npoi++;
    ' S- G* {# X* S4 d   clockSegment=2000;
    % O+ M% p  D4 ]- k& s% w9 y}
    / w3 B9 y5 E* x% Q! @/ o}
    5 ^8 u. f. V# j$ nelse  //没有足够内存调入新进程% m  Q0 H% y, B; L+ x
    {
    % r2 R$ K4 C1 E" [if(i < (*memory).proNum-1)
    & @( b) C0 }" ~& V{" U5 O4 ^) N: b2 s8 Z( V# W
    for(j=i; j+1<(*memory).proNum; j++)  x! W7 r5 q5 l- z. [, O
    {
    % V9 X: @- m4 l* S(*memory).p[j].askMemory = (*memory).p[j+1].askMemory;
    ) B2 ?: c! P! \(*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;/ h/ ~% V, I7 c
    (*memory).p[j].computeNum = (*memory).p[j+1].computeNum;) |6 B0 @- A8 W, d! b
    (*memory).p[j].ioNum = (*memory).p[j+1].ioNum;
    ) n0 z4 V+ F3 ^(*memory).p[j].processID = (*memory).p[j+1].processID;
    . w$ k. e0 ?% N; }# N(*memory).p[j].flag = (*memory).p[j+1].flag;
    8 c9 b* E+ @) x& R& b6 [(*memory).p[j].ioTime = (*memory).p[j+1].ioTime;
    # w8 \5 _) c2 n9 F9 O(*memory).p[j].computeTime = (*memory).p[j+1].computeTime;
      _, n# ~  C6 M2 b(*memory).p[j].runningTime = (*memory).p[j+1].runningTime;
    + c5 j; ~6 N* N- r/ F(*memory).p[j].produceTime = (*memory).p[j+1].produceTime;
    : K5 X2 P; `* T$ Y+ a8 t(*memory).p[j].completedTime = (*memory).p[j+1].completedTime;
    2 ~' `+ @$ n4 l* n. `for(k=0; k<(*memory).p[j].computeNum; k++)
    4 G$ R7 P2 C9 _' r! @(*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];
    7 N, X' h8 Y3 a7 h/ v5 Pfor(k=0; k<(*memory).p[j].ioNum; k++)
    ( O$ C7 X+ [% E& J0 i  p! `9 c(*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];$ D6 U5 F; z4 A% a, G
    }
      Z/ [! V) [7 A) o) C$ ]if(i<poi)% L+ o; q' Q; @. u. `3 G# d# T
    poi--;
    * P1 N6 S, s$ }- H3 ~3 h% Velse if(i==poi)
    $ J* I5 d4 u' z1 u! h# ?, O( x1 LclockSegment=2000;$ u/ Z6 {' J8 I1 M" X; d% a
    }
    $ R6 s; `! R8 M  ]" E* c4 Di--;
    9 K0 J- \1 G1 ^* m) ~(*memory).proNum--;$ E, d; p, ?4 ?, J. [" L/ C
    }' L* P0 H8 v, k( r( B/ G- D$ X) G
    return task_completed;3 S$ p/ x; X. S% o/ P1 `" e' j6 V; _
    }9 C. B, E9 k. d/ d( Q# V
    }$ P5 r8 d  s  ?  Q) ?1 m- T" k
    --clockSegment;
    4 Q' ^  A& P( Xif(clockSegment<=0)
    2 b5 o- n! F: h{
    ! x' w0 P$ f% C) Y3 [poi=poi+1;! e6 n4 b8 d& a  G! b
    if(poi>=(*memory).proNum). ^, m8 Q: |. Y: }' I
    poi=0;
    ( n$ v/ G5 M" I: f; X6 GclockSegment=100;
    0 a6 S- R" F" V$ i( k: W& V}8 B: c# q; N. C, u3 L
    return task_not_completed;
    . e- z( R1 E, v% R1 q; y; @}. [4 G6 \8 M3 q9 _  v& ]3 t
    int TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos)
    : J  s- N* k0 l. C1 o{
    ! g5 a; ^2 t* M. m/ S  uint i=0,j=0,k=0,flag=0,translation=0;
    % p% b1 n. M( o; nfor(i=0; i<(*storage).proNum; i++)+ o& h* @2 K6 J" M
    {
    5 g! f$ @% F& r% ~3 ?4 Oif((*storage).p.comeingTime>MAX_COMING_TIME)
    ; \" w- A# w4 Q9 S: Z, i$ {3 u0 xMAX_COMING_TIME = (*storage).p.comeingTime;
    . k- I$ {" n  G* k}
    ( g" ~2 k2 X1 W) S$ N1 Kif(pos>=0), ~* W, b6 }7 B% D0 F! \
    {. D( p* L9 j: }5 K* M
    for(i=0; i<(*storage).proNum; i++)& s$ w. i4 P! @$ Z; _# W) B
    {
    . k+ K' T) F, [if((*storage).p.askMemory <= *spareMemory)& `. b$ Y$ c+ d6 m
    {- B( [+ S3 o6 c6 e7 y
    j=pos;
    ' _! P! o3 q7 f9 h6 x( O( E% }9 r(*memory).p[j].askMemory = (*storage).p.askMemory;) L9 Y+ }, J" s& y; ~0 A9 [
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;
    ; ~& K7 ~1 _& [(*memory).p[j].computeNum = (*storage).p.computeNum;2 ^6 U6 V* |- h0 S
    (*memory).p[j].ioNum = (*storage).p.ioNum;
    3 h, y. G5 B1 H3 ~(*memory).p[j].processID = (*storage).p.processID;5 c% U7 R! ~1 J! L
    (*memory).p[j].flag = (*storage).p.flag;
    : {$ K+ k- R0 [' K(*memory).p[j].ioTime = (*storage).p.ioTime;: t* }. ]+ N2 a+ v+ F, }" C
    (*memory).p[j].computeTime = (*storage).p.computeTime;
    3 g( H. Q. U9 I  ]( R- _0 }, d(*memory).p[j].runningTime = systemClock;2 |& ~4 ~* h" v' Y& k3 D( W
    (*memory).p[j].produceTime = (*storage).p.produceTime;
    ( ^7 E& Y; W1 B. X1 _5 G  M$ R2 Ufor(k=0; k<(*memory).p[j].ioNum; k++)( n5 ~% l) o) M3 o0 g
    (*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    ( N0 @! X' m: z) H# t6 u+ Sfor(k=0; k<(*memory).p[j].computeNum; k++)) m9 m7 q! F8 d( V
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];
    # e& q5 m5 l' s4 L*spareMemory = *spareMemory - (*memory).p[j].askMemory;. |2 }7 e7 m- _/ G3 q
    produce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    ' `: ^5 c2 j3 s! x; w& c" _MAX_COMING_TIME = (*storage).p.comeingTime;
    , u/ V9 s, y- U/ V! D. ?0 ]translation=1;1 t% `3 Y* V: n
    break;
    & @- F0 a- Y. c- \. [# z}! w. m3 t( D: S2 g
    }; u" Q, S5 i* l
    }
    8 u$ S- X( u  _- i- h7 c! X1 [else: x  f+ [4 P& q- y3 L; c/ O
    {( F4 F0 Y  v8 O/ v3 T: X3 Y& C6 _
    while(1)
    " s5 C4 T4 T( i. g# ~4 m{
    + M# Q: q) w" C' Z! X% v6 S$ tflag=0;
    + J$ s+ }; f0 \6 k" i' S. Tfor(i=0; i<(*storage).proNum; i++)
    : [$ Q* z0 L3 e{9 M# o8 K( y" T! C! E1 E+ ]
    if((*storage).p.askMemory <= *spareMemory)) y# |4 a2 e4 ^% o9 p' d
    {
    , b' V* N; x' y$ t7 E$ h2 b0 Zj=(*memory).proNum;, R. f) q) Y* v$ Y0 U
    (*memory).p[j].askMemory = (*storage).p.askMemory;
    * |: ]  p8 P2 [(*memory).p[j].comeingTime = (*storage).p.comeingTime;7 W1 f( d* z! Q! W
    (*memory).p[j].computeNum = (*storage).p.computeNum;
    + a1 T( ]: w" \  E(*memory).p[j].ioNum = (*storage).p.ioNum;
    1 h9 R, `5 E1 e! T5 V' o(*memory).p[j].processID = (*storage).p.processID;% C# u8 W% s% H' M' ?
    (*memory).p[j].flag = (*storage).p.flag;
    4 y1 W3 n$ p4 [5 }% X(*memory).p[j].ioTime = (*storage).p.ioTime;
    ( [; j0 O; M# q(*memory).p[j].computeTime = (*storage).p.computeTime;
    8 B& ~) H  u% `( }' G(*memory).p[j].runningTime = systemClock;4 y) b0 p) m" u' \: h2 R) x* x
    (*memory).p[j].produceTime = (*storage).p.produceTime;. ]9 E, Y1 ?) |7 C
    for(k=0; k<(*memory).p[j].ioNum; k++)
    8 a8 F! o6 e( M# ]# S% @/ M& F. V- a# M(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    6 p* ~, ^, x! u+ _. A/ C1 xfor(k=0; k<(*memory).p[j].computeNum; k++)
    ! N. j+ e0 H( a# u1 W. _(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];. h; E, b9 K) A1 I/ ~# ^5 a% \
    (*memory).proNum++;
    ! t3 ^6 G/ w. F2 |+ K  G3 O' [*spareMemory = *spareMemory - (*memory).p[j].askMemory;
    1 r4 i. H5 R2 p' C: R% F, Rproduce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    # K7 Q2 o( R% ~/ i5 C) bMAX_COMING_TIME = (*storage).p.comeingTime;6 l# a" r1 X( |) i+ F2 c
    flag=1;: c/ D- V% @2 s: ]1 j  Z# ?' p
    translation=1;
    4 v% i8 l+ V; v8 ?# ?8 F9 w/ _}
    0 o1 D7 ~/ u6 u+ m' l! o* E: {: U}
    $ t; \" w0 p3 H! X, v, Sif(flag == 0)
    7 [7 m) ^% e) X& p. \break;/ o) M& R9 z: ]# p
    }+ y1 z4 f0 J5 {6 n$ T3 q" w
    }) e' f5 Y5 o; @' s" b$ o, p
    return translation;5 r  ?% A6 n' D: d
    }
    6 b  k( ?/ r- Y1 y0 oint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)- E3 T% s" w6 n7 _  S! E3 W' E* }
    {! E& y! q, I7 }$ `% i; C
    static int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;
    , `, y$ |0 H8 B3 d2 u: Cstatic int computeLast=0,waitioLast=0,changeLast=0;9 `/ V. y4 c- t) C: @0 y
    int i=0;7 h3 }& X8 K$ q3 m% j
    if(draw==1)
    7 F  l$ ^; Y2 `6 s( k/ x3 Z{
    * h7 L/ q* @! M  j" `+ G//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);: S% m( u' b9 d% Q$ |: `7 n9 u4 s/ Q
    drawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
      g) W- B; M" k9 q
    & a$ {3 w0 i! ?- W+ j2 C
    : K6 [' l  t) s) q8 f" zcomputeLast=compute;( `9 ~8 Q1 R: N) m9 {7 O% k
    waitioLast=waitio;$ `! @4 w( F: q8 E2 M
    changeLast=change;
    ' g1 g6 R" Y" B' E9 J; G/ F" O}
    , t9 q0 Y6 T' |5 e* o' I8 hif(flag==1)  8 e# K% p+ f9 A( j7 ~8 X3 |
    {
    * v7 Z+ R" U9 U8 C, b* I5 d$ E% Hif((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed
    0 F3 Y* a6 Q8 r. F, ^$ ~{
    4 i1 x5 L5 q7 W1 d# H. a. Fif(flagiocpt==0)   // implement compute
    # O6 B1 G2 |; z5 p1 K1 c{5 U; D8 _! _8 z% e0 j
    i=(*memory).p[0].computeNum;
    " D3 X+ D, ?* F5 iif(i>0 && (*memory).p[0].computeClock[i-1]>0), ?# }, H- ?# |3 @, W1 k6 g
    {: B& w; H. t9 `0 h9 U! }/ V
    if(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed. _: U. H1 u" I; D. p6 F
    {
    " f$ n+ B( a* c# ^% n( n. k! P& W9 D6 wflagiocpt = 1;
    $ U7 j6 X! G" P* \2 e(*memory).p[0].computeNum--;3 A) |& _6 s% r$ @$ w  w4 c+ O
    change += exchange_IO_Compute;0 b/ s% \" ~/ i, ]9 r. G0 ?/ h
    compute++;. l# J) i3 _! ^9 T# Q# P
    }; E0 g* |: }% x) G
    else
    ( ], H9 q7 Q; M9 o; R% M3 q, Ccompute++;* g, a% ^/ V; ^8 F) @

    3 [; H; ]5 [8 p# B" @% ~" X}
    & r0 ?; i! |, |/ L5 k5 }. h2 M% \! Telse
    ) k1 e( A2 y* L+ h7 T3 |1 Sflagiocpt = 1;3 k3 ?; X; I* d" M
    }
    # W1 `5 _7 I5 c5 H' Nelse  //wait io
    5 ]3 x' W' D9 j0 N{2 ^1 j1 Q# a! M8 K
    i=(*memory).p[0].ioNum;
    . K  G3 o" L2 _* }1 U4 ^if(i>0 && (*memory).p[0].ioClock[i-1]>0)
    + s1 i" X+ `; U6 S{* D  V# U+ ^6 r, d
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed0 C3 U1 k9 m. @6 ~0 A, C
    {+ t% y) @8 N8 R
    flagiocpt = 0;6 Z. U3 u; s2 T0 T# U1 N
    (*memory).p[0].ioNum--;
    0 \, h$ i( d. E6 T9 Vchange += exchange_IO_Compute;
    ; e4 O' B% {7 ~  c! i/ M: Twaitio++;' e  e; w8 A/ M0 c% H+ f+ l
    }9 [: y' c; \9 n/ |' S
    else
    + w6 y4 G1 U& q/ }! c8 dwaitio++;8 U4 u" e; O$ L5 \+ v

    # m: W* T9 W% j5 b" O$ {}, N$ q$ Y) ^/ N
    else
    " |4 C& n' D6 f. B' r. Mflagiocpt = 0;2 `/ U6 {7 y& i, ^! L
    }0 o5 c/ x7 r! F. p, Y' L: K+ t+ }$ l9 M
    }
    8 h4 I6 ]& W/ Qelse  //task is completed+ G+ m$ _2 g) G, W0 z
    {$ b5 W$ L& V0 n  g; D4 O
    (*save) = (PCI*)malloc(sizeof(PCI));  q4 O$ N  N" ^( B
    (*save)->next = NULL;
    & _# n3 `' A, s( ?       (*save)->processID = (*memory).p[0].processID;! `5 C9 R( Z; }3 K& F
    (*save)->comeingTime = (*memory).p[0].produceTime;% Z0 M! @( @7 a2 T3 R
    (*save)->askMemory = (*memory).p[0].askMemory;$ P% L- ]! F# W; {* t- B
    (*save)->compute = compute;
    & Z0 s( ^0 ~% R: T* _1 d(*save)->waitio = waitio;9 Y  W9 {9 }7 {/ B
    (*save)->exchange = change;& q% y2 \1 b7 Y2 n& [4 }( c
    (*save)->completedTime = systemClock-(*save)->comeingTime;# r5 j$ f7 F+ T4 _" c, w* N
    (*save)->runningTime = (*memory).p[0].runningTime;
    9 v, z+ c5 B! I8 g; t* U8 @(*save)->completedTime = systemClock;5 x7 N" E6 H- e, U( `+ @, l& F
    //*spareMemory = MAX_MEMORY;) Q2 T8 l+ H# ^5 x5 m: N
    free((*memory).p[0].ioClock);
    7 f5 |9 b6 q, r- z. Cfree((*memory).p[0].computeClock);
    ( S* x+ ^* w1 |- gfree((*memory).p);
    * r3 N9 s4 A- Bflag=0;. R$ ^) u2 d8 y$ i/ \& a
    compute=waitio=change=0;
    7 c% x3 V2 @% G4 b+ L; s: o3 b, @computeLast=waitioLast=changeLast=0;
    6 K' k9 c" W/ ]# `# _return task_completed;: Z$ m/ }! x) v0 J5 P% P2 J" j
    }
    + C: y% L5 C+ d}! D0 K: h) w) `( {3 p) o
    else         . r- C% X  [' g0 N5 @- A
    {
    4 Q6 I+ E4 F* \# ^2 z5 d$ P) iFIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));7 ^) U1 L' A+ [4 b
    change += exchange_process;
    0 @9 {. W4 Q) p  `//*spareMemory -= (*memory).p[0].askMemory;
    & |8 Z! T/ N7 K5 Eflag=1;
    # u3 E/ z# \+ s7 O2 a//showProcessInf(*memory);
    $ _; ^) m. \# ]! Freturn task_not_completed;8 f; ~5 j8 U7 O( `  j$ i
    }
    . W) M3 N  n9 z) n2 @8 S: C3 `6 q' yreturn task_not_completed;* q9 _' y- x  `* Z  @3 r
    }
    $ }$ r% [) j8 o: b3 g& S8 X1 lint FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)
      J' ?# S4 X' T1 g{
    + [8 Y4 D: v7 k; M; L' bint i=0,j=0,k=0;
    7 Z% H& G( m7 Y  VMAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;
    . M+ r; \% }, R8 C0 L+ F. [(*memory).p = (process*)malloc(initProcessNum*sizeof(process));. }, J6 L' D& d
    memory->proNum = 1;) X+ E6 Q7 a1 c
    for(i=0; i<initProcessNum; i++)0 @" x) w1 V( Q; u9 a
    {" S4 J9 u0 U  s5 j, z" R) z
    if((*storage).p.askMemory <= *spareMemory)9 A8 r* Y- V* g) L6 Q
    {
    6 o) H& L; p$ F; ^; h/ J(*memory).p[0].askMemory = (*storage).p.askMemory;
    . @$ I6 p; G% l8 O, v5 A. U. g(*memory).p[0].comeingTime = (*storage).p.comeingTime;
    8 |$ i! _' p5 I" B! K(*memory).p[0].computeNum = (*storage).p.computeNum;( r* u: U" c3 k$ H! Q0 X, U9 l6 c
    (*memory).p[0].ioNum = (*storage).p.ioNum;8 y0 v8 n. [: \0 v8 w  j- B+ x* I
    (*memory).p[0].processID = (*storage).p.processID;
    % b8 X4 w' K& U(*memory).p[0].flag = (*storage).p.flag;
    4 s* h8 w) L9 ]9 I(*memory).p[0].ioTime = (*storage).p.ioTime;# F% r( N( Y5 c( y6 {* I  g
    (*memory).p[0].computeTime = (*storage).p.computeTime;
    7 g" v/ Z& T, Y# o+ y(*memory).p[0].produceTime = (*storage).p.produceTime;) {+ j- i" i6 n
    (*memory).p[0].runningTime = systemClock;
    1 W" S. U+ Z) ^9 D6 N(*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));
    ; H! ?! E+ d; ]! Y(*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));& j3 j/ S: D9 V6 P/ r" q# a
    for(k=0; k<(*memory).p[0].ioNum; k++)
    ! k0 \; p5 k, z6 c' c% }(*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];
    1 z0 }0 a$ R$ t- Vfor(k=0; k<(*memory).p[0].computeNum; k++). ^0 z2 b4 E9 W6 g  ^
    (*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];
    8 J! w4 C3 k. s: D: ybreak;! f. P& W8 `6 b, k% E# S5 ^4 I
    }
    ; G0 |0 o: V* {, }& i; S. E}
    ( ?) B" v0 w  E8 y0 hif(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入3 I! l, T7 g) V% L; }! A! E6 }3 T
    {' E1 g$ S6 k. E
    produce_one_task(storage,i,ID_FIFO++);
      X) G2 W# L4 N  \9 \8 @MAX_COMING_TIME = (*storage).p.comeingTime;
    # j, `7 T! ^  B$ Q* xsort_by_comingtime(storage,i);. k) p8 Z# q6 Y
    }3 R  c/ E' O# s% ]1 Z& v
    return 0;
    & a* d  @) i9 b1 ~" v/ b4 S( D6 ^}
    6 y5 r- t. r! {+ A; cint sort_by_comingtime(processPool * p,int pos)
    : j& Q  l8 i0 X" x{9 Z5 l' N6 `; t9 K* Z4 l+ m" u
    int i=0,j=0;
    ' Q! }! U9 ^5 Y: v3 `6 ^process temp;
    6 m$ g" ?# X1 {  @3 n! aif(pos<0)4 b/ L2 p: |0 c6 `. ^
    {
    , }+ Z& A2 V- b5 p& H0 T7 @for(i=0; i<initProcessNum; i++)8 c1 k$ F( Q. h! ]6 A1 G; K
    for(j=0; j+1<initProcessNum-i; j++)
    $ G% K% ^- n2 A9 k9 q$ O+ z' V# [7 x{
    & x* C2 R! ~) t. J1 [- ?+ Lif((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)+ p1 r& W- [0 m0 f0 T+ `; ~2 ?
    {
    4 u4 X$ O! D& Q" C: jtemp = (*p).p[j];3 b/ r: \& Z( n$ q
    (*p).p[j] = (*p).p[j+1];
    2 [9 X& ?0 K8 d" v3 b: r(*p).p[j+1] = temp;' k' N( R7 D  d; N/ Z
    }2 k: L' }5 s. s3 c$ [" Q
    }) H/ @- L/ S0 S3 i# v, I" r+ i
    }0 U8 U& P, N: w
    else if(pos<initProcessNum)
    $ A+ k' l( L/ p/ z: o, N1 S/ y{" b. Q- c1 Y9 G- k3 k; J( A
    for(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--)' D; h! \3 V' e* r
    {* O! G8 O/ h; g
    temp = (*p).p;1 ?. g6 X0 ~# \; U6 i
    (*p).p = (*p).p[i+1];  c; }+ \* {* g8 _/ a, J# }2 B
    (*p).p[i+1] = temp;
    + s: Y' Z6 y* E- d}
    9 Q; Z; S. F! }for(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)6 X0 ~* h4 r& d( f* E
    {
    2 o9 k$ K6 z% f1 g8 j# Vtemp = (*p).p[i-1];
    ) j1 K% Q# {) Y% L0 \(*p).p[i-1] = (*p).p;2 N7 Y+ |6 j# [7 q1 A) v. I  }
    (*p).p = temp;
    7 J" H' T' W3 V4 E}& k1 I% L  T1 ~$ N! A
    }
    / p( L7 \+ ]  _else1 Y. I% Z( t. ?6 Z( A9 i* f
    printf("position eror\n");
    1 E; w$ o+ r6 d! n/ |5 }7 h- U0 ?return 0;
    & S2 q: B2 F. G5 E}
    : h( a, B5 b7 [) Hint InitPool(processPool * p), l* @. b7 N# F5 E
    {
    0 y$ z2 v' N  i1 Z: a1 bint i=0;: ~$ {8 M5 s; y+ J+ D2 @/ {) I
    (*p).proNum = initProcessNum;
    / q5 b8 E$ _8 @: N(*p).p = (process*)malloc(initProcessNum*sizeof(process));
    + W' X) D# ~+ Ufor(i=0; i<initProcessNum; i++)                                        //init process information
    3 Q& f8 j5 Y: x9 X{
    ; B7 }* r4 L6 C(*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));
    + ]  W! p( {9 d(*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));' w( Z2 p) t9 ^' e! p9 w2 c
    produce_one_task(&(*p),i,ID_FIFO++);
    9 ?3 ~4 T! e  R7 }}& Q0 p0 v- i5 {& c# ?) d
    return 0;! Q: I$ ?) {4 n: w) K" e
    }3 c! ~$ Q, @" b, o# o# H
    int produce_one_task(processPool * p,int i,int id)4 W4 x5 Q$ v3 Z+ {
    {& s$ Q: f( ^/ @1 |  t
    int time=MAX_COMING_TIME,j=0,totallTime=0;
    6 ]4 q$ A& N2 t" }. P(*p).p.processID = initProcessID+id;           
    7 N& A" ^/ b" U5 y0 m4 u(*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);
    ) a7 j( ]" r, Y# @, g( b(*p).p.produceTime = systemClock;- W( A/ D. o" T' j
    (*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;! z" p$ Q3 \+ \2 s
    (*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;
    0 X( W$ c, W( RtotallTime = (*p).p.computeNum  + (*p).p.ioNum;* `9 i9 N& f4 N, ?: q
    (*p).p.computeTime=0;
    " H/ k& Z. z" }% [- bfor(j=0; j<(*p).p.computeNum; j++)# D+ e! i8 v9 a6 y
    {; s0 U7 ~6 E- `! Q3 R
    (*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;4 \$ E4 S. L8 g- c1 B- a( X
    (*p).p.computeTime += (*p).p.computeClock[j];
      Y; s2 y. L. k}
    - S  a, w6 K# v1 O(*p).p.ioTime=0;
    7 C! E* |6 j# T: t6 Ofor(j=0; j<(*p).p.ioNum; j++)
    . ~$ s& ]8 _% k8 U3 Y& P{
    ; C  @5 t0 W7 r# L1 [(*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;
    ( w" v- }! T# n; u" ~0 r- m2 U(*p).p.ioTime += (*p).p.ioClock[j];7 I2 E7 c, ]% }% W& C' j  H- n
    }
    1 _$ y$ y& \$ W(*p).p.askMemory = rand()%(MAX_MEMORY/4);$ t: H& i4 k. [; m
    (*p).p.flag = ready;
    . F1 X5 H* @! O" b, w5 Ireturn 0;
    9 U9 m8 o0 ]& p}# @( @) E# B- W3 k) B
    int showProcessInf(processPool p)6 A0 o, D4 _& ]
    {9 l: ~) R& R# F+ y
    int i=0,j=0;, P$ `# p4 _' ~* {" J
    for(i=0;i<p.proNum;i++)2 _' Z; |$ j0 c- J- X
    {
    ; \9 W: x  z' k5 |4 [- ]printf("ID:%d,%d,%d,%d,%d,%d,%d\n",p.p.processID,p.p.comeingTime,p.p.ioNum,p.p.computeNum,p.p.ioTime,p.p.computeTime
    6 q, r( W' j2 @, c$ j, a/ T; E+ V,p.p.askMemory);$ p' I) j6 W5 ?) W6 E
    for(j=0;j<p.p.ioNum;j++); ~6 T& N2 u% \9 W4 c. Q5 S) N
    {
      K! Z$ ?. a* O1 C2 O( u3 e2 rprintf("%d ",p.p.ioClock[j]);
    " p- A" w- w) N" O5 M0 t}. {/ l, T8 R" W  N: f! O
    printf("\n");
    % C. F' Y/ |, V2 Bfor( j=0;j<p.p.computeNum;j++)
    + l2 F5 E& z4 K/ R6 P# p4 I2 j{; }7 L+ u7 C5 w, m: u; U
    printf("%d ",p.p.computeClock[j]);
    & A3 L* f! y' W' ?* w. O}0 B  R* c  ]' t0 L
    printf("\n");
    # [' X! v5 O. G, S- t0 ?}
    % K1 R& }; P6 ~; K4 q# s8 m/ sreturn 0;
    . ?7 u  G$ ?, f- t+ l  n- K}. t7 ~9 n+ a# j7 I8 q% M
    ————————————————- V. B' ?7 X& A* X1 n2 R8 U
    版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。9 S; L" h& i4 r; e; D
    原文链接:https://blog.csdn.net/wang_dong001/article/details/478435195 G1 M7 E6 r, J* B' E+ S
    - @: Q4 k! c% Q, a- G

    2 ]7 |, G( Q, H" c; P' l, k/ j
    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    fastpost qq
    收缩
    • 电话咨询

    • 04714969085

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

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

    蒙公网安备 15010502000194号

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

    GMT+8, 2026-10-31 23:36 , Processed in 0.305571 second(s), 51 queries .

    回顶部