QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 2477|回复: 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
    - B  t6 Y% ], h; Y% I; W- D2 h: q
    经典任务调度算法的模拟程序+ D- U- \% _. A2 G% Q& Z( O! o/ N
    本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。2 y8 T. [& M2 h

    8 w1 U& q0 U& L; Z编程平台:VC6.0+EasyX图形库环境。% w/ N8 m3 ]$ e# P) ?) t. J0 R
    3 N. ]9 Q; X2 [3 s2 H
    以下截取部分程序运行图::7 c4 M' X* ?8 g" D; r

    : G9 g/ R: G. ]+ p6 [( v& e2 Y源代码:
    & ]8 o4 @! J7 f+ M. t/ t% k4 E1 S7 m$ H% D  J
    #include<stdio.h>4 I- K4 u& \+ ?. j' P( ?
    #include<stdlib.h>* c" Q2 ]/ o) e, H" `
    #include<easyx.h>+ G/ |* m, }& x# l
    #include<time.h>% P# P8 N: V2 k2 s& u# o
    #include<conio.h>' l  y" {; _9 @# x
    #include<graphics.h>
    / O0 E0 u* z* X! }#define initProcessNum 10- H7 z5 }. m7 [
    #define initProcessID 1000
    9 |* s5 S4 f7 V( |5 j#define MAXProcessRunTime 10000
    , V6 \" {# x* d0 m#define MAX_MEMORY  4000
    ) x" x3 _7 P. j& `8 }#define exchange_IO_Compute 10
    + E; y  y/ l9 g  ^6 v#define exchange_process 254 i" R2 p8 R& Y
    #define task_completed 11 K5 }& n) r- l1 y, [+ g# \
    #define task_not_completed 0, L! l! s5 h  x9 K
    #define initclocknum 100
    $ l7 l* [) ~6 u5 N3 cenum condition- U4 L6 A: F' A! {
    {8 k+ t+ u& F) ]6 P
    dead,computing,IO_waiting,ready( P! l. |  q# [- v: s6 ~- x. l1 S- L
    };" U6 }$ m7 |8 L! Z3 Q  \; R
    struct process
    " Q7 Z* ^& N5 I& k6 K2 J  ]{7 ~) e- `, z2 {' x; _; g
    int processID;5 q* W. [$ L+ [( p5 S
    int comeingTime;$ L; y6 s$ j2 ~2 z0 w
    int ioNum;
    7 }2 L% U, k* K6 X5 s  lint computeNum;
    2 G: X+ ]3 }5 e4 F9 ~; Xint * ioClock;
    ! Y/ P: r# B& w. ], L% i- Rint * computeClock;
    , |/ W& v" Z, t7 V; i" {int ioTime;9 o6 n) F' O# y1 M1 ^
    int computeTime;& X2 N6 s8 ?1 _# R# H* M+ E
    int askMemory;& a' K: i! B2 L3 u0 `
    condition flag;9 Z% h5 y, G0 n3 ]0 s
    int produceTime;  //生成时间,以下三个数据成员用以计算相关性能
    / \( X7 r0 |$ q" @1 Uint runningTime;  //第一次占用CPU的时间* T7 E- ^# m$ i* Q: b  F/ l
    int completedTime; //进程完成时的时间0 h7 G6 H( F6 N( Z
    };% e# k7 y. g5 _" Z7 K: Q
    typedef struct processCmpletedInfo  //保存完成一个作业的相关信息8 b7 Y6 l+ H5 O/ n" O
    {
    3 K# D; m/ r# t+ @8 A* ~( eint processID,comeingTime,askMemory;
    + E: @2 T( r4 m3 c# z' Uint compute,waitio,exchange,completedTime,runningTime;$ u5 m; A1 h: [
    processCmpletedInfo * next;
    5 F  B$ {) |) [% |}PCI;  X  A8 G' u* z* [' P- a7 a/ E
    struct processPool
    0 L" V" k& D) b1 H, z3 K, `{, D# t2 L9 L, @4 g" b4 E
    process * p;
    2 ?( {* _% V0 i' @, J! Qint proNum;' l& L5 p/ h/ l5 _
    };  [0 y; p# H4 A0 f0 t+ H1 O& z6 ?' ^
    int MAX_COMING_TIME=0,ID_FIFO=0,systemClock=0,FLAG_FIFO=0,FLAG_TT=0,FLAG_PF=0,FLAG_SJF=0,FLAG_HR=0,FLAG_show=1;/ w( u! u3 Z# g9 k5 {+ V
    int InitPool(processPool * p);
    3 S/ q; A4 s2 R) Gint produce_one_task(processPool * p,int i,int id);! G2 {# c% r+ k& ?7 F. I
    int FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);
    1 V; f  E+ q; ]/ |int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    . e. M# v7 F, T* Xint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);* @0 x( M# o- F6 g9 f
    int FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);5 H3 w: E( |6 N# X2 H  m1 z
    int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);2 B: D0 j! L5 p% E$ ?
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);4 V: ^* P) x) f: ?: G
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);: D8 y, u3 I( W' j
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);: x& g# _9 S& g0 a& V
    int High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);9 w4 \: A" m% z8 G$ o2 d4 R
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    5 S) P6 @9 R6 [$ B9 l" y( g+ k; S3 L0 O$ Y1 D+ h
    . p" t3 o& g+ @: N$ t2 W! w# H
    int sort_by_comingtime(processPool * p,int pos);; j$ Q4 c6 ~# \. h( p7 Z! b( @- q6 M
    int showProcessInf(processPool p);+ n1 S% f& O$ E
    int drawPerformance_FIFO(int x,int y,int memorry);
    # R% \( `; P& N( yint drawPerformance_HR(int x,int y,int memorry);
    5 X; \: y: C- Mint drawPerformance_PF(int x,int y,int memorry);
    6 C. N" y7 O9 d( sint drawPerformance_TT(int x,int y,int memorry);
    / k0 b# z8 H  S# g# J& Eint drawPerformance_SJF(int x,int y,int memorry);3 r  B8 Z2 `# B2 E
    int MouseListening();/ Y8 g! L% N0 G: R8 x2 y2 }3 y4 D
    int MouseListening2(int *flagShow,int * showTime);
    9 f& a3 w) W- y! ~; ~int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);
    ( c$ r: ^) n, u' ^0 O8 q( M8 y
    $ z& n6 {* z% ?7 T
    + e# g& `1 n( A7 uvoid main()/ \8 C* Y# L9 Z1 j+ y
    {
    / \* A3 L9 A  W) nPCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,1 O" e6 t4 o: V7 O, J; F: T
    *Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;
    . d- k. i# i# d" z$ i3 N. Pint i=0,FIFO_memory=MAX_MEMORY,count=0,Timet_memory=MAX_MEMORY,SJF_memory=MAX_MEMORY,Priority_memory=MAX_MEMORY,HR_memory=MAX_MEMORY,6 B$ o' p6 P0 m/ ]
    flagDraw=0,showTime=100000;8 q5 @+ z6 F+ ]* l" n' [* L* A
    processPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;  L  h0 m; }) p  z3 E9 W
    FILE *fp=NULL;( T1 L1 _* }$ A+ U* h; z( R
    //processPool HR_p,HR_mmy;
    9 \+ f6 ?' I8 I! J8 z: c% H$ T  w9 S: z6 i8 |! \0 g

    5 w* J  [# v' usrand((unsigned)time(0));
    6 [# m0 Q5 r2 H# D: w8 ^systemClock=0;. p. Q$ T, m1 z$ r  [8 f5 f
    initgraph( 1200,650,SHOWCONSOLE );9 Q( h9 u  o7 ~, T- ~
    settextcolor(GREEN);
    9 i. n% H9 [4 W2 s5 x) A8 J+ Ysetlinecolor(GREEN);9 a4 J3 e8 L4 K* K2 O/ R
    setfillcolor(GREEN);
    ( _/ X2 h  M' o; N2 SInitPool(&FIFO_p);
    % ?: y+ j) X4 T# v$ esort_by_comingtime(&FIFO_p,-1);! ?9 Q9 F) l' f1 K; V. b
    InitPool(&Timeturn_p);
    - g6 o- y$ i; e, {6 T# e2 ]InitPool(&SJF_p);
    7 U; k5 O. w8 ~5 y& l" _InitPool(&Priority_p);( C  t! H, m( I1 ]/ _/ _
    InitPool(&HR_p);. V. \" O3 y& }  E( b- v- D: ~
    //showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
    . e9 J; W1 l7 V) v& z; n- [+ b, f* c//Sleep(10000);! N! U/ A; P4 `; R7 P

    8 C8 t* [& F$ O- o! V# p0 q+ h1 e  {  x3 |
    Timeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    ; B9 v: @' L- ~. J+ ISJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    9 O0 R& W  u7 }. H' b4 QPriority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));3 r5 ]6 p$ [/ i/ Q" G% s
    HR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    ) v1 S0 S3 @; n/ R8 J, K5 e" i" _for(i=0; i<initProcessNum ;i++)' g" {; ^$ V- A: y- w8 H6 K6 z
    {
    3 C- d6 z1 M7 y; v: |Timeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    ' K9 @# E3 u& F3 kTimeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));2 P/ I, W3 |+ f# t3 E# \
    SJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));3 ?3 g+ U" w9 w* m0 X
    SJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    . F7 J8 c( E- N, f+ bPriority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));, b' Q# O* u/ @: D9 @$ O, l
    Priority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));' B& |6 X" R" V5 h0 F
    HR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));) e& O) z5 o, H6 N# w' l
    HR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    / w1 j% F. K! ~# H, |6 M+ p}  _; V% x. F0 m
    Timeturn_mmy.proNum = 0;
    # E7 N0 u/ X! l0 _' R1 L" uTimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);
    1 J6 Y- Y4 z, g; v; F8 S! dSJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);
    ' O' z$ M* S( K, d/ EPriority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);
    2 ]: s. Y# a' v$ @' |1 DHigh_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);# q8 P$ F4 F) k+ T6 N; W
    //showProcessInf(Timeturn_mmy);& o# q& O# \% t. n
    FIFO_pri = &FIFO_save_head;. E5 U! L8 ?. u; L. L! x
    Timet_pri = &Timet_save_head;
    + k$ P' y2 z: _SJF_pri = &SJF_save_head;4 E6 A0 Q# Q1 y
    Priority_pri = &Priority_save_head;" {6 |- Z+ ]' h
        HR_pri = &HR_save_head;
    * ]+ A6 M) o/ q$ {setbkcolor(WHITE);9 @: N5 q, B7 Z3 c3 Q: _4 ]
    while(1)
    / S6 ?* M" c; b2 m{) N1 i& Y% |# p! S" p
    if(MouseListening()==1)
    ! y' e( Q2 J% I+ v8 j& ?* FflagDraw=1;
    3 z8 x) {2 ?# Q# J& oif(count==100)& H, A) i) q' [
    {1 t+ ?! |' C6 f$ n% H/ p* J
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed)  W# R, _: h% Z* g2 b
    {8 t& Z* M; i8 w' j5 u  r
    FIFO_pri = &((*FIFO_pri)->next);  J+ W' a+ w- S) S7 F9 L- ?
    $ ~0 I4 k' v, Y: L
    //printf("hello");
    6 u8 M3 S" K1 X( S- }4 w}. h$ {# G9 d/ D. X! N
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed)/ _( u  f) v3 L4 m: Q2 v' Q' N
    {( s( n+ f- m" p. Q2 r
        Timet_pri = &((*Timet_pri)->next);; O0 [: W2 G4 H5 R& M
    //printf("hello");
    3 J/ |, |5 ^; N: s% A7 y. d}' H1 ?, Q1 T4 \5 E* y
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)
    * e6 S* a& E8 m; P; h" j{
    4 `) R! U7 ^- E- wSJF_pri = &((*SJF_pri)->next);
    6 q! [8 a% _0 s//printf("hello\n");
    $ L8 U* v) h/ I$ D# B}
      h: P2 |: v0 ]2 ^4 _6 ?. yif(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed)8 z  n4 Q& p0 Y7 K! r  `
    {
    ! s" Z; O5 Z; ]% M: vPriority_pri = &((*Priority_pri)->next);6 m8 m# q& g9 j& i5 \4 N) H" f: W
    //printf("hello\n");
    2 K# j" B( O4 }5 \" m}
    - q8 d$ ^0 P& c- L5 kif(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed)+ v/ c$ f$ O: F. g4 x6 F) D
    {. \& B/ _* h, `4 y
    HR_pri = &((*HR_pri)->next);, l$ z$ F, F4 _, X* }0 \( Y
    //printf("hello");
    8 B' W( ^3 M3 {5 L}
    8 u: j) u# P2 j+ L$ a# D3 icount=0;" E8 b, ~, s" E- A
    }1 w  O# w& l: c/ z: A+ K! @
    else
    8 n( ]- g& c! |8 x+ c: ~{
      S, C1 Q  _  a; F; G/ Fif(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)
    , m5 ]. D* t& A9 U! r{
    # i& x1 @- [( `% B- u" _. [3 fFIFO_pri = &((*FIFO_pri)->next);
      q( W* D! P9 m! P5 {// printf("hello");9 G# J  b, U! {$ D* A; C3 W5 O" t
    }
    2 [7 V! H* o8 h7 Eif(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)) n- x3 G  P6 C; D) z- B$ Z
    {
    1 n" ?" v/ a3 F/ vTimet_pri = &((*Timet_pri)->next);! @7 m/ I: q4 U7 t5 {( w
    // printf("hello");+ U0 O" `8 B, w7 m/ E. w, |
    }- V: y  V8 a& H1 b# E
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)9 V0 p9 ?1 O+ u9 |7 Y
    {; x9 N2 z2 B! K% w4 a+ k" j3 E
       SJF_pri = &((*SJF_pri)->next);
    ! `/ h( N& L3 T// printf("hello\n");
    9 k! y$ D" C# s" D3 L}+ t. H+ G. I$ `0 _; a, f6 F
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed)
    ; C9 O) `# h7 S1 @3 z{
    / b! N0 c9 i- Z1 o" y6 |3 ^Priority_pri = &((*Priority_pri)->next);. H% v2 k! Z+ I- v, r6 I
    //printf("hello\n");
    ' W5 B- f( x2 r4 C- R, H}
    / ]; i+ P" q& W& z0 c) Pif(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed)0 e$ B! z6 X/ V9 O" q4 {
    {
    , b/ |: K; t- t! Q# c2 s  ]HR_pri = &((*HR_pri)->next);9 M' `9 u3 t7 q, p
    //printf("hello");
    9 M& D! g% m. M6 j4 I//Sleep(1000);
    5 q; F4 z% |! z" K}
    7 I1 t. T. }6 r- B: Qcount++;6 m; A% Z% ~& x- j1 O
    }
    - Y; g9 |: k" c( p( Qif(systemClock==showTime)
      ~- h* X3 a! F" c: Z  K& m  t1 E{
    0 M: `/ l- X& I: Z/*PCI * p=FIFO_save_head;0 i; G0 |$ G- ~  G
    int i=0;1 Y# Z0 I0 A# S
    for( ;p!=NULL;p=p->next)/ d: r) I6 j; o$ x; W1 p$ o" P
    {
    0 d8 J6 K5 B" `- Z. \3 E- [printf("Id %d\n",p->processID);
    . L! V8 S# i  Y  ]0 r# zprintf("comeingtime %d\n",p->comeingTime);
    , s* e. ?: t0 }/ P7 U' rprintf("runningtime %d\n",p->runningTime);1 C, `* D( L, b: t
    printf("asdmemory %d\n",p->askMemory);  @2 z9 D* y2 S0 Z3 {# k" H4 d8 ~
    printf("completedtime %d\n",p->completedTime);5 w! c& L: Y6 m, ^) F2 r
    printf("compute %d\n",p->compute);* Y% o$ ~0 b2 q5 A" L0 B2 ?& R0 W
    printf("exchange %d\n",p->exchange);
    2 b& D2 p& x' c* {6 ?* t. cprintf("waitio %d\n",p->waitio);* h- L7 U% E6 D8 ^) ]. w" o
    i++;6 r+ S: r6 X1 @0 g

    8 Y. I* x% `' p/ G) Z# F- W3 {3 j$ y* r+ r: E1 p% U
    }
    ) O3 q2 q& X* o7 m+ l# H2 ^  iprintf("%d\n",i);*/0 |7 a" ]" _7 b5 C8 ]+ b5 [) x
    if( (fp  = fopen( "data.txt", "a" )) == NULL )
    4 Z- W4 m& T+ A; \1 v% z9 J{! j0 r+ x- V: S: e
    printf( "The file 'data.txt' was not opened\n" );
    . O  u& H$ r$ {5 D! h! ~//return 1;- |& r5 }8 B/ c) n# o4 g! t  K
    }
    " s/ y/ W8 ]1 N# H/ |else  w! T2 M7 P/ [6 _# z9 d: x
    {
    4 ~1 @; ]. T$ [( e  Efprintf(fp,"FCFS \n");  T. y; D% d4 q' g7 g6 [* S, F
    for(p=FIFO_save_head;p!=NULL;p=p->next)6 m  {6 }- ?' q) n+ U$ _. Q0 p
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    ( I. K3 C+ N8 O" z( l7 c1 O. `/ Z/ bp->exchange,p->waitio,p->runningTime);
    3 {7 P5 J# J* v( I$ A5 Y! \2 o! ~fprintf(fp,"\nTime turn \n");& ~# h7 [5 ~; d  A2 ]) s. B( l
    for(p=Timet_save_head;p!=NULL;p=p->next)
    ( F3 Q5 V! A# O; `fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute," f, D& C6 A, h. g9 O) c
    p->exchange,p->waitio,p->runningTime);
    : x4 p2 F& p! ]* l2 }+ mfprintf(fp,"\nShort Job First \n");
    / E% v7 J9 n5 ]! U8 }  qfor(p=SJF_save_head;p!=NULL;p=p->next)
    % q8 E# _* k; ^6 ~9 u2 ?! ^fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,3 H& P  v/ T+ }8 {7 u  v$ C  t  |! j
    p->exchange,p->waitio,p->runningTime);# j* U9 ^) M6 G8 H3 X/ m* w! l
    fprintf(fp,"\nPriority  \n");
    1 z% K; n/ s5 b- t& ], x& z) q8 |for(p=Priority_save_head;p!=NULL;p=p->next)0 p# m+ n& T+ o  s- ?. O( r
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,. H0 C, b! R5 F6 F/ z0 h
    p->exchange,p->waitio,p->runningTime);) l- @8 u0 g5 m
    fprintf(fp,"\nHigh response \n");
    : K  G1 J/ o# x1 gfor(p=HR_save_head;p!=NULL;p=p->next)' |8 e+ `/ v5 N" ]5 ~; o
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,: Z8 _0 M! h( q! q0 K- c7 R& V0 N
    p->exchange,p->waitio,p->runningTime);, S. }$ e: F. g! e- P1 C1 K  u
    fclose(fp);
    ' j$ a' Y! q  }! |" P) V}
    ( J3 q3 p0 L2 j# k# zshowRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);% H2 Y: q( D7 ]+ X
    MouseListening2(&flagDraw,&showTime);
    / g1 \- a0 L# e, C}
    : U4 O* ?% [$ A9 A! {3 OsystemClock++;
    4 t6 l9 F  V$ R& e; t6 ?if(flagDraw==0); O5 D  h  ~# B/ P; `% N& O
      Sleep(10);
    1 |  L; k! K6 a8 M}
    . S" u6 r7 U: P1 _4 e& P. o1 k  D6 e$ v; e; ^
    : ]1 Y( l7 o3 f& {( ?) Z" e
    }
    6 c) L  u! P( Q0 ]/ a# J) k+ N; O) eint showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR). k+ O( W+ I" I7 t5 N
    {, n" g# A. `& y; r5 m) V3 C: X
    PCI * p=NULL,* name[5];
    6 |# J. R) E5 F' Iint count=0,i=0;. k% a" Y) v8 \7 Z$ }3 v1 G7 b
    char ch[5][10]={"FCFS","timet","SJF","PR","HR"};
    * f5 ~2 ?7 W/ O) @7 Z% ?double turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};9 ~+ w( H8 i: ~  p  B: \/ C3 z
    struct info5 T+ s6 o* {- P' E% O
    {
    5 A3 A+ x8 L. P# }& Y! Pchar name[10];
    6 X7 v- s5 l; X8 S+ [3 L. ldouble throughput,turnover,wait,CPU_rate;0 ]1 l, ~' Z8 `: c% q
    }inf[5];& ~4 Q/ l* \) i( G& G
    name[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;! O$ q' A" G5 a
    printf("调度算法..........A\n");0 W1 X! w& J- d# u
    printf("吞吐量............B\n");
    5 x- g$ G, O: r0 S' sprintf("平均周转时间......C\n");$ u$ Y( Z& t, u- L  R( K, k
    printf("等待时间..........D\n");
    $ t) I0 i) D2 ^. T3 \0 \printf("CPU利用率.........E\n");" h6 g0 R$ @  b3 j( O- Y
    printf("A\tB\tC\t\tD\t\tE\n");
    # E1 r4 O0 g: X3 e$ c) y; R7 t+ [for(i=0;i<5;i++)7 G! }2 z* Y4 {) h; O4 |
    {
    ) c% F  \$ G1 l% X( ocount=0,turnover=0,wait=0,c=0,w=0,change=0;* P% X: U7 `% b. G7 O. A
    for(p=name; p!=NULL; p=p->next)8 f' W8 @$ e9 Y% t
    {
    $ L2 b, ]& L# ^* g/ Z( Rcount++;
    1 f& P% V. d$ Bturnover += p->completedTime - p->comeingTime;
    ( M; i3 S7 O! D, ~  Ewait += p->runningTime - p->comeingTime;
    ; _2 q/ m! E+ a, I. @c += p->compute;' F" V( U- Z9 ~/ E' p
    w += p->waitio;
      @  M+ J- F4 ychange += p->exchange;
    4 m8 d5 J6 S! _% k. d0 z9 U. c}" V6 R$ z0 F" h0 m' U% {7 U
    turnover = turnover/count;
    ( w4 L9 P2 X# F! \5 O% i7 T! mprintf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));
    ; @% r6 D( ?7 _3 J; o( K' ~strcpy(inf.name,ch);
    / o' V. T( a4 j* `. q9 \inf.throughput=count;4 t$ r. L* E5 z. Z2 N+ m3 p) T
    inf.turnover=turnover;5 z" x9 l' w: O0 k* p! a
    inf.wait=wait;
    0 Z: R1 o4 y% Y# r( \+ Uinf.CPU_rate=c/(c+w+change);# f* l. b) @$ u8 h+ P3 }6 [
    }6 ?( H) E0 M/ W
    //画图
    $ R+ T$ s6 G, [+ _2 |! k//cleardevice();4 w- r* S  \5 `7 n
    line(0,600,1200,600);
    , R$ U& j, C4 K. C7 t' W0 h% Eline(10,600,10,200);7 v1 C  n% f' Q5 k; {
    line(10,200,5,205);
    : h. U) o5 s1 `% v+ X4 zline(10,200,15,205);
    ( M* K: F0 G+ ^) A9 l' xline(310,600,310,200);
    9 M, ^" C7 G* eline(310,200,305,205);" v' l$ x. H. T! x  z
    line(310,200,315,205);
    % `$ F+ ^% o% H& ]4 }8 t4 _: a: Eline(610,600,610,200);; o9 T1 _- ^9 q+ r; v2 ^
    line(610,200,605,205);3 Y. J4 Z5 K4 l1 T9 w8 h4 c
    line(610,200,615,205);- y1 Y8 b' d% n5 U
    line(910,600,910,200);
    5 Y6 A' K8 A. U2 r# ~0 d  C. s% {line(910,200,905,205);  E; C4 B( X( [2 @. L; B8 Y5 B
    line(910,200,915,205);//最高的长度400,宽度均为40
    1 ]; L0 d, o( p) w  c% pfor(i=0;i<5;i++)
    3 }4 v/ B4 W) t: n& J! U{9 Q& F0 f- j! Q) f. i3 a" b/ ^
    if(inf.throughput>pos[0])( c" \* h( k* P1 ]
    pos[0]=inf.throughput;
    ) G" \- f3 k# x8 c% r; }. Xif(inf.turnover>pos[1]), L1 }1 }( [" D: P& N5 c
    pos[1]=inf.turnover;6 t) \  i3 U) h  L
    if(inf.wait>pos[2])0 L- E( n+ J7 w  F9 P0 }
    pos[2]=inf.wait;
    5 ]# E/ ^: K- a3 w6 H1 A! Sif(inf.CPU_rate>pos[3])) o3 h" K) t% K
    pos[3]=inf.CPU_rate;" r7 l: c. p) p9 N
    }
    $ R. j% A6 [$ B! ~" G  ksettextstyle(30, 15, _T("楷体"));2 n) R2 T# O0 N" I. o. [
    for(i=0;i<5;i++)8 D! t% r. O# e9 ^
    {) _# H) e  Z- C3 k! _- D
    switch (i)* r* a& G; U- N9 D
    {
    4 W1 \/ O3 Z; o, K2 G/ O/ Ncase 0:4 w! \* j  K! H# g! e3 ?8 O
    setfillcolor(BLUE);
    3 s! h& b+ U9 d5 p& g  d8 ^fillrectangle(100,50,150,100);
    , ?1 h2 x) P/ o( x) B9 @outtextxy(160,50,"FCFS");
    $ U  D8 h; _3 }/ {6 ibreak;( Z( A3 p  f, m3 p
    case 1:: n) ~5 \9 @# X. t; ]% h
    setfillcolor(RED);; ^" \+ a4 m% `6 w/ d1 r; `
    fillrectangle(250,50,300,100);' N7 N; N9 y( Z5 x5 W( T+ ?$ J( v" ~
    outtextxy(310,50,"timeTurn");
    $ T, n" z( G6 B8 ]break;- S5 B, J# [/ @, ^. Y6 s
    case 2:" [5 s6 z5 K3 b# M  M7 {% d
    setfillcolor(YELLOW);
    / p$ a4 Q1 F4 vfillrectangle(450,50,500,100);: t  F, Q8 z* d! P  l5 c
    outtextxy(510,50,"SJf");
    . \2 x% N  u+ P4 W- H* abreak;( ~0 M. z* h6 @* j4 z
    case 3:
    ' {. V/ _4 G( @. ?/ y! isetfillcolor(BROWN);
    ' Z! ], U6 M( M% G. [fillrectangle(580,50,630,100);+ `7 v! O4 G; u2 E. s# e3 K
    outtextxy(640,50,"PR");, g8 \3 I3 O! D8 w& d
    break;" s* W" t7 W$ W7 [1 \& s
    case 4:
    + a- v1 A' R1 p, osetfillcolor(GREEN);
    " I; j) L' t' x. hfillrectangle(690,50,740,100);
    3 N  L! x" S# `9 b6 _. v# |. Uouttextxy(750,50,"HR");- L8 b" ]) T9 c$ q+ u1 d
    break;
    ) _( r4 V6 a1 i0 M( F: K}
    : O0 d9 h, j6 R6 {! U! t1 k6 ^fillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);
    6 D& Z5 T7 K) ]" ?. F6 C2 bfillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);
    + z, p; }) H% V: ]- h& Afillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);1 |6 s" P0 K& |
    fillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);" `/ G1 U- }7 @, w; D( U

    ) p2 G  P2 y; E& y/ \+ e+ U0 m
    ! N7 D4 D+ g( i+ e- O$ I}
    + C& T7 k3 r! x) {& P% K    outtextxy(100,150,"吞吐量");. K- W) d& {* o6 g( X; D% R
    outtextxy(350,150,"平均周转时间");
    / o( f7 p% c+ T* i/ O- N  v3 {$ F% d$ fouttextxy(650,150,"平均等待时间");1 D, D1 w) N2 l& M9 \+ o$ F
    outtextxy(950,150,"CPU利用率");
    3 [+ r9 ]6 u2 {4 Rreturn 0;
    2 w- O& P' J1 S' O}
    5 L- n# [* a) x3 Qint MouseListening()
    8 B) H9 t" j( O" O3 N{: d9 c+ b* d& f2 y7 ]
    MOUSEMSG p;
    . O1 w! A* W5 P! jif(MouseHit())
    . A+ `8 }7 e! @7 s* b' ]- k{
    . D* X5 e1 Q. A  @# l; Qp=GetMouseMsg();  f) s9 ?; v" ]4 E9 o
    if(p.mkLButton==true). f- E: V( j/ a* r4 Q4 B
    {6 e6 @' A2 W4 t/ W/ C2 I' w) U
    if(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    ; S& T: @, O& bFLAG_FIFO = 1;, `5 y4 j9 Y2 Q  N) A$ `
    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)
    , {/ {! x. Y* Q! L, E5 g& S  P$ yFLAG_TT = 1;7 g8 ?  h" O* z; X0 H, p  H
    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)- f4 a6 r4 t7 y( J  C) Y0 T+ U- K
    FLAG_PF = 1;
    : \. W' m- E$ y; ?% q+ x* z! gelse if(p.x>0 && p.y>325 && p.x<400 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    , [% V7 k$ ]% PFLAG_SJF = 1;
    ! R" O8 i$ l9 ~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); d1 s! c5 ?3 o, b
    FLAG_HR=1;
    # X$ T4 c; p8 A( w* Q( gelse if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)2 D/ y, @, k+ U" z. A: `2 C
    {( q3 `0 |  S0 J0 Z, c' v
    FLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;1 w4 i, s0 o2 o
    clearrectangle(800,325,1200,650);' H5 a3 R0 D8 |
    }6 \8 z% i/ n) `5 v+ |1 L& r9 e5 n
    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 )
    : _. Y" A3 X* x: D0 h2 L5 ~{
    + x+ o7 [( {6 c- y6 P( XFLAG_show=0;
    8 ~" Z# e& {7 }' S& H' mcleardevice();$ x% J) O% F6 i) V$ Q
    return 1;
    + m! R& B, Q& t& ?2 y" J, J}1 y1 T0 w- P( x$ j: q, D
    }; G9 g& K7 o' n9 d; N, L
    }
    " K4 s# A) t! {4 M- N0 ]1 kreturn 0;) g7 d" F7 N1 M6 d2 ~" Y
    }
    , P8 L! @1 }) _- _' Z# ?% Fint MouseListening2(int *flagShow,int * showTime): ^# y# V+ o9 ?! r9 b% ]& w1 z
    {+ X  E: s1 d" J# [. l
    MOUSEMSG p;! _4 v- Q* d9 G' L# a
    rectangle(1150,0,1200,50);8 p0 Q: S! r4 y* T  V& o
    outtextxy(1160,10,"X");0 ]/ {0 P3 e1 D2 Y* S
    while(1)
    : `+ o* x" X, X6 y{
    7 @+ A  G, d" w% p% m5 Gif(MouseHit()): F+ s! b* x* C" l
    {$ L: F' v! o. w9 a! {
    p=GetMouseMsg();
    0 L- h) i. l: Y5 ?6 g0 r; Aif(p.mkLButton==true)
    $ x8 |4 k) q0 d7 g0 ?{8 a; W5 c: l7 g# {, ~; w
    if(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 )
    " u4 N9 {9 y* b% N2 i( W& a{+ T3 |& }, \8 k. W7 L
    (*flagShow) = 0;. i+ r8 Q+ x  ]0 D. O6 H/ q% Y
    (*showTime) += (*showTime);3 E! X3 \  B- g/ @6 H# s
    FLAG_show=1;, k" J4 Y8 N% B3 p4 K& y' V+ b
    break;
    + E3 z' W1 F- L! t# Z}
    # y8 z1 c1 l+ U$ Y. Z7 S
    1 N7 V+ A' f9 ?) x: K+ S# a}
    0 n& `" s! o$ v+ }# G( \4 b}
    ) H# `1 J2 E. U7 ?# [Sleep(20);
    ; X1 y( i5 Y0 v4 w3 p; _- m}
      ]6 J; ?1 X  j+ T' q2 fcleardevice();
    1 L" ^. [0 ^% R0 {6 zreturn 0;
    0 B8 V0 d9 r" f1 J}
    2 P3 r" h: @0 x% l. k6 T, bint drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha)
    7 ^6 i8 _( b, G. q) b{
    : ^# ?+ Q) j$ d' M5 }+ bstatic int info[11][3],num=0;
    % X' {: ~( j. C7 Q& @! r/ `int i=0,j=0,pos[10][3][2];! V5 Q  [) {3 H) l6 x
    float temp,t;
    : G( i% F8 I  g, ~//画按钮,不属于FIFO图的范围! E& L3 A: L* B( k; G' h
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)
    . f4 _. S, y( C{
    9 Q  l1 _: Q# w: T+ R' Csettextstyle(30, 15, _T("楷体"));
      S: X" Z" `* n$ h: Y" `& Q" T; Arectangle(890,455,1110,510);0 G! p8 |2 P& [0 k2 D: H
    rectangle(900,465,1100,500);
    $ B- y3 O, k8 P/ ~0 v% Wouttextxy(910,468,"查看运行结果");% r6 H0 l2 I4 _
    }+ ~7 M$ u1 s6 r  ^( L+ S# w
    //结束画按钮
    . @; p7 A0 I- I5 L) qinfo[num][0] = com;
    ' P& L, t* V9 U7 Linfo[num][1] = wai;
    1 ~0 W* {  S( D( Rinfo[num++][2] = cha;
    : m+ h5 ~' d1 O+ f. B* [' Gif(num>10)  //存储10个点8 u+ G% P2 H5 E  `+ {2 O
    {' U! q. J2 q! y7 l+ V
    for(i=0 ;i<10;i++). A4 G/ r1 A5 L6 E
    {7 m  P/ r$ v% Y$ R
    info[0] = info[i+1][0];
    4 P1 Q+ {5 W( l% E% ^# k7 [( N! Finfo[1] = info[i+1][1];8 f0 v. G  y' I+ C/ Y" N8 u! T1 o
    info[2] = info[i+1][2];
    " \7 N4 [! r6 _, i3 @; T}3 g& n: N, r% P
    num--;
    + M8 d1 `; B) L  e}+ {& J! d' u1 B$ l9 r
    if(FLAG_show==0)
    0 z1 f( P; @+ Lreturn 0;7 u8 c* O# Z* A  d8 f, L, L" y
    for(i=0; i<num; i++)
    % |5 J- T4 _5 A: p{
    ; m4 K9 e; q, zt = (float)info[0];  g8 ?; v% p$ j: j0 ~& |, k1 d
    temp = (t/101)*90;  ^0 B; t5 Q& f7 p! }6 {
    pos[0][0] = (10-num+i)*25+x+100;
    2 S' F5 U9 x! s, [/ hpos[0][1] = y+110-(int)temp;
    4 F) S: A% s; K) ?: {/ P& ot = (float)info[1];7 L, e9 \& w2 y9 ?. Z% z# S/ X
    temp = (t/101)*90;: M6 V. y* E# U6 |
    pos[1][0] = (10-num+i)*25+x+100;5 z3 i+ V( ?4 O: C6 @
    pos[1][1] = y+210-(int)temp;9 b; [7 P& N: j0 _; x" X* t1 Y
    t = (float)info[2];
    ; u, A* s7 ]4 @  jtemp = (t/101)*90;
    3 Z0 J+ N; i* Q& C  Ppos[2][0] = (10-num+i)*25+x+100;
      p4 V1 d, W/ qpos[2][1] = y+310-(int)temp;
    " |+ V3 ^! i6 P3 B& o. ]( k: s& D3 B}, t% p/ D1 X8 B2 l+ Q; Z
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    / k: H* V" H5 }5 X/ c, ^" U% p{
    * N, f8 [  ^  r' Xclearrectangle(x,y,x+400,y+315);3 J# _( f% i: v5 l- V+ `
    settextstyle(20, 10, _T("楷体"));) @4 g5 ~7 A2 ~
    rectangle(x,y,x+400,y+325);( B; W9 I0 v" X: s% O
    outtextxy(x+40,y+10,"CPU");       //画柱状图) I- N" b9 I: i" _
    outtextxy(x+45,y+10+100,"IO");2 h) W3 n8 A& V/ o( L/ Q- S
    outtextxy(x+40-15,y+10+200,"change");
    ( U9 [" W) {! Prectangle(x+35,y+30,x+75,y+110);
    # O8 Z" j0 s. U9 L: drectangle(x+35,y+130,x+75,y+210);' k/ N$ ^0 T8 `' X6 e- m
    rectangle(x+35,y+230,x+75,y+310);& S) M" ?# v: Y# L& m
    outtextxy(x+180,y+310,"FCFS");5 o% Q' o" q9 M' t) k& B% k) H: D
    t = (float)com;# A( o" D9 j9 c; ^5 x) _
    temp=(t/101)*80;
    $ [$ B  q, e$ V. Sfillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    * p( `' l7 G! M9 ct = (float)wai;4 d) `. a- }/ ^
    temp=(t/101)*80;. b% A3 I! z" C; [  Z, h9 r
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    4 x$ D, p; F$ q: J- c4 D. {t = (float)cha;
    / w* c& x- S' d3 |7 h! p- P; w- rtemp=(t/101)*80;; d4 Z; M+ s% t
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    1 x9 E3 B1 P% _/ l6 g$ ifor(i=0; i<3; i++)   //画坐标   high=90,length=2503 W  s8 d% C9 m% k9 d' u
    {2 e' {, w! Z! f% x, }
    line(x+100,y+110+100*i,x+350,y+110+100*i);! o- |2 j3 {3 E: B/ h
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    0 `. |0 U+ N& p  d$ W8 n, g% eline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);/ E8 ?( ^3 ~& s) {! X8 A
    ' p; @* Y* X3 |- t
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    ' B4 H( M" x5 o" g* ^! ~3 R% h. r5 Lline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    , s% [. h# I9 f; mline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);* u6 p* S# V( V' m9 v& m
    for(j=0;j<num-1;j++)
    ! l% ?3 k9 Y5 X9 }{
    : M3 f* U3 P, Rline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);& c+ n' R3 M% F$ a5 r) ?
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);$ a8 z1 \4 M- D: a' ^0 j% ~' r
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    $ L0 `+ B0 A# f) K9 `}
    , F4 ?/ }: V% q% @3 H" j}$ o! T4 N; e, ?6 Q) d' `9 e
    }
    ' r5 Q( V# j, H2 U+ z* [' a, Ielse if(FLAG_FIFO==1)  O# f/ w$ Q% k; S( b5 Z% L
    {
    , P- X0 }# X6 U7 _) R/ fx=0,y=0;
    , s) d) y: E, C: hfor(i=0; i<num; i++)1 q0 ^9 j: F5 G
    {3 F/ p4 q. R  B5 M1 n
    t = (float)info[0];. l, d; P! E  U2 K
    temp = (t/101)*180;
    / ^. k+ M* o- Epos[0][0] = (10-num+i)*50+x+650;
    9 z( D- Q2 b  O' Qpos[0][1] = y+210-(int)temp;
    ) o8 a; c  I( R+ et = (float)info[1];
    / M: ^" \' V7 O4 A7 s8 ~* ctemp = (t/101)*180;
    4 K8 N) u, t4 y. _5 ]! |5 S- o0 I, fpos[1][0] = (10-num+i)*50+x+650;! L* r8 m/ w+ F
    pos[1][1] = y+420-(int)temp;1 C7 K# u% [  @- T+ w) Q( P
    t = (float)info[2];5 b* c# N+ P8 g, h1 v) Y2 Q4 e% B* {
    temp = (float)(t/101)*180;" F$ f6 l, O3 Q7 e) }
    pos[2][0] = (10-num+i)*50+x+650;
    ' B5 c: E& D- x9 P7 Z2 gpos[2][1] = y+630-(int)temp;0 [! q' \4 g6 W) t7 C7 q  v- q
    }( q' Y7 m* T7 V) t
    clearrectangle(x,y,x+1200,y+650);
    " M# k8 J( j4 g3 p) Vsettextstyle(40, 20, _T("楷体"));2 z" W9 ?  V  X  [
    outtextxy(x+50,y+50,"FCFS");" e# M2 d4 m& H: x& i9 q+ v
    outtextxy(x+280,y+20,"CPU");       //画柱状图/ F1 [% g2 k# n/ o- _( m1 n
    outtextxy(x+285,y+20+200,"IO");5 L+ h4 V% g0 f- J/ F
    outtextxy(x+250,y+20+400,"change");
    8 @# P3 \& L5 _0 k  _& y  ~rectangle(x+270,y+65,x+330,y+215);* u6 J% q$ e! _; J
    rectangle(x+270,y+265,x+330,y+415);
    - c7 M4 k  q. T3 Brectangle(x+270,y+465,x+330,y+615);/ a+ ^3 @( P7 o1 k5 }# ~
    outtextxy(x+290,y+620,"TT");
    , n& T6 f6 \" u* S3 Nt = (float)com;
    $ X; ?  W1 J0 E, T) @6 c6 |5 Dtemp=(t/101)*150;/ b1 X3 w# W* |% X; B. L
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    * S) q8 U. ~# b8 S5 k( g0 Z4 Kt = (float)wai;
      t. s5 B3 a: X" Htemp=(t/101)*150;/ ?( [* P# ]( o5 H0 Z( r2 J
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    ) ^  u8 A( a& W, @7 f: Ot = (float)cha;
    - |, ~  ?5 l8 ]7 z5 D+ u6 Dtemp=(t/101)*150;1 \7 \  J4 m. v5 z+ E0 ?. b
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);# h: m* m& J) w. }
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    # f7 K0 s7 Q6 O' D7 T$ U* f! Z. f- c{" q, m, [8 ^- ^5 R
    line(x+650,y+210+210*i,x+1150,y+210+210*i);
    # r, P* k* ^- \# a* w; zline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    3 X! p9 Y5 z0 L- N  }; Sline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);+ q0 T) u- J$ F9 ]( p& {

    . u* T7 n- [$ M/ Q! Bline(x+650,y+210+210*i,x+650,y+20+210*i);9 a5 j5 F, z; @3 _( M
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    2 ~! M, Q4 @# i# q1 p2 P) u( Y, Oline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);; [$ I) t& \" d3 S& I
    for(j=0;j<num-1;j++)
      G$ ^% O+ ]: D1 `1 y/ ?% m, [{3 ?9 g. }/ ~# E6 g
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    - k( y9 A- b! ?, D* s, qline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);" T) m9 F1 l' E8 P) N+ E. J- r4 I
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 5 _. C- m* w( Z6 }( t' }
    }
    ; H) w8 x# h* n7 U9 J4 @}
    ' L7 V3 E" l1 U7 |4 b}
    + c: B4 x6 N9 H
    & b0 @9 u  p* @2 V; p  ^- @
    0 R. O, {" u& ]; Freturn 0;& G4 q) U) H; U
    }: Y% M1 h. H0 Y- C7 {/ [$ X1 j
    int drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)$ d$ T$ v4 G) h# x9 X" ^! w
    {- Z# H% q7 _1 N
    static int info[11][3],num=0;# P3 m4 z+ `8 J" j+ j) ~
    int i=0,j=0,pos[10][3][2];
    . j: }( a! Z( d' H3 ?2 Jfloat temp,t;
    ) e/ d% |! R+ Uinfo[num][0] = com;5 J- ~* c+ P: F! M+ H
    info[num][1] = wai;
    1 U+ i+ t6 N- \info[num++][2] = cha;
    % j8 o% m% {5 g& r! J' Oif(num>10)  //存储10个点/ p5 C/ {. M+ `& s3 s; p' p
    {1 p& f9 \3 \/ R+ T
    for(i=0 ;i<10;i++)
    ; i; h% z0 F$ _3 x{! S& r1 Q3 i+ C! U
    info[0] = info[i+1][0];
    ) m4 h) O3 ?- {# E1 R! ainfo[1] = info[i+1][1];0 {- g$ A/ p% d! l* Y9 i
    info[2] = info[i+1][2];/ k0 s  ]8 m8 u. X
    }
    : N! D( m! R; L/ m7 S$ `9 ^# o; gnum--;2 D- ^/ d) o/ I8 @8 F
    }
    " }' c3 C+ Z, F. f) Nif(FLAG_show==0)
    " D3 d6 B: }. ~, c; V( U8 lreturn 0;
    7 R/ \, b2 l+ O+ Jfor(i=0; i<num; i++)
    % X5 ~! T9 O2 i6 n{
    8 a* B. R1 i1 dt = (float)info[0];( u% H$ q4 T8 v; T! K: h( b$ J8 k; g
    temp = (t/101)*90;' p! K( ?2 y6 g) ^- [
    pos[0][0] = (10-num+i)*25+x+100;  o1 S- N) H0 x3 h7 z9 W. Y
    pos[0][1] = y+110-(int)temp;
    1 |3 i- w. V6 u  c. Y: B7 X' g3 At = (float)info[1];
    $ y. ^* A! @: S9 j1 Z! q- {temp = (t/101)*90;' c+ t( g+ C- H4 k/ `" u; L
    pos[1][0] = (10-num+i)*25+x+100;
    ) ~$ W# k- ?" ?, Wpos[1][1] = y+210-(int)temp;
    3 U! u; I- H- \; K8 O" |* ^t = (float)info[2];
    - ?, Y# s5 f8 [! F. Wtemp = (float)(t/101)*90;
    9 P7 W! }0 K  cpos[2][0] = (10-num+i)*25+x+100;6 G1 V0 P& |* J
    pos[2][1] = y+310-(int)temp;
    + _& c/ C: N2 Z. x+ h}3 L0 E* \: {2 v, \* `. L
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    , K* f6 f" F: l) r( E{% e$ C( G1 m. X/ ]
    clearrectangle(x,y,x+400,y+315);$ d% i5 N4 x& D  f0 t2 }; p: V
    settextstyle(20, 10, _T("楷体"));
    * N& n( s. D( E: }4 D# \$ s! Prectangle(x,y,x+400,y+325);6 U0 r, Q; b# y* i6 y
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    ; O# Z; _0 d$ m) M. E& Oouttextxy(x+45,y+10+100,"IO");8 M3 o  @) K; Q4 ^! f# I" w- O( H
    outtextxy(x+40-15,y+10+200,"change");: z# d/ s  `4 ^+ y
    rectangle(x+35,y+30,x+75,y+110);
    5 {) U& v. ]' ^, R4 q/ K/ ?rectangle(x+35,y+130,x+75,y+210);# B" L6 x: g5 ~% K  h7 ]- p6 r0 X
    rectangle(x+35,y+230,x+75,y+310);
    4 j2 P* S% H& W. eouttextxy(x+180,y+310,"HR");
    9 [2 M$ U2 j+ q  ft = (float)com;
    ' D! p* X% L7 mtemp=(t/101)*80;
    & T. c1 l, k. u: @/ K) ufillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    - s% e# n+ \  i4 b. `t = (float)wai;5 R* A/ X4 D+ {. @3 a. ]0 J5 R
    temp=(t/101)*80;
    * T8 J8 h5 I5 W3 Yfillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    2 Y) U7 z1 q& x0 v- @t = (float)cha;0 t3 F  `8 `$ \7 D: [$ Z4 R! L
    temp=(t/101)*80;
    / h  c1 z: R+ e+ M( Qfillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    - D: x1 ^  p' K1 h. H: M* tfor(i=0; i<3; i++)   //画坐标   high=90,length=250' q1 n7 `+ Q: p
    {
    3 I4 J! @: H; Q/ }: [line(x+100,y+110+100*i,x+350,y+110+100*i);
    ! s" C2 y4 ?$ s6 o2 bline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);3 ?9 X/ w7 ]/ @7 V5 v
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    : a2 S* ?4 A2 f7 {1 k7 A5 t+ h. F
    6 T1 V. e6 n3 D1 @; xline(x+100,y+110+100*i,x+100,y+20+100*i);
    # B3 Q( T% N2 j. a* aline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);; d0 e4 D/ T7 V) g8 n
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    5 |$ S) d) e, e$ cfor(j=0;j<num-1;j++)
    ! |9 o( {! v8 V! C# K+ b( d' G2 x{
    * e; m7 d% y( n' h- S& rline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);! h7 p+ M1 d* {3 I3 Q
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    ! K1 R& v9 X$ i+ S- Hline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    # i8 s- T$ u) c$ ~6 j% S' u: z; X: w3 ^}4 ~' p! l5 Q  b
    }
    / R& A+ y7 ]  J' t8 P- P# O}
      y$ v; k$ c$ F% Q- h  G/ ^1 |else if(FLAG_HR==1)
    ; [3 G4 A* j5 q" G/ @' Y- q{
    1 a  v- c- \6 gx=0,y=0;
    / |4 I5 ~& n8 Yfor(i=0; i<num; i++)
    - a- f, ]! }8 F" @4 J: Z% C  S{5 H/ v3 {0 R0 x% I; |) a
    t = (float)info[0];
    7 g& k% v& S/ ]/ q) d6 Ptemp = (t/101)*180;% J2 t- v% v0 R7 m0 k' c
    pos[0][0] = (10-num+i)*50+x+650;
    ; C! W! C/ b) F$ Wpos[0][1] = y+210-(int)temp;
    ( m# W  k& ^. O3 d- Y$ T, pt = (float)info[1];
    ( i' b. [9 s! m, Dtemp = (t/101)*180;* Z1 T9 E3 _" R* g( M5 {
    pos[1][0] = (10-num+i)*50+x+650;3 _8 v3 T, k! i& p
    pos[1][1] = y+420-(int)temp;, L$ s) X- A5 d9 u$ D
    t = (float)info[2];
    + x* w6 Q  j: s- ?1 _& A: ltemp = (float)(t/101)*180;
    # `. y, l& `% M; P, k, apos[2][0] = (10-num+i)*50+x+650;
    1 h0 c# [3 g; dpos[2][1] = y+630-(int)temp;
    0 V1 z3 X' F+ O  F& z3 k" x- h}# G# L  n" q# }# ]) @- q
    clearrectangle(x,y,x+1200,y+650);
    ' z  P& R* D3 c6 Csettextstyle(40, 20, _T("楷体"));7 n! U2 D% M' ^" V" ~8 Q. r8 P1 t
    outtextxy(x+50,y+50,"HR");
    7 a' s: s! ^# V+ ?6 c' o! ?/ n" Gouttextxy(x+280,y+20,"CPU");       //画柱状图
    : \& e9 r% s8 }1 V2 ?outtextxy(x+285,y+20+200,"IO");) y0 e0 X$ |- _4 n
    outtextxy(x+250,y+20+400,"change");% G1 p+ E6 x4 V$ W
    rectangle(x+270,y+65,x+330,y+215);
    / i% @8 y5 u0 _rectangle(x+270,y+265,x+330,y+415);( G$ X/ d) m, P6 n4 }
    rectangle(x+270,y+465,x+330,y+615);) B4 r/ R3 v. W2 Q6 G& |
    outtextxy(x+290,y+620,"TT");! ?  P2 T$ ]7 v, A6 X% S/ D
    t = (float)com;
    % m1 K" n3 ?4 |# i2 J9 Dtemp=(t/101)*150;& l% T( @3 D; d  V' h4 r
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    % I) `: ^0 h; \t = (float)wai;* q8 Q# I1 g+ `" q
    temp=(t/101)*150;4 i: @1 N! H. [! M6 Q& |" y
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);& {( i0 i8 c2 w: j0 X
    t = (float)cha;2 Y+ U3 E) T8 M; x8 V
    temp=(t/101)*150;7 O: b2 o$ B3 a8 X6 x, n
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);8 U9 R% P' [* p( V. |
    for(i=0; i<3; i++)   //画坐标   high=90,length=250+ M- Z: m4 `' s" V. c$ t
    {, ~- `0 u) F7 W4 W9 \* n4 j. `- w
    line(x+650,y+210+210*i,x+1150,y+210+210*i);1 H  Y3 T! s- I' ]' m1 {6 `
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);( h) C5 m1 m- ?) N/ }2 m
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    ) t9 Y: Y2 ~  t+ |' f
    1 P2 X* L7 K$ p2 w) O$ rline(x+650,y+210+210*i,x+650,y+20+210*i);
      K5 l- w7 X" O6 M2 `0 hline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
      u8 V. [( I& K* G6 q0 G, t3 I( cline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    5 x% `3 E( _" r  }% Z9 u" c5 tfor(j=0;j<num-1;j++)  g4 m  Z! I7 z
    {: g) `! {( _6 Z' q! h; i( c: b
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);9 h) S+ v9 D1 @3 H5 b
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);& M8 v! ]! x/ q, Z% W( @
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    * A# j; n3 Q7 m) c  _}
    7 u6 x' x0 T0 ~: M% n* ^}
    $ ]2 z. U2 N2 g' w}# m! _) X3 V% p) k; X! ?* }2 E2 \
    , b0 p9 p& d6 ]( O$ x1 W" J. l: t
    : D& ?$ l" o! `
    return 0;2 _# z4 S$ |0 V$ Q5 k$ Z6 v; R
    }
    $ [, u+ S  \4 w: [int drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)
    , m- p/ p! Z" e7 s3 `( ~{
    / I( o0 L& \& N' P! R& dstatic int info[11][3],num=0;
    1 g7 g# \4 r4 {int i=0,j=0,pos[10][3][2];0 r, k* I: |. d
    float temp,t;; n- q  l" f% _% r8 A
    info[num][0] = com;- X2 l! `% F# F9 t/ t% C/ I. _
    info[num][1] = wai;
    & ?. \; U. X. }' p1 B, F) [. \+ V+ Iinfo[num++][2] = cha;$ K& m, W/ ^' `! i
    if(num>10)  //存储10个点
    0 z/ O/ r, U0 J: Y+ C{0 V6 a& q6 s' g+ v- n8 Z
    for(i=0 ;i<10;i++)/ ]3 B1 b7 G1 q' n/ \1 F8 `  \
    {" D  x7 F+ h2 {6 N, x1 Y
    info[0] = info[i+1][0];! \( Z+ o2 g7 I8 G1 [
    info[1] = info[i+1][1];5 G  R0 P5 l% {
    info[2] = info[i+1][2];
    ! s9 x4 L! @7 L' m! F8 _) s}- |  w- ]% N: h4 f5 k; ]9 s
    num--;4 k" C& q, o9 b& R
    }1 }+ o) |: A1 ~, \# o2 E/ j
    if(FLAG_show==0)2 A, \. K% l8 W* {- g8 d
    return 0;! _; G" e( ^. g
    for(i=0; i<num; i++)
    ) |! h$ f) B2 `{5 D! m# {% W4 I  f& O
    t = (float)info[0];' z7 O- o1 F5 a
    temp = (t/101)*90;
    7 G# {, L' }2 S+ s- G' k/ g8 jpos[0][0] = (10-num+i)*25+x+100;& H8 W, q. c$ R
    pos[0][1] = y+110-(int)temp;  k; t7 R- p4 @# X  k3 w/ L- p
    t = (float)info[1];. K  S" i& F$ @+ E5 p9 ~
    temp = (t/101)*90;; P" M. V5 [0 C9 ~& w3 j" e! g
    pos[1][0] = (10-num+i)*25+x+100;4 x2 z. v) E: ]9 K
    pos[1][1] = y+210-(int)temp;. j9 ^9 v1 \% ~9 z6 A3 b
    t = (float)info[2];/ H4 W: M4 F7 b1 X* E" W
    temp = (float)(t/101)*90;
      H& @0 _2 t$ Z' Z" v# @pos[2][0] = (10-num+i)*25+x+100;
    * c* ^* x# \( Ipos[2][1] = y+310-(int)temp;; u; {8 C8 F$ X0 V2 }# }) e
    }. `" y! X) I% r  R: E% f( h; v9 A
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)& D- q$ ]0 [# {' S+ O& O* q
    {( S: t8 h: {6 A( q, u+ j2 d
    clearrectangle(x,y,x+400,y+315);
      d8 ~% U4 D: Lsettextstyle(20, 10, _T("楷体"));. n: u7 u5 ~, U) F) B( T! C
    rectangle(x,y,x+400,y+325);1 n, h2 U4 h& m6 Z( _! s6 b; v4 I# x
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    % B) a: f/ G, L5 e) Touttextxy(x+45,y+10+100,"IO");
    7 e; G, s4 X" Eouttextxy(x+40-15,y+10+200,"change");, y) w! N/ k) A: k6 d% X5 X
    rectangle(x+35,y+30,x+75,y+110);3 M. H$ H9 U. M& V+ A: l
    rectangle(x+35,y+130,x+75,y+210);
    / W5 ^% Z) d- Z+ T& S/ Orectangle(x+35,y+230,x+75,y+310);
    * i3 e5 }* v6 c" A# n: W5 Gouttextxy(x+180,y+310,"TT");0 K% n: `# A8 z$ C
    t = (float)com;5 D" _" |4 F# d6 M  V+ i* @" u
    temp=(t/101)*80;) q  B( W+ |8 x* n0 }! Z
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    & v" T+ ~+ }% Yt = (float)wai;( B+ z% Q7 |" d$ _& ^6 l
    temp=(t/101)*80;
    , f7 [) o7 ~, E. a! G0 l1 q: Ifillrectangle(x+35,y+210-(int)temp,x+75,y+210);& D  f. M1 b0 a% h7 ^# W: `
    t = (float)cha;0 G) |. H2 J! |% u
    temp=(t/101)*80;3 R( |2 G1 U7 {5 S8 F1 Y/ Q( `- n
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    9 M7 D# f* e' E: a- b" ~1 ffor(i=0; i<3; i++)   //画坐标   high=90,length=2504 {/ X) [6 y- ~2 u/ J
    {3 A$ s0 O( B% c" n& K$ F
    line(x+100,y+110+100*i,x+350,y+110+100*i);, ]5 `  v/ p' a( R! M
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);. ^' u& Z0 l0 v1 U4 l
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);3 ~2 \- u- B  y0 T: H
    . {. z4 _4 g0 B
    line(x+100,y+110+100*i,x+100,y+20+100*i);6 n7 A: ~: o+ [8 Z+ c( ?; g6 U
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    " k6 Q7 J; W6 s0 [6 aline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    3 K* i! ^5 O1 Rfor(j=0;j<num-1;j++)
    , E# I0 z* o4 K% F; p" _{
    0 C' J, e2 e- C* Y  c# sline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    - j9 j' E  D: \4 C6 e6 R9 s* {line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    6 q4 {+ t: N$ zline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 5 d5 j1 x$ e; S" c! L
    }) D- m2 Y% w  c. B- m$ [9 ~
    }% O1 K% v! C& X- A
    }
    $ M3 d& c5 _5 d' ^5 T. \: relse if(FLAG_TT==1)# e8 ?* m# B# R0 t# P  o9 p9 h
    {  ?/ y3 ^* o- a9 j; E2 f0 r
    x=0,y=0;
    . C* r: ~& {3 t. s/ U* Sfor(i=0; i<num; i++)  r( ?4 I$ r( d/ p% ?% L# R
    {
    & d6 o4 R( B' C+ V3 `" T+ ^% mt = (float)info[0];$ K2 |' `/ y6 [% i3 y& X- }1 E! v
    temp = (t/101)*180;1 ^9 }1 E0 `( d
    pos[0][0] = (10-num+i)*50+x+650;; W) i- ?( D/ m% e
    pos[0][1] = y+210-(int)temp;
    1 b, r4 @  T: c5 V* E) tt = (float)info[1];9 C0 f2 X- ^3 n
    temp = (t/101)*180;" Y, L, A) N2 r2 P9 d8 n# b' B$ d& S
    pos[1][0] = (10-num+i)*50+x+650;
    9 h) k- D0 C5 p/ @pos[1][1] = y+420-(int)temp;4 \8 ^0 J6 @. }1 I/ {( O% ^
    t = (float)info[2];
      f  P* K: J: `- K6 F9 ftemp = (float)(t/101)*180;
    4 ^5 D- `& n9 ]7 X# u- mpos[2][0] = (10-num+i)*50+x+650;) n* @  y: o4 v
    pos[2][1] = y+630-(int)temp;
    0 X- G5 ~( ^- a}
    6 m# y; Y: A0 V5 s% H7 }4 z8 z3 }clearrectangle(x,y,x+1200,y+650);
    1 i& d: ]1 D2 ^1 {( Lsettextstyle(40, 20, _T("楷体"));  r' \0 Y" r4 Y8 B( I( ]' [
    outtextxy(x+50,y+50,"TT");
    2 W6 q9 N8 l1 |3 l, Vouttextxy(x+280,y+20,"CPU");       //画柱状图
    & |& _/ _& ]# G# Y. _6 Gouttextxy(x+285,y+20+200,"IO");, O& v/ h. z" P1 g7 v
    outtextxy(x+250,y+20+400,"change");0 h& x: y( d; f! g
    rectangle(x+270,y+65,x+330,y+215);! T, f& _; `7 @0 T' i. |
    rectangle(x+270,y+265,x+330,y+415);
    : ~& |; ?) U- B2 d4 G& v- p+ hrectangle(x+270,y+465,x+330,y+615);
    6 R4 V% ]5 _: Q2 g* zouttextxy(x+290,y+620,"TT");
      o% k/ E( K+ ], }, c) It = (float)com;
    . e0 J% H. P. _2 R: h" q( ?# W9 etemp=(t/101)*150;; ^6 j# l) R" ~8 _! A
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);' t6 V! J& ~( e3 c# L
    t = (float)wai;
    2 K2 ?8 Q+ }  ^4 b0 @temp=(t/101)*150;1 ~! ?5 l3 ^" o* B" T
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);+ W& n, e6 j2 J+ ]# }5 u: `
    t = (float)cha;# i: [" v2 H" C9 q/ z% R9 ?9 L
    temp=(t/101)*150;# k( U( N" m" e4 r: N* p7 p
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);# R1 O5 \  _6 |- X" H" d
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    ) z; t  m) _  Z2 l% g* R7 m{
    2 U4 m" r9 M" i) M7 L: n% R4 Kline(x+650,y+210+210*i,x+1150,y+210+210*i);  O3 _1 T7 {" f% N  G
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);/ M; o  z, ]3 E( ~$ W8 G3 L
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);- Q* @$ f! l3 i* y, f2 _
    0 G& K8 F/ _3 M. O7 h9 w
    line(x+650,y+210+210*i,x+650,y+20+210*i);3 [- }7 d8 v. x; o2 b4 E: M
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
      o8 Y6 v/ c$ m7 t: }4 Uline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);/ \# {1 z5 x: E) @& @4 M
    for(j=0;j<num-1;j++)
    / k" D  U, P) Y, a6 E{8 Q/ o0 P7 b5 G3 h) @
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);& C$ N& L; j% f7 _
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);/ d+ {/ S! D# u4 F1 d0 ^
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); / g. ~) P) ~6 z  v
    }/ F, s) K& @8 U2 Z; I
    }1 ]% \$ b; P! b
    }
    " ?  I. y) T3 z$ h* {9 {$ v$ }

    # w8 K4 M' A# d$ ]3 p- i$ q* x: }return 0;
    : C. N: j7 A& Y/ Z$ ]7 a& O}% o+ V& n' \& r8 Z) d- u" F
    int drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)! ?5 e% g- ~/ ]0 l- E
    {3 W4 P4 k1 _4 r6 J: i- ~. R8 E! c( _! X
    static int info[11][3],num=0;
    * G8 Q9 O5 D# @, V/ ~  O. pint i=0,j=0,pos[10][3][2];
    # m  ]: V7 D# r, S* J* xfloat temp,t;
    , K0 Y4 Q8 p6 ?' c/ k7 [) einfo[num][0] = com;
    ! u" f9 a5 ^7 Iinfo[num][1] = wai;2 O5 [" j& F0 x- v- k7 b
    info[num++][2] = cha;/ d: D& E( E  ~9 C. j$ M! F9 e
    if(num>10)  //存储10个点
    9 W" Q1 J/ e  G- W" _# Q% h2 V{
    ) @$ a$ Q) J) _  E: yfor(i=0 ;i<10;i++)# n% l" V7 f- q' d  s1 {' z4 D
    {
    % ~9 a& B9 R; L( w+ f( v0 uinfo[0] = info[i+1][0];6 F7 `7 N  D" V8 C
    info[1] = info[i+1][1];/ c( J- s. u" Q0 s4 G$ A: ]
    info[2] = info[i+1][2];
    . X  ]5 t/ b* C4 L6 \}9 p0 X9 }& k4 W  p, v
    num--;" ^0 V  U  Z+ |
    }! U2 h+ l7 ?  n& n8 v; r) p- Y8 C
    if(FLAG_show==0)
    ; \9 i+ H* C/ o2 f6 r* areturn 0;
    7 W' ^6 r1 c& V& \7 |8 `for(i=0; i<num; i++)
    $ w1 y1 e. s  J/ j{
    * u* _" ?: P  g; lt = (float)info[0];1 d6 \3 z; w8 t: g+ [
    temp = (t/101)*90;
    / k$ j: e, u- D- h- c0 mpos[0][0] = (10-num+i)*25+x+100;
    1 Z; z: ~) t- m$ y" L/ L% ]' rpos[0][1] = y+110-(int)temp;2 S3 I; H5 E  d2 q1 Y6 S5 p3 Z
    t = (float)info[1];
    2 R2 e. p+ T1 n" S7 a; H$ q) h1 vtemp = (t/101)*90;0 Q9 ~( {6 J" K5 J7 y$ C% I
    pos[1][0] = (10-num+i)*25+x+100;
    4 f0 I, g( A5 O( ^. Opos[1][1] = y+210-(int)temp;, {8 h2 m. k- p1 L
    t = (float)info[2];( R) G0 M2 V; X1 F
    temp = (float)(t/101)*90;
    / u1 J  O+ E$ L# q6 M+ i3 S; G; {0 ^; Fpos[2][0] = (10-num+i)*25+x+100;
    0 J+ J: t4 [  R0 H! U% Tpos[2][1] = y+310-(int)temp;
    1 O8 a+ N$ u* z: W8 G& `: f}
    2 k5 M2 U( ~/ b% m  W7 Nif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)& `7 U" P3 `( E7 G, G" `
    {
    2 H3 A( o- x  i& ?/ E! lclearrectangle(x,y,x+400,y+315);0 j# ~+ m3 W5 p5 j
    settextstyle(20, 10, _T("楷体"));
    ! i; m9 e, T" w3 s0 I( I3 h0 Grectangle(x,y,x+400,y+325);
    ) Z8 _, R5 m9 G+ V3 V; Q  _outtextxy(x+40,y+10,"CPU");       //画柱状图/ T0 z3 W( p. T9 V3 L& o9 a
    outtextxy(x+45,y+10+100,"IO");
    " K7 ^, {* z, d5 y" aouttextxy(x+40-15,y+10+200,"change");+ e$ c0 j8 t7 |# o6 p0 s0 t5 N
    rectangle(x+35,y+30,x+75,y+110);7 O0 |  M; X# P3 b4 J. f+ s
    rectangle(x+35,y+130,x+75,y+210);
      v; D- K& r$ Wrectangle(x+35,y+230,x+75,y+310);
    . {/ s. `: B8 _outtextxy(x+180,y+310,"PF");
    , d7 r( J* L" I3 c8 z4 Rt = (float)com;, n$ B/ T* \' H5 a3 {0 G) u
    temp=(t/101)*80;
    0 E* J' s' P+ a  `4 i0 H5 W8 Zfillrectangle(x+35,y+110-(int)temp,x+75,y+110);4 Z9 h, y2 V8 ^. i( `9 R
    t = (float)wai;
    + `. M4 w$ i" J3 ptemp=(t/101)*80;
    , ?' w. j+ M8 P0 ~3 j  z4 _" A4 tfillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    - u9 X* }9 L* r( K4 Z7 qt = (float)cha;) G3 a% n6 Q+ J
    temp=(t/101)*80;! }. B# {3 q) k/ U. P
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);4 c1 m5 Z# {% X! b9 @
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    0 i% i, o2 i" n* j, R1 r: j/ x{
    $ Y$ Y9 @, a; x; }% W& }* {line(x+100,y+110+100*i,x+350,y+110+100*i);# @2 a- B- b) J( T/ F5 J* Z- {# R
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);8 N% o" o" R2 a3 ^- L3 f
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);' l# T1 t, U; J" m" c9 S
    ; U1 `+ D3 _# z& t2 J$ z# t
    line(x+100,y+110+100*i,x+100,y+20+100*i);  H/ n: n0 x) d: _* [* V! d
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);. Z0 a4 w% L! _6 M
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);3 x2 Y1 ^) t  ^9 m: m/ I- S
    for(j=0;j<num-1;j++)
    " Z8 }0 n% e$ I* x{
    8 T( L1 \& O4 m  g6 Rline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    0 V- W: F* z' B$ a& b& Lline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    , A. Q0 N5 l1 F1 J  w8 y7 Pline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    6 L; K: I! n, J  h8 k% p7 k" L}
    8 C9 y, I( M2 ]! [2 x" X}
    , W% ]  e1 h: n4 p" }* A+ S}
    , r+ u) C6 S1 H' H  a3 U% y& @else if(FLAG_PF==1)% x& L, T, z+ H& x& C" t
    {5 J/ {  i8 l4 j
    x=0,y=0;
    " R0 Y. k- ?8 J# |) Y, q: |' Tfor(i=0; i<num; i++)
    ( U: W3 e  Z+ H8 J{
    - M+ O7 a$ [) g" O3 D5 E! ?t = (float)info[0];! c! w) e8 s  I3 w0 ~; _$ w) @
    temp = (t/101)*180;
    7 `) Q1 E% v; y" {4 dpos[0][0] = (10-num+i)*50+x+650;
    . ^$ }7 z3 ?! E/ j) E2 j8 Bpos[0][1] = y+210-(int)temp;+ b! q2 m' u7 q! F% D5 n
    t = (float)info[1];
    4 z. l0 \5 V- Ltemp = (t/101)*180;
    9 c8 J# s/ W( }  {: u  cpos[1][0] = (10-num+i)*50+x+650;% \5 @3 @6 _* B
    pos[1][1] = y+420-(int)temp;
    0 a8 j& ~  Q) ^) @- K" J( L$ h, Q- Q. Kt = (float)info[2];
    7 [) r! K. S! q. E4 Ntemp = (float)(t/101)*180;( J6 P* L/ e+ J
    pos[2][0] = (10-num+i)*50+x+650;
    6 q9 {7 Y9 c1 Q- k1 W1 d& q. {pos[2][1] = y+630-(int)temp;
    : o7 v- z% b: B- j3 E; a( J4 g9 s}
    5 p0 r6 }5 U; I7 _9 Wclearrectangle(x,y,x+1200,y+650);! A( |$ s' ^/ c! b  p7 E/ P) F
    settextstyle(40, 20, _T("楷体"));% P' r4 x3 O9 E" P0 S
    outtextxy(x+50,y+50,"PF");- b: {- J. y9 u
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    * K% J/ R. e' E6 i2 C6 ^1 iouttextxy(x+285,y+20+200,"IO");  l4 a$ E; ]; R& k
    outtextxy(x+250,y+20+400,"change");
    5 R2 s) v9 D* r- u1 y5 P, \rectangle(x+270,y+65,x+330,y+215);
    6 f& c$ X4 c1 K% B# G, Prectangle(x+270,y+265,x+330,y+415);  {0 U. m1 t, F' E; P" l
    rectangle(x+270,y+465,x+330,y+615);* T% d+ X$ f, y$ {
    outtextxy(x+290,y+620,"TT");
    & ~% {* @# B$ T' d0 Ft = (float)com;9 s8 }" u! n/ b8 {) I: H/ v
    temp=(t/101)*150;5 w. _4 \# g" V. U( ?
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    4 b! L& L6 a. O) A0 Lt = (float)wai;
    4 E. e* r3 y# x4 x% \temp=(t/101)*150;& ]( `8 A0 ~1 I2 U
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    0 R  P  }3 @7 ?' S$ Z1 \t = (float)cha;
    : M! [1 ]( a" ]# u. g- ttemp=(t/101)*150;5 r! m: g" b7 l7 Q
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);: L! `( e* h- q
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    0 k$ a2 D7 Q4 B1 K) ?8 a: s{6 D4 r8 x2 E* L" T
    line(x+650,y+210+210*i,x+1150,y+210+210*i);
    2 J3 d: |# C; g8 C1 l4 Tline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);  o( T) ]7 c1 @* |$ i+ ~( M5 ?
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);5 t1 ?; O7 {2 r
    # l0 O. s" x; q$ r7 \6 Z
    line(x+650,y+210+210*i,x+650,y+20+210*i);0 K* t" w5 i, E! u
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    5 U. t, @# B/ G2 Jline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    5 b+ o. f, q/ }5 q" Jfor(j=0;j<num-1;j++)6 K' A+ F5 K# i  T' _( _# ]
    {
      ^6 b; J0 d0 U" H2 ~& t5 {line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);$ g' |+ \3 Y; F4 U  `! T3 ?
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);. c  [2 S7 }. {' C- E3 v
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    ; C. a+ I8 z6 U5 i8 p( W- ^! d0 c}
      A# n- `+ N, ~, y. h3 _' n( V7 w}
    * j! [" Y8 \3 R* l6 ~- V1 _}9 I: ~8 i: X6 W: ]
    return 0;1 H: [- l6 e$ \' S
    }
    - i" h& I& @) H: J; v+ S! Xint drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha)
    & V9 X& X4 T# F0 ~{
    ( G5 U0 r+ D+ p  }9 g* O; Jstatic int info[11][3],num=0;
    . G. p3 j4 |5 X9 A7 f3 P' Iint i=0,j=0,pos[10][3][2];% ?& @* s  f2 a& R- r* ~* T+ k1 K
    float temp,t;/ K* _( y& [- j# W
    info[num][0] = com;0 e6 ~* x" S/ c% @- n0 o& L
    info[num][1] = wai;% a+ F8 i, I% d$ S: R
    info[num++][2] = cha;& J1 T  L3 ?$ p# U# a$ q" B
    if(num>10)  //存储10个点2 R/ e# y% _, p9 c
    {
    + o4 x* ^" k' q+ Z/ zfor(i=0 ;i<10;i++)
    $ Q3 ]4 H4 A: k' B! M) c% P{
    # r' S0 W% c3 T; K- U8 {  ~7 D# Qinfo[0] = info[i+1][0];
    6 q0 V% p0 _# Cinfo[1] = info[i+1][1];
    % w8 d# I, C4 n/ p' f5 K; iinfo[2] = info[i+1][2];3 O0 l. r+ o- s. i' J
    }
    6 {2 d! m. F- D0 }- Y4 b0 z4 A# w  Knum--;) v3 {$ {) Z9 S1 b
    }! \9 O  w" e9 G; {+ A
    if(FLAG_show==0)
    - X# J7 b; `- {; c' N+ dreturn 0;* t' w' C' x; ]8 A9 P/ e
    for(i=0; i<num; i++)
    ) z4 }4 m% e3 ^" }{- o) z8 w5 N. \- r$ D0 b, Z3 [; h6 l) J
    t = (float)info[0];+ f7 Z( ?4 \, o- C
    temp = (t/101)*90;
    & o+ T: h2 g& N! ^pos[0][0] = (10-num+i)*25+x+100;
    2 z+ a2 ]$ a+ e5 f. z2 q; Zpos[0][1] = y+110-(int)temp;
    ; c/ Q( u: B% `) `; O& x3 At = (float)info[1];
    - |( H: B1 M9 c' `1 gtemp = (t/101)*90;
    9 ?" Q* _: g: @pos[1][0] = (10-num+i)*25+x+100;
    ' U4 D7 {' y6 J( i% h1 Hpos[1][1] = y+210-(int)temp;4 _7 l; o9 o8 s  E
    t = (float)info[2];
    , e- z- j' K. L- B# ~temp = (float)(t/101)*90;
    4 Z7 {7 K9 U% |2 }6 p1 H9 A0 Qpos[2][0] = (10-num+i)*25+x+100;5 ?" H# b! V3 r3 ]) E( g
    pos[2][1] = y+310-(int)temp;& l; z  B" ?4 z- x' A+ X
    }2 w+ L4 n" d. U) t# T, \
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
      ]* j: ^- [5 \0 I, M. r, I+ {- o{ 1 c% X# \' O9 E9 V0 n; b$ q
    clearrectangle(x,y,x+400,y+315);: o7 ?( W$ O- i) }  r# [
    settextstyle(20, 10, _T("楷体"));& m! f' E; Q/ U. H
    rectangle(x,y,x+400,y+325);9 B3 m& O. X+ a5 ?: |5 T$ s
    outtextxy(x+40,y+10,"CPU");       //画柱状图+ B* v! E7 z4 K. {/ G! O8 s8 p
    outtextxy(x+45,y+10+100,"IO");
    0 ]" H8 Z% q5 Couttextxy(x+40-15,y+10+200,"change");& d4 ~% F6 z+ X; |+ |/ N3 e
    rectangle(x+35,y+30,x+75,y+110);) K4 D9 `: l: l! k) m' F$ m
    rectangle(x+35,y+130,x+75,y+210);
    ) }# M0 Y1 ?. t, S  C! n5 Nrectangle(x+35,y+230,x+75,y+310);9 R% N) m; c( b6 f
    outtextxy(x+180,y+310,"SJF");: L* _5 @$ n4 {5 i* g$ o
    t = (float)com;
    2 x1 m  g. L- `* L. U' U7 y4 k' ~temp=(t/101)*80;
    7 Z  D( ]& Y& s" Y& ^fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    " O* T7 a2 r, X2 N/ j' It = (float)wai;
    ) q1 ^" I& z) t6 H! V* B. P6 y$ u" Ptemp=(t/101)*80;
    , q& f( Y3 |( F/ o+ qfillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    9 G8 e4 v4 l, f) k$ R4 yt = (float)cha;6 c: [" r  F8 W0 k0 P$ {
    temp=(t/101)*80;
    & I, P7 r, Y8 i! Ofillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    ( y5 u$ E0 p0 d; wfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    . p' n+ y1 L9 f% s% e$ i. x7 F! x  I9 S{$ I* r' s7 A, }1 j. N+ I
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    6 K4 w% G4 ~  a! oline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);" X5 m$ F# g7 k! M8 Z2 s
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    + Z* n2 c9 S  l( w$ `% Z: i+ z- r$ D8 J- K$ O  p# x8 y& u
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    0 P) e, c$ z) \% S/ Eline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);* X( e: l* d" i. h2 f
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);9 t+ N/ y$ G0 J3 u
    for(j=0;j<num-1;j++)
    5 t$ ^1 N$ F1 t& }, n* D) W" A, G{2 ~1 h+ y6 N/ A
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    : f: ]; q6 |5 i8 q3 n9 qline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);% ~' o1 ]- R$ m, o9 T
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ( D4 z7 D# m: z# ^& C- L  f
    }
    8 @, G+ w) e& B# |}
    , E& y; A: e* L& n$ h}; q; u& `8 f+ }. c/ z6 u- w
    else if(FLAG_SJF==1)
    8 j& q3 u9 F* b. J{
    - K8 o6 ^6 x/ I5 _; ix=0,y=0;
    4 N7 z$ q3 _; w$ B9 A4 N+ C! efor(i=0; i<num; i++)
    ; R3 u9 ?2 a# ]* u" h- B! \{% C- H; `! y. \6 C% T
    t = (float)info[0];
    & Z; D# _/ p2 T# Z  gtemp = (t/101)*180;
    ) z2 Y/ v9 w7 r) Tpos[0][0] = (10-num+i)*50+x+650;
    ( n6 ^. ]" V/ ^' |5 ~pos[0][1] = y+210-(int)temp;
    ; s) @% h% S3 H; Gt = (float)info[1];
    & ]: u% \/ h2 t) O: }temp = (t/101)*180;
    6 z. b/ z1 T( u, hpos[1][0] = (10-num+i)*50+x+650;
    & V% [& ~" ]/ V& n) ^3 tpos[1][1] = y+420-(int)temp;0 g, s7 b1 I9 e6 r- X( d* K
    t = (float)info[2];* N) c, r0 R* U- N, R8 d
    temp = (float)(t/101)*180;
    2 s8 i3 r2 `, E. M9 [7 r1 _pos[2][0] = (10-num+i)*50+x+650;
    % X' ?) h$ u. o% \pos[2][1] = y+630-(int)temp;: q$ ^3 b; `4 z% l
    }
    4 w8 F# y) {7 ?0 B  }  w' [clearrectangle(x,y,x+1200,y+650);
    6 s/ P1 n/ I0 D! E" z7 Rsettextstyle(40, 20, _T("楷体"));
    # E! a2 e8 f1 c( z$ Aouttextxy(x+50,y+50,"SJF");( v4 i+ p, B3 @$ b! a. K
    outtextxy(x+280,y+20,"CPU");       //画柱状图( [: m, R+ g( k) Q
    outtextxy(x+285,y+20+200,"IO");
    , g  S: d( f; P5 d* z4 Eouttextxy(x+250,y+20+400,"change");+ D) S  K0 V6 q+ X5 m+ e8 G
    rectangle(x+270,y+65,x+330,y+215);
    : ^  u. r" x0 h* _rectangle(x+270,y+265,x+330,y+415);
    5 `5 l& K1 Y, {# x, |rectangle(x+270,y+465,x+330,y+615);
    3 f# Q" H7 U& E/ C+ R( W  N; z2 Vouttextxy(x+290,y+620,"TT");
    9 y8 I: K! [3 i# I5 At = (float)com;. _  M0 Z( ?0 b  O- n
    temp=(t/101)*150;
    . d6 Q5 g4 y0 E" mfillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    " z& d0 D, N0 |; |+ Tt = (float)wai;
    : }) m2 w- }! E* R/ F9 ~temp=(t/101)*150;* N& l1 |, V! o+ _' X/ J* F; _& k
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);0 d, T3 m: S+ Q. d
    t = (float)cha;3 M. h3 n+ S1 r
    temp=(t/101)*150;! W3 ]* {7 R/ y7 Z* D4 D1 _$ R. ]
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);5 D" A9 W$ F, K8 O+ z9 u9 `
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    2 P1 ~$ D9 Z8 d{0 i8 \2 s' e1 L7 b1 q) M. |. c' M4 U
    line(x+650,y+210+210*i,x+1150,y+210+210*i);
    % y! F- k/ Y2 c( p0 Oline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);0 q5 ~: `2 U, g# t2 H0 m
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    # f: S$ A9 F" v! s* h8 L) ]# t) }8 p9 N
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    ; O% g0 d  }5 p! O5 G7 Mline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);) c" o/ g, G5 O3 n. s4 Y
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);0 x9 m3 P4 b. D: |6 |- I/ O* c
    for(j=0;j<num-1;j++)2 D" _6 S1 N0 F* e. k* X% z) ^% b
    {
    + S2 A1 I& I/ r/ y, B- Sline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    ! O. [/ Y8 E. _/ Nline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    " V+ c/ r' Z$ f' V9 U& D1 Bline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    0 w' `* _" Z' q}* Y; t3 P1 Q9 j& d5 z
    }5 ^" V# H8 x( H2 \$ ^" [+ g6 v0 [) j
    }/ ~4 a# Z. @, C/ R1 p, E
    return 0;
    % c1 H; z5 t* ]0 [/ w% ~; ~}
    ; }! [- _+ h' B( b5 K2 Bint High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)1 A; o& h% _6 v6 C
    {
    0 L3 o( s; _: a5 E& U8 t9 \( v) Bstatic int compute=0,waitio=0,change=0;6 _" P8 [- S# D2 ^' T
    static int computeLast=0,waitioLast=0,changeLast=0;5 y, E% w: r1 F& t4 X
    int i=0;
    ( C. f, e  c1 ^  |0 r1 yif(draw==1)$ P# ]" T# I1 f8 _( r" {2 ]1 }2 d6 n
    {
    3 O, C! M/ }! n$ f( H! r//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);4 Y, }$ X4 x6 k
    drawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);8 {7 E1 E( g* _! G. |* V
    computeLast=compute;
    " D$ ?+ |+ I2 e0 L& h- o, Z0 {waitioLast=waitio;' ^3 {9 A# F4 s
    changeLast=change;
    + C& l; S1 D- U% y}
    , i( R% Q" j& z8 b! E$ ^* J# aif((* memory).p[0].flag==ready)8 I, H* L3 l: W! X6 z9 l6 n% F
    (* memory).p[0].flag=computing;
    ' Q! \' \' q3 q8 N% ]if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    0 O8 I) O$ F6 T. m7 x{( o6 t3 B) C9 w( X% j) E
    i=(*memory).p[0].computeNum;) V7 ~: s' Z6 t; c: @1 ^/ y
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed
    & i$ `4 N( ]1 l  Z5 l{
    ' z( ~0 W3 u" R3 [9 u: l(*memory).p[0].flag=IO_waiting;, T7 ~" S# s1 Q( Y
    (*memory).p[0].computeNum--;& h6 v- B( C/ X- u$ _
    change += exchange_IO_Compute;; P+ P9 U: N  ~. C  z
    compute++;
    * ]) h% X8 l6 `$ }1 g8 o( \7 ?3 g  r}
    - F& g, {9 a6 J# L- }/ m) W$ q- \. e' Delse1 }: R$ ^) |* [& W& z3 Q
    {4 ~' R) d0 E. i/ w8 Z# O6 m5 e" ^
    compute++;% a8 d, d/ ?) w$ i$ Y# A' Z# R
    }
    8 n# X/ b# Q/ j- U6 K7 |+ A}
    ' W$ S) E- W8 a4 e$ _1 |else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)2 s4 D+ M$ }7 i
    {/ O" q, U1 [7 ]6 s+ A
    / Y) Q* i% ^/ j( N( r
    i=(*memory).p[0].ioNum;, P3 O* q6 b5 {9 }. q; B/ H7 N
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    # Y% R2 c: G' H; v* ~{
    9 E. _; _; z- z3 w(*memory).p[0].flag=computing;
    * D4 D( f, @: i/ H; m5 ?(*memory).p[0].ioNum--;6 b6 H" \8 d/ ^: E
    change += exchange_IO_Compute;
    : f9 _7 {3 x1 v7 K9 Y4 Vwaitio++;
      R) I* ?% F2 d. x: \7 {# D}5 r6 ^, W! ^& e8 d9 g) [  f3 |
    else
    ( ]; ?7 I7 j5 q! ?7 t2 |{
    # a' L: i$ w5 y7 N+ ?waitio++;& [* ~4 X0 F6 R& u! T$ i' L# w
    }2 p7 q7 w* E# p2 w7 K  N
    }
    1 w; r, d0 G; r4 p2 }; |! _7 Zelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)# w% F# ]4 ]! G2 q' k4 g5 z
    {
    , q+ p( i3 Y5 |(* memory).p[0].flag=IO_waiting;
    * Z: L% O: j% P2 ochange += exchange_IO_Compute;
    1 @0 g: a! h# _}
    4 U: J" e$ c& V0 z) P& velse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)7 {6 U+ `% B. @& a0 @$ U1 G' T4 K
    {
    , |+ {9 ?* i& H0 d) }2 k(* memory).p[0].flag=computing;
    4 t8 {: o* T1 s: n. c' g, ~. dchange += exchange_IO_Compute;
    : Q3 U( t2 Q' N( e6 [}
    3 o& @, ^' w& p0 Iif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
      S, S7 a+ M& L& N{" N% ?; E, L9 P' \
    (*save) = (PCI*)malloc(sizeof(PCI));& K$ x6 ]# G0 D
    (*save)->next = NULL;8 I5 \/ O2 [! ]- [
    (*save)->processID = (*memory).p[0].processID;
    . }, g, l1 W1 ^+ f. o2 R) M( Q(*save)->comeingTime = (*memory).p[0].produceTime;
    ( D, q5 `7 A0 N1 A3 H, M(*save)->askMemory = (*memory).p[0].askMemory;& x, G* _1 g' j  o  Q: d% `# M; S
    (*save)->compute = compute;
    ( N. E) L& S9 |- W. m6 @(*save)->waitio = waitio;2 O1 ?& V7 z) U& U2 p, l
    (*save)->exchange = change;, C; z9 P0 z: M4 W' O+ p& {+ Y/ w
    (*save)->completedTime = systemClock;5 ^2 G5 ?: }+ J' E9 h  k/ d
    (*save)->runningTime = (*memory).p[0].runningTime;; ^  s- U! X* h3 m8 h7 b
    *spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;
    . P  w$ G+ T) I( H( Ncompute=waitio=change=0;
    & s3 F) B7 P/ D" dcomputeLast=waitioLast=changeLast=0;
    ) P0 e8 Y1 ?& y" D7 lHigh_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);& k" B" K; K) k: ?2 ?$ a
    change += exchange_process;' L- Y% G0 n8 h* c3 Q4 {
    return task_completed;: v- \# @7 z+ Y: c- G8 j
    }8 d- |0 i2 G  G
    else$ r) ^$ X, u4 Q
    return task_not_completed;
    $ S' }& s$ I. ^2 E& r7 Y}
    6 s; F3 i$ i8 l9 ]int High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch)
    ( d; [8 p! o+ h8 h: Y9 B# ]: E{
      i- T* s$ k! y9 D) g4 Nstatic int waitTime[initProcessNum],i=0,j=0;
    . Y( c3 U9 h" ^' ~* b* }static double HR_ratio[initProcessNum];  r' ?# T' g9 Y5 U
    if(flag==0)                    //初始化数组/ u; Z8 t. M7 ?0 G8 D. t! F* A" x8 a6 X
    {
    " s7 |* C3 Z9 r! v2 M! Gfor(i=0; i<initProcessNum; i++)0 z+ j& e( M) O6 j% ]/ N# T
    {0 D0 @* l  ^! J( G
    waitTime=0;
    1 m- L/ F+ R. lHR_ratio=1;2 q, _2 m. I6 j) {- P3 [
    }' b6 s; ~, w! n/ g7 h8 _
    }
      i& D" ]1 {6 v2 J% ffor(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比) I( @6 d3 |! s) [
    {
    ' a) x( S' Z1 J/ s! S- iwaitTime++;
    " a6 g, i) v. A  sHR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);; `4 |1 J6 ~  {1 w: A$ d0 G: e
    if(HR_ratio > HR_ratio[j])
    * L* n* T! H/ qj = i;. O) P9 E6 x; v
    }
    & _* A/ ?- Z+ r; u- H$ k8 [if(dispatch==1)                    //需要调度一个进程到内存中执行$ M: x; e5 d$ X8 N9 F" p
    {
    # @9 @% q/ h8 Aif((*storage).p[j].askMemory < *spareMemory)6 @3 R% r7 ]- {; r
    {
    4 h6 `- P; @: R1 v% `2 s(*memory).p[0].askMemory = (*storage).p[j].askMemory;
    1 Z; }2 v2 `! _& w; k(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    3 B/ g3 Q( D. Y5 b(*memory).p[0].computeNum = (*storage).p[j].computeNum;
    ( B7 t* F  l% s0 H9 k(*memory).p[0].ioNum = (*storage).p[j].ioNum;) K, R7 e+ Y4 h; W4 c" s
    (*memory).p[0].processID = (*storage).p[j].processID;
    + N5 K4 u# b3 _, U/ O(*memory).p[0].flag = (*storage).p[j].flag;2 C" Y& x% ?/ L
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;7 H1 `' \0 d1 Q/ D6 u0 k- Y- X
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;2 \$ [( I7 S& U* _6 f
    (*memory).p[0].runningTime = systemClock;
    8 r; o0 B. V/ i6 h% Y3 ?. `6 t2 i(*memory).p[0].produceTime = (*storage).p[j].produceTime;
    : @" S$ D: v9 K) efor(i=0; i<(*memory).p[0].ioNum; i++)9 p! O7 \5 d$ U! m3 t: A5 R
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;
    ; d2 d& m% i) x; rfor(i=0; i<(*memory).p[0].computeNum; i++)
    # R; S8 ?3 f; v$ y(*memory).p[0].computeClock = (*storage).p[j].computeClock;
    ) T. F. ^0 M  D/ T% h' b, y(*memory).proNum=1;
    0 k9 j, w7 E# {3 D1 }3 w% m*spareMemory = *spareMemory - (*memory).p[j].askMemory;; h  d: ?3 s' [0 b  O
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    ! S) G, F8 @4 w(*storage).p[j].produceTime = systemClock;
    ; M/ v/ W+ A2 e0 m! W0 mMAX_COMING_TIME = (*storage).p[j].comeingTime;5 q$ n3 |9 j/ n& |0 g; P, ~7 x
    waitTime[j] = 0;
    ( U3 h3 n6 o6 w* K+ u. A5 iHR_ratio[j] = 1;1 K2 }7 [. U. l
    }
    * w* r  P+ {. i- ]+ U+ e2 ~else
    ! t  ^- [$ L2 F, {' ]" f2 l{
    6 q' F+ s: Q1 ]printf("A process ask for a memory overed the system capacity\n ");# E+ y8 {8 u$ q
    exit(1);
    0 t) Q2 E: x: {$ r}
    . y: m8 |' F- [6 P}
    ) {/ n9 l3 i1 m) H' X: Jreturn 0;9 g: D3 s5 {. R' |5 H1 R4 Y
    }
    2 Y9 \: O7 W- q3 u2 bint PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    , u/ U# R# r. |, Z+ I{" u( ?5 _4 F1 b7 n/ R
    static int compute=0,waitio=0,change=0;
    0 U4 C" h( }$ q" nstatic int computeLast=0,waitioLast=0,changeLast=0;* i$ W! j" X6 f5 ^- z0 Q9 I
    int i=0;9 \5 @$ ^+ S- T4 H4 H; b
    if(draw==1)4 w- V* L- B9 v
    {
    7 d6 u" O( P4 E2 \- P8 n7 _//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    5 ^9 j! ^" P% \. ~( adrawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);1 E! D4 ], f9 G* L+ s

      c9 T. N; V4 R$ b( T+ a0 R/ K- D0 f( O% x, Y8 G; T; Q
    computeLast=compute;
    - T2 @5 [: J- MwaitioLast=waitio;; C3 F1 ?  d$ r# Y
    changeLast=change;
    ) \9 U$ t* Z+ K}
    ; @7 m7 D# G3 r6 x/ z' |, K; A: ?if((* memory).p[0].flag==ready)! f2 `/ s; x5 D1 ]. w4 t% x1 ^
    (* memory).p[0].flag=computing;) L3 o8 l1 H& g
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    4 b( _: M9 b; [{
    ) }0 ]1 V, {- ]4 t' Zi=(*memory).p[0].computeNum;
    8 r& ~+ e# J2 ^/ N; aif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed' W% ]  a" e( H, O) N" f
    {4 w3 v# x: [2 S# Y% @3 V
    (*memory).p[0].flag=IO_waiting;
    : e) l0 `; U: d/ \; B( K! l: I(*memory).p[0].computeNum--;
    / U# j2 d5 \& l* h7 mchange += exchange_IO_Compute;# `5 w. _! \* ]( a7 B& @( {
    compute++;% g9 s6 Q0 |8 q4 \9 f" j
    }) N/ _, S  E: ~5 u3 z8 L# w) r
    else
    * _6 W# p# O# o, M; |- F{! u7 N, C; m' D9 Y, t" c) u# B/ ~. B
    compute++;( k- P1 Q) u, f2 A& R
    }7 {! J0 [. y+ D; f/ O2 o7 U
    }& g" q" F0 e  h* s5 a. W& g8 t
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)- z1 N8 b/ T# x. u) v
    {' z6 F4 C4 X4 N3 _
    & p3 Q" K1 K4 a  K/ U. w8 m# H
    i=(*memory).p[0].ioNum;
    , s* i  |6 B  [1 |$ G" Z$ V- oif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    6 Q, [6 _. |0 n4 B% g{5 j" ^; c: N2 m$ a& w
    (*memory).p[0].flag=computing;
    , M2 F! H( j$ u: n! C2 A(*memory).p[0].ioNum--;( i6 ?! b% o  ]2 j, Y8 p8 T6 e
    change += exchange_IO_Compute;
    * ?* |& Y5 R3 c5 e& J* v, xwaitio++;" s% O; ?; v9 |& M( E
    }8 D& I) l7 `6 m) |. _, Z1 E
    else  `, Q- E$ B9 g% e
    {
    % o7 u# ~/ o+ W" U6 N$ fwaitio++;6 \4 _8 P% g7 V
    }5 L1 K) T+ y8 E  Y7 W
    }$ Y: Q. P+ Q2 `, p! U+ Z1 Y  a
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    4 t3 D, Z0 R$ h  O$ K* m{+ G7 @* S) E: s; W
    (* memory).p[0].flag=IO_waiting;
    ; {7 z9 f! k2 f9 @! @9 ^) Tchange += exchange_IO_Compute;
    ; W; [. N, n/ \7 h}
    6 @* \( u) M, d- @9 Y5 f& aelse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    8 A& Z! x. y+ z* Y* b$ }{
    - G5 S+ a1 P+ b* i: n- F# O  U(* memory).p[0].flag=computing;" D- i; I* ]: d1 I3 s
    change += exchange_IO_Compute;7 a9 R$ K- w8 U8 ^# p5 J
    }" h6 M8 T* E/ I5 |3 Z( r
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成7 b* F& _1 [' V+ b  Y2 t
    {# m* W# ^9 x0 [. K: R/ W
    (*save) = (PCI*)malloc(sizeof(PCI));
    ! [: f2 a" n  t) V(*save)->next = NULL;
    ) ]$ V  P* Q% M) f# ~(*save)->processID = (*memory).p[0].processID;$ w/ q' ?; Y& a7 O, L- K- u- E! A* g( q
    (*save)->comeingTime = (*memory).p[0].produceTime;( R5 A9 G" Y6 x
    (*save)->askMemory = (*memory).p[0].askMemory;
    " K5 U% q, N5 o0 P% g/ N: m4 {(*save)->compute = compute;
    " |# j8 W2 h) ?, E(*save)->waitio = waitio;- r" Z6 l% d" E( q6 }0 r2 H
    (*save)->exchange = change;
    0 ]$ D+ N; |: I0 q8 i; N# q(*save)->completedTime = systemClock;
    8 R' ^- q  Q) ?: s+ _. a3 Z: t(*save)->runningTime = (*memory).p[0].runningTime;
    2 n6 t- `) y, N* n& w" z9 t( g*spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;
    / R  C  V& u% q: s6 ocompute=waitio=change=0;  ^8 x: x% Z3 [  b! Z4 x4 E
    computeLast=waitioLast=changeLast=0;
    . Y% b  z% I, ^9 o4 d! {3 GPriority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));1 ~* E& q" W% Z
    change += exchange_process;7 O" r$ h: i4 P7 `- Z
    return task_completed;
    9 y& m, n% H) p5 S0 z/ N' H; E}  c( T( y$ t$ p" o& c- S
    else) x+ N0 s1 R7 |# i  q( p
    return task_not_completed;1 Z  ]% g+ T8 b9 i1 P5 ^- L
    }' v, I4 F: ]! \) U2 @- N; ~
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)0 B8 t1 Z/ I2 x6 `5 |9 q$ K
    {
    - g5 R& T+ X6 U' {$ oint priorityNum[initProcessNum],i=0,j=0;- z5 m- w/ @+ ~% S* A- x# q
    double temp=0;) F* ^- P6 P# p
    for(i=0; i<(*storage).proNum; i++)    // setting priority to each process
    7 W$ d& N, R" z3 R9 b. q6 N{7 V. @2 y; R; w# p0 A' F. ^3 E7 t$ p
    temp = (*storage).p.computeTime/(*storage).p.ioTime;
      Z0 J% M+ U5 {: K5 t2 Kif(temp > 0.8)
    1 A7 [& p3 a9 t5 d9 _priorityNum = 6;
      k0 G0 f/ {) \else if(temp > 0.7)9 _  z$ A' m: ?, L9 J$ i! d0 }
    priorityNum = 5;% ^. p# ~3 h8 ~6 _
    else if(temp > 0.6)+ C4 ^/ A5 g4 K3 S% Q
    priorityNum = 4;% K6 ]- F; w- s$ o/ r; K. f- r
    else if(temp > 0.5)2 O( R7 A8 @) J1 U( h
    priorityNum = 3;
    ( F5 S/ v& A  h; ?+ L6 Aelse if(temp > 0.4)
    , w0 z: R: z( C5 \9 m. v% ?priorityNum = 2;
    6 K+ ]+ Z, R3 H2 G8 s3 helse8 b* f# H# A) z2 n; @* `
    priorityNum = 1;1 K. o$ w* d# x, `! e2 }
    if(priorityNum[j] < priorityNum)% F: o2 J2 q' U9 O; R' S
    j = i;- F$ Z- k- f# R& d3 v- |# U3 [  n
    }% l; k, ?: A4 m- o3 j
    if((*storage).p[j].askMemory < *spareMemory)# p5 l* E' l5 x. o9 O; `! W
    {9 z" H( m. {7 T- |$ }- d
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;7 D9 z& p: p6 K( @1 D) u6 @
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    + N& {6 v# D9 O# y& w" t8 Z" q9 b(*memory).p[0].computeNum = (*storage).p[j].computeNum;- a6 g" f5 N4 G, O( l9 ^
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;) a8 ?; a6 m: x- e* s
    (*memory).p[0].processID = (*storage).p[j].processID;
      J" |  ?% Z+ S: ?(*memory).p[0].flag = (*storage).p[j].flag;
    % F5 K# F+ {1 G. L(*memory).p[0].ioTime = (*storage).p[j].ioTime;
    9 p: k/ M2 F* A(*memory).p[0].computeTime = (*storage).p[j].computeTime;
    : E5 {7 I, O; f" _3 G4 Q(*memory).p[0].runningTime = systemClock;
    * z7 \5 ~8 ^$ j, w5 I(*memory).p[0].produceTime = (*storage).p[j].produceTime;6 V! g# {7 h% ?' k5 T
    for(i=0; i<(*memory).p[0].ioNum; i++)
    ' j+ S8 R8 s1 j' @(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    " }' g, x& ]0 @, N2 m8 Q) ?for(i=0; i<(*memory).p[0].computeNum; i++)
    , C% Y" G" n/ s3 h" _) ?(*memory).p[0].computeClock = (*storage).p[j].computeClock;
    9 Y  e& k. X; L(*memory).proNum=1;
    + g3 c: w) U( X1 G8 q*spareMemory = *spareMemory - (*memory).p[j].askMemory;4 [! \2 L" F' g1 G4 y) x
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    5 F' |) n1 \$ qMAX_COMING_TIME = (*storage).p[j].comeingTime;
    9 m$ [! o9 v$ G* l5 y4 _3 i}
    ! c; {6 l& J) J, u' celse9 d! A( {2 W$ h9 ]* q; `: p' p9 J3 Z
    {
    ( L5 A6 g* u; [5 D6 i3 aprintf("A process ask for a memory overed the system capacity\n ");3 H1 b% W  c6 I
    exit(1);
    $ J( U- s" U4 T) V! H: f1 ?; m" N3 A5 t}
    9 m2 A" ~0 f0 U, Y$ G; i( Kreturn 0;
      r7 M5 l# B: T9 A0 G* U}
    2 q, W, Z1 e2 I9 e( ]int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    & l+ B: P9 Q  O) G+ g{6 U: D" x4 V' z
    static int compute=0,waitio=0,change=0;
    ( U% h. J! r. J2 \static int computeLast=0,waitioLast=0,changeLast=0;! x3 K3 [# i6 v0 U/ K! q
    int i=0;
    3 o5 z* y3 g' e  a& V8 Rif(draw==1)7 u; J( F" u6 T& }
    {
    6 t( B! t2 t) c0 ?: e//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);8 M9 k3 G7 ~% u, r/ C" o
    drawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);- d% h8 j, `) E$ @' J. |
    : d* E1 c# }7 J5 E* l7 E# ~

    + S2 o4 e* Q# QcomputeLast=compute;
    . w* h: W+ y; ^  l) b! j, O, {! bwaitioLast=waitio;4 K4 J# P% G$ R/ A. o2 `3 m& Q3 F3 f0 f) n
    changeLast=change;
    - a/ O1 o5 _+ c9 ~" s}
    8 A& Z" K" v1 n. M7 L4 |if((* memory).p[0].flag==ready)% P" }/ W2 R7 L/ j  `6 g$ [
    (* memory).p[0].flag=computing;
    ! A# `$ z3 T# f) [  Wif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    ; x0 `7 m2 I$ H* U5 M# s" \. c{* q. D2 z; W2 w1 B  `
    i=(*memory).p[0].computeNum;% ]; E9 I" O! x: o7 {1 p) T
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed  m! d# y+ P3 u* L; @/ |+ C% ?7 q
    {
    + @" g- \2 ]* ~& W0 o(*memory).p[0].flag=IO_waiting;# }+ n2 l+ ~4 `/ N
    (*memory).p[0].computeNum--;( R4 F: h7 }0 o0 B5 }. p) u
    change += exchange_IO_Compute;. D2 w* R5 R& @* P( V* o
    compute++;# t' }7 H* x( w4 Q" H5 a" e
    }
    0 n. J% P* O0 ?: Welse, b5 f# E1 S. V: l5 N
    {" h8 w0 |4 ]- s2 G* f; v- V" b
    compute++;
    4 Q; L# z1 d$ w) v, c. `" z}
    ( f) W, g/ H6 G8 z! a3 ?3 h- }}
    9 b, Z: k. i/ a5 W" z5 ^6 Belse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)8 a. N8 D9 l& \) H0 O
    {
    7 ^$ U: ^8 Z# C; m2 v8 H' o4 @8 d# a0 l" R
    i=(*memory).p[0].ioNum;3 ^0 v+ V7 x$ a- d6 y9 g
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    5 t: }( S4 `5 }3 r6 X{' g9 e3 s8 \6 k  |
    (*memory).p[0].flag=computing;
    * K0 F0 s/ r$ r, u! A+ L(*memory).p[0].ioNum--;
    - y/ N! J- o2 gchange += exchange_IO_Compute;
    % l" v! z3 }  l5 N$ w; |waitio++;& ]3 S$ A; D! J
    }) q3 ~* I$ _( M. H( G
    else
    " G3 U; w: g- v/ [9 U. i  I{
    7 b; Y+ j5 G  m' V0 i  Swaitio++;
    ' h! Q1 H: u0 k- ^" F}
    % H+ }. T& R$ w2 R8 n3 ^}5 B4 |, n4 `: V$ P# o
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)& c8 u) I6 c( i$ G; F( z
    {
    : \! L/ e. a2 j& a# ~% [. M(* memory).p[0].flag=IO_waiting;4 T) {, p% ?3 u
    change += exchange_IO_Compute;. M& l) d. L. \! h' b7 l
    }
    $ H. _- {: q- ^; R9 a/ x) t$ telse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
      S$ M4 f( z! ^2 t{
    5 z1 {- u2 x6 W( f; L(* memory).p[0].flag=computing;1 w8 B) q0 x  `# ?  q2 w: w8 {
    change += exchange_IO_Compute;- n* I# Z) u" S( `
    }" m$ w$ L6 ]: \9 i$ @0 L* o
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    6 m! m' t, B7 b8 n4 W{, Y* V, b. M- J! d; q
    (*save) = (PCI*)malloc(sizeof(PCI));
    ; ?, A/ Y% Y; `' ^9 S: U(*save)->next = NULL;
    6 Z' X% l* e- J0 K# z2 [/ k% p(*save)->processID = (*memory).p[0].processID;
    ( V% C5 K& D7 [4 h+ J/ Q/ R' N$ K(*save)->comeingTime = (*memory).p[0].produceTime;* A" R$ n7 T8 x
    (*save)->askMemory = (*memory).p[0].askMemory;8 `9 e! P0 A3 O1 E* e' t
    (*save)->compute = compute;' ^6 [  B  [8 I7 D% j' ^6 X4 z$ A
    (*save)->waitio = waitio;* j5 R% b: |' u: n: [: Q
    (*save)->exchange = change;1 U# {0 ?7 ]; S- E' o3 _$ A# J
    (*save)->completedTime = systemClock;0 D% f4 D, k2 x8 D5 p/ g
    (*save)->runningTime = (*memory).p[0].runningTime;5 k# G8 F7 m7 N7 e8 b) P
    *spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;
    ) j5 `8 d3 H; G# S+ Ycompute=waitio=change=0;
    ! U" m$ h8 z: |% VcomputeLast=waitioLast=changeLast=0;
    ! g; P# V3 K- m5 f( gSJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));) G. {! Q% a8 r7 K5 ?
    change += exchange_process;4 A$ D# w) ^. b% l3 h" j' v: S: r
    return task_completed;" K0 M9 L0 U2 m! X  y) I3 B
    }
    # @) [0 G( y( @2 o- |else0 |1 Z. O9 R7 q( m# [$ I
    return task_not_completed;
    9 j4 |1 ~* b/ `! p" n) ~7 `1 I}; p# W6 Z. M, F3 l
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)( V0 N* c& H' E# R2 d" w2 y7 u
    {5 w- }! t$ x$ o) D
    int i=0,j=0;) o- F2 |5 ~1 a! R& q* `7 @+ U
    for(i=1; i<(*storage).proNum; i++). H0 K+ a4 f' f- J0 C( h
    {
    7 E9 q, ]0 B2 [& G" Wif(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime))! d; u8 \; g( l/ s- d8 t8 Q* u6 [6 J
    j=i;
    " Y" m' v5 }3 v# ?' W}6 j3 M0 V/ W8 J* K
    if((*storage).p[j].askMemory > *spareMemory)$ r$ w* f* p/ O9 v
    {
    5 J: j. o4 u+ jprintf("The memory asked is overflowed than the system memory.\n");8 p: A6 |' s- J6 e3 p* v  N0 U" k
    exit(0);
    / ]) d+ ~% n  ]7 K# h! I- G}
    % S5 t9 G4 d1 N- P% o; ]else3 z4 L0 w3 v$ A8 H- N7 K; _
    {. i- O0 f, ~2 E1 Z5 l& t8 P
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;% G1 b% [$ A, A  C
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    2 X+ U1 ~( c5 d3 L% ]/ j(*memory).p[0].computeNum = (*storage).p[j].computeNum;
    $ [, C( |( l, j3 C1 b) u) J(*memory).p[0].ioNum = (*storage).p[j].ioNum;
    ; T$ I5 ?/ a! E+ f4 O(*memory).p[0].processID = (*storage).p[j].processID;
    & x% S* \) Y3 l* u$ s( `(*memory).p[0].flag = (*storage).p[j].flag;
    $ }; [" X8 X8 [5 f* g* ]1 G(*memory).p[0].ioTime = (*storage).p[j].ioTime;
    + a0 V( p$ I. \& n  l# E(*memory).p[0].computeTime = (*storage).p[j].computeTime;, J# @" U. w& H
    (*memory).p[0].runningTime = systemClock;4 k8 p0 T4 p/ g7 X- o* d
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;
    & W' i" `+ s0 e% q4 Jfor(i=0; i<(*memory).p[0].ioNum; i++)
    3 {# Q, A) N2 u! A( `* d: |( @(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    & B6 }" m  i0 C: Ffor(i=0; i<(*memory).p[0].computeNum; i++)
    ! z. b) {. E8 C(*memory).p[0].computeClock = (*storage).p[j].computeClock;
    4 A2 o0 E2 J$ t* g! M. L' j(*memory).proNum=1;
    % A7 z* Y" Y: T: u* K/ c*spareMemory = *spareMemory - (*memory).p[j].askMemory;4 j! v' u4 c1 M( l6 ?
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    # T, l# n% }4 d6 nMAX_COMING_TIME = (*storage).p[j].comeingTime;
    & E2 g. j8 z( m; D}
    8 d- E$ P+ d1 C+ \0 _. {  a6 Ereturn 0;) x$ |. k1 X& n7 q: ]
    }" p% H1 L4 J# V. p4 \4 U
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw); ~' o# r% x5 E! m1 s
    {
    ( c+ e: J4 ~2 ^0 G& K0 g6 ?5 Ustatic int compute=0,waitio=0,change=0,clockSegment=100,poi=0;
    ' u# {, m4 t+ @* ~static int computeLast=0,waitioLast=0,changeLast=0;
    ! ?: b' R( J  _int i=0,j=0,k=0;
    ' o9 x2 |/ }# T: Y  B7 v! Cif((*memory).proNum<=0)
    ) [. X$ h% x* d: p# gTimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);3 P. b8 P" r# T& N! g9 V4 i
    if(draw==1)# W0 L' P" n" Y; O. o
    {" C( q# @4 I' M( a; [& m
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    ! _" v0 ~0 j! f& r* H5 Q& B# vdrawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
      O: O" s' ^3 T5 B7 b. R. f) ]/ T: s3 t# X/ }" s' z4 Y: p

    $ m; N$ b) y% u- G6 Z5 H& tcomputeLast=compute;  j/ r# @4 m& C3 ^- l2 t9 r/ x
    waitioLast=waitio;5 `3 X$ g5 Z1 a0 q) }8 ]. A
    changeLast=change;1 y& A! L- q  |- f$ T2 e" ]
    }5 W) |# j! ~: Y" v2 `, s' a
    if(poi>=(* memory).proNum)' G1 K+ D$ X' }5 @) A  }
    poi = 0;1 U# r! j3 c' N
    if((* memory).p[poi].flag==ready)4 `) ^  h+ V1 w* a. [1 s/ a9 b" c
    (* memory).p[poi].flag=computing;
    & H8 R8 _5 j& Jif((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing); z9 }9 U/ k5 e( n8 c' A1 V. a
    {
    ; ?, ~2 ~% R/ q+ g9 U, ni=(*memory).p[poi].computeNum;
    / [) F& N2 I9 Iif(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed
    8 `; B0 A' S7 t. @{
    / c( t  D0 R' `(*memory).p[poi].flag=IO_waiting;6 f* i. n9 p' A( R$ e
    (*memory).p[poi].computeNum--;6 }) Z% _& K. j% i
    change += exchange_IO_Compute;* a2 |; {( P$ Z
    compute++;
    1 k0 D5 l" h1 {8 q4 I7 Q9 m}6 G; I7 }1 u5 R3 b3 \" Y. n
    else' u, k5 E4 N5 B0 x. e6 h8 @
    {, w/ K/ p" m( B- O: v: T: f% ?' o0 ~
    compute++;# {. V" V4 b3 }/ d
    }2 N, y6 e" h. m0 r
    }5 J# Z" n6 e3 O- s' Z0 @3 X
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)" M/ ]7 T5 h* g2 _# n
    {" W' r0 O3 f  k9 p" y- x" w
    ; r) u7 ~5 v; k6 W6 [& O1 z- x
    i=(*memory).p[poi].ioNum;/ s, d! E; ~# Y9 c# }# J& A% ]
    if(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed
    / Y* x) i5 l8 h4 {% E( B8 a{
    % z/ p) K. C' k0 {( ^/ D# U1 v(*memory).p[poi].flag=computing;
    : e) a, T: R  p* i(*memory).p[poi].ioNum--;
    - D+ p# k) M1 [* c2 C4 l  K3 i2 Ichange += exchange_IO_Compute;
    " M$ ^1 B) |1 @/ J5 o; Bwaitio++;, @& z( [7 p$ ~% w
    }
    2 R) m4 w7 Z; o. F* i, V. qelse8 @9 O- h4 w- q& t+ ?) f
    {
    0 E7 a. a# }& ]* z; x7 v: \waitio++;
    2 N) i5 A; y) R  x; q& i! m' C, D}* |1 K' r) t+ I( N! t
    }3 \. r2 H% _* }4 T
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)$ t( \& z' ]+ Y1 k/ K
    {
    , Y" {3 l4 R% ~  ~. I3 v# O(* memory).p[poi].flag=IO_waiting;
    7 X" Z- ]. ^8 `change += exchange_IO_Compute;* ^/ U* k( {' q
    }- p6 W9 ~9 A: I! Q+ o; y" g
    else if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting)
    3 a1 i! k3 X' q* ^{
    + s& \% M! t$ Y" R$ t+ R& k(* memory).p[poi].flag=computing;
    ) A# q2 g1 ]( K' L- o/ Mchange += exchange_IO_Compute;
    + z4 ^# {- }3 S}" g$ |5 @9 ?7 Y9 B. T' D9 h
    for(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进
    ) N$ h, k8 s3 _# Q{- L5 u# v2 g# A$ R
    if(i!=poi && (*memory).p.flag==IO_waiting)
    , [4 m' P+ C( a1 q{! H0 f# Y1 w  K/ n4 L
    j=(*memory).p.ioNum;
    3 }( c: A! `6 k  f7 s% Zif(j>0)! _; `4 a2 q5 {! N$ ~. ?
    {" u8 c9 X' t6 Y, Z
    if(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed& v% z; s# @+ u3 u7 o
    {
    $ W9 h' B: h/ C* I, N4 I. [(*memory).p.flag=computing;
    - c6 M, f  |9 `" b% U' C& C(*memory).p.ioNum--;
    , k+ i# i. Y7 P6 z/ d1 m( Tchange += exchange_IO_Compute;) n! U. u8 e* ], b3 B( D. Z0 `( \
    }
    & @# _& h* U6 |( k! f: b2 w}
    1 S. z% D$ E( _4 u}
    ! Y* R1 o/ b0 N; d}  l9 B8 C8 Q7 ]" p; b) m
    for(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程9 N( I/ |6 H4 a& y' D; T) z
    {
    - W5 e  V; k6 `2 z% a9 n3 aif((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed' n/ S2 ?" O! ^0 v: G9 l" o
    {& L/ M* |; m$ B2 }: y/ p  j+ I* Q
    (*save) = (PCI*)malloc(sizeof(PCI));
    + B3 M$ q( t( j" ?(*save)->next = NULL;% A; C3 N6 r6 K2 Z& K" i2 D# K
           (*save)->processID = (*memory).p.processID;
    4 H* c; E- W$ H+ k/ t( U& M(*save)->comeingTime = (*memory).p.produceTime;
    6 ~( A+ e! f. V' |(*save)->askMemory = (*memory).p.askMemory;
    * a- U8 m( ^8 O8 Q(*save)->compute = compute;
    4 Z, l5 {) f+ v( t(*save)->waitio = waitio;
    $ ^8 p& D9 ~* b. D, ?(*save)->exchange = change;% `" A8 s! L: x: c& i/ p
    (*save)->completedTime = systemClock-(*save)->comeingTime;
    # h4 z2 L" S5 I% D2 s(*save)->runningTime = (*memory).p.runningTime;
      e2 j7 u+ k# ~1 ]9 ~(*save)->completedTime = systemClock;+ ~9 L5 g& r) A
    *spareMemory = *spareMemory + (*memory).p.askMemory;5 c$ A# d" _* _: |5 W) i
    compute=waitio=change=0;
    # P# i7 l& r( ZcomputeLast=waitioLast=changeLast=0;# X7 ~" ]" I$ t4 l3 M- I7 y
    if(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入) m- F9 _# x9 k: C" c& D$ u$ S
    {# H% M4 e; _6 z7 d- Y: w* k0 E. K
    if(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程
    ; }. W4 }8 s* m5 |) E! U. W1 x{
    2 t& y0 ]8 r1 ^2 {! O' |2 r8 \( Jpoi++;
    0 _: }. `8 q8 `# m6 {2 k   clockSegment=2000;
    % f; }* g& q3 ]. J$ k/ a}2 F" Z* |! t/ \! ?; D. S
    }) ^  D' l; T  J0 p; D* v, I9 C
    else  //没有足够内存调入新进程
    7 S' x5 F% K* A) S7 b( i8 C3 D{
    8 |' o$ Z  d8 c0 v5 gif(i < (*memory).proNum-1)) I, F! f& v% Z+ G2 v
    {
    ! t) P* A, u5 J' E* Nfor(j=i; j+1<(*memory).proNum; j++)1 ^4 \. C  `. ?/ ^- E
    {
    ) T2 m; g) g8 f(*memory).p[j].askMemory = (*memory).p[j+1].askMemory;
    5 K: h9 K$ h8 e* P( W* x! h- ](*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;
    ! Z* ?- @! S) Y" ^8 }# T6 b(*memory).p[j].computeNum = (*memory).p[j+1].computeNum;
    7 N  v9 y* F4 c! c+ _, g" U(*memory).p[j].ioNum = (*memory).p[j+1].ioNum;
    5 Q8 c$ _; u+ ^- d; D" t(*memory).p[j].processID = (*memory).p[j+1].processID;
    ( {  _6 v8 r) }9 u; e7 \1 U, S(*memory).p[j].flag = (*memory).p[j+1].flag;0 B4 Y0 w  \. S0 m. G; x- m9 J
    (*memory).p[j].ioTime = (*memory).p[j+1].ioTime;
    # A, z0 W0 H7 g6 D- M' J" L; t(*memory).p[j].computeTime = (*memory).p[j+1].computeTime;
    9 x7 s- R+ l& _(*memory).p[j].runningTime = (*memory).p[j+1].runningTime;
    6 u+ ]7 R' }7 R(*memory).p[j].produceTime = (*memory).p[j+1].produceTime;4 z+ T7 N' F, Z5 ]# I3 U/ r+ ?
    (*memory).p[j].completedTime = (*memory).p[j+1].completedTime;7 G/ l2 s  c1 q$ T/ E  L9 B" m
    for(k=0; k<(*memory).p[j].computeNum; k++)# u# d$ ?! c# }# C6 s
    (*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];
    9 m) [( Y  d$ d( nfor(k=0; k<(*memory).p[j].ioNum; k++)' g2 ~6 z* t+ @& m+ S: K6 \
    (*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];$ X/ n( E& c0 D
    }* M3 E3 [4 Z* ^/ N
    if(i<poi)
    2 P5 k* D- z0 S1 Ppoi--;
    3 R! p, h" m/ h/ T4 qelse if(i==poi): X6 _" v' m, [9 M/ }. N' `
    clockSegment=2000;
    1 e! p3 M% h4 L}/ `9 L$ ~# L+ }; Z* L  b( Q
    i--;5 b4 P+ I0 M; D0 u
    (*memory).proNum--;
    ( S1 _) E+ K1 {1 j5 e( X}) b9 n4 O' g4 `& x% ]
    return task_completed;, L' g. B+ {* }' ?9 k5 j
    }
    7 D2 M; K, Y4 E( E! z2 J}
    : O, M; B8 K" T; s; d% @8 W7 f--clockSegment;
    ( y! y1 f. i+ C' N! rif(clockSegment<=0)
    , o( \$ i: e* q1 t/ L{
    * F; e4 r1 [* H. B" _poi=poi+1;9 a$ W1 s  X" ?2 Y% O+ x1 {7 [4 a$ W
    if(poi>=(*memory).proNum)
    9 I+ e5 \2 t! W8 q  Q* `poi=0;
    3 Z$ w0 k9 k6 i, nclockSegment=100;
    - x* ?& G0 y# ]* Y7 b4 P$ j0 F* c$ @}
    , ]3 ~: C0 ?8 mreturn task_not_completed;
    # D3 K6 O: s, |' e; n}
    9 \7 N# T$ a- X8 k& _8 y. rint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos)5 R& y) B% G+ Y: ^
    {' c) l* Z  U/ y6 P# f* x' L
    int i=0,j=0,k=0,flag=0,translation=0;
    ) t3 a* x" m+ R+ h- Bfor(i=0; i<(*storage).proNum; i++)
    $ h& h0 t; b( N2 I( h! D{$ x4 N: O( J  P8 f0 F: T' {0 N
    if((*storage).p.comeingTime>MAX_COMING_TIME)
    0 ^& \/ E# Q) Q1 d$ N/ fMAX_COMING_TIME = (*storage).p.comeingTime;
    8 Y" i4 s7 H$ w# f  h}
    ( z9 ]$ L; D6 H! \' H0 Tif(pos>=0)( I  A$ ]2 y5 T+ D- p4 V
    {
    ; f/ `% R4 n5 U- Xfor(i=0; i<(*storage).proNum; i++)
    ' z5 k- w8 q0 @{. S! Y5 Z! \8 o
    if((*storage).p.askMemory <= *spareMemory)
    & R9 g, ?0 S/ |; d% M{
    " p( s2 N* p* f1 B7 x6 fj=pos;
    ) c+ d& w( h* M# ~2 S. P1 u(*memory).p[j].askMemory = (*storage).p.askMemory;
    % j, x' A$ M3 c- z7 I  {(*memory).p[j].comeingTime = (*storage).p.comeingTime;( R; R1 k4 h! r0 e; N
    (*memory).p[j].computeNum = (*storage).p.computeNum;4 r6 _% H% b8 b2 o, [1 N  g1 s4 t
    (*memory).p[j].ioNum = (*storage).p.ioNum;& f) f$ P; U& ]6 K$ m  l4 e& z, M" ^4 c
    (*memory).p[j].processID = (*storage).p.processID;: {" i3 n1 M) @8 L  a
    (*memory).p[j].flag = (*storage).p.flag;: K2 t; G& o) f
    (*memory).p[j].ioTime = (*storage).p.ioTime;; R- A) Y4 n3 e) v$ X
    (*memory).p[j].computeTime = (*storage).p.computeTime;
    6 d9 ^' R$ k1 Z1 Q(*memory).p[j].runningTime = systemClock;5 I1 Y) i7 Y% o" \$ n* F
    (*memory).p[j].produceTime = (*storage).p.produceTime;
    4 m2 c- ~) M" v+ c3 S$ k6 @2 a+ ^; _for(k=0; k<(*memory).p[j].ioNum; k++)
    # x. K& I, Z  d0 [2 B(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    8 `( d8 J# k# O) ffor(k=0; k<(*memory).p[j].computeNum; k++)
    " U0 p5 K2 z7 R( H(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];  y/ n, z  P( s! O9 Q4 Z
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;$ G  {7 k4 H7 f7 L, \* Q
    produce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    ' k6 l+ A  N! m. U* LMAX_COMING_TIME = (*storage).p.comeingTime;& k/ ?1 M) V& i" v
    translation=1;! Y6 u' v& U) i4 F
    break;
    $ x8 S( M1 f* s' L}
    & |1 C4 W& [: F2 g2 `" Q}
    2 M. Z' p5 h* y- ?}7 v+ B3 T" A) q5 C" F% |/ W$ Q# G
    else4 ]+ {6 O# y/ B1 H. p
    {) U# I  A  `; r$ ~0 U
    while(1)
    / l/ K" s" B: v0 Q/ P6 S& C{
    ! N5 k3 o# f, \8 [7 j) q5 ?flag=0;
    ! \; G7 o6 F$ I) `for(i=0; i<(*storage).proNum; i++)
    ) r, Q- o3 x5 i, |, A- q' F{
    $ {* d" N  p$ X/ F8 Nif((*storage).p.askMemory <= *spareMemory)
    * U( w4 O4 I, C4 p{' o+ N( b+ m% {  n5 p
    j=(*memory).proNum;9 n0 u. h4 I. `4 `  q# I# p
    (*memory).p[j].askMemory = (*storage).p.askMemory;+ f9 T" b9 [4 C) ~0 [4 q5 b
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;3 k6 Z, j3 D' J+ Q
    (*memory).p[j].computeNum = (*storage).p.computeNum;9 j- c: j7 B* z8 `6 n% ^
    (*memory).p[j].ioNum = (*storage).p.ioNum;1 q" H# q; |# u. t5 M; }0 v
    (*memory).p[j].processID = (*storage).p.processID;
    # ~2 ~% l7 U/ H( J  ^; l(*memory).p[j].flag = (*storage).p.flag;" ^5 B( h: G$ l
    (*memory).p[j].ioTime = (*storage).p.ioTime;6 |' Z5 A" x! ]
    (*memory).p[j].computeTime = (*storage).p.computeTime;. N6 T+ Q9 K5 D
    (*memory).p[j].runningTime = systemClock;
    6 r' P4 U$ e, e, D& o3 }(*memory).p[j].produceTime = (*storage).p.produceTime;
    ) @& w+ C7 p$ u% X' N/ |for(k=0; k<(*memory).p[j].ioNum; k++)( P. e; F0 |! O: ]" R/ B
    (*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    7 C% N  Y8 G+ e: s. Sfor(k=0; k<(*memory).p[j].computeNum; k++)1 W/ b1 b5 ^  @9 E4 ^2 L# \# W( R
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];
    . ?) H, {& A% K; q- N6 c. @(*memory).proNum++;
    . b+ m7 `0 D$ n! l' H*spareMemory = *spareMemory - (*memory).p[j].askMemory;
    & T6 t# M8 O& i$ _produce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    . l8 H2 U' C! v3 N8 zMAX_COMING_TIME = (*storage).p.comeingTime;( Y1 R6 M- c% e/ t
    flag=1;3 |* I1 a5 N$ r& T
    translation=1;+ `2 V0 X9 D) D; S) I; E' p0 G2 i
    }9 A$ z, K: p: u" \  l
    }( w) j5 y2 l4 I& q7 P& Q
    if(flag == 0)
    2 c5 t& p( |. k. lbreak;# f% L/ Z! k& P$ \5 W
    }! G+ u* Y! E6 t; b7 f
    }( W+ c4 h& r5 y) S% }2 O$ r. e
    return translation;
    $ a. g7 I8 ]* `1 Z}$ _, A9 O: T# ?) f2 E$ g# c# I
    int FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)
    2 j' z3 K3 d7 e1 w# e2 P4 O! R{
    $ R2 |. [$ i9 A0 j6 ?5 Jstatic int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;  E! _& P4 A4 J& g" n- [8 ]( m0 z
    static int computeLast=0,waitioLast=0,changeLast=0;
    4 Y, c( Q" k) W& lint i=0;
    0 X; m0 A) p: g" B( Yif(draw==1)2 v' k" E+ u( M3 V; o7 f% d& ]2 N
    {
    ; [- Y' V3 r. I/ X  N//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);4 G# a, a1 N% n$ y
    drawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);7 f' d& L; S# j

    $ q' H0 I8 F& _' ?. F6 ^. G6 i' K; j6 b+ q1 w
    computeLast=compute;7 z, N. x! ?& T/ W
    waitioLast=waitio;
    5 E3 y7 T) c4 P; x1 Z! ]changeLast=change;. @8 {' O& W% Q* @, d, G# a
    }
    ; ]; O! J, {0 j( e: Qif(flag==1)  
    5 s0 W. I# u( s* z4 y* d: `* [{
    ' W+ i5 {* ]0 C" t+ v; g" c& ]: kif((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed
    3 |/ J) p) l: D! b8 W5 p+ Q{# y! L( S' z4 h; n1 V& G7 F
    if(flagiocpt==0)   // implement compute
    # a8 L4 b% D" \7 W, T{$ w# S0 V! n+ T; m- H. i
    i=(*memory).p[0].computeNum;
    ! u; D/ O+ G# v* W) Zif(i>0 && (*memory).p[0].computeClock[i-1]>0)
    : b/ Q$ g/ z9 r* R# q{! F# w' l" s. b& a
    if(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed6 q0 P. _6 u; a/ v% }/ n2 q3 T, I
    {  F2 e! S  D5 E' b( j6 o" v, v; v
    flagiocpt = 1;5 C: }% j4 r% i1 _! _( t  H; @
    (*memory).p[0].computeNum--;5 h5 B" t$ T7 S1 r% T) T
    change += exchange_IO_Compute;& i6 b4 v$ k3 q/ M
    compute++;
    . ?# ^( u5 u& l) z}
    % o; q9 ^1 `& helse
    5 i- _( V6 }9 F; F0 K0 K) B) w; Qcompute++;5 V' F# z$ k* V$ @  o  B

    ( B' I, [: U" |( H+ H; ]}
    : Z8 C8 P# g7 X9 Zelse
    , M  v7 c5 _3 ?' k' b0 fflagiocpt = 1;
    5 Z/ U  h8 z; d( s, `8 a2 l}! Z5 F. `1 S; L( N3 z+ C, ^
    else  //wait io
    " ^! a' \2 j# C, W{1 ^( a) d9 T4 H+ f( P1 c4 [
    i=(*memory).p[0].ioNum;1 k* s/ n+ H* D% ?, U
    if(i>0 && (*memory).p[0].ioClock[i-1]>0)
    2 f0 y; S/ m. J) {$ l: H2 c6 X& ]{
    4 f. f/ b6 W6 Sif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    1 i7 W. e: o$ a# D* r8 T{
    & ^! N/ [6 ?% p0 x( |flagiocpt = 0;, |. i- Y- E, _) I* F9 _) R
    (*memory).p[0].ioNum--;7 v* d/ z/ k" r8 }7 y  _6 j) z
    change += exchange_IO_Compute;- ~  m, d* Y8 {8 g1 |
    waitio++;) e8 _5 [- i5 g7 y$ ~( R5 J
    }& d1 d. k. Z6 }# x
    else$ o9 g1 D0 @2 w* L. b
    waitio++;
    2 P1 \1 S" r7 |
    : ~4 g6 n. V7 H}3 Q; A& @1 h: H" ]' h3 r! g
    else' ~' D7 s7 _0 M& u
    flagiocpt = 0;
    " P( A/ H* L" s  p# U}# L& o" L# l7 X# H' K2 ?+ K
    }
    : B5 a1 z, H* ~9 E$ lelse  //task is completed( J" |; \# X  a: G' w
    {
    ! W& `" x% Q6 v0 }2 A5 ^(*save) = (PCI*)malloc(sizeof(PCI));2 X. T$ b! c2 L; M
    (*save)->next = NULL;
    # C+ P! f/ |( }0 z+ ~2 g% c) I  |       (*save)->processID = (*memory).p[0].processID;
    & P$ q3 k/ ?! b& f(*save)->comeingTime = (*memory).p[0].produceTime;
    9 @- X# p3 M9 `0 e* k' W1 B& Q: u  C(*save)->askMemory = (*memory).p[0].askMemory;
    9 [; d) A0 {1 L7 W(*save)->compute = compute;
    & q- G3 K, x& X. z& n3 [" j& W(*save)->waitio = waitio;# Z5 B' k# F  O! y8 c2 l, s
    (*save)->exchange = change;1 k6 e3 ]( s9 {% x0 Y% B( F! M
    (*save)->completedTime = systemClock-(*save)->comeingTime;; `  x& ^3 t( K$ V, a, j
    (*save)->runningTime = (*memory).p[0].runningTime;
    & D; V& X) k  ~# U8 r(*save)->completedTime = systemClock;
    1 L3 S9 M+ M+ u//*spareMemory = MAX_MEMORY;2 Q( f* U7 x+ K/ i7 Z
    free((*memory).p[0].ioClock);' u: K6 @- u: U/ `6 ~, m4 e
    free((*memory).p[0].computeClock);$ ]# J" d' h4 L
    free((*memory).p);
      K9 h  W( L" x$ z2 _8 z9 ~4 y4 qflag=0;- h: d2 c6 y# p# K
    compute=waitio=change=0;
    3 P3 n3 A+ t: Z3 J. l# z0 l1 xcomputeLast=waitioLast=changeLast=0;' Z9 B9 l: k8 V& v2 A$ c
    return task_completed;) a, B& q7 Z8 @% U% Z
    }5 _' z: k% |' L# g/ @
    }
    $ [+ g5 r# e% n* Z7 S! d- e5 Melse         
    4 n2 x5 Y8 g+ m' `! h: h, `{: q# V: c& X4 y; {; F) h# a0 b9 @
    FIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));
      T- j; p0 V3 Y' e0 V3 {change += exchange_process;
    * j! M: N7 D0 l! h2 y/ \: P//*spareMemory -= (*memory).p[0].askMemory;
      Q" M( x' p0 b1 C8 K% v, Eflag=1;; b6 @5 B' B) i% G4 ]0 m
    //showProcessInf(*memory);
    & H  w$ O6 x) _" vreturn task_not_completed;
    0 @0 X9 |) e* u6 B# J1 N8 M( e}1 H4 ?9 T: ]6 E! h* Y
    return task_not_completed;
    9 N) t, P( W% `8 w}( w* A7 ?( w6 c
    int FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)
    " i  T- G2 H% D{
    , l0 y) V9 V7 uint i=0,j=0,k=0;
    3 I# J& P9 \) A* N( K- v% x* W5 fMAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;" G/ W% W% E6 O
    (*memory).p = (process*)malloc(initProcessNum*sizeof(process));
    / ]4 T( x* h. o; [( e3 Kmemory->proNum = 1;% h+ M, f. ~, s$ p, C7 K
    for(i=0; i<initProcessNum; i++)
    , T" l, q1 f3 u{
    ; b- g. t. {6 ]' r% C2 z, Bif((*storage).p.askMemory <= *spareMemory)
    / I& z5 G! `6 B{
    " |  q3 x1 B% y/ Y(*memory).p[0].askMemory = (*storage).p.askMemory;
    , y2 c1 G5 z9 G(*memory).p[0].comeingTime = (*storage).p.comeingTime;; M) v7 }* G! K4 c. @1 i
    (*memory).p[0].computeNum = (*storage).p.computeNum;2 j; b$ G1 I- X" T
    (*memory).p[0].ioNum = (*storage).p.ioNum;! \/ ~8 o" J* E  z$ \
    (*memory).p[0].processID = (*storage).p.processID;
    $ }) P0 k2 f& L. |(*memory).p[0].flag = (*storage).p.flag;
    . h2 v" }1 P4 l7 c- o+ \, S(*memory).p[0].ioTime = (*storage).p.ioTime;" B/ D5 d  |  y; {
    (*memory).p[0].computeTime = (*storage).p.computeTime;( ^+ e4 P5 G/ v: Q
    (*memory).p[0].produceTime = (*storage).p.produceTime;
    / |9 g5 G! l  Q( |7 R# [! k(*memory).p[0].runningTime = systemClock;* \* {7 }, ^5 w4 m% V4 b: `- @! ]' p
    (*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));
    4 [, k, s, E7 t( ?5 C/ t2 T(*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));
    . O( C& B$ _; v/ ?7 X  Tfor(k=0; k<(*memory).p[0].ioNum; k++)
    & @1 n: s, O6 U& `9 u/ ]: m(*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];
    4 d% g( G- I7 O5 _+ Sfor(k=0; k<(*memory).p[0].computeNum; k++)
    % F; l  P1 m) E. P(*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];1 j+ B6 J+ ?- _
    break;
    8 o+ t/ n' Q" ~}1 c7 `7 a* \9 s; [8 {
    }1 l4 o& N6 \& p5 @$ x+ b' q! z
    if(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入
    $ u* M$ c0 `7 ?) V, s$ \{4 a. A; P( p0 C
    produce_one_task(storage,i,ID_FIFO++);
    & `% e- b* b% V$ n  ^MAX_COMING_TIME = (*storage).p.comeingTime;0 O8 d0 h* [6 m9 A
    sort_by_comingtime(storage,i);
    3 o, g% f6 Y0 p4 n# Q}! X# h9 d3 f; @. M
    return 0;
    4 @* ~0 t4 L; E8 x) ~" z}* K7 s; R9 N+ a0 i
    int sort_by_comingtime(processPool * p,int pos)
    ' k& N5 E' c4 ^& L* V" b# S7 S5 J{* ^/ N% H( \3 v, L* s
    int i=0,j=0;
    - v; @. Z" l& s$ pprocess temp;
    3 z# x/ l" v) vif(pos<0)
    1 y. F7 g) _4 @{
    4 S" Y  m4 V3 D- K: z2 o# s& Z6 @6 ufor(i=0; i<initProcessNum; i++)5 |7 P8 q8 J0 j9 f/ y
    for(j=0; j+1<initProcessNum-i; j++)
    + ^% x' z; R7 z7 L4 V{% w, V' k. t1 {" [4 f- S' D
    if((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)
    0 a9 y7 K: E- c+ W{
    * k0 q* l" @) Y- F7 m6 a( Dtemp = (*p).p[j];- _/ @; [" p5 F0 i
    (*p).p[j] = (*p).p[j+1];* J! _. ~4 E  Y& u0 T2 Z3 d4 |" V* e
    (*p).p[j+1] = temp;
    ; o3 E6 W# d5 T}
    # Z. a+ j, K9 ~! E$ v}( ~* ]6 k8 R3 d& a) N! \
    }. R" F4 i, F; Z7 C. u" H6 p
    else if(pos<initProcessNum); g1 q0 n; ?  ?
    {
    ) T) w5 S: m% I- p4 Dfor(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--)3 Y/ v  B" q. T& T/ j7 Y
    {7 Z' K+ A! C* C0 y  J  A8 Y
    temp = (*p).p;5 u7 ~8 V2 h/ y3 o9 {
    (*p).p = (*p).p[i+1];- R! z& X+ @3 r/ F; q6 Z
    (*p).p[i+1] = temp;
    # O' o/ o7 ?: I& w% C! C}
    $ y6 ]# {# W5 ]. l; X) Q" i1 hfor(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)& q: I7 e8 e, ~; u5 c; J
    {! a) W1 v- l% ?
    temp = (*p).p[i-1];* s  k* e7 K; j$ I
    (*p).p[i-1] = (*p).p;
    + b( h: P( E, m, Q. `(*p).p = temp;! K& U* ?$ ^6 V) ~+ B
    }
    ' N; S& i+ I' h) u1 Z}4 T) [8 @( e9 O( H
    else
    6 N% n, V% x5 @5 T3 K  A: Hprintf("position eror\n");
    + j9 P* X. S- d2 \! u" Z% m2 Rreturn 0;
    : z8 H* n% u$ A9 X$ z. l$ ~}/ H9 C* _! U# K4 w7 J
    int InitPool(processPool * p)- q) f' T  J$ I
    {
    & @/ U* ?: T; |0 q& Kint i=0;9 w! x' C9 P$ R3 U" @) T! }/ Y+ y8 {$ t
    (*p).proNum = initProcessNum;! u3 p) a+ u$ V& I& p
    (*p).p = (process*)malloc(initProcessNum*sizeof(process));
    # F1 M. U8 r& ]5 _% u" j/ }for(i=0; i<initProcessNum; i++)                                        //init process information& a1 o  a* |0 u4 K* K% q
    {$ M  g8 I5 I% \7 A9 Z# L
    (*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));' ^  g+ f9 T  n  e: v
    (*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));
    / D9 T0 l# a6 l6 L3 _) `" Xproduce_one_task(&(*p),i,ID_FIFO++);
    8 w" r9 g+ g# x5 z/ W% \8 ?. z( W}# @% [/ }: h$ i( Z4 t. W
    return 0;
    ( U' `4 `3 |1 z0 _* H2 w# P" u}5 `& W( t3 X+ h$ t: A1 W$ B
    int produce_one_task(processPool * p,int i,int id)4 ?' e" a7 M! p' D: u  ]
    {0 B: Z+ O$ h6 N' i% Q& `( t
    int time=MAX_COMING_TIME,j=0,totallTime=0;# Y" {0 N' a7 ~0 m7 B( ^8 a
    (*p).p.processID = initProcessID+id;           
    5 x% Z1 I! s5 B" F! V(*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);- E! q) H3 c* C, e  {
    (*p).p.produceTime = systemClock;: t, v! N2 O2 }7 _
    (*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;4 o1 s- I: j7 C. a0 d
    (*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;
    2 F4 x6 F$ \" w3 _6 q1 [8 TtotallTime = (*p).p.computeNum  + (*p).p.ioNum;( C* {8 T' W" F9 ^3 L# B
    (*p).p.computeTime=0;
    " x7 [6 `8 r# y, r: A& |for(j=0; j<(*p).p.computeNum; j++)( O( `( E% ^6 w& Q! g
    {
    7 R) y# D1 V1 z2 e* C: Y(*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;0 L3 Y5 ?, R, E2 t& n( e
    (*p).p.computeTime += (*p).p.computeClock[j];
    / _4 j/ ]2 w( ^! T}
    2 A$ T1 D5 u2 A! G4 J2 i(*p).p.ioTime=0;
    ! ^$ p3 x& S( d4 Q" G; jfor(j=0; j<(*p).p.ioNum; j++). D2 c8 e% e9 O
    {& ~4 \$ ^; e$ u' y! \/ G4 Z
    (*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;
    & }! k3 O7 s% ^(*p).p.ioTime += (*p).p.ioClock[j];
    * p2 q. l' z+ g5 Z0 I  z}6 {1 A0 M( W6 K! J. T' v) {
    (*p).p.askMemory = rand()%(MAX_MEMORY/4);* M. V4 U! P5 M1 g$ m- u( P
    (*p).p.flag = ready;) g. ?4 f2 Q8 W2 f% U2 Z4 U' O
    return 0;& Y7 g  U! D3 L$ L
    }
    : r3 Q! `7 N5 {. Jint showProcessInf(processPool p)$ q  A) p' ?: ~- p& p
    {7 y: W2 i8 H1 O
    int i=0,j=0;
    6 p2 G8 j; I6 ofor(i=0;i<p.proNum;i++), U$ A( E( H, A% c1 _1 P1 Y$ T0 D
    {
    ( P+ {7 J1 U' ^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
    ( {; c3 M! W$ _% X,p.p.askMemory);
      h9 v6 D# k4 {. ]for(j=0;j<p.p.ioNum;j++)
    3 ^# C; M# i* ]* y+ D{# z& w; b" }3 n- _, t( b8 l6 q/ T4 h
    printf("%d ",p.p.ioClock[j]);% X% C$ o" ~3 J; e6 d2 K* [
    }
    0 b, Y( }7 z' R# h+ T" P9 A- E; qprintf("\n");
    5 _3 Z* Z' B) h8 L% u$ f* g1 |, O+ yfor( j=0;j<p.p.computeNum;j++)" m' n& X8 B  C8 C% w  t
    {
      f  Q& v. h! Jprintf("%d ",p.p.computeClock[j]);
    ( I; T' f7 P; b}
    ( p* d" ^. B- V' c. x0 x6 Gprintf("\n");. Y+ K* x# o# E" c, V% F- U/ U0 s. d
    }
    1 Y5 u2 W2 V" T; p5 r/ Zreturn 0;
    / v9 t; P& \1 ]6 S. e- @$ a5 h}
    ) @1 X% C) `5 X+ a2 V————————————————! F: {; S; P1 p9 e$ |5 q7 [. C! ^
    版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    & \& [) G& T8 |, H0 _原文链接:https://blog.csdn.net/wang_dong001/article/details/47843519
    ' p0 f4 t8 D+ @/ Y
    ( }& x9 ]3 \# }& q8 u& E- l+ V! n1 K- E) K/ C
    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

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

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

    蒙公网安备 15010502000194号

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

    GMT+8, 2026-7-24 20:09 , Processed in 0.650654 second(s), 50 queries .

    回顶部