QQ登录

只需要一步,快速开始

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

    9 S$ j. K2 i( i  s7 i! n经典任务调度算法的模拟程序
    + D5 g' @$ A. E+ v$ |- P本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。
    # G3 j! q: p  P* d
    ( F: F1 G( v- S/ T: C$ ?, }9 t编程平台:VC6.0+EasyX图形库环境。8 ]* i, y3 O+ x& \+ C0 Q

    % X5 K  u+ b0 }# p% j6 k以下截取部分程序运行图::( g8 a! c- i* |! Y6 T% }3 j

    $ ~( h! I, d; y* ]4 X7 T源代码:
    0 t- l1 u2 |, y# r
    - N% |; F4 m# K% \  T; O- D4 Q#include<stdio.h>) ~; V7 J; q0 G2 S; h
    #include<stdlib.h>. C: P& W  T) A* Z; _* g7 A
    #include<easyx.h>) S( V  G3 e: T% B; @* a
    #include<time.h>
      Z. p3 N: W/ k- C/ a8 j#include<conio.h>
    $ J- \( o; i4 H( c2 r( m#include<graphics.h>% w9 d8 ~# a; O2 C7 A
    #define initProcessNum 108 U; k+ q) e0 A, T" t( o8 X" `) ]
    #define initProcessID 1000$ I1 L) v2 |2 n  @7 b. R# f
    #define MAXProcessRunTime 10000- u* g+ ~9 i% O) d3 K$ [
    #define MAX_MEMORY  4000
    " u4 S# G/ B2 Y/ A# |& k/ G( O3 Y$ ^8 W#define exchange_IO_Compute 10' |  J) H* f/ l* v! r/ g8 z% {
    #define exchange_process 257 r( e: _3 `9 l. V$ `* f4 I
    #define task_completed 12 a5 `( u% L% R. E
    #define task_not_completed 0. E: e5 J" Y- Y  Y% R# _
    #define initclocknum 100/ s6 E+ x. a: Z0 q5 i
    enum condition" P; k/ r3 Q' x6 E! s  B
    {* C- ?7 x7 h) m1 Y, d% |, R
    dead,computing,IO_waiting,ready1 x5 L: C) U3 q) z
    };7 j1 H, u+ G" N  g, y% o  O+ s
    struct process
    ( k1 Q+ l# v( w( z" ^! K$ l+ V{
    ) y; ], l( F6 Wint processID;
    + u, U4 j  I# V/ Fint comeingTime;
    ; Y4 {, S; U! i! Y  ^/ u/ E& ]int ioNum;3 y+ [$ F0 H2 f  h
    int computeNum;, S8 E  G1 V% X8 }+ A
    int * ioClock;
    + U5 J4 Z( j. M; M7 v. F+ W% k" Fint * computeClock;
    : J* g) C/ o' fint ioTime;% F, z# ?9 i& c) d7 V# ^* p* l
    int computeTime;
    $ j* G# d; o4 f' `& b6 u" L6 eint askMemory;$ k" `: U( T' ?  ]; z1 i
    condition flag;
    / ?5 E/ W  ~, I- [' {, {, [int produceTime;  //生成时间,以下三个数据成员用以计算相关性能3 X9 r# ]# }6 |: l4 e7 b
    int runningTime;  //第一次占用CPU的时间" K' l; m! F0 F* `+ x% S' y+ b
    int completedTime; //进程完成时的时间
    ) s3 |1 o( @8 _6 x- a};9 G3 `4 V0 d0 S' u
    typedef struct processCmpletedInfo  //保存完成一个作业的相关信息
    * `- Y  [* o: z! u{. S, X% N7 I$ |7 c
    int processID,comeingTime,askMemory;
    1 s6 V' T& w- ?- k* y; t$ M0 V% xint compute,waitio,exchange,completedTime,runningTime;
    1 z; T6 u' G4 L% EprocessCmpletedInfo * next;' K# H/ I6 F2 t, }) j# _
    }PCI;' F( j% C5 C0 ^4 Q5 |9 d
    struct processPool0 Q5 b2 d2 w6 M; ?2 ^
    {6 ]$ f7 m+ ?- ^7 X. e9 A
    process * p;5 S( k( q' z2 o) W- R0 J; R, i/ p4 a
    int proNum;
    ( u) x  e& t# l; t) {};
    % c% u6 k2 d: f, b: O, N( `0 yint 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;
    ) R# `+ T8 s9 N9 x) X0 G, }int InitPool(processPool * p);) Y% _6 _& m8 h7 g0 O% }, l/ Z
    int produce_one_task(processPool * p,int i,int id);5 h; e+ N! e2 Y; U/ Q# Q6 f# j% c) b
    int FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);1 A9 B9 p2 c; ]# ~- p8 ^7 U6 \
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);: [$ O* C6 G; l, M/ E
    int TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);' U6 S/ _% c8 i" `- {
    int FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    : o9 _6 C, M) o8 O! l8 I4 pint ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);2 c  Z* T* K+ a1 E! m# e
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);# i' f/ L6 N$ F) G* G, g
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    ! e( `: r2 `& P8 {+ bint Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    + O9 G/ A$ D! X6 gint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);$ D2 c. p  R7 K6 a
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    ) a! w. n) l4 A) \, d( c$ K2 w' _1 G. |  H8 I

    ( |5 J7 b9 ?- C2 M% ?int sort_by_comingtime(processPool * p,int pos);
      s+ x1 ]- A- rint showProcessInf(processPool p);
    3 x+ t8 u# i1 I5 P" d) i; d, nint drawPerformance_FIFO(int x,int y,int memorry);
    1 O5 |0 O/ E% E/ u+ g. a4 x  P* C! Tint drawPerformance_HR(int x,int y,int memorry);+ ?1 e* H; P& c7 l$ S
    int drawPerformance_PF(int x,int y,int memorry);. u( X$ h/ X, F/ |, J0 e
    int drawPerformance_TT(int x,int y,int memorry);! Q: i6 ]/ D' [- H3 N
    int drawPerformance_SJF(int x,int y,int memorry);6 {: ]8 T- C1 ?+ I3 m
    int MouseListening();: p0 x8 r5 g9 o8 T2 n* b4 @
    int MouseListening2(int *flagShow,int * showTime);
    " X6 w9 B9 Y) @+ C5 t, X9 v3 {int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);/ n: L$ T! v4 g" y3 B8 T# y& B% ?

    . G- _' _" _& G' P- N1 v" z0 ?
    * V+ x3 I0 q2 ?8 g/ mvoid main()
    ( u. m" W2 [; G2 @0 V{
    - F, B/ T% r5 n6 H0 `! F! HPCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,
    % R6 u$ U# S' L- c" x9 j*Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;7 U! T5 t, U1 L' S" p' T
    int i=0,FIFO_memory=MAX_MEMORY,count=0,Timet_memory=MAX_MEMORY,SJF_memory=MAX_MEMORY,Priority_memory=MAX_MEMORY,HR_memory=MAX_MEMORY," K, P% ^8 `. p+ x4 ^" A
    flagDraw=0,showTime=100000;3 U: A/ v# q% }& g7 Q
    processPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;
    0 k& J) A* h9 d5 G7 E% `FILE *fp=NULL;( Z! O0 T$ o4 T( U! X
    //processPool HR_p,HR_mmy;
    3 a, t5 c1 @2 M) H: {0 c& a! T3 @' q! R4 z
    # X4 x& G7 v# F- e: }3 I
    srand((unsigned)time(0));: h3 M& P* L: I' G
    systemClock=0;* A! i3 B" k; _
    initgraph( 1200,650,SHOWCONSOLE );
    , R" W( I) p- C! M- Wsettextcolor(GREEN);% k1 {+ c' ^) n" }/ Q" D
    setlinecolor(GREEN);
    ! t7 F* Y5 \5 {setfillcolor(GREEN);
    3 B/ C0 V0 T& u  s, mInitPool(&FIFO_p);' Y# h' o7 v5 @5 J: A
    sort_by_comingtime(&FIFO_p,-1);0 q( ^0 ]! R# X& F7 g
    InitPool(&Timeturn_p);
    " q- G: M/ J( h7 I) ^/ [# [  lInitPool(&SJF_p);% F. }3 d$ W5 I# z* }0 u* N" R, k
    InitPool(&Priority_p);
    , a$ c8 i0 g. EInitPool(&HR_p);/ y0 w& C" N2 p# H" D6 K: {$ H
    //showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);
    6 N+ K7 x* t+ z) p. \! J* p9 Q//Sleep(10000);
    / a! h& t6 e! U) h* Q  I
    5 I7 I9 @! A4 r2 O& |2 H+ X0 o
    # a. s; S% ^9 _; x1 b7 OTimeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    . X( t$ ]0 i/ l. ]3 dSJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));( T  _: a" p! {2 L1 @1 B$ w
    Priority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));  o5 x; d  G8 j& z- ^" V
    HR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));2 y1 Y! g& }% B2 q9 |( u
    for(i=0; i<initProcessNum ;i++)
    / m1 P! J0 r2 z: l{
    : @, o& B9 d) D8 O8 j% q* VTimeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    " V- {4 X1 Y+ S7 wTimeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));& V1 {* e3 W0 c  @1 ^
    SJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    ( b- _) S9 G& J6 @SJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));  p% q9 c, \+ k1 D- I# l" p
    Priority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));% F5 q# l: i; R6 T, m. q
    Priority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    % l$ _! q: K  L5 s6 iHR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    9 C( i4 O: O. q) z- t6 h' uHR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));/ ~3 {& L: U, X( a
    }+ M6 |" y# T1 J( h% r! l
    Timeturn_mmy.proNum = 0;; d% `1 h1 s% k& K. Q. y: L; w$ d
    TimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);& l5 X  b+ ^4 V6 M- C
    SJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);
    2 O2 U3 C7 D- s" ~) f  S' oPriority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);6 ?/ _+ n+ t5 R$ I+ d( U
    High_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);' K2 |# O5 ~/ ]/ V" h3 e0 _2 Y& b
    //showProcessInf(Timeturn_mmy);
    & D0 v/ ]; u% b$ IFIFO_pri = &FIFO_save_head;" B3 O$ h, `" V7 D' K5 d
    Timet_pri = &Timet_save_head;3 D& `6 |  E0 S! x
    SJF_pri = &SJF_save_head;
    0 X/ r7 X3 l+ C' Y. e5 }. MPriority_pri = &Priority_save_head;/ ~; l5 A3 j4 u) C
        HR_pri = &HR_save_head;
    $ ~7 Z; F! R3 b/ T: V, o% Wsetbkcolor(WHITE);) g( }4 [3 u4 V$ j
    while(1)
    0 |1 N1 y. g7 x9 t+ v' ]8 q{
    4 x& _- B; x8 f7 nif(MouseListening()==1)! w1 c6 \# W. K6 `( U9 f: w
    flagDraw=1;
    : ~3 B8 I2 R8 ~$ qif(count==100)
    8 q  y: t0 a) e" ~6 `{
    ; U$ H' M: w$ |0 c4 p) Sif(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed)4 Z" X1 ]1 y/ ^" w' g. W/ V7 R
    {2 v: G/ Z4 E; _6 ]$ V$ E
    FIFO_pri = &((*FIFO_pri)->next);
    & W( F4 [# Z0 i% g7 O5 m5 ?5 L0 e- k5 |$ X# Y3 @
    //printf("hello");0 k, ~4 O" u% i9 q) g# P5 o( B9 z. O* h
    }3 K1 z. Z0 E. z1 g) i- G5 z4 P
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed)2 U' E" U2 e) E) y3 C/ V3 ~& U, H
    {
    6 h5 K- V1 }& x& P    Timet_pri = &((*Timet_pri)->next);
    + _7 z, m$ R, g' N//printf("hello");
    2 K! q7 {/ W! g' b& Q}
    7 M! |- q5 l9 I5 o& Vif(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)
    & R' L# `, }8 o' v, ~4 {, ~{
    0 {; D: [9 V! kSJF_pri = &((*SJF_pri)->next);3 `% q2 J* d( O+ @
    //printf("hello\n");- t2 R. F2 i& R
    }
    ' \0 [( N2 G, v4 V5 B  i6 [1 ~if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed)
    $ U/ U1 W: p2 Q+ ]5 ~{
    3 V! P* d! [% ^0 uPriority_pri = &((*Priority_pri)->next);
    ( d- R( `+ `; @- B8 s- _1 y6 f//printf("hello\n");4 P! l1 f2 `' M
    }5 m7 ~  h! v! U
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed)
    4 i; o6 X+ f3 B+ P2 h& @3 c2 d: a{
    % s8 v& R$ v# O/ [& {3 ]& H# G) ]HR_pri = &((*HR_pri)->next);# I6 g0 p: b# r4 q
    //printf("hello");
    9 t  {+ T/ V, i3 E) v* F; L}* h" T! k% u: o
    count=0;- ~( D* X/ C  T' a5 R( j
    }; F( m+ U7 ?( Y5 O* Q* C6 s$ M
    else' ?- ?+ B# k4 f, A2 {4 E0 q5 t
    {  N, B( v- A4 Y* ?: A: v) a
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)
    7 f& G2 U# [8 Z- I( Q{7 k) l' @+ T. d
    FIFO_pri = &((*FIFO_pri)->next);
    6 c+ o, u/ G# d* P) A// printf("hello");/ O, n. [( h& |( E; F- G4 M: R0 F
    }: Q& V) ?4 f2 J( w( m* z4 t
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)2 U( ^- p' ^$ G4 M! D
    {, E1 F9 u2 o7 ~* f* S
    Timet_pri = &((*Timet_pri)->next);
    ; B, B* x8 n0 u, y5 c9 j1 v// printf("hello");! o8 B. O5 }3 G# m$ V9 T0 t' q
    }6 Q2 w, S& ]3 H1 I' B+ p
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)
    ; n4 }9 {4 n2 U& g8 J5 x3 [{9 S# N1 R9 E8 g/ h* q+ D' p
       SJF_pri = &((*SJF_pri)->next);
    9 ~+ N# i& s  h/ x9 |// printf("hello\n");
    4 {: z  B  Z, @/ N9 D$ w  L, }, l3 U}
    ! {; P2 G) h, B, F- hif(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed)& [0 l: Q. c! r* }# S/ S  G
    {# v* [. d- j* q( S5 V# \4 \
    Priority_pri = &((*Priority_pri)->next);
    & y& Y5 K6 S4 H//printf("hello\n");
    + A% v/ z) _# d* \) m* ~}' J$ d$ [4 b. _6 g/ m
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed). p8 Q3 Z' ~& r1 q3 |& X; Q1 q5 X( z
    {6 W6 I* X) ]" |0 t6 z5 L$ [( j
    HR_pri = &((*HR_pri)->next);
    ! u7 |% n; [; x9 j//printf("hello");3 C1 a2 t, w" T/ F
    //Sleep(1000);% l# c/ u) f. K& q
    }  W$ M8 T9 ^( h6 x' x5 Y
    count++;- y7 W" W6 T! ?! t7 w2 i5 s0 N. u- n
    }1 v9 t! R, M( t/ _- J4 e+ |
    if(systemClock==showTime)0 j6 j4 q1 W2 f0 `8 f2 [
    {
    9 G# D- J8 Y) }3 i+ {/*PCI * p=FIFO_save_head;
    ) z3 |# Q9 r0 m* T+ |3 R0 \# Dint i=0;
    # t" a) h8 ~$ i0 K& }, |0 I( m4 {for( ;p!=NULL;p=p->next)
      c2 \3 q* ~1 K$ h9 J: `{4 F% {& }3 u' W$ d" b# t- K
    printf("Id %d\n",p->processID);
    2 i, t6 {9 m& ^4 ?. Hprintf("comeingtime %d\n",p->comeingTime);0 r& c; j2 U) b2 g6 r+ ?
    printf("runningtime %d\n",p->runningTime);
    - o, f5 c6 I1 J4 K1 X; u% G# _printf("asdmemory %d\n",p->askMemory);' F' |& }2 _6 Z2 O* [
    printf("completedtime %d\n",p->completedTime);$ J& a4 S' O4 X% z( u- i2 I
    printf("compute %d\n",p->compute);
    ; Q+ z! J$ B7 Q5 hprintf("exchange %d\n",p->exchange);
    % ?2 r& }1 ^  n6 r1 aprintf("waitio %d\n",p->waitio);5 m& t6 z3 Y; c# O
    i++;) J- E1 }3 x( I% J' Q5 B
    2 J+ ^9 E0 I( h" v

    ! H3 x  n* W* e1 b' c5 V7 O}5 b3 ?( V  K3 w' w+ N
    printf("%d\n",i);*/
    ! z- C( u- T9 E+ p8 dif( (fp  = fopen( "data.txt", "a" )) == NULL )" h- n8 n- X( x& j
    {
    - N' J. `4 z* V2 bprintf( "The file 'data.txt' was not opened\n" );
    8 ?% t8 P% A- n( r8 L% }% q//return 1;
    7 k, `6 s5 B# f! I  f3 u% E4 Q}6 `! {/ l* S* u' e
    else  ~+ T: V) z4 \! _  w* C! @
    {. r3 t0 \- S9 y* p. I  ?+ d) @# e
    fprintf(fp,"FCFS \n");
    9 M8 c. Q9 W4 o4 t9 rfor(p=FIFO_save_head;p!=NULL;p=p->next)8 `2 |2 N/ Y6 p8 m! C1 R$ v
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    + E) R! U. _" [+ o0 f0 c( Ip->exchange,p->waitio,p->runningTime);
    1 H9 D) Y% l4 m5 c% P  V% k$ Ffprintf(fp,"\nTime turn \n");
    ( v+ g# V+ Y, j2 jfor(p=Timet_save_head;p!=NULL;p=p->next)0 P# M# Z7 q4 m1 `, P
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,) y. I  |  {1 ]
    p->exchange,p->waitio,p->runningTime);9 k* W4 Q7 I/ U! m% }5 t
    fprintf(fp,"\nShort Job First \n");0 b- e/ q+ k' W" k
    for(p=SJF_save_head;p!=NULL;p=p->next)$ C. `. R, I& Y
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    / r4 l" y! t7 u- N5 y3 hp->exchange,p->waitio,p->runningTime);1 X9 O  x4 b5 w2 q
    fprintf(fp,"\nPriority  \n");
    7 R: u' ~  j& r9 X( |( y/ S7 l4 }+ Tfor(p=Priority_save_head;p!=NULL;p=p->next)
    ( Y5 w2 n' l7 j8 u) h/ g# jfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    5 `$ S; C7 h$ B0 ]. D# wp->exchange,p->waitio,p->runningTime);
    : J4 h( `( M* j# Afprintf(fp,"\nHigh response \n");
    0 V8 t8 P" l+ F) ufor(p=HR_save_head;p!=NULL;p=p->next), S" l( q. r. y! W
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,) m3 ?) l: S; j0 ^, s
    p->exchange,p->waitio,p->runningTime);# w1 b8 f) [# C5 y4 \' ?
    fclose(fp);
    9 I( R, d: y7 i. s}7 s; w5 w# G+ ^" g6 _! m
    showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);$ V, X- N# X) @
    MouseListening2(&flagDraw,&showTime);# f& _# F" U1 @" p
    }
    5 v: a7 B) ]4 U  u( ]: H* g. gsystemClock++;" U$ ?' W; Y) b1 m, W
    if(flagDraw==0)7 P" R+ F" C0 R" x8 V3 B) Z) w% X
      Sleep(10);' o2 m: {3 C5 z
    }# i; }) G$ X' e+ t; I+ U
    $ t0 z2 [4 \) F# i/ k

    ' O5 D! z% |) w& T( s& }1 Z}( g4 i% r1 n9 G7 a
    int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR)
    - b0 s! K9 }! h5 ~# R{$ l% m$ {# S& C& p; M
    PCI * p=NULL,* name[5];
    ( x& ]. k% [6 A8 i; q; B. dint count=0,i=0;- x3 U$ @. G! d3 Q9 R- B
    char ch[5][10]={"FCFS","timet","SJF","PR","HR"};! ^7 N% j6 B5 F2 Z7 L  y# _9 B& n
    double turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};
    ; X& g5 Y7 R8 F7 y$ _* G6 kstruct info" h$ Z9 N9 j% [, ~9 ?
    {
    ( g/ |* `& w4 O1 b2 O' N: Xchar name[10];2 _! |9 ]) v! u+ ]+ G$ N; H$ R' _
    double throughput,turnover,wait,CPU_rate;
    2 U0 V& k% [8 c$ R' H( {}inf[5];
    ( w; C& \+ j' \6 F. gname[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;3 K/ M8 b1 D- A1 c3 o
    printf("调度算法..........A\n");
    1 A2 ~3 p0 z; E& c; }, U1 Yprintf("吞吐量............B\n");
    8 P. q" h3 ]2 Qprintf("平均周转时间......C\n");
    % X1 q& u' Z$ T  Pprintf("等待时间..........D\n");0 g1 _5 @% }" T6 ?: h5 e
    printf("CPU利用率.........E\n");# c) n$ {  y9 F' Q
    printf("A\tB\tC\t\tD\t\tE\n");
    , R8 E8 D% F8 }* i/ W  tfor(i=0;i<5;i++)* [" t% v' d0 J, e5 M) b
    {8 W  k# [% d' D7 v3 f
    count=0,turnover=0,wait=0,c=0,w=0,change=0;
    4 _) \" c8 E$ o  X4 }* dfor(p=name; p!=NULL; p=p->next)
    0 b' a1 d5 \: W2 C! p) E. N2 @' P  s/ C{
    2 s1 B  P( A  l, @( f) ocount++;* p5 o+ O7 b( }3 _0 N1 i0 p/ ^
    turnover += p->completedTime - p->comeingTime;5 c1 b2 j: L+ h" ~9 \
    wait += p->runningTime - p->comeingTime;
    9 X- x5 p9 C+ s; H  {2 ]c += p->compute;3 Y- t' u# J$ u& S+ X8 t4 b* x
    w += p->waitio;
    1 o5 R8 N" B9 \; t2 n) Xchange += p->exchange;
    & G0 `" o; S7 A0 f7 Q6 C}
    " [6 q- d1 `; lturnover = turnover/count;
    # x0 _) Z5 E0 `0 I0 A# V8 Lprintf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));
    " N  z6 C3 U  U5 e) ~0 J; |7 Z8 jstrcpy(inf.name,ch);, U) m/ t& s$ \/ c6 Q% O4 c
    inf.throughput=count;7 u: i1 Y- |. n2 t: N/ b
    inf.turnover=turnover;1 \" D- R$ h$ T; F. I
    inf.wait=wait;
    6 E- q6 s, O* B# ]& pinf.CPU_rate=c/(c+w+change);: k+ Q) A" b0 f, J3 i1 u" G
    }
    9 {# Z9 q+ Q/ ^  k" @//画图
    8 V, \9 r1 M; n) w4 |- g; g( `//cleardevice();
    1 L& ~! c* l" d1 s- x9 ]line(0,600,1200,600);4 f9 f* V5 }; `) _& q. ?
    line(10,600,10,200);7 {# ^, c* o5 s/ Z0 N% v
    line(10,200,5,205);
    6 e) e! J: t3 j3 ]7 i5 pline(10,200,15,205);( O9 o( R1 d* c2 a5 E9 O, p/ V( ?
    line(310,600,310,200);
    4 D% d. K$ q) O9 s4 w+ Gline(310,200,305,205);
    4 \' D* e) g- o; |1 Hline(310,200,315,205);
    , f6 x+ I" ~. S% |9 j  S& \( R) kline(610,600,610,200);
    ! M) }/ Z% A2 f& cline(610,200,605,205);. p4 s( E2 N  q
    line(610,200,615,205);- M  g% |8 @0 w' t4 j  g* Q2 r5 q
    line(910,600,910,200);
    # ]/ B3 \7 i, F, C% g0 eline(910,200,905,205);3 l% E% ^9 m9 A9 V0 X. O
    line(910,200,915,205);//最高的长度400,宽度均为40
    - @3 Z" x5 k1 Hfor(i=0;i<5;i++)* r  `! c6 a9 w
    {, M: c/ T/ A; |8 x& w
    if(inf.throughput>pos[0])+ j' [3 ]& _; L6 U7 {
    pos[0]=inf.throughput;8 p% N, |1 A. Y2 s0 y1 }
    if(inf.turnover>pos[1])3 h; x5 ^  B& D$ L6 F" D
    pos[1]=inf.turnover;4 K- K+ ?: |# l8 X5 i7 ~7 s$ E, K
    if(inf.wait>pos[2])  k3 r$ h7 n6 Y- ?+ o1 v$ L
    pos[2]=inf.wait;. _  g2 w6 m! x0 O
    if(inf.CPU_rate>pos[3])
      X: l. d# _' z: u+ spos[3]=inf.CPU_rate;' ~! u5 i! p& u1 c" x' v
    }* Y9 B* F0 O7 v# o+ l
    settextstyle(30, 15, _T("楷体"));5 j  n! g- A* p6 d
    for(i=0;i<5;i++)+ M2 f* X* L# I9 E' w6 @6 o
    {- Z$ z7 a$ `; {/ |
    switch (i)% k7 _* ~% j% f* r4 D
    {
    1 e" t5 B7 C8 _3 i& |, xcase 0:
    , S0 _1 K. d6 H% o+ N8 I8 U9 {setfillcolor(BLUE);1 ]- Y' A! E( p
    fillrectangle(100,50,150,100);
    $ E3 j( }% G# F. i; souttextxy(160,50,"FCFS");2 V. V( j6 j/ z! h: K5 Q
    break;
    7 p' u6 ?- B7 \/ ^( w  C# S' dcase 1:5 @+ W5 t) b) e" g
    setfillcolor(RED);" Q0 v- {5 o8 g& b; r' Y
    fillrectangle(250,50,300,100);
    - B. {, G) C  ^outtextxy(310,50,"timeTurn");- w! H/ r5 c4 q
    break;  \1 r, y4 ~) T' O7 p0 g
    case 2:% R7 l& v5 L3 X3 q; i
    setfillcolor(YELLOW);
    , d9 H# Z( _- F% H8 r4 Hfillrectangle(450,50,500,100);
    & Q# _$ s* o; ?outtextxy(510,50,"SJf");% `  H4 Q2 H; _6 {, O
    break;
    . [+ H" G6 ^7 ]9 ]case 3:
    0 u( W4 D( b0 Y% G8 C: H9 i0 J4 xsetfillcolor(BROWN);
    7 L5 F, J( Q1 g4 K3 \6 }+ Efillrectangle(580,50,630,100);
    & R5 B9 U  B# X; o2 k& Y" e" v! |outtextxy(640,50,"PR");
    1 N. G1 `5 z2 u& Ybreak;( V* J; [8 }  V% C6 W# R* u: h
    case 4:0 z! U) u  ^8 o7 d
    setfillcolor(GREEN);$ T1 C4 E" t$ ^0 @& A
    fillrectangle(690,50,740,100);7 e3 t9 u5 n& I' E7 h
    outtextxy(750,50,"HR");4 c/ Z0 l+ h$ a- l9 \! h. w0 N
    break;
    ( F; Y5 x! d% S, ]" u}
    " B# Z! }$ U' w5 w! w6 Vfillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);
    : m/ n' f7 F0 W; i. F; U5 ]fillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);+ N) u# `) r+ \* @5 V" o/ Y8 o
    fillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);) R8 F: f( E5 @$ d
    fillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);
    1 k2 A* N- P2 {% W
    9 j; K* o4 m) f( F9 F# G, n
    . M0 G8 ?5 g  a' I}8 k/ y) b" e' t; A, e
        outtextxy(100,150,"吞吐量");
    ) E% A8 ^) M7 p8 routtextxy(350,150,"平均周转时间");5 G8 _3 z- t4 N
    outtextxy(650,150,"平均等待时间");6 l$ a1 Q% ^9 a! X
    outtextxy(950,150,"CPU利用率");" V$ p  i: ?/ v* Q+ x
    return 0;0 v+ H7 i- s- c1 I7 e
    }
    ! G3 R' H0 W$ j# ]# F+ v- Kint MouseListening()
      C( d! c, I9 P+ {5 E, T4 Q$ ?{
    & j; x, i; v$ O& k" d) N- rMOUSEMSG p;$ E# J3 \, ]8 ^1 h6 \. L3 y9 c
    if(MouseHit())4 p! ]) ~$ M" S7 {" ^$ X
    {
    1 y$ b" o) v: q! B% }p=GetMouseMsg();' x0 l" i7 a5 u7 g1 o: ~
    if(p.mkLButton==true), ^* u0 d3 E9 P, P" I" j! M
    {
    ! A0 I7 M- s% G4 J& ]" nif(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)+ l. x/ Y* \  [, v
    FLAG_FIFO = 1;" e. r0 e4 N5 s2 E6 G) Z* B
    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)
    6 B6 c. b: }* ~. z) n( DFLAG_TT = 1;; ?1 L! ^8 ?8 p% d
    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)7 w" m( n& F; n7 }1 }5 |* i  y
    FLAG_PF = 1;
    7 b0 z& _. g! s& h+ _+ E  |* T- welse if(p.x>0 && p.y>325 && p.x<400 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)7 |$ c# i$ D/ I, j: b
    FLAG_SJF = 1;
    & v' V4 H2 i/ Q6 A" b  z$ u: P6 Nelse if(p.x>400 && p.y>325 && p.x<800 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    3 h7 a5 n- F+ P5 H9 w! MFLAG_HR=1;
    . {: M: a- P# b( Aelse if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)
    $ t+ O+ E  l+ a- `( `; s5 ~" D4 p- A{: `" X3 z6 A$ t' C2 V
    FLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;
    4 {( c/ S2 i; d4 W, ^3 a( Wclearrectangle(800,325,1200,650);, [  B" ]& Z! {1 Z1 |' Z
    }
    7 F% A" G  ^3 Selse if((FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0 && p.x>890 && p.y>455 && p.x<1110 && p.y<510 )
    ; T+ [" Y$ u- ?( S4 l5 F5 q{
    ! A$ m3 g* w& x% I- x4 J( o7 zFLAG_show=0;" \+ G6 t, a' z9 @
    cleardevice();4 I$ \' Z7 @* d2 t
    return 1;
      @5 T: Q- }7 x& B9 Z}" p  o7 C3 Q8 B- T2 K
    }# K" B1 z7 c. ~0 `/ E" N% K
    }9 H# B7 h6 J& {3 m
    return 0;
    6 y1 X) S* g( G9 r. O0 t9 A}6 X7 h- m0 G7 B
    int MouseListening2(int *flagShow,int * showTime)+ m0 m. F+ W- P4 y% A- U! d. n! \
    {
    3 u2 O9 D1 q2 i9 }- G& [, a3 aMOUSEMSG p;
    : V7 B% S: ^! y5 i* w- w+ ?rectangle(1150,0,1200,50);4 x" H$ x; Y5 P, q
    outtextxy(1160,10,"X");
    ! z* q0 [# e% i( p  hwhile(1)
    8 Q+ ?- u2 [  w3 P, X3 \{
    1 Z4 ]+ t' y+ U  X- l, t0 Dif(MouseHit()), A9 ~# k/ q& O  `5 m: a
    {0 u# z7 D& d8 x! B5 I% u
    p=GetMouseMsg();+ K! ?8 r$ Z2 t
    if(p.mkLButton==true)
    % T( h1 u# h/ |. J! A' L4 u{9 |: |% g. H3 Q8 H6 Q
    if(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 ); v! f+ d2 x& C" e2 }/ [
    {
    * K4 u4 H+ h* E: B3 z  p(*flagShow) = 0;, r- F. [) U. q: W0 o
    (*showTime) += (*showTime);
    9 y5 C7 Y: T2 r0 m) d; EFLAG_show=1;
    $ t  b2 D! q* I) T: x2 T* b0 ubreak;7 g6 M, Y& w" [! d  b, |
    }0 D- ]# K' ^5 m

    & H* x3 q2 C1 m- R6 }. d! M}
    9 E+ I( Z; P0 r1 c$ _}
    4 ^0 n8 }( `" g+ H/ c, hSleep(20);
    5 _4 Z- x5 v" ]9 @+ E/ Z7 b( @, y" ?}" \0 [  c* H/ d; ?
    cleardevice();
    / H( |, `( X1 U1 V: Rreturn 0;( f9 H& t  b6 G
    }
    + w* G, w+ Z- i9 w7 Y% ]: xint drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha), I3 i: W' b' n# M; \) e3 \9 Q; R( o
    {
    ) b9 y3 ^& r8 d! fstatic int info[11][3],num=0;
    1 b1 v/ ^& Y* |! s; uint i=0,j=0,pos[10][3][2];- N) L" S( p8 N2 B! O
    float temp,t;
    ' ?! g+ g( y# y/ c: ^2 v" P4 v//画按钮,不属于FIFO图的范围: ]0 V1 a4 q$ u! Q! E
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)3 k# p9 E1 t* s
    {
    & N8 a- ?6 `+ Z2 o! a0 V  jsettextstyle(30, 15, _T("楷体"));
    / ^1 u; S$ R% N' p' q) o& a4 }% x9 zrectangle(890,455,1110,510);/ }' P4 ?3 L2 o! O# j
    rectangle(900,465,1100,500);. y2 W9 O2 ?# M* m% y& {
    outtextxy(910,468,"查看运行结果");
    , O  C" v  \* c5 z5 T) H( f; M}" _# ^5 K! W" G  ^3 t, \8 ^
    //结束画按钮
    + I) v& a: Y& A2 Z! ainfo[num][0] = com;
    - X. M! v) F! o$ s1 k6 w) v( B" \info[num][1] = wai;7 q. s/ R! l; u& g. K0 |
    info[num++][2] = cha;
    , v7 f# E- a6 k8 Q  Xif(num>10)  //存储10个点
    9 z7 Q; T/ k* M1 r{
    - j/ ]" a' j4 n& cfor(i=0 ;i<10;i++)- }( D7 Q+ x' Y! n4 V# z! e
    {
    - k1 a: Y; C+ e+ l( l" \info[0] = info[i+1][0];
    8 K! k1 w+ F4 F% Ginfo[1] = info[i+1][1];  V* R: ^2 o1 c6 z3 ~& B
    info[2] = info[i+1][2];
    / |) x2 E' L6 N3 X  Q}& I  k( e; n- u6 r, e2 W- h4 y/ K3 x
    num--;
    % S( t* Q1 [& y3 w}: q, e5 ?/ v& p$ }) Y6 D" f
    if(FLAG_show==0)% ^0 W/ z9 W/ p+ b
    return 0;3 K1 e; [& m4 t, R& _6 s
    for(i=0; i<num; i++)
    5 v3 N3 V1 M7 z$ p, a) D. s# U: h{; N/ j5 O( p) h/ ?2 c) k& e: b& P+ m
    t = (float)info[0];- `6 X+ d9 C" L1 S* o) C6 Z
    temp = (t/101)*90;) a, R( g* u1 c7 T1 F
    pos[0][0] = (10-num+i)*25+x+100;% i2 H  o- r" A# l
    pos[0][1] = y+110-(int)temp;5 A$ R! y! P+ r+ W1 b! \
    t = (float)info[1];
    " m: d( }+ m. g" g+ }8 v( Ntemp = (t/101)*90;
    $ H! Y8 }% s" j3 jpos[1][0] = (10-num+i)*25+x+100;
    / r8 Y7 E2 v& r5 F/ ipos[1][1] = y+210-(int)temp;$ C4 _0 z  G+ t2 u# _" Q
    t = (float)info[2];* }. L# K' c' q7 c/ F( u
    temp = (t/101)*90;  d% `& t- r1 L6 L, u. ~7 o
    pos[2][0] = (10-num+i)*25+x+100;
    * O' J3 f) y! u% vpos[2][1] = y+310-(int)temp;
    3 R# I' b+ r) c6 c4 M% {$ \2 j}
    9 d- y/ G; ^( Y! _if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
      u+ t$ P8 p6 L3 K5 G( V- u{
    1 j+ @9 c% D' i3 d% ?clearrectangle(x,y,x+400,y+315);- I9 T' v1 O+ W1 l
    settextstyle(20, 10, _T("楷体"));2 W6 \3 F3 G* X! U: l# s5 S0 D
    rectangle(x,y,x+400,y+325);
    / D6 |5 q3 h, t5 a' ?3 \) Routtextxy(x+40,y+10,"CPU");       //画柱状图
    3 ?* Q8 D0 R/ o* Houttextxy(x+45,y+10+100,"IO");
    ! q. c* M" d+ t1 ?$ qouttextxy(x+40-15,y+10+200,"change");
    - I. v$ }1 }6 r, \2 Zrectangle(x+35,y+30,x+75,y+110);
    # ?) h3 \6 T5 j1 a4 j2 U$ f2 o0 e: Yrectangle(x+35,y+130,x+75,y+210);
    $ B" m: L% ^7 brectangle(x+35,y+230,x+75,y+310);7 h+ d4 X5 ^4 L1 q; j. H- Q
    outtextxy(x+180,y+310,"FCFS");4 Q& a2 f" K0 o4 f. h
    t = (float)com;
      {1 r. W& r0 x% Stemp=(t/101)*80;% S& f) z1 `3 W, s! E8 u2 w0 P
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    " v7 v4 o: {& D9 W$ d; gt = (float)wai;
    7 R8 M! j. Z' e% U) atemp=(t/101)*80;# K& a* |6 `, `) Y/ v8 B
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    + Y& z% }) ~: T6 W2 bt = (float)cha;
    3 j" R1 ]; {: t6 T( B) _  ^; a4 Htemp=(t/101)*80;
    7 F7 V& F/ V+ u! Mfillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    " u0 Z. z5 R( tfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    3 s2 G* z3 r; ?3 f: b{
    . H% h% @5 s( Y# k9 m2 ?line(x+100,y+110+100*i,x+350,y+110+100*i);: h( w4 C0 \) h2 N3 D; D5 h" H" B8 P8 o
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);7 l+ [# ?' A. p4 @: f/ p+ Y
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    / G# N8 J8 u' O1 E# D# Z
      A$ }% E- d) Z$ W8 Mline(x+100,y+110+100*i,x+100,y+20+100*i);: b& O0 h( u6 x, d* B
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);) l+ i2 q' ]2 z9 t; v
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    & a3 b  T8 n1 dfor(j=0;j<num-1;j++)
    + N. @5 n2 b8 u% j  s5 V, E{) y: ?" j( M- B* c. \; K2 l
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);2 s8 O% u8 N3 h: e, Z( B
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);! V- h5 H. |( y4 J0 o  B
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    9 Q! K# g1 n$ W) y}
    5 R) p! i* i# W9 M/ N+ H5 {}- i' s: f1 P" f) C
    }$ ~7 K$ r7 f- a: V; m6 e. b
    else if(FLAG_FIFO==1)3 T8 @4 S6 Y( `( d
    {
    3 z! F. s' N$ H6 c1 [x=0,y=0;
    : o+ w5 @, O( W2 `3 O. _5 A! m' B+ Zfor(i=0; i<num; i++)4 v* i+ f1 z, n2 p7 H5 E6 T
    {& z$ [) A* h( m, Y- d1 R# |' Q
    t = (float)info[0];
    $ g2 |3 u# g  J% K% H. a" W% }temp = (t/101)*180;
    ) H: v1 A. Y! ^: N7 Vpos[0][0] = (10-num+i)*50+x+650;
    0 z" M( a& `. r' G: |pos[0][1] = y+210-(int)temp;; X' a" j. {5 l6 D5 r$ |
    t = (float)info[1];
    # v  |" ~$ H9 l) y& p7 N3 ]3 Z  htemp = (t/101)*180;
    5 D7 w6 l8 p( [" M6 y, a7 p& L, Apos[1][0] = (10-num+i)*50+x+650;) l0 X5 v5 t3 A- K' w9 _
    pos[1][1] = y+420-(int)temp;. A2 S& U$ f3 q4 ~+ N2 A9 N
    t = (float)info[2];
    - S3 B3 ~5 ~! O' F7 ftemp = (float)(t/101)*180;
    # M. N  ?$ i5 R, a7 spos[2][0] = (10-num+i)*50+x+650;
    2 Q  g. X. Z7 \- B5 ~8 ~5 |* dpos[2][1] = y+630-(int)temp;
    5 X+ I2 @2 ]" n6 o5 |1 x4 E}
    7 w4 Q7 W* \0 |0 V* ?: m' `clearrectangle(x,y,x+1200,y+650);. [& z: x# c( z3 z5 H8 X. {7 N
    settextstyle(40, 20, _T("楷体"));
    9 I8 I1 g1 w. U: @! t1 b( a$ U6 ?: X5 {outtextxy(x+50,y+50,"FCFS");
    1 R. B6 X) h( Z3 y. G# }outtextxy(x+280,y+20,"CPU");       //画柱状图
    # Y9 b+ m5 Q. j: c8 J7 vouttextxy(x+285,y+20+200,"IO");
    , {- U& h# N7 X4 pouttextxy(x+250,y+20+400,"change");8 h) d) }: M9 [) O# a0 S
    rectangle(x+270,y+65,x+330,y+215);
    . D7 U' b- w" `0 i: Erectangle(x+270,y+265,x+330,y+415);$ R: N+ `! G! J2 }8 G% L
    rectangle(x+270,y+465,x+330,y+615);
    / J: b( j% j+ Zouttextxy(x+290,y+620,"TT");. {% N! b4 U# `% E
    t = (float)com;3 t  V0 m; F9 ~% b1 W
    temp=(t/101)*150;" W' b" W. n% p' C
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);0 n# l2 f' i& u9 m2 p9 N
    t = (float)wai;7 \* m) q5 Q! {" G  C& G" ?5 d
    temp=(t/101)*150;% F' @8 [) A+ f* ]: f
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);9 F. h3 `% h2 E; A
    t = (float)cha;& v" ~9 _& v, y+ \
    temp=(t/101)*150;
    5 T. `7 Y4 r3 S! C& Rfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    6 u6 T" O, w2 H% I: z, \7 {for(i=0; i<3; i++)   //画坐标   high=90,length=250( @( y) m- J! d
    {
    . P* K) q! T) K. a7 G# W& ^/ Eline(x+650,y+210+210*i,x+1150,y+210+210*i);) K* e2 Q1 l& Q" k& `9 m
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    ) W% N7 D# d" kline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    9 B1 `" q2 D2 q& ]7 H5 Y
    # ^- C6 l$ ?& R# L/ I8 ]! p# O; r' d% xline(x+650,y+210+210*i,x+650,y+20+210*i);
    9 K/ `3 S8 B! a3 _) @$ l: X; w! eline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    3 C" L7 n1 C  @) c, V8 e* eline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);8 T- {4 i' f& a* O1 T7 j  L
    for(j=0;j<num-1;j++)  Q/ w- _; v0 O: @4 s
    {5 _/ {" N2 P8 z% G& x: Z  t
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);  B6 h6 W% p$ a( q3 n& K+ C
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);" I  ]; L& r+ u9 \9 r  l( k  V
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ; u% [& V8 x  U
    }
    9 n% T4 b- J2 Y# ?% U: C+ C}
    9 o; N9 O- @, m% c# j}
    # J/ A9 v! ?& j
    " m: J0 ?; J/ D+ d$ [7 ~0 ^( \( q
    return 0;
    % L3 x+ N$ _# D/ g$ S' r}
    ( x. {; d) F0 Rint drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)7 ^$ o$ \/ h; z6 h9 v
    {+ V# q& H% S9 |# P( s9 R
    static int info[11][3],num=0;+ y( G: t8 o5 t4 [, F
    int i=0,j=0,pos[10][3][2];2 r- S! H, ]; |) b; m: K; O
    float temp,t;
    ' J" v5 U* g: f" w: g7 x, _info[num][0] = com;5 U2 s4 W+ s7 Q0 ]" ]
    info[num][1] = wai;
    ! ]1 V& m, q" I& x/ Ginfo[num++][2] = cha;3 s, [2 H, n& F1 t/ O* B
    if(num>10)  //存储10个点9 d2 d! V0 k# `6 F2 T. ^
    {
    $ e0 n6 {: u+ Q; i. `- _$ M7 sfor(i=0 ;i<10;i++)
      D/ o6 R9 W+ _5 c4 z{* z8 i9 x& u5 o7 z( p) i; m2 `
    info[0] = info[i+1][0];
    : u- ]* B9 b; S: r4 B5 }6 Uinfo[1] = info[i+1][1];! Y  P2 h* \' P$ S5 F/ g
    info[2] = info[i+1][2];
    . H' V/ W: J* `9 C9 \3 _) k}
    " d. D7 E' t! k2 l$ x, xnum--;3 R( r6 i* k9 b; f
    }
    2 c  a0 L1 G* K; w% t! i7 ~if(FLAG_show==0). q1 H7 S6 N1 ~  S) r0 E+ v8 O+ R
    return 0;
    8 s* I# @# I6 B& h( \4 U+ `: \1 F+ }for(i=0; i<num; i++)/ z0 M! g- o! f- u- Z
    {/ t- _. h! x& t2 i8 g
    t = (float)info[0];
    3 I5 A4 r/ N+ f* s( ]* {% otemp = (t/101)*90;% P* D! a- J3 m) D! U+ D$ A1 _
    pos[0][0] = (10-num+i)*25+x+100;/ j7 k( t2 m8 W( c* P5 j
    pos[0][1] = y+110-(int)temp;
    7 Y& r6 S& I5 t* xt = (float)info[1];/ d- x8 h0 V4 N/ R5 B- U
    temp = (t/101)*90;- O; u/ E0 y$ |, E
    pos[1][0] = (10-num+i)*25+x+100;4 ^9 R' \: }' |( k6 ?9 T
    pos[1][1] = y+210-(int)temp;$ t# U4 o8 J7 `" g: H/ M
    t = (float)info[2];% T% R# @. w9 e- S' ^6 K5 X3 r
    temp = (float)(t/101)*90;- @4 b; D* p5 r9 y' p/ T
    pos[2][0] = (10-num+i)*25+x+100;! [$ z3 B# b2 h3 q# D: [
    pos[2][1] = y+310-(int)temp;
    ) J9 P* q2 p  m- W% ^( R4 Z}
    : t* ~) i' L! N; w* `$ [& i* @- Mif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)# I* B- g6 x0 d5 S# e8 j* Z" M
    {
    5 D' [& L% R, ~: v. J9 ?. V. {clearrectangle(x,y,x+400,y+315);
    / H+ I3 Y0 ~) k4 k$ l4 Hsettextstyle(20, 10, _T("楷体"));
    * a0 I) s5 a& @7 Z( N) Lrectangle(x,y,x+400,y+325);, ?# g9 ~9 j' Y( ~- S
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    % t, i% Q) `5 K' Houttextxy(x+45,y+10+100,"IO");5 B8 |2 {* @/ x- V# j
    outtextxy(x+40-15,y+10+200,"change");# w7 j7 O) C6 r4 ^2 J7 L0 p3 h* c
    rectangle(x+35,y+30,x+75,y+110);( z* {4 T- `( d5 q+ F
    rectangle(x+35,y+130,x+75,y+210);
      U( D5 v5 N( y5 w8 wrectangle(x+35,y+230,x+75,y+310);4 g; L+ J0 v& p0 A. g
    outtextxy(x+180,y+310,"HR");
    6 Z# n+ _( o; G7 wt = (float)com;
    * x7 @. @2 r$ Etemp=(t/101)*80;
    0 s, ]* t" g, ^$ q/ H3 }/ {fillrectangle(x+35,y+110-(int)temp,x+75,y+110);: q# z) b4 R; a9 j+ B; Z
    t = (float)wai;4 w# j8 [$ P% ]7 a
    temp=(t/101)*80;' W8 n5 U$ q9 `
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);' B% w/ @& @( K( H
    t = (float)cha;
    ' q% Z  u  g3 b/ [) F% Ktemp=(t/101)*80;0 U& F8 ^5 l" O5 u
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    ( E9 v' q9 ~' _/ `/ g5 l. Zfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    ! l' ]4 s0 t# }{
    4 m& d7 y$ A, v! R7 Tline(x+100,y+110+100*i,x+350,y+110+100*i);" v/ h0 o3 o. v3 e' g% w& }
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);* \# P! p6 l  N; }8 J
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);* m0 ~3 Z" }0 J4 N
    5 u' A6 K8 L$ x/ o
    line(x+100,y+110+100*i,x+100,y+20+100*i);! C- q, M0 t  y
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    6 U9 g+ d$ d+ C; D; A. Jline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);  n3 c" }1 O; R4 A. {
    for(j=0;j<num-1;j++)
    2 t$ h( j, ^4 w0 i$ O8 @+ X{
    3 B* I1 l" M; Aline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    , L+ L$ c& f" M' \5 r% z3 `line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    " H# l. _( g2 G- aline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); : E5 m; |: L/ r- ?2 y
    }
    $ l# D8 ^3 n" v4 r" H5 V" p6 h4 M  ]}" u( X$ ?0 F" b- L7 D6 I
    }
    : B- `6 b4 ^' d2 O  zelse if(FLAG_HR==1)/ z/ F  a( G/ T: t4 I/ ?. t% L
    {
    " T' C+ k+ E2 C5 K: h2 U+ @x=0,y=0;1 l. n7 a6 J$ k  m# Q
    for(i=0; i<num; i++): F1 z+ i6 C, t. v8 C
    {
    ; n+ g# F* e8 X9 {) I) e( ^t = (float)info[0];
    + A; h" O( {- q1 \temp = (t/101)*180;
    ( F- A6 L9 ?+ M4 ^& O, |* j/ C3 y( \pos[0][0] = (10-num+i)*50+x+650;
    5 S2 O3 }* v$ Jpos[0][1] = y+210-(int)temp;$ L5 r  j! e6 ]. H6 g/ m% z! [5 ~
    t = (float)info[1];3 b* h0 D" G: N5 B1 S% A7 g' a
    temp = (t/101)*180;
    - ]5 z9 a3 D- p6 Mpos[1][0] = (10-num+i)*50+x+650;
    6 a6 H8 [- |6 Z% r2 Bpos[1][1] = y+420-(int)temp;0 p) Y5 L, |/ @6 g
    t = (float)info[2];
    + M4 T, Y7 _( jtemp = (float)(t/101)*180;7 C; s7 y# Y. l8 t+ ?
    pos[2][0] = (10-num+i)*50+x+650;- d) n8 {4 g3 u
    pos[2][1] = y+630-(int)temp;) B, I3 s% r1 c1 W
    }0 u& x9 @+ M% [- H1 m, h$ o
    clearrectangle(x,y,x+1200,y+650);
    + S! V, C" b2 A, z9 q' K! |4 msettextstyle(40, 20, _T("楷体"));
    ( \6 W; k0 l: U& @$ W" youttextxy(x+50,y+50,"HR");, Y* {; X1 v2 g- Y* k- {
    outtextxy(x+280,y+20,"CPU");       //画柱状图" |, K0 `7 |, q
    outtextxy(x+285,y+20+200,"IO");  ^7 F9 e9 T( ~
    outtextxy(x+250,y+20+400,"change");
    6 @- Z  V7 `- E/ Srectangle(x+270,y+65,x+330,y+215);- k$ C1 i$ c  q+ t
    rectangle(x+270,y+265,x+330,y+415);
    ; G$ h# n& x3 D7 Y# W+ Mrectangle(x+270,y+465,x+330,y+615);
    . `7 f9 R4 B7 O# X. `8 douttextxy(x+290,y+620,"TT");1 v, O; b3 z4 m2 d7 G4 K$ a  X- q
    t = (float)com;' A! D* j  Z5 D% Z* W
    temp=(t/101)*150;
    - v6 E: B' i! Xfillrectangle(x+270,y+215-(int)temp,x+330,y+215);/ r* [2 T! h+ y$ h5 [2 N( `+ @
    t = (float)wai;
    4 x; N8 h% e7 s  B; Q9 ntemp=(t/101)*150;0 ]8 w6 A: R: p- M5 O  V4 [
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);$ }. U' d3 G* g
    t = (float)cha;) H" y9 v* L: b" }6 J3 t+ I
    temp=(t/101)*150;
    9 \9 [% I6 j7 K3 d- `fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    5 q! G+ q: j; Y- B9 H; _5 `9 Pfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    ) J$ ~  {1 Y5 p2 _. ~& _* z3 B9 X0 {{/ L) j4 m+ F, Y$ T) _' s  s
    line(x+650,y+210+210*i,x+1150,y+210+210*i);
    1 E) z' P0 z; [2 [$ S8 ]line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    * j( c0 o+ ^- b% I0 M# W( Hline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    ( C& h5 G# F- s" u/ p% H% |( _* L4 m! x  V( [
    line(x+650,y+210+210*i,x+650,y+20+210*i);; g) b: o- c- P& E' M$ s; Z- b. x* O
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    ; D0 E; U! X( h1 m6 s1 F1 Eline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);/ @4 P6 x- [9 {# r
    for(j=0;j<num-1;j++)7 T; K; ^' R- `4 \( P
    {
    ! {& m: P' h1 Z4 p' U; mline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);6 m- }7 q7 i0 v% ]) z4 }
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);' G+ |0 c9 S. o1 q
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); + p, E3 Z* F* o' o$ R
    }
    ! X: \. z. ~7 d( \! d}7 P/ F+ Q/ c- D; x( _0 y5 o8 c
    }, R) p* Z& D, M6 n9 H
    . }- Z% p1 n) q$ p. X; P' _

    ( f) T. c8 w1 p: h$ Y0 creturn 0;
    3 R4 x- u$ L+ G; d7 Y}
    5 Y' K2 D  L( e( o7 _- jint drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)
    7 c8 F7 X: T- o" g' x3 `' ~{
    - Z7 g$ ^% |: E5 F. x/ u9 _static int info[11][3],num=0;$ o& ^, |$ g8 p8 W
    int i=0,j=0,pos[10][3][2];, J0 j8 v/ z* F* P' L
    float temp,t;
    + q: A5 t4 \: h" v4 B7 {info[num][0] = com;
    ' m( r& u" |4 M7 ]' m4 x6 Winfo[num][1] = wai;6 }3 t) s2 Z! J/ S
    info[num++][2] = cha;
    9 D. e& V0 z( [( {4 hif(num>10)  //存储10个点4 W3 ]  \/ M, b5 ?* J6 p
    {8 I( C4 q1 B3 d1 j( f9 @3 s5 Y
    for(i=0 ;i<10;i++)
    0 X. d+ J6 N0 ]( X{
    + C: t8 O& G' R' }% Ginfo[0] = info[i+1][0];% ^9 V9 o& w1 B1 k& C2 i
    info[1] = info[i+1][1];
    6 I' e* g( x  n) q% e4 oinfo[2] = info[i+1][2];% G: c2 {2 d+ s! f6 k8 }; t+ w
    }
    6 V: T! Y# w2 t  Fnum--;
    9 N3 }$ P2 q( u2 G! |}! D' F" n2 f2 [& x$ n# u
    if(FLAG_show==0)% ?* ]9 K: n; U7 E4 E
    return 0;" h6 d, {6 F/ R
    for(i=0; i<num; i++)
    6 W6 p( l+ f0 b7 l{( Z# \; w# S+ m6 Q6 p. B
    t = (float)info[0];4 w/ ?, C" d* y+ J9 L: k( c7 o6 b
    temp = (t/101)*90;
    & B; S5 {+ p1 q8 r9 v/ G' J- @pos[0][0] = (10-num+i)*25+x+100;0 }+ B" n( T# b6 E7 x4 A2 ^0 b
    pos[0][1] = y+110-(int)temp;
    % o: Z/ ]. p3 v2 f' C6 at = (float)info[1];
    ! R+ F" T. j( u2 Z# stemp = (t/101)*90;/ J/ {4 e6 R8 O" a! L& D; E
    pos[1][0] = (10-num+i)*25+x+100;
    6 p' h( k' R0 Y' X1 \pos[1][1] = y+210-(int)temp;
    ! g) T2 \# z/ o1 m. {, x$ f) l) Pt = (float)info[2];8 e5 J/ |7 U) N& [. S4 C, f
    temp = (float)(t/101)*90;$ G- R; x2 [  f5 e
    pos[2][0] = (10-num+i)*25+x+100;
    , J8 d( X- u6 Y6 c( v" Lpos[2][1] = y+310-(int)temp;
    1 J+ Z' ^8 L# [) i) k: P8 u1 V  z}% z1 J+ q, Y4 K8 w5 C
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)9 w1 I$ F) S4 _4 O
    {
    * d( h; u  b  Cclearrectangle(x,y,x+400,y+315);3 N6 e! b6 M: L$ A$ ^5 p  l# N& u
    settextstyle(20, 10, _T("楷体"));
    , p+ S0 U& w) v% u6 h4 U' ~: Orectangle(x,y,x+400,y+325);' w9 G: @& B1 l4 [5 i
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    6 J+ L* Z. \3 E% ]$ B& Fouttextxy(x+45,y+10+100,"IO");
    ' I$ q6 _9 N7 t7 iouttextxy(x+40-15,y+10+200,"change");! f# I3 ~; T+ Y8 p( B, H
    rectangle(x+35,y+30,x+75,y+110);
    : J4 D8 W8 f3 K& V% z' M1 u- Jrectangle(x+35,y+130,x+75,y+210);
    ; N0 L( u4 S- {6 i) xrectangle(x+35,y+230,x+75,y+310);, }# A6 o* }5 }6 @
    outtextxy(x+180,y+310,"TT");( q, _9 _  F9 S# Q  L
    t = (float)com;
    , _4 |- P  A8 ~, |temp=(t/101)*80;" c% [: R$ R+ |
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);% E# }+ e* U2 J; X4 a* {
    t = (float)wai;- E6 ^% o! X2 p$ G& j9 \
    temp=(t/101)*80;8 p" u; A+ ^, i5 ]
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    # _1 s: L3 |, ^, n' |: R& _5 @t = (float)cha;: J  e" T2 E" C/ C/ |# n; y
    temp=(t/101)*80;
    8 E2 X6 x$ e4 F& H, Z; ^! I! nfillrectangle(x+35,y+310-(int)temp,x+75,y+310);! G, u; G4 t' v0 g; s
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    . N( p: B0 X  I1 e0 j{
    3 p  G, a" f* O: y# D+ w9 i; Hline(x+100,y+110+100*i,x+350,y+110+100*i);3 K: i' P6 T3 [5 g7 L2 X/ \
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    ; |' ], e0 t1 `% Kline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);4 Z! p( U0 ^5 N; ?7 m5 E
    $ f6 \! A- L( B- ?2 \
    line(x+100,y+110+100*i,x+100,y+20+100*i);9 u7 ?% G! v2 _, j! O  E& P; r
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);: l6 ]1 J  q; u+ f% B
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);# }3 v. X! j$ `( w7 R1 ]
    for(j=0;j<num-1;j++)
    6 {, n% M0 ]5 h; A{
      M, ^# T9 e4 g6 ]4 u. Zline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);6 O0 K1 N: e4 }7 m) x3 P9 B  W
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    * I9 C& [6 v: |* Nline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    # G: Q( I& O+ ~4 l3 E' F) T2 G6 o}
    ; f' s. F: X1 b( j( ^}7 z0 U0 X. N3 i, U' t, L. Q7 M
    }/ @1 S" `2 B% N' @; ]. \+ ^
    else if(FLAG_TT==1)0 I7 u( Q8 ?; s# o
    {! w. t" O2 f: C0 \: A
    x=0,y=0;
    3 c* ^* ~' `  Y' sfor(i=0; i<num; i++). ^0 R0 F9 Y" F) M2 @
    {7 o2 J' i+ C& l+ g
    t = (float)info[0];
    1 D5 X& y9 m( v1 g) w9 r4 @, Qtemp = (t/101)*180;
    7 O5 o& U) Q: f+ `pos[0][0] = (10-num+i)*50+x+650;# _. V$ o' a2 c+ Q
    pos[0][1] = y+210-(int)temp;, _: J/ H6 y% j8 @4 w
    t = (float)info[1];
    , f0 Z. h% V9 r. L. D5 ytemp = (t/101)*180;* O" c7 B0 H4 r1 r2 f# C$ a
    pos[1][0] = (10-num+i)*50+x+650;
    7 c: j" q- g# m8 x% Q8 Hpos[1][1] = y+420-(int)temp;% Z- S, z8 u  W5 V: Q! a1 p
    t = (float)info[2];. s) V4 q/ G3 ]8 v) Y, Y  C; k5 l
    temp = (float)(t/101)*180;
    % t9 }& O6 {; [6 m3 {pos[2][0] = (10-num+i)*50+x+650;- P* h# C, ?$ M6 h( g% U8 I3 T
    pos[2][1] = y+630-(int)temp;
    " @# o' X( D+ E- k5 Y; q1 A% u}
    1 m1 u2 ^4 R5 Y6 J9 ~7 Y- `clearrectangle(x,y,x+1200,y+650);, h* m% P: d" M
    settextstyle(40, 20, _T("楷体"));: p/ r- {5 Q- K& W
    outtextxy(x+50,y+50,"TT");
      v/ ^2 L; }6 }7 t" Y) Kouttextxy(x+280,y+20,"CPU");       //画柱状图9 V$ \1 ?0 k2 b. e
    outtextxy(x+285,y+20+200,"IO");; L6 L& w9 _1 h$ B1 i4 |5 T0 n
    outtextxy(x+250,y+20+400,"change");
    5 s% }6 }5 i! |0 j/ prectangle(x+270,y+65,x+330,y+215);
    , H0 z. N7 F- R1 I' arectangle(x+270,y+265,x+330,y+415);# f. {9 |' ]# U! t& U. c
    rectangle(x+270,y+465,x+330,y+615);
    ; O2 k0 L) V# aouttextxy(x+290,y+620,"TT");! @7 c& Z3 z: c, d! Y# f! d
    t = (float)com;- i+ g$ _; d. u; C2 m' q$ G4 |  P3 a
    temp=(t/101)*150;& t+ G% ?7 X: r7 m) b
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);2 p4 K4 A9 g- g5 r* K0 Z
    t = (float)wai;
      X$ E2 w- l6 c, Atemp=(t/101)*150;
    ; f! D, e% E1 ~; D$ ifillrectangle(x+270,y+415-(int)temp,x+330,y+415);. a; u  l" f/ Z2 n5 N6 m$ h
    t = (float)cha;
    2 I% r# @% o# K2 V# D7 S4 Wtemp=(t/101)*150;3 p8 d2 ]' O; ]( L
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    5 ?: z# H9 F' U+ w- g# N' U  Ufor(i=0; i<3; i++)   //画坐标   high=90,length=250( Z& A+ r# ?5 X) H
    {
    8 v9 x/ g1 ~1 Y  q9 eline(x+650,y+210+210*i,x+1150,y+210+210*i);# E4 K6 |4 @2 `* a5 ~5 {" q
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    5 j  i" P& @" aline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    ' }! W+ O  f$ J' a6 y6 _' C. [  t+ y# q+ @
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    8 O6 x$ r, v* m8 x4 gline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);) r& N* A% ~* a
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);8 M0 Y; m4 X$ e+ Q3 t' i% ]0 H5 Q' u+ N
    for(j=0;j<num-1;j++)
    3 l' V$ h2 i' h{
    7 K' X. w* Z. \" w3 j' X; J! G* aline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    ! o2 \9 O+ m) J( D' ]& J+ t9 A# H) Qline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);, e) F) m$ I- y! L8 k, g; N: t1 r
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    7 K; @/ J% ]9 j9 ?% ~$ ^$ Y$ l8 ]}
    ; n9 [# d4 B' l/ V, m}
    ! I  K  {( ~4 N+ Y( U4 h( k}
    3 T$ \$ v* V* V8 @# Y1 m8 ]
    3 j: ^9 K2 T! L  z3 W! P5 }
    ' Q+ ~% T3 p  x- s0 Wreturn 0;" O8 F0 o/ R( ~3 j+ e$ c" I
    }9 c  Y2 C  X3 b
    int drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)
    " m  e# z( s$ o) P5 O7 J( Y{) i' |- d6 N) m8 j% H$ e
    static int info[11][3],num=0;
    $ o: C: X$ t. ^  |$ ^8 ?" N& Qint i=0,j=0,pos[10][3][2];6 P% ~9 G( |# M0 n, q4 u+ _2 p
    float temp,t;
    : a! F. D) f  winfo[num][0] = com;8 K$ i  X  Z" R) V. S
    info[num][1] = wai;
    ) |" x& H! z, A0 }. e3 Cinfo[num++][2] = cha;+ i, a6 J7 X) F0 q; M& c- x1 k( ?9 m' G
    if(num>10)  //存储10个点
    & q7 q0 B* F! m; `7 `5 r3 }& ~{$ n% w7 q( @' q; T5 k' W* D
    for(i=0 ;i<10;i++)
    . b4 s# Q+ n4 o$ H. G{) B' O( f0 ?3 I. D( a* M
    info[0] = info[i+1][0];0 r5 z5 {  e* k2 \; D  {  a
    info[1] = info[i+1][1];
    8 i$ g+ c* l  p$ \info[2] = info[i+1][2];
    ' J, D2 Y3 B7 Y$ N  P3 o% ^3 ^# v}+ T6 v1 |7 m5 m- J
    num--;  T% e7 {) j6 j9 }1 ^( C; p) U
    }! D7 X( w5 D8 s$ U, C  C
    if(FLAG_show==0)
    ( q6 B6 E5 @5 e$ n$ _1 z% creturn 0;
    & T1 m' h' ]3 D2 U- v* v0 ufor(i=0; i<num; i++)1 w; p- [/ o( ~" K. |0 t0 K
    {
      ?6 @# u( z( ?t = (float)info[0];
    / Y1 _7 c2 a: d  h, Otemp = (t/101)*90;
    " {9 K2 A+ i, A2 R" `% m8 ?pos[0][0] = (10-num+i)*25+x+100;
    ) v( a3 B: L, o9 R) ipos[0][1] = y+110-(int)temp;
    ( j- F, M& a" |  c/ w9 Vt = (float)info[1];
    0 z* d3 u4 B' d3 {; ?1 J! _temp = (t/101)*90;
    & T4 x+ {% L1 f+ [. qpos[1][0] = (10-num+i)*25+x+100;
    $ I5 w% \# |/ ?5 b8 ypos[1][1] = y+210-(int)temp;+ o" P0 W5 r- f7 c* s0 f/ k
    t = (float)info[2];
    # I- `5 B/ l( h% \; r( Wtemp = (float)(t/101)*90;0 Q0 `) q3 m. i$ Z% G/ B; O9 I( f) i% Y
    pos[2][0] = (10-num+i)*25+x+100;
    . Z# E9 D. D7 E1 E" Mpos[2][1] = y+310-(int)temp;5 B1 c4 |. m! e: b: w
    }1 S( ?0 L$ ~8 `" Z$ H% l
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)( w6 c& t$ U& g( q; ~
    {
    " O3 Y/ o# [+ B5 [, S- J; ^clearrectangle(x,y,x+400,y+315);6 g$ b* _+ Z& d0 V! [1 L1 Z  o
    settextstyle(20, 10, _T("楷体"));
    4 y5 T; y6 K" \; brectangle(x,y,x+400,y+325);& w) Z7 V) e- p, z
    outtextxy(x+40,y+10,"CPU");       //画柱状图- ~" ^7 i" C; E& m: h% U, o
    outtextxy(x+45,y+10+100,"IO");( l* f' H% M; c7 o
    outtextxy(x+40-15,y+10+200,"change");# }( Z1 @. J5 O+ L& M- n3 {$ x. ^
    rectangle(x+35,y+30,x+75,y+110);
    4 I  l0 G4 t3 A3 ]rectangle(x+35,y+130,x+75,y+210);6 q1 r' s7 F' V. o4 x& z
    rectangle(x+35,y+230,x+75,y+310);/ I) x$ P  Y$ ^) p, D, S
    outtextxy(x+180,y+310,"PF");4 J) N$ n  V. a5 G
    t = (float)com;! u) p/ I. {$ O( |5 t3 B
    temp=(t/101)*80;
    7 h- N8 s$ U# D% B5 ]; J, Kfillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    - b9 r. H$ e5 m1 n; wt = (float)wai;
    1 o" q, R7 ?0 i4 Q* l# itemp=(t/101)*80;% u: y& P: v, Y+ [
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    $ W3 U! `3 ^. P& n- Ft = (float)cha;( ^8 d! w- X5 _8 b  T8 c
    temp=(t/101)*80;- {9 [7 k4 j* q9 k, ~
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);7 |, _/ j. c8 g1 }2 m
    for(i=0; i<3; i++)   //画坐标   high=90,length=250; I5 r( t7 _* j9 c
    {' Y/ o! M; d2 B/ g/ ]: U7 k8 y
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    9 W! h* M/ ]1 v  bline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);9 I) M9 j+ ~# D
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    ' [$ S2 D* z  o4 @( `  R8 G6 v  f. V2 M; X
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    6 O; T" `& ?: Wline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    ) ]- _1 I6 n1 U) j( {/ m2 Yline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    2 Z" i, v+ d* p( l9 P/ Gfor(j=0;j<num-1;j++)) J- _, M: H* z; }: c
    {
    0 m6 |3 V$ P* I, S+ hline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    $ J7 d$ ^9 @# D, ^3 c: hline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);8 [8 @$ x/ R' d) g- d2 W
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    9 T, t/ b" w1 @0 r& y, M! T& {* l% m}
    8 k! K" E% d  T" n8 w, O}+ s1 Q1 w. S) W' u
    }
    ' n: G: o) ]& v  Uelse if(FLAG_PF==1)
    : z4 D, @! N: \{( \9 g2 q7 [3 O# i! W: m
    x=0,y=0;
    . C6 D" m4 J: U* Z5 l3 Efor(i=0; i<num; i++)
    % ]7 l! ?$ u* n( q/ x# _{
    ; i, |$ L! ?9 w7 M9 _  H/ @t = (float)info[0];& y4 U% j" i) l6 ~; _# t# O5 ~
    temp = (t/101)*180;* i1 j; l7 N' \2 p9 Z# T! `* r: r
    pos[0][0] = (10-num+i)*50+x+650;
    * v  `% `% k$ `& j7 ~/ Cpos[0][1] = y+210-(int)temp;- u/ B1 k8 Y9 F. O& P% s6 `
    t = (float)info[1];" k9 m  t* a! }* g4 c6 M
    temp = (t/101)*180;
    ; Q: p: j: V: k* ?- Zpos[1][0] = (10-num+i)*50+x+650;
    6 c/ B: P# F6 |6 K6 k/ p: Tpos[1][1] = y+420-(int)temp;
    ; ?+ G3 W8 i; i- D* B& Zt = (float)info[2];
    0 j/ `0 y3 c; ^, R2 {  p7 j8 b2 etemp = (float)(t/101)*180;( M2 s  O4 }$ L$ E& L4 [
    pos[2][0] = (10-num+i)*50+x+650;' `9 Y2 F- G7 _% J3 _
    pos[2][1] = y+630-(int)temp;% _" U: }3 ^" g7 \  p: n! x& t
    }
    2 q* @, c' u# Yclearrectangle(x,y,x+1200,y+650);
    ) h8 h! Z: s9 b) m: psettextstyle(40, 20, _T("楷体"));
    " W; @/ g) j* J2 W% K7 c% g% Couttextxy(x+50,y+50,"PF");, a6 {4 P- B% t3 @
    outtextxy(x+280,y+20,"CPU");       //画柱状图5 _3 o* k( N) ^# F9 z8 V% @) D
    outtextxy(x+285,y+20+200,"IO");
      u+ S% G  ^5 R: i- c; }outtextxy(x+250,y+20+400,"change");: j, ?$ \, R5 \) S/ _: N
    rectangle(x+270,y+65,x+330,y+215);, e4 w* }: S9 \3 d$ R7 c
    rectangle(x+270,y+265,x+330,y+415);
    * T! {4 E( L6 L7 F9 u; R# }rectangle(x+270,y+465,x+330,y+615);
    + L' r. h6 s; s* ]3 ~' C9 b3 wouttextxy(x+290,y+620,"TT");- p9 q( l" J3 k+ m6 C8 M: D
    t = (float)com;) T" o; H( H0 |$ A: n- v" j
    temp=(t/101)*150;
    ; S/ |+ B- |9 u" ?1 d3 w  g. @fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    ; x. e( G& K& tt = (float)wai;. Z5 L- B& _+ j3 N
    temp=(t/101)*150;
    ) g: r" B4 c$ O1 p2 c& {5 m# v4 mfillrectangle(x+270,y+415-(int)temp,x+330,y+415);4 ~# w: t& c$ [1 G1 n
    t = (float)cha;% |: N5 N/ p# w2 u6 _% w3 Q# W9 }( R* H7 I
    temp=(t/101)*150;1 l4 j. b% u! A/ i" z* N( `5 Y8 r- U% }
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    , d. F. P) l' a. N. n3 K8 P( yfor(i=0; i<3; i++)   //画坐标   high=90,length=2505 j; |6 N1 E: Y, N* e7 U, U
    {
    7 U7 j8 f5 d& g: W. kline(x+650,y+210+210*i,x+1150,y+210+210*i);
    2 Q6 v% X% o2 f5 O: w/ jline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);. ~1 Z. r% d! N" q7 l- F$ M/ R
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    . @" {4 P& h! c4 r5 C8 [# h5 y8 |, U& b& }) S" n7 s
    line(x+650,y+210+210*i,x+650,y+20+210*i);
    8 w7 M" G# C2 p& L% q* Iline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);: \- P" E; |- k' m
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);6 S4 S- K: o; y" P  Q" A5 L
    for(j=0;j<num-1;j++)
    , Q; j8 z2 y; C& ~) e{
    ! a0 L1 F' f; y+ k$ }) l7 ]" `line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    0 |) l6 l1 t% y! zline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);. P5 s5 k7 |. X$ s/ v
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    4 B7 D* C, f, b; R4 d! y( Z}
    % p! f: H6 }( P0 B) @, P( k) d}
    , ?, E1 ]+ w0 D2 k$ B, [5 \* u}
    0 i. X) ~/ b2 L& q3 O  [8 Hreturn 0;
    ' Y" J7 `8 d) k5 ?( x}+ I5 C4 c* g& G$ ?0 r9 e( Y
    int drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha)8 @" s0 U5 @1 B+ L. M
    {
    " ^& p+ C5 P+ O  d4 q7 A7 L3 ostatic int info[11][3],num=0;
    ; s# ^8 t) V3 H4 o- [5 I- j# Mint i=0,j=0,pos[10][3][2];
    ) E1 y3 C, F1 J( a9 gfloat temp,t;- }( L; h$ Y  `- l: H; P5 K
    info[num][0] = com;% U: t" x- \2 A+ F
    info[num][1] = wai;
    4 O( ?1 ~9 w! A, d9 E9 _( g" Zinfo[num++][2] = cha;
    . R# }/ s7 T5 V/ G# ~if(num>10)  //存储10个点4 S! C9 j3 L* e- B# l
    {
      Q& c& R% z3 Y1 ?( K3 Y1 E7 N2 Ffor(i=0 ;i<10;i++)
    0 ~& J7 E9 k9 G{
    ! J  v6 d! f5 ^+ I# Pinfo[0] = info[i+1][0];
    ' I+ {4 u0 ]( T# O' _info[1] = info[i+1][1];" C, H! I' }6 H) p- R
    info[2] = info[i+1][2];
    8 Z" P* r, ?' S! @  o}
    " c5 {( k' [) x, n) Cnum--;$ T$ g$ }: C1 v! v5 K2 c5 o4 h" y+ \
    }
    # E: r1 ?& ?) L  e" q7 Wif(FLAG_show==0)
    4 V6 k$ F- h8 dreturn 0;- l9 [' R  Z  h$ {2 m
    for(i=0; i<num; i++)- f* a/ x1 \( ?& j
    {
    , f6 v6 w5 X9 U  F9 ~1 Gt = (float)info[0];$ h$ _( D" j# j# _6 M- v
    temp = (t/101)*90;
    ( _; A- I% R- h# H3 E+ N2 S% npos[0][0] = (10-num+i)*25+x+100;; l  m" N% ]1 H+ h; `4 O& \* d
    pos[0][1] = y+110-(int)temp;- ?; w3 H4 z$ J. _- M" y
    t = (float)info[1];: W* O  ]( J8 |4 t* V
    temp = (t/101)*90;1 h. a# A2 g6 A# T" l% O- O; A
    pos[1][0] = (10-num+i)*25+x+100;
    0 B4 }+ z* r% Xpos[1][1] = y+210-(int)temp;5 g2 a6 n; r& P; Z
    t = (float)info[2];/ I. s* r- m# w, U
    temp = (float)(t/101)*90;
    $ F( {) ~2 v  v% _pos[2][0] = (10-num+i)*25+x+100;0 H$ n! t& r( U
    pos[2][1] = y+310-(int)temp;
    7 r* U& j* L+ p7 {}
    - j& t! g# ^/ L9 M9 a$ G9 lif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    7 w/ z3 G2 O. ^2 q{ 5 L0 N7 k7 {1 L  o1 r# c+ _7 M1 h
    clearrectangle(x,y,x+400,y+315);
    8 F/ w# q* _4 f$ `, l( T' y8 [settextstyle(20, 10, _T("楷体"));" h, G) q! j) W! \
    rectangle(x,y,x+400,y+325);1 u' Y8 k& t8 ?
    outtextxy(x+40,y+10,"CPU");       //画柱状图4 S" c! r  L. ?! B3 b" ?$ D9 e/ q
    outtextxy(x+45,y+10+100,"IO");1 I; w  v) n) \0 l1 m. G4 g- i, F
    outtextxy(x+40-15,y+10+200,"change");, G0 c1 c1 E  {; p- w% L- y
    rectangle(x+35,y+30,x+75,y+110);
    * t) `" \, @; [/ y; rrectangle(x+35,y+130,x+75,y+210);* h: t/ ^" L) N/ k" X
    rectangle(x+35,y+230,x+75,y+310);! i1 H( v1 p6 }9 }0 j$ T/ V
    outtextxy(x+180,y+310,"SJF");
    2 p) A$ p4 O7 \t = (float)com;
    : a2 d; Y( F( ttemp=(t/101)*80;& H7 o- d. q7 B  t0 I
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);. L0 p) ~+ \: U* j7 K& z! \
    t = (float)wai;! [) v2 V, E" b
    temp=(t/101)*80;1 T$ A1 m. {' C2 w
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);$ G4 Z* U& p+ {( w5 T, p, ]
    t = (float)cha;
    6 T' A; J/ d' N7 |1 [0 ]temp=(t/101)*80;
    ! _) n- w. i4 w4 z. w! Efillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    # G% n  U: L) O8 d4 Z8 c  Pfor(i=0; i<3; i++)   //画坐标   high=90,length=250' ^, O5 K! ]9 @# @+ C3 W
    {
    4 C0 o# p4 ]+ }# y1 n; V9 E3 {line(x+100,y+110+100*i,x+350,y+110+100*i);
    ! f6 v. D  T3 X" Q& |; T1 Qline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);/ g1 Y: ?, n& P0 {8 ~) F1 O4 X. N
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);6 l! B6 [5 |/ `2 a" F
    ! p6 r7 u4 Z' o" X2 J. o, ]; k8 u
    line(x+100,y+110+100*i,x+100,y+20+100*i);% ^4 _, N  e/ X
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);8 c' O7 i$ Z# B' A) d: e  y
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    3 b; R' X) w* f6 T( Y* [for(j=0;j<num-1;j++)) ?0 [% m  V( M, I. u: i% ]/ V
    {* L7 y$ n8 O* _1 E
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    8 e1 S& K, Q: [; G* D7 [, S' Oline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);7 K. ?: n( Y: X' O1 M
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); . _  ?3 P5 U( a% A0 |6 k' T$ c
    }. [: u/ i) A+ N* E7 _3 r
    }" s: a4 R1 ]# _5 C
    }
    9 u$ e0 X4 R5 H7 E/ \/ z3 q- qelse if(FLAG_SJF==1)
    7 a! d* ~0 h6 D$ W{) D) a  l( D5 B/ E) I6 \
    x=0,y=0;
    1 `4 t" J, a; mfor(i=0; i<num; i++)
    % Q$ U* P, {# @- N/ d0 ^{# R( A0 a8 J6 Y5 n
    t = (float)info[0];3 m# t* \& ~: F: c
    temp = (t/101)*180;
    6 R& @. U, C: o( b. _/ ppos[0][0] = (10-num+i)*50+x+650;
      g. `7 L0 v  V0 F4 B  W+ r) Ppos[0][1] = y+210-(int)temp;5 L$ z" `6 V! }: U/ X! D
    t = (float)info[1];! U% j: A# v; W! d% p
    temp = (t/101)*180;$ V  S1 K/ Y& N$ w
    pos[1][0] = (10-num+i)*50+x+650;) X& u  c4 ]9 P5 {5 k3 i" M) x
    pos[1][1] = y+420-(int)temp;6 `0 \1 F) Z  w+ L. _4 d
    t = (float)info[2];
    " B0 K4 R5 W: S& ttemp = (float)(t/101)*180;
    + a9 ^$ [8 T, g1 d2 T* Q/ \pos[2][0] = (10-num+i)*50+x+650;) I( Y- W7 V0 m8 \# J$ w
    pos[2][1] = y+630-(int)temp;  Z' ^* q6 N4 ?
    }0 k5 Y+ Q$ @& e! ~
    clearrectangle(x,y,x+1200,y+650);+ s3 h7 d& t9 v1 Q4 F* `/ L2 k# y
    settextstyle(40, 20, _T("楷体"));
    " Y  F, z, L+ l8 ]/ wouttextxy(x+50,y+50,"SJF");9 Q4 q/ M5 w2 s1 ?9 R8 i
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    . W9 g$ o" e' h( qouttextxy(x+285,y+20+200,"IO");
    8 V" ]9 [: V/ i& ?7 i: Bouttextxy(x+250,y+20+400,"change");
    $ ]3 I! N; b* a+ ~9 Mrectangle(x+270,y+65,x+330,y+215);
    % A, B; w. O' D1 W7 ^2 Arectangle(x+270,y+265,x+330,y+415);+ n( a$ ?( b- c3 U: i! z
    rectangle(x+270,y+465,x+330,y+615);
    3 J, h9 m( ~! ~" n  Wouttextxy(x+290,y+620,"TT");5 |5 d! w# G. |& {* P" M( `
    t = (float)com;9 Q* |! f8 z* j# n; ^/ ]; s
    temp=(t/101)*150;8 V# j; r# \3 w$ X  L; N
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    5 \$ @2 H7 l$ T$ A  e2 ^0 f# c0 Vt = (float)wai;
      a6 G( W# ^. m# c6 I% P  x; ~" }temp=(t/101)*150;; {8 ]$ \7 L' O; c0 X8 A* M  z7 T  E
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    5 y* H2 ]2 J, G  ~" }t = (float)cha;
    3 z2 w+ J) h& D) itemp=(t/101)*150;
    , v' }- @7 Q( ^) p& J% }fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    5 K- B0 u5 h: H2 x5 G  zfor(i=0; i<3; i++)   //画坐标   high=90,length=250* Q: x/ M0 A! {; |- x+ c
    {
    * G: I! e0 j" u4 [: F3 vline(x+650,y+210+210*i,x+1150,y+210+210*i);
    : X( A3 C* f3 O8 |0 N1 K  fline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    7 {' y6 X& C; b( Aline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    6 u' z' {9 i  ]; ^3 s; Q3 E7 x8 i2 U: g) ?7 d' r1 Z& [
    line(x+650,y+210+210*i,x+650,y+20+210*i);
      }9 q* q( b8 @line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    ) s) }2 }6 {6 J, |9 y) jline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);$ X2 \3 ?. t2 w4 b" J! i
    for(j=0;j<num-1;j++), X5 C" @& S" Q5 J
    {
    5 n2 T% [4 \7 q. J4 Gline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    * b* X: a! ^; @- Gline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);2 x) t# F, G; n/ C, n4 @
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 8 F2 l9 x0 Q9 N6 z: ~9 J( ~/ x
    }% B2 z' c; r; O
    }2 B7 _1 C# l2 z$ c
    }. |% Z) M* O# V+ J% v1 c  \
    return 0;  Q" @- X  J: ?' M9 s6 ^& w
    }
    6 N. n7 D! l9 v* S0 o9 Zint High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    6 i, [! e* o5 h{! g6 m1 F3 L. L, T
    static int compute=0,waitio=0,change=0;
    ' ?8 i+ b7 g9 g: Istatic int computeLast=0,waitioLast=0,changeLast=0;! F% R' t) j  N9 I6 ]
    int i=0;
    . K  |; b( S0 b: r$ y3 Q. D. qif(draw==1)) o3 o; R% _/ ~, A3 j' O
    {
    + X$ i6 [/ w1 Y' b5 o0 c//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);1 X( h( d& o0 A+ R  [) e& w
    drawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    ( m8 p+ _- P" H& f* y; Y, F# kcomputeLast=compute;
    % n/ F6 C7 J( v3 s3 TwaitioLast=waitio;! l, H3 @. a) ^6 n: P: k
    changeLast=change;
    / t% I/ X; e4 u; E2 U# I- K}
    ; r3 V- W0 T1 yif((* memory).p[0].flag==ready)
    3 _( q& t: C7 T+ n/ m(* memory).p[0].flag=computing;% L7 Z6 `, W+ \4 C) C) h
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    . Z% @( J/ _2 \7 S+ l2 \% J{8 R, l; ]; T; H6 ]- a; x- ^
    i=(*memory).p[0].computeNum;* P) L8 z; I& E
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed* Y  n8 S" S0 q" C
    {
    8 o- a' s7 `( i5 K' K(*memory).p[0].flag=IO_waiting;
    6 c) \: ^' W, N$ ?8 {(*memory).p[0].computeNum--;# [; \, N; e* ^/ }  v
    change += exchange_IO_Compute;
    ' C; V: w0 Z, k6 }6 {# p: Tcompute++;& H2 x3 P1 e6 I. |; ]& b) i
    }
    # J6 E7 ~* J6 V  selse  b2 t5 ^* Z' u! |: u# |
    {
    - m4 W- X1 `- J" u4 Wcompute++;
    ( z/ J" Z# J) c}0 Q; w; l" M6 G9 O- {0 y4 |% z
    }+ D5 l6 D, C% K
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    # D& p1 O8 e+ u; s; F" J{
    ) c) o9 d) I$ K& H* i* {! k2 }& x5 K# C- l2 d8 i
    i=(*memory).p[0].ioNum;
      W0 ^* j1 n3 E) wif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    * U" |8 P) R5 J. ~$ h+ [{- S+ Q1 u# w! [% H! V9 ]
    (*memory).p[0].flag=computing;
    $ M- Y  G7 k  N. A1 J0 L  c(*memory).p[0].ioNum--;
    0 f$ w8 g6 v5 `change += exchange_IO_Compute;; p8 X  P$ D0 E7 ?- ]) j
    waitio++;" {8 j4 g  q+ O! Q) Y; j/ Z, s
    }) h" b3 W* a8 v
    else  G) x( T* ^* ^' s
    {
    , Y& Z8 C+ ?: K4 w8 Kwaitio++;
    8 G. `2 y5 \3 z' G}
    5 ?2 i' G; n6 d9 Y# [( M- l}: M0 Z; r" P/ K, N* z
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)* w8 C) q5 t$ ?! \) X, V
    {
    1 k7 W, v! g/ z! w(* memory).p[0].flag=IO_waiting;+ b; Y. v* w( r4 ^, C/ F! @. R
    change += exchange_IO_Compute;
    / N8 `8 E. j' c" @) `}, ^" d. f  T* ~' W" p! G
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)& H9 L$ \2 r# F
    {
    ! Z# h5 J& z$ b9 i9 C(* memory).p[0].flag=computing;& r' y: i! P' w% L/ f
    change += exchange_IO_Compute;
    2 I  b3 }: L) c( r6 L$ [! Q. b}% G* l/ B' j8 i
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成) k0 k: Q3 y8 z8 P: W
    {7 v/ d) ]2 s2 D4 X" ]5 s
    (*save) = (PCI*)malloc(sizeof(PCI));7 X0 [% h) O+ H, m3 j$ L0 o) D' T
    (*save)->next = NULL;
    & m8 a6 N" z& U" d0 l0 j(*save)->processID = (*memory).p[0].processID;
    2 b; E/ D0 s+ O; l8 R3 ?6 W6 Y# {(*save)->comeingTime = (*memory).p[0].produceTime;
    / H; A: Y: T1 q4 V(*save)->askMemory = (*memory).p[0].askMemory;; e& D0 m- P4 ?/ z( t
    (*save)->compute = compute;
    0 T- i  o0 f! o+ L7 n3 `! Z(*save)->waitio = waitio;
    7 i  f, |# V4 k(*save)->exchange = change;) C7 @' w  h4 Z
    (*save)->completedTime = systemClock;# Y6 b/ ^' I7 B; E8 E/ H& W
    (*save)->runningTime = (*memory).p[0].runningTime;
    ) y! B, p) V% ]4 B- |*spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;9 K' m2 [& u  d" T* A
    compute=waitio=change=0;% y; ~5 {9 R3 }9 s
    computeLast=waitioLast=changeLast=0;
    * l  N) H6 F1 f) j/ }  }( @High_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);
    ( A$ q) j1 q; \, G0 k7 a0 ?change += exchange_process;
    % W. S$ N6 C& K7 e( dreturn task_completed;
    ; x; g. w7 k, `: u# i}9 r3 a0 c+ V# k& G: c' w
    else
    : k  Z2 I3 P; j. o& U( [* p! Lreturn task_not_completed;
    ( L' ?4 p, P' \2 a8 F  W5 p9 J}
    7 y' L7 n6 l7 Y& b+ vint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch)* j# t4 B2 s: _4 d. W
    {
    : ~2 x& ?% [/ Ostatic int waitTime[initProcessNum],i=0,j=0;
    ! z, j& Q- F' X0 r1 f/ [3 Wstatic double HR_ratio[initProcessNum];  q5 P6 ^, ^9 l' X# E# b2 S
    if(flag==0)                    //初始化数组& ]' _4 t  ]; Z6 i! B4 o
    {
    / X( L- x5 }; |4 z' |0 {5 C% u" jfor(i=0; i<initProcessNum; i++)7 @8 w, T6 [( O4 o9 _
    {
    * J/ h1 w/ c; A2 `7 NwaitTime=0;
    / L/ P( k! C3 u9 j  h5 }HR_ratio=1;
    # L& b9 S6 t  T# U}
    / k& W' a3 B, ]; t}1 d/ y: p; P0 J
    for(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比
    8 t& n& Q$ a4 f/ T0 S{
    4 Z! s5 ]/ z* SwaitTime++;
    ( p9 {- j* C# Z4 ~HR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);' C+ ?  x' y8 K5 n2 P3 ~7 n
    if(HR_ratio > HR_ratio[j])
    2 o/ z( w9 g+ T- }4 D: Sj = i;
    ' P; S" j( i+ `( i% K* m$ i}
    & f' d/ h# ^; b# L  kif(dispatch==1)                    //需要调度一个进程到内存中执行; I. U" `9 A6 {) r
    {: h; i* y8 `+ \7 ?+ g  E+ f
    if((*storage).p[j].askMemory < *spareMemory)/ {6 _# [% d- ]4 a
    {
    ' g6 f5 U2 Y& o  G" c& Z(*memory).p[0].askMemory = (*storage).p[j].askMemory;# @2 F% E' j) I" k  [
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;1 c% E1 E* ?4 u$ U  E: @! y! t+ x( M
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;& `5 N- r9 Q  J" D* {' g
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
    $ n) l& w6 I. p+ [5 b; H" ^& k(*memory).p[0].processID = (*storage).p[j].processID;
    . B$ k( w( P$ U. E, M4 l% N. B(*memory).p[0].flag = (*storage).p[j].flag;3 b; t% w' Z* V7 I
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;' ]: L* F1 L' R* i1 [" v; @! S5 |
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;
    # Q/ ~4 G" w; J! Y( p# p/ X' a/ `. j(*memory).p[0].runningTime = systemClock;/ P4 m8 b, X4 [- V; a. L( k- {+ C( l
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;
    $ v5 r* `" _: F3 ^1 H; L: X6 p" C, Ufor(i=0; i<(*memory).p[0].ioNum; i++)
    , f+ }% m7 c' {6 V, S(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    8 c7 A1 e9 q1 u; M* Efor(i=0; i<(*memory).p[0].computeNum; i++)* t( J7 |. y% {6 b$ j# y
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    0 _5 H) i0 a4 [! |(*memory).proNum=1;- V: |/ ^* {6 G
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    , N; V  \0 D: \+ K" Oproduce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    " w" |3 w: v/ e(*storage).p[j].produceTime = systemClock;
    . ?/ V; J! F- N$ T7 xMAX_COMING_TIME = (*storage).p[j].comeingTime;8 Z) i8 _+ m- t( [% l0 w" K+ m6 k' Y  J; B
    waitTime[j] = 0;
    8 n# I! ^5 T9 M2 K7 ]HR_ratio[j] = 1;9 F. P  l+ {- u5 G" b
    }) v# O+ x6 X- k, F* i; S
    else' n+ L- d" j, Q& O0 j/ E
    {/ a! @/ `2 y. k
    printf("A process ask for a memory overed the system capacity\n ");
    ' k8 w1 |/ {: H% l# nexit(1);" V, T. y5 P! t' N  H+ v& @" y3 i& R7 h
    }& z4 x. e3 H5 X. J0 ?
    }( V3 K: |$ w$ R: D7 J/ E+ E
    return 0;
    9 ^3 A; f1 e" |6 I}3 b4 B0 R3 \8 z  I- p9 R
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    0 C  e  y: m% @0 d( r  B5 v{  G8 T* I  t5 R8 e  H2 z
    static int compute=0,waitio=0,change=0;8 {$ f6 a- E" B8 I+ w6 q
    static int computeLast=0,waitioLast=0,changeLast=0;
    ( g5 n$ K' A6 p+ ?; c; Vint i=0;7 u$ J) E+ c' ^7 E+ A& m
    if(draw==1)
    0 P) l$ z( {) h3 X7 D{: j  m# u! F; f
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);* p& q. S' h+ g, \& z& Q
    drawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);% r1 l+ B# e" O
    2 U' D/ T" l- l6 _/ T4 |( H

    0 s+ ^! Z6 T+ c) h) E# j- v9 ^; w$ BcomputeLast=compute;  U5 }% o9 Y; |
    waitioLast=waitio;
    ! T6 i1 W: Z( R: Q0 \; bchangeLast=change;" f8 b1 X# Y6 D" o4 q
    }
    / o. f. ]5 b- @if((* memory).p[0].flag==ready)3 @$ T" T/ S2 O) V# V
    (* memory).p[0].flag=computing;0 ~9 j( |, {2 L1 |
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    1 u2 C5 I, m: _1 e/ b{2 L  u  C- |% F" X/ d
    i=(*memory).p[0].computeNum;
    7 [8 J5 v) ?  J7 n- e! N" r6 Tif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed
    2 N% m% ]) a  Z! ~0 i$ ^; }+ o{* I' `5 J8 |( O0 P: b, O
    (*memory).p[0].flag=IO_waiting;
    1 [# w- |9 ~& R% u& Q(*memory).p[0].computeNum--;! _! s# ]0 k5 ~' V. M- W' f
    change += exchange_IO_Compute;* p8 q  G" @; Q9 I3 E
    compute++;
    " ]0 ?" q& Y  v% ^2 N; E8 h}
    . Q% Z/ F/ f, s& [$ i/ [$ ?else
    ; S. ~5 T# }  w8 `5 [{
    / ?1 G- i7 n& |- g& Z5 O& ycompute++;! J* V( P& a; o+ {; W; g5 ]2 ^
    }
    # c; j$ P) s( z% T  ]}
    . L/ O) @" C8 k7 Selse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    2 M6 \' V$ A; Z{# |) C' x2 @6 z) \; r

    9 V" G7 d7 |0 P9 d. ~; Xi=(*memory).p[0].ioNum;  \3 z3 [( c$ h, C
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed- y/ i9 f5 ]; O' d' W' M
    {
    * r  \* C# t9 x- B2 Z1 k" g(*memory).p[0].flag=computing;& l+ B% W. K5 `( w) h" n$ u: L# {
    (*memory).p[0].ioNum--;
    : p" w0 }# F5 ?, f/ Echange += exchange_IO_Compute;
    # L) o2 c9 g5 Swaitio++;$ {3 K8 l" ]' v2 Y  ?( I3 n" O2 ]
    }% L( i: ~( c* Y( `/ J% v$ e; f" D, T/ k
    else
    + g" V! ?5 z6 i1 L; C3 [{% _) L- r# P8 o4 s
    waitio++;+ Y3 A, x9 l6 r7 `5 _3 y( P
    }4 l9 I- N7 G) [* U  M/ y
    }% I4 ]" U% g1 K
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)7 x4 l3 K- l# R1 _. i+ |- u
    {+ K; k4 R0 z) Z! k* e  k
    (* memory).p[0].flag=IO_waiting;
    - q3 J! p" X5 ^change += exchange_IO_Compute;
    % S( `1 U0 g+ U/ u. f}
    8 x$ o/ A. D6 velse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)# b5 o' r5 a5 j% r+ b( C
    {
    . X  z: Y0 y& _(* memory).p[0].flag=computing;
    # Z4 o" _+ P. n) p! @change += exchange_IO_Compute;! K8 G3 X+ {6 z
    }
    4 E* y! z* m# b- w$ Eif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成$ X4 L) t- P, G9 s. ~  }& J
    {
    4 y% E5 v- r% ?4 _* j$ T- H* p(*save) = (PCI*)malloc(sizeof(PCI));
    1 k/ I, R: q4 y(*save)->next = NULL;2 f* f. R) }* \8 C! m, ]' \  x
    (*save)->processID = (*memory).p[0].processID;+ M! ?$ u- y. i
    (*save)->comeingTime = (*memory).p[0].produceTime;
    ( o' s1 W( o5 v7 v(*save)->askMemory = (*memory).p[0].askMemory;
    4 L: P# H* O" t3 X7 c& Q, R6 Q(*save)->compute = compute;& f( [6 [% P1 \, r
    (*save)->waitio = waitio;) z  W$ g; g5 F' ~, S9 A& `9 k0 {
    (*save)->exchange = change;
    ! p9 Q' K8 W) P6 w* o(*save)->completedTime = systemClock;
    ! d& \1 k: _9 T7 |5 k$ c! q6 l(*save)->runningTime = (*memory).p[0].runningTime;
    : s& x  r+ {! g*spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;
    1 x/ R$ g# V- ?# Q* F$ ?* Dcompute=waitio=change=0;0 D% ?+ N8 l( @4 s
    computeLast=waitioLast=changeLast=0;
    ) K* B9 Z1 {3 z" m+ E2 {Priority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));2 ?5 h; s2 n1 x9 N" H
    change += exchange_process;
    6 W1 z/ s3 B. W9 S7 s! ^return task_completed;- V' Y  B- P8 \! c: Y; ~9 v4 a. `' C8 E3 @
    }
    3 s' g/ h! X$ ]8 i8 ^7 L# welse1 B9 H7 X% c$ I3 q* @) k
    return task_not_completed;  B+ X& d8 o' y; P
    }
    ( d$ J$ C; m8 I) k9 C0 }. ]% ~* Lint Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)9 u9 Q* Q( Z. J7 a  B) Y
    {
    - [$ N7 O- r* B2 Z" p- |* vint priorityNum[initProcessNum],i=0,j=0;
    9 y3 |% L' ~# J! i1 Wdouble temp=0;
    ) C8 }/ s% n& @/ L- ~0 Wfor(i=0; i<(*storage).proNum; i++)    // setting priority to each process8 O3 r/ l, \& ?3 d6 x
    {
    9 D) M! \: w" [2 z, Wtemp = (*storage).p.computeTime/(*storage).p.ioTime;1 b0 K: @8 a! `5 M& l$ c* [
    if(temp > 0.8)$ E1 e/ ?6 U: A2 f
    priorityNum = 6;
    0 ^* Z# f: g+ [% k" d4 C" `8 helse if(temp > 0.7)9 G" P7 l) T; O) m" g2 C% X8 h
    priorityNum = 5;" ^( _4 f' q# c! Q+ a" s) @
    else if(temp > 0.6): V+ a$ ^* P! n) }* z* z
    priorityNum = 4;
    9 b* F( L' w, b2 {) g' B- m; B( A8 felse if(temp > 0.5)* {/ Y$ N! a- J4 k
    priorityNum = 3;! \$ z- {; z$ Q* D) t/ \
    else if(temp > 0.4)
    + V9 N1 z+ h+ G& {, \priorityNum = 2;8 q! {! |1 ~- G. G/ p/ q
    else! S8 g$ [6 [8 Q
    priorityNum = 1;
    - E/ {3 x; O' Gif(priorityNum[j] < priorityNum)5 \& B& m: R9 Q3 Y3 _9 r. K
    j = i;. L6 o1 V6 o& f7 C
    }
    + O% A. K8 b8 X4 D& ]if((*storage).p[j].askMemory < *spareMemory)* X' D' O# h7 z" D4 z
    {
    2 K3 f5 q7 h$ k, `- h(*memory).p[0].askMemory = (*storage).p[j].askMemory;
    6 G. h9 y6 d( R, w(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    5 F1 U4 K6 V- t! t(*memory).p[0].computeNum = (*storage).p[j].computeNum;' X" c% N+ M% \/ h. [
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;; }# J3 m0 E! n. x, I+ [6 r1 B
    (*memory).p[0].processID = (*storage).p[j].processID;
    2 E! m6 w9 z4 N1 K. v9 }3 S8 x(*memory).p[0].flag = (*storage).p[j].flag;6 V4 g% Y' |2 k! \$ q, j* W; y
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;: T9 s/ s5 Z& r% Y
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;
    " \0 H- E1 z$ z* e& \0 w. y(*memory).p[0].runningTime = systemClock;) C! {, g5 ~  z. d( O2 p  O
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;* Q3 A: _+ A- n* b5 N
    for(i=0; i<(*memory).p[0].ioNum; i++)
    1 \- Z+ n2 g- T(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    7 r* i" N6 q: A' B( vfor(i=0; i<(*memory).p[0].computeNum; i++); v, S8 L4 L1 G# r
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;0 |1 q  i) p" d# d( p5 g% f
    (*memory).proNum=1;2 Y3 G) h! B+ T
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;% ]  V; d. r1 S9 B
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程) U, L4 b1 j  N: s1 t, }
    MAX_COMING_TIME = (*storage).p[j].comeingTime;/ b, R$ M1 p3 Q: U& x3 j
    }
    5 G3 Q. }( O" |! @# u7 ?$ ^else5 _( r8 C, m3 p* ]
    {
    3 V3 {3 D" H) S3 E4 Y$ V1 |printf("A process ask for a memory overed the system capacity\n ");
    2 r( @8 j6 b! G* S7 D4 nexit(1);4 ~. B, V. X# ^5 e* m
    }
    : P  q3 X. @, preturn 0;4 ]1 t5 H0 d8 t5 ]1 |/ o
    }
    7 S; ^1 \/ N. C/ ^8 d0 U( |int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    & u2 y- D! r2 \! y  }{
    7 l' U1 g0 }/ U3 i: X  w" d! rstatic int compute=0,waitio=0,change=0;
    ( c: G! N, y" i/ n0 Xstatic int computeLast=0,waitioLast=0,changeLast=0;
    ( |6 k% K( x) h) i/ @5 t" \( {int i=0;
    ' ~) E- y) |, yif(draw==1)
    - Q! k5 |) m* S* B& g, N{8 c' o/ a4 c" n( K- O* I9 Y6 o
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    # A( Y. _0 H' x1 z& f- H3 E8 g1 CdrawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);# o9 I9 f6 r) Q9 l  q6 f

    1 P# i, S3 V" p5 i. H- P
    4 c7 `; e$ F5 _; J+ {6 @computeLast=compute;$ e6 ?6 z2 j0 [2 W, h6 q
    waitioLast=waitio;! Y) Y/ S9 v" R' w$ z) u2 l: ^
    changeLast=change;
    : h, h7 Z1 l9 l! }) r}
    + S  i% m) `2 ?* iif((* memory).p[0].flag==ready)
    1 s1 e5 h- Z4 V" r/ ^9 @0 C# U(* memory).p[0].flag=computing;
    $ Q+ j/ ~2 k% B$ m4 @- ?if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)% d6 ~, n2 O. V1 f% {
    {4 l" {$ L  o6 i8 q1 Z
    i=(*memory).p[0].computeNum;: ?4 x7 H2 i; x5 r5 d5 B/ d0 i
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed
    & F. B7 W. ?- `6 G! j{
    ' i& h) l8 S  v  l# q! c/ V& w(*memory).p[0].flag=IO_waiting;
    % j- c  D1 A) o(*memory).p[0].computeNum--;0 m1 i/ V  N/ K2 \0 D8 H
    change += exchange_IO_Compute;
    * h) r4 V; c5 ]8 N' a, ]compute++;
    5 {# R* N3 C7 y) a$ v}
    2 |6 X4 \7 Q3 x# z8 @, ]else( T4 `! T6 |4 H3 K/ |
    {5 @1 {  S5 e% I5 i
    compute++;
    9 X% U7 j8 K# L* l}
    % @* M. j* b/ X& D$ H) _: ]6 K}
    2 v9 a0 G8 H; `( x! Y3 Kelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)2 m, s' B& m% y  W7 ?) a
    {
    , e* S; R+ N0 ]
    $ {% G" d/ t4 b; }i=(*memory).p[0].ioNum;! h! Q' _7 Q0 P3 k1 E
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed" v* J1 }$ p+ ~# b
    {
    4 V9 Y2 u' x  K(*memory).p[0].flag=computing;
    3 ?! G4 p, T, j2 {(*memory).p[0].ioNum--;: g7 h/ Y- e% W
    change += exchange_IO_Compute;
    9 K8 H- G+ b, D( o+ iwaitio++;8 ?& v6 n# p7 n, D( C3 `* b
    }
    9 ], b7 N4 y2 Helse
    ' c# G! r& _+ [) b; Y! k- k{: `! M9 M- U7 g8 a% l2 d6 z
    waitio++;2 p) f/ _& _/ A/ ~! W$ Q# J7 B1 [
    }' B* y. `& G4 x+ h) h( N. [& p/ C
    }' X+ r: C& j! q9 E$ O
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    - y$ U0 E/ M9 `1 o" r- d  K{
    - Y9 l7 M5 k" a: J  @9 y$ W  n  m(* memory).p[0].flag=IO_waiting;
    2 k. d- `4 r* C- J! H0 J% Cchange += exchange_IO_Compute;
    & q0 }! @3 m. `9 z# B6 ^1 t}2 L/ _  y3 K- i
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    4 t7 |! u9 o% @{' {% Q1 @* _- K+ w
    (* memory).p[0].flag=computing;
    7 H% j* N8 |5 I' S- C" g  ?change += exchange_IO_Compute;9 I( |# l5 T" p/ U
    }
    4 p4 q  j6 k1 M# F5 \- Mif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成# r$ {) W% O& {0 v7 b' [$ x
    {
    8 m7 a% K  n) T0 a(*save) = (PCI*)malloc(sizeof(PCI));; d+ o+ E' i, Q# O( W7 C! m
    (*save)->next = NULL;; e7 t) p8 p" L) x+ p4 O% T
    (*save)->processID = (*memory).p[0].processID;# t, j3 U2 I' p9 J) |8 a
    (*save)->comeingTime = (*memory).p[0].produceTime;: Y; C+ P) t; P- u* X; k/ c
    (*save)->askMemory = (*memory).p[0].askMemory;
    - N8 ?6 Y' ^: O/ \) r" d(*save)->compute = compute;
    / G# g; a! M" ^" c8 Z(*save)->waitio = waitio;3 }' A  A4 z: X) q' d3 a, M
    (*save)->exchange = change;+ ]5 ]+ H4 L" d
    (*save)->completedTime = systemClock;
    9 g5 c6 R  J. u& L6 A' w8 x+ }(*save)->runningTime = (*memory).p[0].runningTime;3 T2 y$ {) S6 B# k3 Q
    *spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;6 o, N" g' |5 ^* e
    compute=waitio=change=0;4 V* I4 f7 g+ ?& k% L' v# e4 h, C
    computeLast=waitioLast=changeLast=0;
    - u9 Q( b3 t; ]& G: KSJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));: @, [# X$ E1 ]4 y* A' t( ?. H& Q
    change += exchange_process;' L1 L. A1 N; W0 A3 D
    return task_completed;! d( m  ?# M$ ]. _9 T3 s! _8 I% M% Q
    }
    " q1 z' D( P; W$ N" Delse+ V- l- S- T7 a
    return task_not_completed;! K: W# q: W+ X5 Q& x
    }3 G. Z7 }( W2 [
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)9 g% N% i% T& ~. h( }* f( q: e
    {8 A9 `7 |, C; S, L
    int i=0,j=0;
    % n. W9 A2 l0 j, k; Zfor(i=1; i<(*storage).proNum; i++)
    ) M7 i! {, {: }- ~8 q) ?8 Y9 m{- E$ E" U# F2 w8 b
    if(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime))' _8 C3 }# G$ p$ O1 N
    j=i;
    " q# ^: J' s4 W}+ r* l2 e& Q, h6 z
    if((*storage).p[j].askMemory > *spareMemory)) p6 B( `% b8 w/ h7 T8 U* z
    {) M& _1 U) i5 ^; i% L
    printf("The memory asked is overflowed than the system memory.\n");! O0 [+ p2 A, V" j/ r& \: Q" ~. X
    exit(0);3 N) _' q/ o/ r" u/ j: b
    }8 V* [6 u" a8 Q3 A$ U2 U. _
    else8 j& k, @8 L$ z
    {2 o/ Z6 N0 ^  O' P# p: v
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;
    1 S4 r. [) L0 g" Y, A: o3 N(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
      n1 F" n, l) F(*memory).p[0].computeNum = (*storage).p[j].computeNum;6 F* q) J9 F5 D+ p! H* p+ H7 ?
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
    $ y( l2 u5 R  F$ F(*memory).p[0].processID = (*storage).p[j].processID;
    5 c  f3 m$ l1 l& T(*memory).p[0].flag = (*storage).p[j].flag;( ~" b, S+ {  c6 ]+ P
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;
    2 R+ j3 L! Y2 c. L* g(*memory).p[0].computeTime = (*storage).p[j].computeTime;
    8 i9 K* J1 U9 I) q; X3 ~3 Y* e(*memory).p[0].runningTime = systemClock;
    4 D' X0 T# B9 F% @* r" [; p(*memory).p[0].produceTime = (*storage).p[j].produceTime;# o% Z" ], n8 |3 S# ?! O
    for(i=0; i<(*memory).p[0].ioNum; i++), _$ @$ D* n5 _  `9 l, @# v' V
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;$ O( V3 p. {! @) o5 [! D
    for(i=0; i<(*memory).p[0].computeNum; i++)5 S0 {1 D, q; O
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;" m: y. @! V( j2 n& \" j9 u
    (*memory).proNum=1;
    5 P+ U* z4 ?" ]% I  _*spareMemory = *spareMemory - (*memory).p[j].askMemory;
    % x( a/ a( C) e4 i' h+ Aproduce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程' q, |8 d* j4 D) x% v
    MAX_COMING_TIME = (*storage).p[j].comeingTime;
    $ e4 h7 t/ {7 {- h2 }}6 D4 w6 Y+ ^" R& J
    return 0;! R" N  _: @, ~8 H9 M( U
    }
    , ^1 `- ?( ]3 ~1 i/ E+ g+ }8 b3 v( nint TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)6 x, y! h5 J; t+ Z- j% y( B1 r
    {& m+ }9 T& b5 m
    static int compute=0,waitio=0,change=0,clockSegment=100,poi=0;
    5 S; k$ A! N+ O  h6 J+ Y, istatic int computeLast=0,waitioLast=0,changeLast=0;
    : z( I/ y6 E3 L) V8 I7 Z# A. Yint i=0,j=0,k=0;  d) U  K6 b7 ]  K1 }) K3 \8 C
    if((*memory).proNum<=0)
    / l9 g9 k- _4 m. g  s" }$ X6 i6 |TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);
    . I  [. N" r% q) P7 Sif(draw==1)$ ~5 k! f( a8 O( A- Z# V) \* A' {, ~5 H
    {6 \3 C8 m; }) M. L, h) p4 \# [
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);. L' _+ }0 Z  E# D2 U
    drawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);, ^( a  N: \8 @6 W' j
    : t% r+ }+ y0 u- P# O7 f
    ) N4 S5 s1 v2 H( d1 N7 M$ t9 M7 t
    computeLast=compute;
    7 L4 }5 [3 O) @( x4 ?waitioLast=waitio;, G  m0 v' W1 p: u% D
    changeLast=change;
    9 F, z  u- k! ~+ l% d}2 v4 D8 m' q. ?* V
    if(poi>=(* memory).proNum): _7 Q7 b/ j. O% S- o* ?8 j- B
    poi = 0;4 I" \# ^, z( v+ g; K. Y4 G5 x
    if((* memory).p[poi].flag==ready)
    0 b' I' x; z8 H( S% |6 Y4 ~(* memory).p[poi].flag=computing;  \# b2 z; Q( C0 R1 j& T
    if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing)
    $ N0 H( w, Q6 k{) f" R7 U% O7 x) l- O
    i=(*memory).p[poi].computeNum;
    3 ]+ U" W; W, M5 ~if(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed
    4 K: S% S: {) m{
    7 z5 [1 R9 R2 ]3 b! s(*memory).p[poi].flag=IO_waiting;  G8 C  L( Z& e$ L2 N& t
    (*memory).p[poi].computeNum--;! U5 \  m8 J  }- ]
    change += exchange_IO_Compute;8 B2 H& w, X+ M' Z8 n. c# b3 s$ u
    compute++;
    ) @5 q' _4 L% Y3 b}
    7 y+ o* g) x! Q3 b) ~! L* Telse
    ) I5 W6 z# r+ t+ H{' i+ v# F/ b/ w; l4 p/ o- p( n
    compute++;4 q# c& H% ^4 b- z0 A0 {  U8 D# \
    }
    " v& q) v( ]; }4 k3 u}
    / ^  x. Z2 B3 M7 telse if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)
    ' N0 y) ~; ^& j+ y{* v+ v. K) j' O" O; r/ l" D% j
    ' m' a4 w3 b# D2 {1 D3 ~
    i=(*memory).p[poi].ioNum;! J( z3 G' j1 ^1 I5 u$ m! L) }% x
    if(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed( y0 k; C1 `$ v1 |( K( S  |$ o
    {
    2 v; J- y5 a1 B' d; m(*memory).p[poi].flag=computing;% O+ N" n/ Y7 a- S, n
    (*memory).p[poi].ioNum--;
    ; R6 p% ]* @: [( H% K; U: s4 fchange += exchange_IO_Compute;
    % t9 M$ ]7 {# N' n  a% Swaitio++;
    3 h) t4 n) r/ C* a- Q4 X( ]}5 O( q5 G/ V' I' K# Y
    else
    9 y7 g. t8 I, o& t{
    / u- m2 p5 {# Y0 pwaitio++;
    ' G7 A& u- D' s}
    ! S5 r" Y; h0 M7 a}$ U3 V& X  c* E3 i7 t
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)0 T: U$ k, D8 O% W
    {: i2 w3 k- u/ B% m' c
    (* memory).p[poi].flag=IO_waiting;$ c1 ~7 U" I  w+ \# B# F5 B8 M$ G
    change += exchange_IO_Compute;. ^2 @# d7 }, z7 i; O- H
    }; d9 W$ v! B' k8 o, o0 f: s
    else if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting)" g& Y6 @2 b4 Z7 s5 u
    {1 g  @+ O( }# h
    (* memory).p[poi].flag=computing;
    % H7 j( h7 }$ [) J  r6 Ochange += exchange_IO_Compute;
    $ g, V- i8 |; N' x$ _5 I}
    1 q0 f0 s+ ~5 K: e  k1 qfor(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进+ U( G* B7 e5 j. c8 M
    {4 G2 Z( a( b- B- S
    if(i!=poi && (*memory).p.flag==IO_waiting)  p/ r" B8 D* k1 X
    {
    3 I& H. V0 m( q  x/ R9 Ej=(*memory).p.ioNum;
    5 [' `5 q% V3 O1 oif(j>0)0 _" o( B9 z9 Y: u/ ]) s
    {
    6 x6 T2 W; q2 E7 F# Wif(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed
    1 k& y6 `( L1 ?) r/ g! c: v. |# B{4 q' B6 s' M+ B' P8 W
    (*memory).p.flag=computing;" f, n: M0 O( @2 a# P0 g7 q
    (*memory).p.ioNum--;
    # S% z; P/ J* T! y. nchange += exchange_IO_Compute;6 x7 Z: U- g5 {2 w! K% H& k
    }8 E7 A5 S: T4 _4 J+ O& r3 U$ @
    }
    9 c' `0 [; ?( O}, e8 B' ?5 s2 D8 b5 K# c
    }$ ~! Z: n9 Q& Y! O2 n" O3 {4 q$ ~. z. X
    for(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程& [8 _  Z" O0 K; h& P
    {
    $ Z# o* v4 N# h& fif((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed2 W  o8 b( \1 T; c2 c) h1 J
    {
    ' a0 e9 n$ B/ \6 y(*save) = (PCI*)malloc(sizeof(PCI));+ o# ]; v! C4 `: D8 b
    (*save)->next = NULL;
    . Z2 T# v0 p2 C       (*save)->processID = (*memory).p.processID;' b. u: l6 l3 V1 m: J. H+ y
    (*save)->comeingTime = (*memory).p.produceTime;8 B) V% e  Z2 j2 B
    (*save)->askMemory = (*memory).p.askMemory;; T/ S1 \- t+ l% K) G5 U+ h! C# M
    (*save)->compute = compute;
    ' |" k$ X1 O+ t4 X* U2 y4 |  W(*save)->waitio = waitio;
    * N+ o& U; Y6 }6 j, ?$ r(*save)->exchange = change;1 [- ]2 W( f' J' s) d& n, i
    (*save)->completedTime = systemClock-(*save)->comeingTime;
    7 {% O8 r" \+ ?6 s(*save)->runningTime = (*memory).p.runningTime;
    - ^. w& S, d) J# {(*save)->completedTime = systemClock;
    ' s, K* t  ^+ h; p1 d% K*spareMemory = *spareMemory + (*memory).p.askMemory;  _) L8 \9 B9 K! B
    compute=waitio=change=0;
    8 x( X+ H: |, m, |" McomputeLast=waitioLast=changeLast=0;" @! d5 ]' f* ?& K8 g  ]4 O
    if(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入
    ! Q+ Q  b, h4 |4 S{
      u, s$ b# s, G0 ]2 g8 b3 aif(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程& ~+ R" S' I8 d0 I. [% J1 Z7 z
    {
    5 d0 X3 i5 ]; p5 @3 Zpoi++;' T& H" s. G' m. ~! D
       clockSegment=2000;
    . N5 X7 v" B/ M, _* O$ M7 b}  J+ Q' t) p; S# Z
    }
    3 s8 H- s- F. f8 O! W2 Helse  //没有足够内存调入新进程; z3 Q9 y" t2 e9 |  ~% w
    {
    % F( ?, L0 Z# p1 C" ~9 xif(i < (*memory).proNum-1)
    1 e+ T. w8 B; p{7 y3 A" [' M5 c4 l! z: m/ E9 B8 D
    for(j=i; j+1<(*memory).proNum; j++)" W2 ~7 W  N$ a- z
    {
    ' Z' J; V. u4 R2 k(*memory).p[j].askMemory = (*memory).p[j+1].askMemory;
    2 y  ~# {' A4 w/ _9 A# B5 O(*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;
    + O3 a" [, J3 a: Z5 Z3 v  t(*memory).p[j].computeNum = (*memory).p[j+1].computeNum;* f# v' i) ?* _' z4 D
    (*memory).p[j].ioNum = (*memory).p[j+1].ioNum;" j/ {' x5 i8 i& u6 f1 `' n
    (*memory).p[j].processID = (*memory).p[j+1].processID;9 }! E" }8 V* m3 }7 p2 x* h! {
    (*memory).p[j].flag = (*memory).p[j+1].flag;
    , J( P" a4 Z3 ]5 z(*memory).p[j].ioTime = (*memory).p[j+1].ioTime;' o* o7 E5 C5 T# ?5 g. e- H
    (*memory).p[j].computeTime = (*memory).p[j+1].computeTime;- c) F, v% V- X& X
    (*memory).p[j].runningTime = (*memory).p[j+1].runningTime;+ U) n9 \: m9 T# U; g- ~
    (*memory).p[j].produceTime = (*memory).p[j+1].produceTime;8 ?9 M+ ]/ C5 w- `
    (*memory).p[j].completedTime = (*memory).p[j+1].completedTime;
    " g! V( [) S* T6 D4 Rfor(k=0; k<(*memory).p[j].computeNum; k++)
    ' }* x( ^" K9 K4 N9 r) Y5 Z(*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];  [5 M% G! F' |3 i
    for(k=0; k<(*memory).p[j].ioNum; k++)* w" [. \/ w" B) H" R, Y9 x
    (*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];
    0 R0 y! r. |2 }/ Y4 A. d) @" ^6 O}" Q$ q5 \. A' j; b4 _& e# d
    if(i<poi)7 X# T1 w/ H" g
    poi--;' `) v- B3 q* o: N* z
    else if(i==poi)
    # f) v6 e- p# E4 o* n8 w# W, U- ]  ?clockSegment=2000;
    ; [4 k  a% L* _6 l( `6 ]}8 i# P) d7 A# H, x% \% H- g. u5 C
    i--;, o) X, z- m* {
    (*memory).proNum--;
    / m6 ?) a5 u+ ]# [}$ H! @( [. Z" z: X
    return task_completed;  w# ^  g  }& M( p( H
    }
    5 ]$ V6 a; B! D, V}' h& Y; c6 M+ _& e$ I
    --clockSegment;
    , b4 d9 \5 w. nif(clockSegment<=0)- G9 O3 J/ J; p% C
    {$ R6 o( w6 h5 ]9 N
    poi=poi+1;
    ( B' d5 d; ]$ qif(poi>=(*memory).proNum)
    4 a- J" B# K- u; N  c' i- zpoi=0;! B( ^. O' }& D
    clockSegment=100;
    ( ]8 u. o* V' |6 h" D5 v/ {" F& g}
    : c# \; F0 \4 F+ g- Ereturn task_not_completed;
    - p' _  Y/ g( q. j  _3 i}; e) C% p; n1 b- L7 N
    int TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos)% R8 n* V# o: E1 O! T, {, }
    {  j- c- f! j% p; e; l
    int i=0,j=0,k=0,flag=0,translation=0;
    5 `7 K8 M* R7 X* m8 ~2 A: Efor(i=0; i<(*storage).proNum; i++)
    0 [0 T/ {' y* A% [; r) f! z4 U/ d{
    6 @' x( l2 g; w0 Z& Z  b- bif((*storage).p.comeingTime>MAX_COMING_TIME)
    ' D, t2 z+ G6 ?& U+ s  f5 e3 @MAX_COMING_TIME = (*storage).p.comeingTime;
    * L# |$ ]6 A: {! ^9 u& R}  r( u( {* [* h% S# x$ x0 N
    if(pos>=0)
    . }" b* @  A3 i2 N* k; w! d" h{
    : j. a' t+ ~* B' o0 [1 {" Efor(i=0; i<(*storage).proNum; i++)
    0 g* c) `5 n% b! F{
    ; E  R+ ?: n! A: P5 h" h' tif((*storage).p.askMemory <= *spareMemory)0 s2 k9 U! _4 d. P( b6 d' w+ k
    {
    # v+ o! k, ]+ ]) R$ hj=pos;. E/ k0 g( @, r, ^
    (*memory).p[j].askMemory = (*storage).p.askMemory;: J0 Y1 w  K# W
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;
      p2 ?0 K% w- H6 A- L5 v(*memory).p[j].computeNum = (*storage).p.computeNum;4 D/ {: ?1 j+ T* H
    (*memory).p[j].ioNum = (*storage).p.ioNum;
    / U' y1 t$ ~' ~+ b  J$ K(*memory).p[j].processID = (*storage).p.processID;
    + |% S: d; B& W$ j% x; i+ K( \(*memory).p[j].flag = (*storage).p.flag;
    . `/ w* I5 q; V9 w3 v* Z' f(*memory).p[j].ioTime = (*storage).p.ioTime;
    - v1 ^. h0 F5 z(*memory).p[j].computeTime = (*storage).p.computeTime;
    4 L( z8 r  b5 M& Z(*memory).p[j].runningTime = systemClock;
    2 u; B$ {1 T0 K(*memory).p[j].produceTime = (*storage).p.produceTime;, E1 o+ Q) O$ E1 @7 |
    for(k=0; k<(*memory).p[j].ioNum; k++)
    . ~+ g) r0 q: m/ j* a9 }- Z(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    1 N1 L9 n1 j3 [. O6 a- Dfor(k=0; k<(*memory).p[j].computeNum; k++), C0 ]9 c' ]7 Y1 M( d; v
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];
    " C& S0 H  N( ^. k' Z5 ^*spareMemory = *spareMemory - (*memory).p[j].askMemory;
      A9 I5 x" |5 B! ]+ R0 O' f+ H2 Xproduce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程  q+ t4 m3 m2 ^* P2 N
    MAX_COMING_TIME = (*storage).p.comeingTime;4 k+ \& Z' |# r% X" x
    translation=1;
    5 `; f. ?+ X% n# O  X/ cbreak;7 {: r& a, f' ]: j0 R
    }4 x& M* \/ l2 o+ s2 I8 d
    }
    / Q# E* {/ w  g3 R}  A; J7 o" h& ?( T$ g; }; a
    else1 F7 e) T% \+ Z& g* q
    {
    5 p; k. K- |/ @/ q, m) b, |- dwhile(1)
    8 r+ F* G- Y' X  U1 [% r  D{. t/ _: r7 Y/ T7 ~4 S$ q
    flag=0;! g8 K3 F4 D8 R- U
    for(i=0; i<(*storage).proNum; i++)7 d4 ?* U" O: W, t" t
    {
    0 {" a- U* Z9 `( w- r5 c) c0 K2 fif((*storage).p.askMemory <= *spareMemory)7 F. t* V  g$ P( @0 p9 _, ~; U
    {  \/ k; K: N& C) k
    j=(*memory).proNum;; c2 w" J3 k6 {' \1 V' w& ~* N- D
    (*memory).p[j].askMemory = (*storage).p.askMemory;
    6 b! k0 Y' t) t1 h  {. w(*memory).p[j].comeingTime = (*storage).p.comeingTime;
    % E. z; e( j8 K# i/ \* a- Q(*memory).p[j].computeNum = (*storage).p.computeNum;, k# g) }0 h/ M1 A# Y, V0 [" a
    (*memory).p[j].ioNum = (*storage).p.ioNum;+ U# t! A8 a! E- J2 r( G: [
    (*memory).p[j].processID = (*storage).p.processID;
    0 k" V- p& _, Q1 S; {(*memory).p[j].flag = (*storage).p.flag;
    0 j7 e5 w8 [- Q7 h/ G0 c% v( w(*memory).p[j].ioTime = (*storage).p.ioTime;
    # a# `! a5 B2 d8 p9 b* f(*memory).p[j].computeTime = (*storage).p.computeTime;9 F3 O( C  `  H( E! {) t
    (*memory).p[j].runningTime = systemClock;
    * H" G: \! C6 j; m- V, b. r% E(*memory).p[j].produceTime = (*storage).p.produceTime;3 R$ s/ \/ n9 q% k- h% h7 }
    for(k=0; k<(*memory).p[j].ioNum; k++)
    ) e* @' n5 i4 Z) M3 P7 m0 @6 X(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];2 S% X2 c0 N& I: E
    for(k=0; k<(*memory).p[j].computeNum; k++)
    ; I0 r$ ~+ r/ I* Z* T8 N  O4 W(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];
    7 T) X: L& d6 @, \7 W(*memory).proNum++;
    4 i; e) Y9 j  y6 s*spareMemory = *spareMemory - (*memory).p[j].askMemory;
    7 b+ {$ g; b" A' @3 P" i7 L& zproduce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程/ G& Y# L/ `5 n; V  c- y
    MAX_COMING_TIME = (*storage).p.comeingTime;4 _, L3 L; D, b% w, i% R
    flag=1;
    . |5 H5 A) x8 x/ r. z$ btranslation=1;
    6 g6 A( ^) k; A) v, O, [9 }1 B}
    8 g: j5 |  f6 z8 N# m. C}9 d, V! d; K& E( w
    if(flag == 0)
    ) o- k7 y" I+ vbreak;- R  n3 p, ?5 V( I
    }& Q& \2 P3 d2 f' l; @
    }
    / ]$ z; t' ~3 {7 Q9 A7 qreturn translation;
    : [# i' i) ~$ e. ]: e}
    / D0 F( v4 `0 J- e# ]+ J- c5 Tint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)) R! M) {) w2 @5 E7 W  B
    {
    * v7 a* @6 I' k' I+ sstatic int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;
    3 @  Q( M6 k1 kstatic int computeLast=0,waitioLast=0,changeLast=0;
    7 j0 [6 [) g( G2 Gint i=0;" d6 ^1 @+ S5 a$ U$ O  v
    if(draw==1)6 n7 |. N8 C4 V. S+ A3 T
    {
    1 f3 ^1 I9 Q$ Q+ |& H- ^2 p//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    # ?, g+ }( A5 q* s4 @drawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    2 X$ b+ d- A! k$ }/ h9 A: t- w& B6 ^4 o, ~) N8 ^& `
    , B* j& e+ F1 R( D
    computeLast=compute;3 q$ K  l4 _' i( P* e
    waitioLast=waitio;( W& u; b0 q$ V" r, L" V/ H: d& C
    changeLast=change;+ }' t- C5 I2 T: \2 x! V+ p
    }
    6 _5 _3 P: y8 W  v9 `# {3 Kif(flag==1)  6 t  O3 L/ D/ a3 l- U. ]
    {
    * O+ @$ [# u" _. |% u7 n  g' ~if((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed
    2 f6 N( O, p% i* a{
    % {, A8 o/ T9 F4 A+ aif(flagiocpt==0)   // implement compute
    , z0 O) d$ P1 }' y8 }  v7 }{5 U2 y/ Z( n9 m/ E& _0 s
    i=(*memory).p[0].computeNum;8 n0 |5 x8 m2 P* B
    if(i>0 && (*memory).p[0].computeClock[i-1]>0)) d0 U" S1 C2 Q
    {0 H' Y$ w  X5 d  J( w
    if(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed
    - t2 R; P6 u( r0 E8 U( C1 |, ~{) N) J( j! E. _4 ]9 ]
    flagiocpt = 1;! V& o2 \$ I) Z( {; R9 R4 E. h
    (*memory).p[0].computeNum--;% e- @( y* h2 L2 k9 X" o$ I
    change += exchange_IO_Compute;
    5 M& W" y8 Z7 ]% e# ~: mcompute++;3 D( C+ B, C, I1 y- E
    }
    $ Q+ u. p* H0 welse
    6 r7 `1 v  Q) b9 n: R. k4 [8 @compute++;3 O$ H: X4 i. v2 i/ P8 T

      R2 T  y6 u& u  G% c  w7 b6 R}
    / ]! o% E' _8 Q' melse
    ; O1 p$ {. J7 z5 H1 C; {; xflagiocpt = 1;
    7 J/ T; X6 H# }6 p}' Z/ D, r, f' k" i  |
    else  //wait io" p# V( O: \; p# A
    {+ o) n+ X2 V- c# [  `
    i=(*memory).p[0].ioNum;
    2 w; L7 |, I6 ~$ T1 D# T& Vif(i>0 && (*memory).p[0].ioClock[i-1]>0)% Y: p1 f: N5 b& U/ x0 `
    {4 d2 F: p6 i0 t0 p: x% a9 ?
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    * \3 s8 V; F6 i9 _7 U: B{
    3 \. S  M( e( _* N% |4 [! sflagiocpt = 0;
    + I* G! ^) ~, M4 h; U/ M(*memory).p[0].ioNum--;. U  X: G7 |& m, C3 t
    change += exchange_IO_Compute;1 p: i. \7 C1 O& ^& k3 q# c% p, R
    waitio++;
    7 m0 a& _. U0 `. t9 F$ O0 w}5 g# |9 [  x: S& |' {
    else* E& j7 g) O1 L; S  E6 h2 y4 }0 f+ ?
    waitio++;( q! t. X( }( _2 t0 x

    % R! ?' C5 f, }8 U, R}+ ~  x' M# S7 ]) r: n/ w
    else
    ) @+ m! w$ S2 G3 sflagiocpt = 0;: ]# J2 g' ~9 ~! R; O8 l
    }# ]4 ]5 t+ `9 \) V# E
    }
    ; ~1 ^* g# H  Y  Z6 A: ~1 W8 l. Zelse  //task is completed  \$ }% y; P% A6 U
    {
    + m1 V% j$ A' h2 @3 C& V3 g( A(*save) = (PCI*)malloc(sizeof(PCI));3 }2 i  ]0 P% u, q' O: t6 O
    (*save)->next = NULL;5 Z5 d0 `# I; z
           (*save)->processID = (*memory).p[0].processID;0 X) T" ^* f2 P% R$ C% M9 Z$ @
    (*save)->comeingTime = (*memory).p[0].produceTime;# a, ~6 G. H3 ?$ I& s+ s$ O: R  H" N
    (*save)->askMemory = (*memory).p[0].askMemory;
    0 H6 ?% E! W' |" M5 W7 i(*save)->compute = compute;/ Q4 U* ?- ~! n' ~3 E) B
    (*save)->waitio = waitio;
    0 S) }- t' a  g(*save)->exchange = change;
    ( Y- z2 q, V- d/ C  ~(*save)->completedTime = systemClock-(*save)->comeingTime;
      c1 K- b6 g' \* v7 X- \4 R(*save)->runningTime = (*memory).p[0].runningTime;: w/ ]- C9 H( Q( H1 i8 ]5 Q
    (*save)->completedTime = systemClock;7 E5 B. z! d; E6 b, c- m7 x
    //*spareMemory = MAX_MEMORY;/ G2 g, a8 N5 \
    free((*memory).p[0].ioClock);$ x" ?, T% z4 V. i4 q" a
    free((*memory).p[0].computeClock);; b6 o6 I/ |3 K& J+ q
    free((*memory).p);
    3 \- i0 W6 k8 x+ }% p: uflag=0;% Q8 B+ N) o* J$ L- J
    compute=waitio=change=0;
    8 k" |* _3 |* g% QcomputeLast=waitioLast=changeLast=0;
    % ]1 W, L  O+ I7 }return task_completed;
    ( L+ ]  i5 |/ g7 Z' A" V6 b% C}+ G' Z& h- }5 [/ s  _( d; e. G
    }
    ( F( ]4 |  G2 k3 ^/ p$ }1 g0 Aelse         
    3 ~9 J+ w# l2 Z" H( C{% S- C: P$ U  C, a2 S7 t+ m
    FIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));
    4 U% z+ P* i6 a! |% W4 Ychange += exchange_process;
    9 X3 R' d* n' ?8 L, C" D//*spareMemory -= (*memory).p[0].askMemory;2 |. Y' p3 i, ]% j0 F
    flag=1;
    6 S* r+ v$ z/ S- T+ h//showProcessInf(*memory);# P1 R) b/ L- a5 g- x5 A- j8 \
    return task_not_completed;
    + N/ ], T% y4 R' O( D}
    2 [0 ^/ O+ |2 S6 k8 \- d4 b: }return task_not_completed;
    ( I) k. F+ ^2 ?* v4 I}" N3 Q" y- V5 K  B) c/ C
    int FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)
    5 p7 x9 x9 u+ `4 }  W{3 T! E2 I9 c( m6 U
    int i=0,j=0,k=0;. I6 b: `# ]/ k1 ?8 \8 d! r/ K
    MAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;* o; L  l: K4 w, z6 |
    (*memory).p = (process*)malloc(initProcessNum*sizeof(process));
    % K1 k7 L  M( Zmemory->proNum = 1;; P! l# U- x* P4 @  K% H; R9 K
    for(i=0; i<initProcessNum; i++). z" g3 ~" Q3 V) Y  z
    {' Y7 l+ n4 q6 g, D0 x; V5 d
    if((*storage).p.askMemory <= *spareMemory)
    ' r+ X% e5 d. o# X- D% N9 U5 a! J8 ?{
    , v0 n: Z. M: U+ G; T9 N(*memory).p[0].askMemory = (*storage).p.askMemory;
    2 k" o+ T( K/ v(*memory).p[0].comeingTime = (*storage).p.comeingTime;6 q% g7 O4 _/ c1 t# k% Z7 I
    (*memory).p[0].computeNum = (*storage).p.computeNum;
    , ?2 I7 j1 W1 b$ [8 p(*memory).p[0].ioNum = (*storage).p.ioNum;
    4 |7 ^+ W+ Q" N! t# ]0 Y8 T* ?(*memory).p[0].processID = (*storage).p.processID;/ s6 \( u. h* z, z
    (*memory).p[0].flag = (*storage).p.flag;
    + U8 ^  a0 y; K4 I& @(*memory).p[0].ioTime = (*storage).p.ioTime;
    $ R+ Z! r2 H7 Q9 I(*memory).p[0].computeTime = (*storage).p.computeTime;
      W3 [8 o' c+ `( [" {1 o3 s6 e(*memory).p[0].produceTime = (*storage).p.produceTime;
    ; E* i1 ?4 ~7 Q* R& j(*memory).p[0].runningTime = systemClock;
    " j' T  M& ~9 T: M(*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));
    : L5 }# l" z+ k: i* T! A(*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));
    " r6 }  g5 L# M: C# Jfor(k=0; k<(*memory).p[0].ioNum; k++)
    & l, a0 q9 U; `$ U* I9 R; I(*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];$ _# M( H! _" ^* F/ M! j
    for(k=0; k<(*memory).p[0].computeNum; k++)) Y+ R1 y8 p0 t! ~) m2 E! p( ^1 V
    (*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];
    0 F1 c) Q; c3 j# d. N# f" Fbreak;! U  H$ ]9 [9 D7 z/ P
    }
    3 ]. E/ h0 y6 g: _6 T7 I& p9 b}& |3 z3 @2 E6 E9 _3 G, c& f. r7 K
    if(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入0 i/ ^/ M( H" @: [' b
    {
    ) C% r1 j( w* Cproduce_one_task(storage,i,ID_FIFO++);
    7 _3 {" W% j! m- r( C5 {( V8 wMAX_COMING_TIME = (*storage).p.comeingTime;' P' m) I% x2 s0 S( o  f7 w
    sort_by_comingtime(storage,i);3 Y, q0 i2 M: b
    }9 T6 j# B+ ~/ G5 p0 n, n4 ^+ K7 o
    return 0;
    : s6 E- \2 E- S$ _# q$ Y: k4 K}2 L- _: E4 g, `9 _
    int sort_by_comingtime(processPool * p,int pos)
    * a4 R* I9 F! f8 e2 i{
    & n7 j9 d# n$ f+ Q( \: f3 }int i=0,j=0;
    7 N. |! F; V- a& b/ ]7 s/ ~process temp;" o; T) o& ?9 x$ W& U+ E1 f2 N1 s
    if(pos<0)5 h, t) d5 }0 l2 _8 u
    {
    . H3 C( w, t1 Z% v& z8 @" d4 Lfor(i=0; i<initProcessNum; i++)9 ]0 W6 c2 n3 h
    for(j=0; j+1<initProcessNum-i; j++)7 `# M* {  }  p0 u  P2 ~! L- W
    {
    3 L1 y+ `2 L  K% J1 [9 {6 P' H* Cif((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)
    - ~. ?. m8 g4 M* Y# [8 y3 V1 Z{: Y9 _- b) S: l5 I# g/ r1 d
    temp = (*p).p[j];3 I7 R  _  G( j6 `8 K
    (*p).p[j] = (*p).p[j+1];
    ) p4 u+ R: P  x(*p).p[j+1] = temp;
      s! _: j; O# ^}4 P) A. b$ `$ i
    }. o% D1 [% Y- K2 t% H/ U0 d+ {
    }) G- h) R' Q- h+ t% w
    else if(pos<initProcessNum)
    1 F2 p$ a% |$ m% ]4 g6 j4 v{
    2 }- H! j$ U+ R' t, @  Z( zfor(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--)7 I9 V' n7 O, k6 w9 R" c
    {
    ! h- W$ q6 u4 @$ c2 @5 u! }7 |; @) Gtemp = (*p).p;/ O, t. P$ }" T& o; J9 J- K* {  R+ V! N
    (*p).p = (*p).p[i+1];3 J4 U3 @% P. q$ a) j* L( r
    (*p).p[i+1] = temp;- s5 x% L+ F) y  R1 K
    }* ^, ~0 ~" O5 J  E
    for(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)
    2 A6 m6 u' ]2 Q/ t, a& m{& i* C+ c; s" D
    temp = (*p).p[i-1];
    ( h3 a, m7 @- [/ @  q9 G) ^(*p).p[i-1] = (*p).p;# ^, u6 ^0 D; f2 E6 c$ L8 @2 z
    (*p).p = temp;, J, {/ \  m9 y3 _6 v
    }
    ( w& \0 _: g! L7 A$ _' T}
    * Y4 ~9 @7 Y- G. H0 K4 t: \- felse$ ~! P! f4 a3 [# A! v
    printf("position eror\n");$ X* V5 s! Z/ e: ]- n6 z; p  u. ]
    return 0;' y1 o8 ~4 S/ k+ \5 h1 r5 z: b
    }
    / y3 k: q  s3 y: h" _0 {  {5 _% Sint InitPool(processPool * p)! W! K4 m% \, ?7 r% Q" ?& @, _4 F
    {; s. X9 M7 T" `! A% M) J4 x3 m" `
    int i=0;
    " }0 j; F+ ]( N' n(*p).proNum = initProcessNum;7 O' v$ b6 v/ k; J
    (*p).p = (process*)malloc(initProcessNum*sizeof(process));
    4 U: o8 T3 w: Tfor(i=0; i<initProcessNum; i++)                                        //init process information
    ! _( u+ d; D) n- r  O$ z8 y+ g{
    7 B4 z: D/ l0 b% @- I* P6 U: H9 ?- m(*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));3 W/ r# e" d8 B! T3 {" }
    (*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));
    * n1 z" D# w% u! g; |produce_one_task(&(*p),i,ID_FIFO++);
    / V' v; \9 f0 D9 v) L( C- J}" O2 y" j2 A- r% y! N$ U
    return 0;+ |! m$ G# Z$ q7 D1 X
    }+ h+ k9 T" W2 d" D
    int produce_one_task(processPool * p,int i,int id)8 g% x( T/ v! u- z+ _
    {
    , O. n4 S. i/ Dint time=MAX_COMING_TIME,j=0,totallTime=0;. M" }# S1 b% T# j( F
    (*p).p.processID = initProcessID+id;           
    * B3 {8 P3 m; {3 W(*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);- p- }, }0 g/ V
    (*p).p.produceTime = systemClock;* r" w" z, I. |$ _
    (*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;$ P& t- P: p& ~' \; f( s
    (*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;
    ! M9 z. y, F3 q$ a- C$ X0 DtotallTime = (*p).p.computeNum  + (*p).p.ioNum;
    9 @4 u: Q2 `; t3 N5 F5 S, ?8 y8 o(*p).p.computeTime=0;/ d, ]/ k8 O4 ^% C# I5 t( u( |
    for(j=0; j<(*p).p.computeNum; j++)$ p& L; y5 l# @* [# L
    {2 H9 @: o1 ~& U3 t$ Y* M" V
    (*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;: Z9 `9 e/ T1 H: _1 K
    (*p).p.computeTime += (*p).p.computeClock[j];: d- e, q  H( O3 g% _
    }5 t4 x  \* _+ G! r/ z( q  @
    (*p).p.ioTime=0;
    & d2 A0 o& H1 ifor(j=0; j<(*p).p.ioNum; j++)
    9 T* i' M/ B- d: D- Y{3 `7 n+ E4 @3 Y8 m
    (*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;1 T) |, D- |: Y/ A7 f3 m
    (*p).p.ioTime += (*p).p.ioClock[j];" `, r! u4 M+ {% Z
    }
    ! D5 o; k5 w/ X* u9 \& }(*p).p.askMemory = rand()%(MAX_MEMORY/4);/ K8 J2 ]) _, A+ X) W) U+ \
    (*p).p.flag = ready;
    - |: t" l% ]7 r2 S5 V/ i0 Creturn 0;
    0 I- O0 x+ p1 m) r}
    9 B0 T7 Q. ~# f. ^2 I) n4 V$ |* ~int showProcessInf(processPool p)
    ; D  {0 y7 T0 \9 E8 k{2 i3 w" u6 L2 O! P
    int i=0,j=0;
    # ~2 A! x, |! c9 B& l- i3 b7 Zfor(i=0;i<p.proNum;i++)
    2 G' W' P2 _* M. p) I{
    1 D& H/ Y0 D5 t( X7 Y; y( T* Xprintf("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.computeTime8 I' t6 H( f2 M2 U
    ,p.p.askMemory);1 B1 ?3 M! L' B. z5 o
    for(j=0;j<p.p.ioNum;j++)
    2 F  Z8 M' W$ w7 Q0 C8 j4 R8 z1 v{/ Y, ?9 @0 f* g2 k8 d
    printf("%d ",p.p.ioClock[j]);0 Q; p! e, v) y) @
    }# h: C+ L9 P9 n: ]3 e5 R/ c
    printf("\n");$ X: y! C& c! X5 F8 B
    for( j=0;j<p.p.computeNum;j++)' Q$ p) h5 k7 y; `$ _8 N
    {
    7 Y, t  k' _# }+ n1 J* _printf("%d ",p.p.computeClock[j]);* E1 _, I. J( d* C
    }
    ! f5 `  c8 x; Y. {; v+ ]0 rprintf("\n");
    ! [0 K; b8 v8 @}8 V% t/ I) d$ a( G' T6 W+ E
    return 0;
    5 q+ X1 d, [, T+ `" D6 L$ s) \}( X+ ^2 o5 n3 Y4 X
    ————————————————
    # j6 ~0 K* T' b9 z( E版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。* W/ ^1 w+ ]" h& _& r+ B
    原文链接:https://blog.csdn.net/wang_dong001/article/details/47843519' S& ?# D/ i9 B) l

    & U' R# k$ x2 y3 ^- P# R7 W
    8 P9 q. m; Y3 I: y/ e; H1 z# l
    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

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

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

    蒙公网安备 15010502000194号

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

    GMT+8, 2026-6-15 03:24 , Processed in 0.519386 second(s), 51 queries .

    回顶部