QQ登录

只需要一步,快速开始

 注册地址  找回密码
查看: 2530|回复: 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
    . m' M9 t9 _' j* l$ j% p0 }
    经典任务调度算法的模拟程序
    / {1 r2 c- K, e2 a% f( U  o! c本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。
    9 v; R$ H$ j0 d+ o3 _2 \  w, r
    7 E1 Q0 R$ Z' N6 j( j编程平台:VC6.0+EasyX图形库环境。9 f) q* |- X2 m- `" T
    4 G/ s, V( v2 l5 E4 E; g% S
    以下截取部分程序运行图::1 S9 h/ d  Z6 n' {$ k2 g( q
    , i  B$ O) R0 ~8 u6 M/ b: F
    源代码:
    ( I1 P: ~+ ^% h3 _. \/ L1 V* s
    % N* y% r0 w  Q5 n% B: d% A#include<stdio.h>
      [( u7 j" J9 G#include<stdlib.h>
    8 V9 ~9 c/ U4 J, H. B" x) t#include<easyx.h>
    + V7 O0 Q- r; Q- p9 |8 M#include<time.h>
    3 t2 w  P; O; a9 L#include<conio.h>' F2 I+ K& y$ q7 Y
    #include<graphics.h>
    9 S& s/ L0 Y! h- I1 Q$ t#define initProcessNum 10
    5 A7 `" ?8 B4 V4 o% M1 k5 \#define initProcessID 1000* `8 t! [4 o& M. ]  {
    #define MAXProcessRunTime 10000
    0 X. K# @3 g) W- u#define MAX_MEMORY  4000
    5 m! j! ?) ?3 G7 _+ n* A- v* e6 y#define exchange_IO_Compute 10
      v1 ~, a1 C( a* d* }#define exchange_process 250 M" m& U+ m& k( S4 Z* |7 r, y
    #define task_completed 1
    1 e: a2 a  v# ^$ c& T#define task_not_completed 0
    & L9 ]# c7 A4 C#define initclocknum 100
    1 C4 Y5 ?3 D3 `# z( f: j6 }% Tenum condition% G! |; g/ ^& g5 c- i
    {$ b; G0 j. i) w% P3 j
    dead,computing,IO_waiting,ready4 V6 X4 x. ?! n8 C2 |
    };" E- o' d1 y0 {" R  z/ s+ ?
    struct process
    4 p2 @$ `0 s- Y: H{
    % w" c8 ~' l( Jint processID;. A* x3 g8 T- _3 B- T0 b
    int comeingTime;
    7 Z; ~" u' }; A& |4 gint ioNum;% ?0 P0 T/ ^+ |% D) D8 R" h$ _
    int computeNum;
    0 P' a' `6 K( |" v- G8 F5 Cint * ioClock;4 ^) g( e( E; L2 Q: j' ]
    int * computeClock;
    7 S! \( M+ ?/ Z) A* M7 gint ioTime;
    / m& \( l/ O  h) r8 ~int computeTime;
    ' [' @0 J# G5 \- fint askMemory;
    & z7 v( O7 c8 C% w8 p" Tcondition flag;! ~! o& S: \) r: z7 H) q3 N
    int produceTime;  //生成时间,以下三个数据成员用以计算相关性能
    : ]4 f2 h. l' M# Q/ I+ Hint runningTime;  //第一次占用CPU的时间/ S  u' e5 D- v; Z' X5 i+ ?
    int completedTime; //进程完成时的时间/ ^, G) Z. }" n: i
    };
    6 V7 l+ M& p3 t2 h) Mtypedef struct processCmpletedInfo  //保存完成一个作业的相关信息
    ! K* y( C% M# z, G$ w: H6 K{
    ; b  I: G1 W# ~# G) \int processID,comeingTime,askMemory;4 k" O% i7 v& l3 r
    int compute,waitio,exchange,completedTime,runningTime;( t0 K$ {6 {% j( D' G
    processCmpletedInfo * next;
    , p6 s) J) d8 F: `* ]( r4 ~8 g}PCI;
    # ~0 ^( o0 d. `! [& sstruct processPool0 Q' u7 a% j2 T% K% }' A
    {$ i1 P$ f2 p& u. F! [1 W
    process * p;
    # n2 Y: m; m  N$ x- bint proNum;. @& T5 O1 B2 N5 R; i, f" ]
    };
    6 E! x3 N. W$ X& [( \int MAX_COMING_TIME=0,ID_FIFO=0,systemClock=0,FLAG_FIFO=0,FLAG_TT=0,FLAG_PF=0,FLAG_SJF=0,FLAG_HR=0,FLAG_show=1;$ u7 T$ E, S$ G  [; m
    int InitPool(processPool * p);
    & `  j- J9 J- }3 C$ i; Vint produce_one_task(processPool * p,int i,int id);- p0 q/ C& }, o2 m
    int FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);* c! n5 p* G& u) f- l& y
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    6 c' @7 Q, K. E6 B" i/ aint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);6 h  k# ~3 w: o. r- D, {3 p, Y9 z7 F
    int FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    8 ~& x* N6 D. t5 `3 }0 m8 ]int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    7 C. X# P, h& H" E, @! _+ xint SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    " R" n4 _6 e/ H0 O1 ~7 b1 hint PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);
    8 N! F2 `/ D2 L/ H& g# n/ Y3 }int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    6 A5 N* g" [( |int High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);
    + v6 f" G) b- X9 C* k8 b+ Y, C: qint High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);# u4 Y, j; x3 ~6 X+ y9 E

    & S7 q" k8 N4 R8 R% q
    ) |  \; ^+ ?' z# pint sort_by_comingtime(processPool * p,int pos);: J0 F8 S9 `6 N5 Q
    int showProcessInf(processPool p);
    ( {0 T; h' H  A! g! dint drawPerformance_FIFO(int x,int y,int memorry);
    8 B- K+ M8 }; D2 x8 b6 ~! @- _* F$ mint drawPerformance_HR(int x,int y,int memorry);
    $ D8 ~  p+ d! N3 H! aint drawPerformance_PF(int x,int y,int memorry);4 q* C4 B. Z/ |9 F7 n( h  i
    int drawPerformance_TT(int x,int y,int memorry);9 I0 e: l% k+ V
    int drawPerformance_SJF(int x,int y,int memorry);8 g+ s9 g( z3 [  ~) B  C$ z
    int MouseListening();7 V- Y' I  C' U$ |- L+ e6 g' w
    int MouseListening2(int *flagShow,int * showTime);
    , j' m* d6 i1 m$ V. X- hint showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);
    " o4 ?& c1 ?8 ?. x# d& V* O3 ]( @
    6 O7 y! U( k: z! ^$ Z; {; o% i" F$ y* ^" a8 u# `
    void main()
    / k+ I" g' n* Y{7 l4 _# g! F. e  O
    PCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,
    0 O+ x  I6 D$ j/ D3 _$ V*Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;/ f. l4 R0 [: f) a6 K
    int i=0,FIFO_memory=MAX_MEMORY,count=0,Timet_memory=MAX_MEMORY,SJF_memory=MAX_MEMORY,Priority_memory=MAX_MEMORY,HR_memory=MAX_MEMORY,
    , K: {' |" K. f( L  |- ^% K% N5 hflagDraw=0,showTime=100000;
    ) F, y3 h$ F- Q) Q: OprocessPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;
    " ^2 }( I5 f0 ^% {: _. IFILE *fp=NULL;
    . x% ~& A. `7 i; ~5 \//processPool HR_p,HR_mmy;
    . r" E! |. m1 Z0 Q# L3 ^' ?9 R4 }1 w" z, C" U+ }
    # l( X: s0 ?0 ?7 Z6 a, z- e
    srand((unsigned)time(0));
    7 s$ O: t6 j( l9 T3 AsystemClock=0;0 `; H& z5 e7 `# A! |# ?/ `5 Q
    initgraph( 1200,650,SHOWCONSOLE );
    ) B, p0 q1 d9 _7 ysettextcolor(GREEN);
    * N4 i& v) V3 [setlinecolor(GREEN);9 l- g+ V) ~5 E, x2 G/ G/ j  a
    setfillcolor(GREEN);
    / f) U. o; [) B* \2 NInitPool(&FIFO_p);  p. |) K" u; W7 m& u  X
    sort_by_comingtime(&FIFO_p,-1);
    / A$ g5 V( ^  OInitPool(&Timeturn_p);
    9 J) s- _, Y( ?0 G% M2 WInitPool(&SJF_p);# |+ k+ \5 L2 n4 ~5 w
    InitPool(&Priority_p);2 H' Z  k* Q" H
    InitPool(&HR_p);
      S# J- u6 N% }0 u2 ]//showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);& d+ {0 R9 m, m
    //Sleep(10000);
    + }! G( }* K% i$ C" ]9 ]+ C
    9 B+ b0 Z& W) L: V) D/ W7 i' {# A1 W4 l/ p' C  h
    Timeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    " @! g: K7 q3 c% g5 V+ ^' }2 ISJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    - s8 B, _3 g' d6 VPriority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));( \% q. V# @+ g6 `. g0 L8 m& r. O! D: Z
    HR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));  q, d8 Z, Z- M9 e& a0 g4 w
    for(i=0; i<initProcessNum ;i++): h- m; T% u& }; x$ y. J
    {& @) b. R0 W& Q5 |/ X/ E6 W
    Timeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    + l/ c, \* U3 n. n3 RTimeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    - r1 P. [8 W! x: M2 D1 q6 d  ]SJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    % F% F1 a6 K, n7 U- Y, ?5 O' MSJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    $ l- k' q4 J) Q' y) x" wPriority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));8 v+ ~; F; F, n/ ?$ c' Z/ W/ |; f
    Priority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    ) |; o* k4 _( x- w  }HR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));& L4 y6 _1 q) r
    HR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    6 w# ]8 w/ E, h3 Q' b}
    " K) k" f8 h* |) ]" KTimeturn_mmy.proNum = 0;: P! b. f7 H- ~* @5 k$ S8 Z5 L4 L
    TimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);3 w0 i- u2 _# ?3 ]; E- K# O4 u% o
    SJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);
    - H* h" e" U7 [) m3 p2 D6 H7 P3 cPriority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);
    3 V! y$ z8 G) X* s! @High_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);% L7 B" {- ~9 W4 M
    //showProcessInf(Timeturn_mmy);; h4 U. a! ^% F6 S
    FIFO_pri = &FIFO_save_head;
    6 y. @; L; O9 O4 G! DTimet_pri = &Timet_save_head;' ?* y+ m0 G  z" E
    SJF_pri = &SJF_save_head;
    - a: g8 l1 v+ r2 r) pPriority_pri = &Priority_save_head;
    . ^+ X& n8 h7 |8 R! O    HR_pri = &HR_save_head;
    5 n; U* |# s. E3 Csetbkcolor(WHITE);* C2 ]! J0 g3 C2 S5 E: T! J/ a0 r
    while(1)
    : K, `0 `8 K2 H; R6 |6 K- P( r{! ^( i  p' T1 e" {* i% T* ]
    if(MouseListening()==1)
    ' [7 S( r' L/ ^. `  A1 g$ PflagDraw=1;
    ) y4 @* U. S6 |! _' {5 S$ {if(count==100)
    + M% H7 V8 U7 N+ y{
    ( `* ^( S: j: R* o* \& }if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed)( f( O. v4 v# z5 z- O
    {
    & k6 P; a+ J- k2 k  B# GFIFO_pri = &((*FIFO_pri)->next);
    - F: _7 [9 J- C/ P  Z
    4 @* M, k0 @. h6 w3 h/ M; B3 o- H) T# j& g//printf("hello");/ w+ ^8 z' L+ k' ^! Y5 @
    }- [6 P+ Q: Y0 I1 n( ^
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed)
    9 S0 |6 I9 \2 A0 t& O0 q9 n( C( h5 ]" Y{( q5 R, [' x- `# ~! j
        Timet_pri = &((*Timet_pri)->next);- S" v6 A" [3 ~$ H
    //printf("hello");
    4 @. g6 n$ O' I2 [6 C# J}
    0 p  `8 s9 h! Rif(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)
    # N0 i. L5 M4 Z; r7 y0 f' }{
    7 D/ ~- I* w) w* V* jSJF_pri = &((*SJF_pri)->next);9 x3 V( Q$ r' v7 m7 `( m
    //printf("hello\n");2 u& j/ I  g* g0 ?5 W
    }7 y/ S8 o# j  ~; P4 P; J" x$ e. W! o
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed)1 l7 E& C8 E6 b5 n, K8 s$ h) J
    {* _6 U8 y) j& P# ?8 [
    Priority_pri = &((*Priority_pri)->next);7 W" F2 p9 F3 o# G, u' O* e
    //printf("hello\n");
    " l0 u0 O( j& j! E5 p}! g* C5 q' j* E8 T+ E# F5 D0 k, n
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed)- \1 G& b% \0 y; H9 H
    {
    ) X9 w8 L5 p+ S( r3 {+ H) zHR_pri = &((*HR_pri)->next);4 q3 f' v8 i+ U" e* k, I( I* Y
    //printf("hello");
    6 {3 s. m4 t6 Y7 m+ |. A( q! `}
    $ A6 C" a# B  S1 i  H+ u( \. Ncount=0;
    3 M# B2 |5 f. f% ^}$ v/ H2 {" p: T' R- ^
    else( g2 C% {2 y7 F. O
    {) D* s9 o% i/ L5 G
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)- L2 ]* {5 \  p* Q
    {! q& b9 j+ V2 G% p0 E! f
    FIFO_pri = &((*FIFO_pri)->next);
    5 a1 n- N6 ~. x6 R- E// printf("hello");
    8 l9 x% R: ~8 G6 D" J9 U1 m$ b}
    1 [: K7 D- _3 _- W9 Aif(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)
    ( Q" r+ i* L& ~{
    0 B3 p, l, y* _1 g/ d6 h/ t# x2 wTimet_pri = &((*Timet_pri)->next);
    " \7 @7 l# ^9 B  \// printf("hello");7 Q. g1 A. Z# s9 R/ |
    }
    ' W4 Y% L; `$ @; lif(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)% T8 x1 C& Q* C  [. ]5 H5 f% n: n
    {
    : l0 d% r* U$ ~4 K% h. N5 `   SJF_pri = &((*SJF_pri)->next);* g- o  p$ }7 S
    // printf("hello\n");& r0 ]* K3 T; c
    }
    ( C$ x2 G% }" S4 u0 eif(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed)
    6 X, o8 _; o) \5 [: k3 C: u{
    7 [4 p" Z+ ~, {8 u/ n+ ePriority_pri = &((*Priority_pri)->next);1 j  C, ?: Y$ Z2 V& X7 K* F* h
    //printf("hello\n");
    2 l( d" L4 ]! ~}" u0 V- C2 Z$ \: @4 v
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed)% P! b0 [' l6 W, Q8 U9 E% D1 `6 [
    {, Y# Z9 k. [. e; m; M, p
    HR_pri = &((*HR_pri)->next);( _, b" g8 C+ c1 z- J* E
    //printf("hello");
      y/ E( U% [; {( D' Y//Sleep(1000);& Y; x# D0 `9 J) r  D6 ]0 `7 k
    }- A# G- U) a' V4 m  I
    count++;
    ; l) C9 m+ F! P}
    ' f" o6 G/ _- J/ z* aif(systemClock==showTime)
    + I/ m, H; z2 e, {7 m$ M, t  L{! x  b% P* ^8 J* Z5 I6 v* _
    /*PCI * p=FIFO_save_head;
    * C) j2 ?6 N3 Rint i=0;
    % F" b2 Z" K" s. |! n/ R9 Sfor( ;p!=NULL;p=p->next)
    - H: h: s4 n. B5 O& g! E, |, D" }9 g{
      V8 S+ v# @  g0 S) Oprintf("Id %d\n",p->processID);
    ; I* x8 l8 N0 fprintf("comeingtime %d\n",p->comeingTime);
    $ m* G7 d- j6 S; C' tprintf("runningtime %d\n",p->runningTime);1 o. x: B4 b# g) w: B
    printf("asdmemory %d\n",p->askMemory);
    5 @8 m7 I7 ?) z8 Lprintf("completedtime %d\n",p->completedTime);# [& B- ]. T* L$ a$ H$ o
    printf("compute %d\n",p->compute);
    5 i- ~7 w2 `( W! Iprintf("exchange %d\n",p->exchange);, y1 Z: c9 ]" B
    printf("waitio %d\n",p->waitio);
    2 n; T4 Y$ `8 m$ b( Ri++;
    4 f/ j5 E3 Q: ]* H4 L7 ]) \
    7 U6 g7 ~" Y( q0 t  q$ T# Z( |- P- J- g
    }
    ( r3 M3 [$ c! y9 \- ^printf("%d\n",i);*/
    8 u0 [+ R' t$ P' N) H8 I7 b. v/ vif( (fp  = fopen( "data.txt", "a" )) == NULL )4 b3 h: N5 ~  Y% o2 ^5 f
    {
    0 r% @+ T% C. A- Z. mprintf( "The file 'data.txt' was not opened\n" );
    & Y) ^9 l9 B) B% z7 M  k//return 1;8 S7 L1 N% `/ u
    }& x# T* D' a! [$ ]% B
    else: V% n% Z) K( K4 ]( a: i% s# p
    {
    & [- W$ V3 V' ^; qfprintf(fp,"FCFS \n");, S1 L" x1 ~1 I% d. {% g) X# Q
    for(p=FIFO_save_head;p!=NULL;p=p->next)
    6 N/ ?- q% T9 w/ b, ]fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    0 x% @8 K8 V% \; \) B' Pp->exchange,p->waitio,p->runningTime);  v, T% Y. d3 Z* v9 d! {
    fprintf(fp,"\nTime turn \n");
    $ @0 O( P# W5 ?% E' ~' y- Q0 lfor(p=Timet_save_head;p!=NULL;p=p->next), h' l7 j" A( ]( ^6 g
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,/ ?" e, |, S# f2 O. w6 N
    p->exchange,p->waitio,p->runningTime);
    4 E+ _- E9 `* Z1 S$ W/ ^fprintf(fp,"\nShort Job First \n");
    * O1 K# Z1 K9 B& J* bfor(p=SJF_save_head;p!=NULL;p=p->next)
    6 Y  w) c) A8 C$ {1 Bfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    5 [) g5 ?! b* dp->exchange,p->waitio,p->runningTime);
    3 B# o$ \: j1 h6 m* [3 W. bfprintf(fp,"\nPriority  \n");
    , A& M2 q' y3 p- E" I  z4 a4 Ifor(p=Priority_save_head;p!=NULL;p=p->next)
    9 n( b& i8 Y/ J# ~! n$ N% s. B! ^* R! h/ `fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,8 @; i0 w( u7 P2 l6 Y1 B
    p->exchange,p->waitio,p->runningTime);
    . S+ @$ A" `6 p$ c3 w6 mfprintf(fp,"\nHigh response \n");% e0 {( q1 S' Z( V7 j8 H
    for(p=HR_save_head;p!=NULL;p=p->next)( S6 X" a5 Z) E- i, z' b5 P
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    1 ^3 B1 Z7 e$ ^3 t% j: fp->exchange,p->waitio,p->runningTime);0 O6 S8 a/ c9 k% W( e0 y' W0 t
    fclose(fp);( C5 E8 h! D% r+ M, X
    }
    0 u6 y: J( o' e( y. l& p& @1 D* TshowRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);  M9 J9 k- D/ S
    MouseListening2(&flagDraw,&showTime);2 G. ~8 M0 T! Y( l' C
    }' v0 E8 m3 d* m; J6 Q
    systemClock++;
    ' z6 {* \& B8 ^; j1 Uif(flagDraw==0)% k5 T8 Q0 _* n, u( M
      Sleep(10);
    " @: l: n, ~/ S}" K9 E5 |5 U. j# j- ~

    ' |3 T. _" {9 H
    4 F3 Q, [8 k2 H3 t! f% F7 H}
    $ x4 S3 _; h" P" j2 o/ x' ?7 eint showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR)
    7 t" K  y) g% W$ n$ Q, `{
    5 b; o3 t8 d+ K3 A5 WPCI * p=NULL,* name[5];
    - ~( q& x. i; O9 }int count=0,i=0;
    $ z" N& E9 q7 l- rchar ch[5][10]={"FCFS","timet","SJF","PR","HR"};: S, A% K# P* V5 K- _. K
    double turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};3 d8 v) F% G2 T0 i
    struct info3 }; O- p/ \$ }) z% m8 n' Z! l7 _
    {
    $ `9 f# }, [. C$ cchar name[10];
    8 J3 _* J8 [4 g7 U. @) p5 _+ J* a. Udouble throughput,turnover,wait,CPU_rate;9 y; ?/ g( X: S; c: O
    }inf[5];; X6 |, R8 l3 t' R
    name[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;8 r# Q8 L: Z" M$ C1 E* O
    printf("调度算法..........A\n");
    5 t( i) I9 g! W; Z9 O: I/ xprintf("吞吐量............B\n");, m" Q2 @0 z" B" [" H
    printf("平均周转时间......C\n");
    9 f- y' o! \2 m# [- Vprintf("等待时间..........D\n");& F  Y6 U2 `. S# [
    printf("CPU利用率.........E\n");* ^  Y( V8 I' C: _8 T0 m! @  e
    printf("A\tB\tC\t\tD\t\tE\n");
    - x% E, t. s8 Y* t# @for(i=0;i<5;i++)4 g) q+ E) l- h7 P5 W3 b9 v) S
    {; F; u6 L6 l0 n7 u8 O
    count=0,turnover=0,wait=0,c=0,w=0,change=0;9 d0 W  q) M1 w3 t
    for(p=name; p!=NULL; p=p->next)4 Z5 R# I: J* S+ t9 U, v! X
    {
    ; [/ p2 R7 f; Hcount++;
    - {# o' i1 D; B, ]' |7 Q" i8 yturnover += p->completedTime - p->comeingTime;- `2 B: F3 c. w5 \! z% Q7 Z
    wait += p->runningTime - p->comeingTime;
    9 i6 @$ X( Y+ O- G- h2 e3 D  e- I& Qc += p->compute;% R  t, H) C- B, E! s* P
    w += p->waitio;6 z" o2 I+ c; ?7 V- S
    change += p->exchange;
    ; q# I* w9 z3 C9 R' q% O; ]}
    - z% I2 Q: x5 F5 Eturnover = turnover/count;
    : V4 m' [; [5 N: N) cprintf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));
    3 }: K; Y7 P3 k+ i( Ystrcpy(inf.name,ch);1 T4 n$ v& k% V( w' y2 C$ E
    inf.throughput=count;' u7 K! |9 J6 M$ N6 L  o; q" J# g
    inf.turnover=turnover;" z- `! c2 k5 x" y( w
    inf.wait=wait;+ R/ L2 g  n( O* ^! F8 h# g: ]
    inf.CPU_rate=c/(c+w+change);
    ) P# T1 E- f1 v8 R8 u: z}, u6 f+ o2 |$ B' A6 w$ \# Q
    //画图
    ) h. |  N3 p& m! c1 q  U//cleardevice();
    ' Q5 r0 h; g2 v0 |7 b1 O' xline(0,600,1200,600);  C' C" R5 M5 \2 Z1 t
    line(10,600,10,200);
    : I1 A) q9 M/ s* Yline(10,200,5,205);0 s/ ]! S& T7 m  D  b
    line(10,200,15,205);
    " t4 h: R5 Q: V8 i$ k  zline(310,600,310,200);4 o6 U3 n9 a/ s
    line(310,200,305,205);
    - D: C' S/ D! ^$ j/ i' D  K% }7 uline(310,200,315,205);! |+ V* Z$ W1 N2 j- N( G
    line(610,600,610,200);5 X7 O" p/ I# d1 w2 \: H% n
    line(610,200,605,205);
    ( F- T4 I% Z+ k$ Y6 y& gline(610,200,615,205);0 l; r. f# W; P: U) m
    line(910,600,910,200);7 D  K0 z- K* i# Z6 ~6 A4 ?7 g8 x
    line(910,200,905,205);  B, x. q# y' U
    line(910,200,915,205);//最高的长度400,宽度均为40
    . c) ^7 |" {, w% }3 f- C* i$ |for(i=0;i<5;i++)  @  d7 w, j( A+ x7 r+ H
    {
    1 w. B3 c# [) ~if(inf.throughput>pos[0])4 ^3 @: Q0 X( |/ {9 {7 ^
    pos[0]=inf.throughput;
    ; n, ~+ k, n  X. X! Fif(inf.turnover>pos[1])% X4 y8 u/ P. r% w* D% z1 r
    pos[1]=inf.turnover;
    6 O9 x" j6 Z# ]% K( B4 j% Q" G5 cif(inf.wait>pos[2])1 Q/ {+ S: {3 X6 q$ q& R
    pos[2]=inf.wait;
    ! g5 n( |! |) ?* u! D% Jif(inf.CPU_rate>pos[3])/ r" ?( }  c/ o/ O7 \) b* Y+ ~  r
    pos[3]=inf.CPU_rate;
    7 i6 O+ J: I5 V9 s}9 p# H% B9 O5 T7 N5 }
    settextstyle(30, 15, _T("楷体"));: k4 c4 {7 }8 N6 y" o
    for(i=0;i<5;i++)$ x0 m7 l9 W& w( ~# P2 F8 Q9 R
    {5 I2 l' |; h  |) r7 M4 ?, }, k
    switch (i)2 C) P9 E& m$ s; A! J
    {/ K* U* ^2 ^3 k: M
    case 0:
    0 Y* F: e+ b) I9 `6 j: L3 qsetfillcolor(BLUE);5 |. Y: D6 x. `% ?" t* k
    fillrectangle(100,50,150,100);
    6 k  I) ~( ]$ touttextxy(160,50,"FCFS");  J  o: p8 z+ G# ]) c  s2 K0 O5 _
    break;
    ! d# A  G/ s$ [, v2 pcase 1:/ H8 ~& [/ `* K# Q" M7 W* F, H5 z
    setfillcolor(RED);
    * i% n  g# g! q1 ^2 L# [1 i! U2 rfillrectangle(250,50,300,100);8 }: v7 n7 U: q5 E' c* P5 o. b
    outtextxy(310,50,"timeTurn");
    ' |4 A, L0 ]* Q/ ?4 k( t$ H9 ]break;, f- v; b2 d* a& Y  b5 j8 M
    case 2:! s3 a2 z* p$ Z
    setfillcolor(YELLOW);! M5 P; ], I/ W6 I
    fillrectangle(450,50,500,100);
    7 d3 D& m$ g" N! jouttextxy(510,50,"SJf");' e7 P. |7 u) e6 ?. z
    break;
    - i$ o4 p% a. s! ?3 |case 3:& @' @1 y* n8 ?9 Z+ n* U5 |, [
    setfillcolor(BROWN);
    . q  i) J+ n, {! h: lfillrectangle(580,50,630,100);
    7 P: Q. ^7 w1 `- X; k. Uouttextxy(640,50,"PR");
    # }' q2 l4 ~* l0 U- Gbreak;. S8 V7 D' u( r# t5 m% [' x
    case 4:
    ( _4 ?' y4 d% r4 V0 usetfillcolor(GREEN);
    5 b7 h& U# I/ m9 Y7 ^, Y$ E4 bfillrectangle(690,50,740,100);+ B1 A! U: R# v
    outtextxy(750,50,"HR");0 v! v" D) s" ], C: ]( v: p8 s+ D
    break;
    0 Q; B% m5 i+ Z% T( u}
    ) B* e  ]8 a! v# [( f7 Y3 rfillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);+ E5 G3 ^( V2 k5 W1 S7 l. f
    fillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);
    / ^# E4 X* q1 ~/ z; P7 o' V& efillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);& ~' F4 M$ k2 W
    fillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);
    & H+ N* ~" b6 U% e8 k/ p! T4 @5 k/ J, o$ \$ H) D
    ' q: f: x3 D, F" u8 n4 v3 T
    }% r  W& B0 W- ?7 w- m, Z
        outtextxy(100,150,"吞吐量");
    & }3 A' B7 K2 H# d$ }outtextxy(350,150,"平均周转时间");
    ; I7 s1 e  k$ Y# e1 a: @8 bouttextxy(650,150,"平均等待时间");& |6 h+ t* d4 B9 {; Q% F
    outtextxy(950,150,"CPU利用率");
    , x' }2 ?/ ?3 |# U! Zreturn 0;5 a! U6 [8 ~% c/ y: A" r5 V4 g
    }) x, H9 q& S0 d' N
    int MouseListening()
    % f# t# Y( O8 x0 f( W" e{
    1 y* @( ~2 ]4 h) PMOUSEMSG p;" M$ m+ I4 `( o( R2 w2 B
    if(MouseHit())  E" _* x# H2 W* X2 {0 _% p
    {
    5 o  u! n5 V* T0 c8 B% X0 B& R  Xp=GetMouseMsg();5 X+ K' L" t# j' L: P
    if(p.mkLButton==true), i2 m8 n6 y# ]4 W0 I; W
    {! ]% a% ?5 r) b# l. d
    if(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    4 d9 I, _/ u* @) x" wFLAG_FIFO = 1;1 M7 [: }( X6 M7 t. M! b, L
    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 i, e7 \" N2 c
    FLAG_TT = 1;1 y# s9 e1 |6 n% e; X, r3 r2 a
    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), L6 z+ y( F, M! G. u- l
    FLAG_PF = 1;% r& ?7 E* }% v9 A, [6 H7 w
    else if(p.x>0 && p.y>325 && p.x<400 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)7 L/ B! A& K% V
    FLAG_SJF = 1;
    6 b$ z5 o" t8 A, ?, Kelse if(p.x>400 && p.y>325 && p.x<800 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)9 M+ Y( ?* ]( r0 l& e& K
    FLAG_HR=1;
    8 z4 P' r" {$ relse if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)7 \9 e! U& t4 ]5 ~8 x+ G
    {% N4 h0 t& s  u7 a1 c5 v
    FLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;; U1 o( Y& d0 h) _  D2 g0 {, I4 N7 q4 B
    clearrectangle(800,325,1200,650);
    ! F& F$ E7 I: y% N9 i1 n}; C, m) T: |! J) K6 R# Q
    else if((FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0 && p.x>890 && p.y>455 && p.x<1110 && p.y<510 )
      r  p0 d* f3 _! y; _+ B5 l{5 E. o5 E9 e. m. U8 z& g- u1 q; M* ]( I
    FLAG_show=0;
    ; P) g+ p, `: m8 C* ~: Q$ h$ rcleardevice();* h5 R3 y) [/ ^
    return 1;
    7 u0 l" ^' r+ ?- P; d6 _& m}
    2 Y) G. c4 u; s+ w* a0 ]1 Q$ Q, H}
    3 I( c! f+ f# z) L}8 o# j6 ~, k7 x5 W8 u
    return 0;2 K" n- p1 i2 D' R# W
    }
    9 M1 ?- d6 t7 Xint MouseListening2(int *flagShow,int * showTime)$ S% m/ o( d1 z* s4 h- J" A
    {* c5 i. `  n- E: H$ z/ X/ i* Q, b
    MOUSEMSG p;
    ( n7 G8 N1 S4 _* _" t/ Urectangle(1150,0,1200,50);
    7 b) h% T. n/ G' W7 H3 souttextxy(1160,10,"X");; K! m8 @0 K% A: ^- P% i4 ]
    while(1)
    % L9 L. R* q% G2 y) d% H6 t% r{' {- o) D8 v* j# P. D
    if(MouseHit())
    ! S( w4 p" ~4 k- G* j! E{* N( e. j. y8 _
    p=GetMouseMsg();
    : ~* A1 k9 x# P( u; Z+ |if(p.mkLButton==true)6 v# R. K$ s5 Z1 @
    {% s" h3 ]. h- r
    if(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 ), }% H' i- {5 i* B# R! }
    {+ W3 K& P( e& o$ d5 g
    (*flagShow) = 0;% b3 P7 j& g& P
    (*showTime) += (*showTime);# H: g$ \/ x, s- {; r& V
    FLAG_show=1;  ~6 d3 O0 P0 y8 t
    break;
    0 L. U% w# e2 Z" n}1 }( y; F2 t4 M  h: r5 \8 e

    2 k' u# i$ b1 D1 A}3 e7 r& f0 l4 V% V/ x
    }
    , X1 o' v5 ^* }2 e. Y. ?6 @Sleep(20);
    % C. \5 T8 j* R9 G}  e7 p0 g2 t1 S6 x/ J( D; o
    cleardevice();
    % Y7 y: m% `% K; Wreturn 0;
    & W$ B1 d' N; R, v0 W: r" r4 X/ X}
    8 b8 C+ [/ u6 V- Nint drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha)
    ; ]/ Y: H: m) V* I' c# q{
    + Z8 Q/ ~( y: ]static int info[11][3],num=0;) N/ L" }) e, l4 n4 ], }: I! C
    int i=0,j=0,pos[10][3][2];
      G( u0 @& N/ X; W' @float temp,t;9 F, y+ t. a: L7 Q  i
    //画按钮,不属于FIFO图的范围
    ' z2 I  F* a2 m% X3 `if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)
    1 L5 p' t1 d# I7 p7 O6 ^{
    + c+ t0 L& P7 @' Jsettextstyle(30, 15, _T("楷体"));7 y, \# Z) N4 d% e  r+ i
    rectangle(890,455,1110,510);( Y( y# w2 [' ?" s9 a6 u
    rectangle(900,465,1100,500);
    ' U; D5 z7 `. Houttextxy(910,468,"查看运行结果");
    6 w0 ?; @  K; p( J4 g6 E}9 _# P* }" f. }0 {# j& ^+ K
    //结束画按钮4 _$ K/ |  T+ c2 e
    info[num][0] = com;
      Z$ n1 c* O0 I7 _, linfo[num][1] = wai;
    : Y3 C" `# B. J& _info[num++][2] = cha;0 q4 v) r0 g, N- d5 |. _
    if(num>10)  //存储10个点& \- ?4 `. z2 t6 t; A6 s" H3 ^
    {' [) a3 H. N4 R* P3 c
    for(i=0 ;i<10;i++)
    7 R2 Z6 b$ k" d  Q+ `{
    / Q9 o* h' w2 W- ~0 q& E/ einfo[0] = info[i+1][0];  G2 |) }. D$ T( c6 v6 W0 P
    info[1] = info[i+1][1];
    6 K9 d. W' o8 F3 Oinfo[2] = info[i+1][2];
    1 ^" M8 W& G% I4 G" g3 g}
    - D+ H% T2 p/ F* ynum--;/ U7 z/ V/ F5 E* d+ O
    }% _! U4 v* h- F) e
    if(FLAG_show==0)7 c4 b  f- |$ c+ H1 }3 ]3 V
    return 0;
    ! K. n7 L7 z# v* d' ~% t! v/ @( xfor(i=0; i<num; i++)- @3 j4 R2 |, Z- M# d
    {
    1 [1 e% w$ _( mt = (float)info[0];; d8 k4 b1 V+ H8 u* J7 ?) R
    temp = (t/101)*90;' G) Z  `* O. V- s
    pos[0][0] = (10-num+i)*25+x+100;* o: ?* |8 _( P* J) w/ Q6 U- S7 a2 }
    pos[0][1] = y+110-(int)temp;
    ' x$ j( q4 W$ m, dt = (float)info[1];; U4 h( D* p8 d1 J$ h
    temp = (t/101)*90;
    & ?( F& G) z- `- F) T1 x3 X0 Cpos[1][0] = (10-num+i)*25+x+100;0 K9 ]5 z0 M$ ^& O6 j' u% J
    pos[1][1] = y+210-(int)temp;
    5 B5 E6 u  h7 \, `3 rt = (float)info[2];2 A$ A* Y) @: ?
    temp = (t/101)*90;
    ! p6 Q% J' i- R  {pos[2][0] = (10-num+i)*25+x+100;. @) T2 o+ d1 f" Z0 Y" `5 S/ S5 i
    pos[2][1] = y+310-(int)temp;9 _' n0 u* S! h9 b0 W: v
    }
    1 v  ~4 q# I4 P- ^9 b% _7 ~if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    3 u$ p# [( ?* G) Y# \8 u( k{% \1 o, B  l+ \% C, Q9 u- q
    clearrectangle(x,y,x+400,y+315);: }2 {3 f4 m# l2 d( G+ F
    settextstyle(20, 10, _T("楷体"));) Y' v/ T; W1 z" T% L, u
    rectangle(x,y,x+400,y+325);# w# T% @6 U: H" ]; Z
    outtextxy(x+40,y+10,"CPU");       //画柱状图& X& g6 H% M4 E; d1 [1 g
    outtextxy(x+45,y+10+100,"IO");
    8 g1 t7 b8 O4 s8 wouttextxy(x+40-15,y+10+200,"change");
    . {; A% S" m7 v3 D# y5 N: yrectangle(x+35,y+30,x+75,y+110);
    * m4 f+ g: |3 h1 ]3 z4 Irectangle(x+35,y+130,x+75,y+210);  |8 ^4 x! L) u7 x& P" C# M
    rectangle(x+35,y+230,x+75,y+310);% t; o9 {, a; W3 P* O) B( a: G
    outtextxy(x+180,y+310,"FCFS");2 c! N5 {0 f! _- M
    t = (float)com;, O6 w4 |( I" P3 A9 j" H
    temp=(t/101)*80;
    2 {- a. a2 h  {# kfillrectangle(x+35,y+110-(int)temp,x+75,y+110);. d% @0 U- A+ h# y
    t = (float)wai;
    " f/ K9 j/ l7 @2 m9 ~$ ]" @temp=(t/101)*80;+ T# _5 o% d7 r4 P. x
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    # w% R& [3 z  u  W# pt = (float)cha;( r/ B. C+ n% X- y
    temp=(t/101)*80;5 m# l( a" {; W! A5 T
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    6 p0 L2 S) }  p3 Dfor(i=0; i<3; i++)   //画坐标   high=90,length=250# p5 i  D. p2 V$ m2 g
    {$ f7 q# {& N7 _) r! P# ^+ x; D, M
    line(x+100,y+110+100*i,x+350,y+110+100*i);& |  @% L: M  C" Z7 H6 q4 C8 M5 `
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);+ c  S* R7 J, \1 ~" u
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);4 v, K, f0 u6 N

    ; `! H0 B0 Y# a3 s" e4 Pline(x+100,y+110+100*i,x+100,y+20+100*i);/ p$ `$ ^/ h, V( `5 i- `
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);# ]( ?5 E/ C9 j6 y. `& L: H0 t
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);& i* ~0 w' G; L
    for(j=0;j<num-1;j++); B6 c8 J! v, o: c3 b; q$ j
    {
    4 v# H0 W  n  S6 p  Z; Bline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);# k- T/ F( t& @
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);; |$ w) M+ O3 @; Q8 V8 X  x$ P' W
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    2 K5 u* [7 d+ |& E+ b}
    : q# X6 i* G( n% @9 W1 z# s}
    ; X" B7 o% G  _$ n/ z3 Y# A}
    - q( e$ R5 _4 W: o: melse if(FLAG_FIFO==1)- }, h0 M) Y% N, ^2 W
    {% t6 i- s. {! E& i9 S
    x=0,y=0;
    ' e$ A- T( A' p2 Z$ l+ Rfor(i=0; i<num; i++). r9 v% K9 Q  }1 u
    {
    ! n3 _& z3 j( M8 d, lt = (float)info[0];
    ! f  j7 ]! ?" \4 s1 H" z4 E; `temp = (t/101)*180;$ L  e9 I0 n# ?2 G; D% H
    pos[0][0] = (10-num+i)*50+x+650;
    9 g. l1 }  _) ~pos[0][1] = y+210-(int)temp;
    : W& o- E* o" c3 Q0 M$ j; Y5 at = (float)info[1];
    0 t- J, P7 C) s' x" _7 ?temp = (t/101)*180;+ O3 l4 k* u$ q0 F: s4 u& ^
    pos[1][0] = (10-num+i)*50+x+650;2 m, |) S  k8 E0 A
    pos[1][1] = y+420-(int)temp;6 c- G! _) h; q/ H. G# T  V
    t = (float)info[2];$ i: i( q  Y' F! e! K, l
    temp = (float)(t/101)*180;* |; u+ [$ P! y  ~9 u
    pos[2][0] = (10-num+i)*50+x+650;% e0 W2 g4 n; W0 U9 `) Q, r
    pos[2][1] = y+630-(int)temp;0 H( v" W8 I. D( Y- X
    }
    + P4 N* a6 r  ^9 p9 C$ \clearrectangle(x,y,x+1200,y+650);
    , A7 a% }/ w- S6 Y) Lsettextstyle(40, 20, _T("楷体"));
    ! e/ o% I* M/ w% f. routtextxy(x+50,y+50,"FCFS");5 b7 Y7 @; f! h6 k8 H
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    ( ?6 ]+ n4 G, F6 Z  }& C8 U, Routtextxy(x+285,y+20+200,"IO");# V4 \* k# O* C$ P  X
    outtextxy(x+250,y+20+400,"change");
    & m) b: f+ O4 ?8 S3 N- yrectangle(x+270,y+65,x+330,y+215);
    4 H# m. a( s. Erectangle(x+270,y+265,x+330,y+415);
    , \! S0 W: ?* T2 Z- F& vrectangle(x+270,y+465,x+330,y+615);% @3 J  ]6 V4 J3 f
    outtextxy(x+290,y+620,"TT");. }! J. r6 W  m/ k( D/ ]
    t = (float)com;$ }* f1 ^: k6 m4 u
    temp=(t/101)*150;
    # }$ M6 l- }8 o* B' _, V" y2 ^0 Ofillrectangle(x+270,y+215-(int)temp,x+330,y+215);# K: G) S; \5 `5 k: g6 q5 a5 z
    t = (float)wai;9 N! J1 A( L9 W: ]* g, K# C
    temp=(t/101)*150;8 ]6 U9 ~, o1 H4 o4 i& e
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);- x3 K1 E7 r* V# k) \
    t = (float)cha;
    & u  h4 s7 W5 c8 R- S& p* W; Ktemp=(t/101)*150;6 W/ f# O* @; R, l
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);$ s" B. H0 S% Z; i. b, \
    for(i=0; i<3; i++)   //画坐标   high=90,length=2507 \6 ~1 t- H: P
    {7 S: g  Z$ s9 [7 W9 E; ~
    line(x+650,y+210+210*i,x+1150,y+210+210*i);1 ^- P8 E2 ?- p  n+ R9 K
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);! u- f9 P8 K: }6 x
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    ; h! P! M' G; u2 e& W( x" v
    8 K) @7 A% m: I/ h: Wline(x+650,y+210+210*i,x+650,y+20+210*i);
    8 s; F9 q4 z0 A8 p5 Jline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    1 J9 Z" E; A7 _& uline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    - u* I2 r' w" [- {3 Cfor(j=0;j<num-1;j++)
    - A, I6 d- D# O: s) V{
    0 J) e5 T8 {* I$ B, {  P. wline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);, R) o4 z/ }3 `, e7 K8 E
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);$ G, h  n' o( R7 s  c
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ) ^# P0 M4 M  u# X( c$ Q" r, g, \6 S
    }
    & v2 j9 Q6 O; ]% H  |}( R+ m4 J. D& [2 S# q9 d; m
    }
    $ W7 Y6 [; f& Y. P8 L) Z
    6 Z! p0 t: `1 F3 c: X$ J+ A0 f/ M
    ! F8 ~' M. c7 [2 {7 c1 i2 sreturn 0;. h! Z! m& q4 C
    }4 ^* \" I; \- t* w0 b
    int drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)- A/ N/ s1 T! N, U  R
    {+ `+ B+ ?% _& i0 p) o
    static int info[11][3],num=0;9 ?- O" w6 C! ~/ T# N  p
    int i=0,j=0,pos[10][3][2];
    2 i  E% {. ^9 g- q4 S! Z: h, H( efloat temp,t;
    + |8 I( K6 h6 n/ finfo[num][0] = com;
    * O, D* H# j* M& S# yinfo[num][1] = wai;" S) ]& A/ o: V
    info[num++][2] = cha;
    8 q/ P) n  s: y/ e' t* `( Pif(num>10)  //存储10个点% o# E% S( h; p! O* [* s6 o5 y
    {. [+ b1 W9 b% ], s) v" Y) {8 a" S
    for(i=0 ;i<10;i++)# E! f4 k1 J6 o( a' |6 w3 r
    {
      I1 J2 H! X2 y) Q; {* Jinfo[0] = info[i+1][0];
    1 A: g! a8 |6 ~/ binfo[1] = info[i+1][1];
    * a: U0 e( v: T0 i0 ^2 Iinfo[2] = info[i+1][2];- s' k% ?/ [) ~+ n: q" h
    }1 o( w, [* r2 [4 p. F7 u7 _
    num--;+ G8 l( c/ Z- G* _! A# Z0 [
    }
    3 M9 h9 g' m, a, Q4 s  ^if(FLAG_show==0)0 J5 o+ q! M$ p* W' @( {; G' v
    return 0;
    8 z$ _5 ]- s% G) ~7 Ufor(i=0; i<num; i++)4 X  q  G, v+ D+ f" Y4 M$ p- r
    {; K7 y7 _$ L9 v  D" m, {7 q4 l
    t = (float)info[0];, e6 S: W/ A1 A5 y9 O7 H9 n
    temp = (t/101)*90;( D; m+ _$ f4 h. p. T! h6 ^, Y
    pos[0][0] = (10-num+i)*25+x+100;
    ( w: V& s3 j/ I1 D! R" Mpos[0][1] = y+110-(int)temp;
    ' R3 u/ _: j1 P; At = (float)info[1];
    ) K- {) @3 T: v& M+ e* etemp = (t/101)*90;( u8 V6 L3 H7 a
    pos[1][0] = (10-num+i)*25+x+100;
    " y9 @8 b2 n5 B- o& @: _& E/ r: dpos[1][1] = y+210-(int)temp;! P3 u+ G! Y8 G4 r" P9 y2 g6 P
    t = (float)info[2];
    ( O# h/ A2 x% I) V2 p0 p  P" l& ~: ~temp = (float)(t/101)*90;
    , w7 a& f1 z8 z( c& Y8 ]" t& l& zpos[2][0] = (10-num+i)*25+x+100;
    - M+ J; L$ g, c; G$ F6 Y1 Lpos[2][1] = y+310-(int)temp;
    . P: [. z9 ~! U2 Z& x/ C. z5 {. m}, p& V" e/ e5 I: S
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    0 R  X/ h8 {7 ~3 s+ i' `{" `6 W- P/ E  Q! s; H8 D
    clearrectangle(x,y,x+400,y+315);7 A' J. ?! }3 N+ R
    settextstyle(20, 10, _T("楷体"));
    * A) E7 U) S$ ]8 ]3 vrectangle(x,y,x+400,y+325);
    * `/ y$ }$ E/ s. _3 a0 z) T" Q; bouttextxy(x+40,y+10,"CPU");       //画柱状图/ B5 {% r- y' S0 F" E5 T& @
    outtextxy(x+45,y+10+100,"IO");
    , V2 Y, t+ B: W: G* T: Z1 |; vouttextxy(x+40-15,y+10+200,"change");
    / G0 R! i3 t) r5 O* ?7 r8 ^) s. arectangle(x+35,y+30,x+75,y+110);
    % E/ {$ L0 G$ `, O' m- ^; |rectangle(x+35,y+130,x+75,y+210);; N4 C; x4 ^  Q! j- B
    rectangle(x+35,y+230,x+75,y+310);
    % F' J9 j$ [; c- e$ k0 W) F, zouttextxy(x+180,y+310,"HR");
    % A/ I; I& C$ [6 M% h0 w, kt = (float)com;3 E( `1 y9 F, i) y
    temp=(t/101)*80;( X, V- b3 m6 W! \: E2 ^' B
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    5 _% N6 y, X6 L7 s# Y# w4 e) O- ct = (float)wai;, ~( a3 a( l+ R! e' I
    temp=(t/101)*80;* _- P% B, x! O! m7 e# N9 H
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);9 z- }2 D" f# R, Y4 \( E
    t = (float)cha;
    9 n! Z1 q+ m! e8 ?temp=(t/101)*80;/ X  z" T8 G9 G; t  G
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);5 {! E# k8 s1 l
    for(i=0; i<3; i++)   //画坐标   high=90,length=2503 J7 C2 v* f: t% I
    {' C2 N3 K9 L) O& a0 i
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    % M, J  I( i8 S. b& ^; O5 Qline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);  H: @* R, I7 X
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);2 ]+ X. c# O1 N) e

    ; k5 B5 ]2 F* O; g( K5 U9 Yline(x+100,y+110+100*i,x+100,y+20+100*i);
      E. G" V# t$ U3 I+ e# J+ bline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);( O' G! Z2 |; J2 o+ y2 t2 w& l  w4 i2 j
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    * M- U9 K3 h) x; E" {4 vfor(j=0;j<num-1;j++)
    # \. T) `- ?1 J) I7 f/ f# P{
    " L6 T' Z6 ?% P) xline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    ( q( E9 ]$ {1 w8 `, kline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    4 U' f% r; P7 P2 D$ l: O: z" hline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 4 A1 T3 z- `$ u0 X6 M! Y. {* k) z  b
    }- j5 i* f" Z$ o1 n8 U
    }8 ?1 t# ]. @9 V( Q
    }
    . D2 a! @7 \8 j! @" X8 Welse if(FLAG_HR==1)( n# k0 w' \6 [% \; e! g3 S+ L
    {6 G0 e9 I$ e0 X0 x% J+ X! ]% ?, x
    x=0,y=0;
    ( A) z' X4 x) {& i& Hfor(i=0; i<num; i++)
    # z$ |; G) ?; i4 }# i9 ?{6 N# x$ R( K! [+ l# d
    t = (float)info[0];' R3 M# d- H7 _* G1 T1 q" c# ?
    temp = (t/101)*180;- _8 K2 d% S: S; A) o
    pos[0][0] = (10-num+i)*50+x+650;: H, \1 {! J( i! v
    pos[0][1] = y+210-(int)temp;  P" Y& _+ {0 d" k
    t = (float)info[1];; i: Q& V+ D$ Y# T+ e8 V) y
    temp = (t/101)*180;
    5 j1 ~; V& d& ^! m& ^% n$ Tpos[1][0] = (10-num+i)*50+x+650;/ h% j- E3 L5 u1 y0 W; p
    pos[1][1] = y+420-(int)temp;
    / \$ G0 i' B. K5 d) K4 Vt = (float)info[2];
    5 c% G( K# \) E' ]+ }! ]" P- L* D3 Y. Ytemp = (float)(t/101)*180;
    - A* T  S" M8 m0 e$ zpos[2][0] = (10-num+i)*50+x+650;
    * S0 @8 }; M( J9 k4 I' d2 Fpos[2][1] = y+630-(int)temp;
    6 Z6 }+ {0 o# ]! [$ O}9 p* m+ e% `1 J- {+ K' F1 B
    clearrectangle(x,y,x+1200,y+650);" Y" U3 y+ t! ^8 Q+ V8 \9 h3 L2 U
    settextstyle(40, 20, _T("楷体"));% y# A3 f8 m( O
    outtextxy(x+50,y+50,"HR");
    * }: F; i5 a# E1 Z1 L7 fouttextxy(x+280,y+20,"CPU");       //画柱状图4 t0 {4 s! t$ W: h3 |# x
    outtextxy(x+285,y+20+200,"IO");  y7 I+ H7 w4 t$ H9 k7 a
    outtextxy(x+250,y+20+400,"change");
    ; b; I2 m5 A5 U0 J. srectangle(x+270,y+65,x+330,y+215);3 O' M4 }; d7 d) D2 c: X' C
    rectangle(x+270,y+265,x+330,y+415);
    0 }) i# B8 n2 Arectangle(x+270,y+465,x+330,y+615);
    1 @, d' J# y# h- C, xouttextxy(x+290,y+620,"TT");# K& Y7 F2 V# Q9 a+ m* |; B' V& X
    t = (float)com;
    $ [( @3 r% E; y1 d: m4 O* Gtemp=(t/101)*150;
    4 M1 t- O) |2 S) [7 C" U0 Ffillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    0 N$ a  x. }) C7 J! Pt = (float)wai;
    , E+ i% ?) p0 itemp=(t/101)*150;
    3 T7 M  o+ h4 Y% R2 afillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    ' o+ z5 g$ E+ H" kt = (float)cha;
    8 O/ V, P# }, H  `* Gtemp=(t/101)*150;
    / t: E" X. @; F5 N6 \/ bfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    5 R5 X# Q( u/ L7 p; _/ pfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    + Z, R$ o% J* i0 B{# u* f+ @6 ]! Y! Q5 d
    line(x+650,y+210+210*i,x+1150,y+210+210*i);- y0 v) d4 [+ V3 _0 v3 z  _+ g
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    . _2 T! K( ]/ {  A/ ^/ Bline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    ; S' S2 A$ S% n& f
    . o" Z3 N. B: }8 A8 I+ Eline(x+650,y+210+210*i,x+650,y+20+210*i);# n/ d5 w& |9 y- [2 u' m# E$ p' c
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);' H& k8 k8 T0 O; h0 D
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    * i+ @+ R' a; V2 x+ s' V3 ~for(j=0;j<num-1;j++)
    ( M! y' R0 I* P, M" i{# J% C8 H! @: H9 p# c
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    ( S" }, M4 `) z5 q8 {* o% r4 sline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    " j& Z1 u6 x6 {$ g6 u1 wline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    ' H- h/ U5 J' g; _2 P}
    $ C1 X. ?! v" v& v. a8 d  X}
    ( ~1 w( P3 f  x0 }}& _( c9 e* r6 l% }* j: n/ u4 Q+ V

    : S6 D4 @, C2 _6 F5 o9 `' ?6 i  ^# S  Z
    return 0;
    2 _+ I8 F  [- K5 q4 c' Y7 Z}
    / l+ @: r7 n' I2 N6 L+ c3 z+ oint drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)2 I7 L6 p0 L7 c
    {
    , g' o' Q7 Q8 T) vstatic int info[11][3],num=0;
    : K) _* _( o+ U4 Nint i=0,j=0,pos[10][3][2];
    # ~* {4 T# N" q% n1 D3 E: |float temp,t;
    8 q( T9 g$ a8 [; hinfo[num][0] = com;  b% b- P9 y+ T; h; T. Z& Y
    info[num][1] = wai;2 N# c5 b% q' I3 X' ~
    info[num++][2] = cha;+ [$ x: O; |9 M6 o$ q7 i
    if(num>10)  //存储10个点+ [; M( |- K0 x% J) o" w
    {9 C+ ?1 Y5 \! C% d* x2 s
    for(i=0 ;i<10;i++). Y. F- u; v0 ~9 n$ k4 s/ ]
    {
    ! T/ x; z. `/ s% |8 H7 q* Iinfo[0] = info[i+1][0];0 p) O' `( r: O6 D
    info[1] = info[i+1][1];
    ' Y1 o2 F+ q# t9 H+ Yinfo[2] = info[i+1][2];
    ; s  j) s, [) G" x}; q& W3 N9 w) Q' {! u/ t9 s8 s
    num--;+ w/ `& {" M, [0 V: v
    }1 S4 m5 R6 Y# w( y* O* g) y  P
    if(FLAG_show==0)4 Q; ]/ T  b: S8 E! E, l2 D5 U
    return 0;6 x! M: G  M6 a! U
    for(i=0; i<num; i++)( Q! W5 S# K# l2 ]0 J4 Q
    {
    . ^) q; O! ^! b1 W7 o6 gt = (float)info[0];
    % L1 }! |1 C1 B! p  Htemp = (t/101)*90;2 a/ l8 T/ l. z5 z! Z
    pos[0][0] = (10-num+i)*25+x+100;
    3 H* ]% ^9 k, @pos[0][1] = y+110-(int)temp;
    4 Q8 W1 @  ~; K8 Qt = (float)info[1];
    * i4 m$ U: B- A9 [6 c: O6 etemp = (t/101)*90;
    + }( T5 h/ Y, I: d# Npos[1][0] = (10-num+i)*25+x+100;, F4 w% C& h7 a" _# l$ E/ N
    pos[1][1] = y+210-(int)temp;
    6 z& o5 x: Q  _6 l; q. T+ p$ ^' l' Nt = (float)info[2];. P- ]4 G' @2 T/ v/ `
    temp = (float)(t/101)*90;
    1 m3 D! m8 k* M. Mpos[2][0] = (10-num+i)*25+x+100;1 j' E! \: [4 O9 I& W
    pos[2][1] = y+310-(int)temp;* W/ i/ y  O6 O) M& x( S, @$ S
    }  v6 R* D1 N' p7 W' S$ h- i( v9 ?
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)$ I& Y0 g/ R' a" U  K7 v, ~0 m: N
    {3 @+ g; m# i: l6 z& n* r
    clearrectangle(x,y,x+400,y+315);
    3 T  y/ u$ E' H1 Vsettextstyle(20, 10, _T("楷体"));# Z% D) Q7 f" F) Y. O. c
    rectangle(x,y,x+400,y+325);+ ?) G7 _# d! g4 J( C1 G! k$ W
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    5 M2 y/ N' A5 Douttextxy(x+45,y+10+100,"IO");& f" l% B# Z; ?
    outtextxy(x+40-15,y+10+200,"change");
    + X: ]0 T6 m) l0 n% K6 Crectangle(x+35,y+30,x+75,y+110);, M" c! M9 ~8 V; y0 w6 D; H- X, ?
    rectangle(x+35,y+130,x+75,y+210);
    ( ^" k9 r, K: nrectangle(x+35,y+230,x+75,y+310);4 A3 d5 t) g% `
    outtextxy(x+180,y+310,"TT");6 G/ V, a# l2 \  G2 Z& T
    t = (float)com;
    7 V* J* ^' q3 k6 M0 }temp=(t/101)*80;; d9 ?: V# ]! T7 ?
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    - `# x% V$ ?, b0 H" ]% {t = (float)wai;% _0 o2 j+ B4 X+ a5 x" Y
    temp=(t/101)*80;* j. i+ d- Y2 U* F* l9 v, t3 \6 Y
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    % Y* M5 K/ k- l3 A$ z% p# E- L% mt = (float)cha;+ Q1 P" ^6 }2 p* V
    temp=(t/101)*80;
    ; C/ c5 q) I1 i" k' pfillrectangle(x+35,y+310-(int)temp,x+75,y+310);4 Q. k/ @( I2 {; l+ E
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    7 U, m) k7 G) C# C{4 d( H. N7 S* O) N
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    + @8 k' x/ [6 @+ }line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    2 i  L% P9 N( i* Sline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    8 x/ V% q% a1 u7 p# `
    ' \5 l2 [$ ~$ o  j  Nline(x+100,y+110+100*i,x+100,y+20+100*i);
    7 Y( G  H. E# b5 _! z& Rline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);5 F* Y! `3 J5 E9 m; X! b
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    ; q2 E6 a2 Z% ^9 W/ z  Mfor(j=0;j<num-1;j++)
    + U) x$ d5 J1 R2 V0 ~{
    # V8 K1 q1 O; m- A8 h& F. N0 Cline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);7 k9 L; m$ {! B
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    8 W4 l$ ~* n: ]line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ( v+ t( ^$ s3 x
    }
    - i1 a. O" {# o0 t) P5 O7 e}6 l7 u  }+ X& x3 Z" @
    }0 _! p* f! i9 z  G5 A
    else if(FLAG_TT==1)" y& l% F" p4 s4 D$ s, K3 T
    {7 t$ T0 A4 i) ^
    x=0,y=0;
    , l: y3 a( F6 u/ _4 E' `$ bfor(i=0; i<num; i++)
    ( x/ E' X1 u6 B) ]: z{( g1 ?9 S) ~4 O" n0 a" T
    t = (float)info[0];5 e& N6 ?" N6 |) d  Y' f) ]+ O
    temp = (t/101)*180;* x5 B# u0 Q0 X* |# s9 `/ M
    pos[0][0] = (10-num+i)*50+x+650;
    9 ]9 l! g: n* x9 s  zpos[0][1] = y+210-(int)temp;# V& q5 Q. l/ X* ^  T
    t = (float)info[1];
    4 k7 M: J, W/ W" Z: r( Ptemp = (t/101)*180;1 s1 |- L0 }/ Y" A$ K3 s
    pos[1][0] = (10-num+i)*50+x+650;& }3 t2 u7 l; c, \9 p
    pos[1][1] = y+420-(int)temp;, O" r) S1 m4 T+ m5 T0 q# W0 W) R
    t = (float)info[2];2 `- ]- o1 L& g/ u" b: M4 P
    temp = (float)(t/101)*180;
    9 s3 i$ `  T5 Z* I# _pos[2][0] = (10-num+i)*50+x+650;" c; H% n% T$ o; @. j8 A: Q( S0 T
    pos[2][1] = y+630-(int)temp;8 _6 l' a2 v$ j5 p# O5 @
    }8 X# Z8 ^& l, L) y( [1 W6 {( h% `
    clearrectangle(x,y,x+1200,y+650);
    9 `5 y1 f% z7 C/ A3 Q7 H' {$ r8 ?! Isettextstyle(40, 20, _T("楷体"));
    5 I3 s, G+ F* d/ b5 Eouttextxy(x+50,y+50,"TT");
    8 @: ]9 f: ?- K" y6 {outtextxy(x+280,y+20,"CPU");       //画柱状图" w4 e: k+ X$ ^5 d$ F+ ]1 w
    outtextxy(x+285,y+20+200,"IO");
    5 F# k$ A5 K% w9 j  youttextxy(x+250,y+20+400,"change");
    % g1 M# _. K4 N! W) Orectangle(x+270,y+65,x+330,y+215);
    + |) @0 k7 v, q2 z: j6 L4 grectangle(x+270,y+265,x+330,y+415);6 S: V% X' M7 [: |( d
    rectangle(x+270,y+465,x+330,y+615);" H8 d+ l4 K3 g( Q1 J
    outtextxy(x+290,y+620,"TT");! O6 _/ ^* H/ x8 ~! M# m8 H
    t = (float)com;- `5 z; q/ o& E5 l. V# ?! u7 i/ K
    temp=(t/101)*150;
    * f+ t9 K/ F4 Z9 ?( K* lfillrectangle(x+270,y+215-(int)temp,x+330,y+215);! O( R3 G+ b4 u* w  w
    t = (float)wai;
    & I2 ~2 o, O, p9 a* n" Qtemp=(t/101)*150;
    + ]0 U& c9 t: b5 Q1 @8 O) N2 u( ]  u; nfillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    0 P, C7 X6 O% [4 i0 Mt = (float)cha;
    4 }! b1 U  `# i4 ?+ i$ vtemp=(t/101)*150;
    & v& t" i& g! ^$ ^fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    9 [2 `) S9 N- f5 T% U! U8 hfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    7 k. @5 M, K- _  w{
    8 X2 b% l, H3 T* }* e1 M7 t, I" ?line(x+650,y+210+210*i,x+1150,y+210+210*i);/ r& ?3 o5 }/ S1 M! {/ I
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    # b' c9 f6 A& |0 d/ c* J+ m# M6 {# Aline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    6 a/ @6 E/ r. o( E7 d' b( j9 h5 v, a; M0 v
    line(x+650,y+210+210*i,x+650,y+20+210*i);% L6 C# n/ Y) T5 s! M# B
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);% |1 ~; Y+ B: ~- r* O
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);( D. b( l$ K1 t2 y8 B3 S
    for(j=0;j<num-1;j++)
    - g: i' z' ^( f' {{% I, m/ T3 B1 b5 Y$ C& Q: }
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);; t8 {6 t/ V8 t, h! A" C
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);' i; I: ~' {. [5 r$ f
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ) O, L8 O8 o1 m7 }. X# x! N+ {4 F
    }
    5 c! K$ w2 Q: o5 }1 A4 R) v}* C# F6 C  q: g6 l" y9 f
    }% K* F, ~" Y' |

    ! C5 j+ P" j5 B
    0 `7 V" \: O2 ?( D7 n2 S5 h6 ~return 0;
    * l+ `5 ~$ R# a& N  i}
    $ o, W0 e' L4 I1 v* uint drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)2 y1 G+ N$ E: R  B2 y0 `6 y( V
    {; b" L3 u7 g. h* B4 x$ `( j3 b+ w
    static int info[11][3],num=0;4 y5 |% w( L- G" [
    int i=0,j=0,pos[10][3][2];8 Q% R2 A1 r7 P' I
    float temp,t;
    8 B: }: x) H6 A+ }# ]info[num][0] = com;3 t: {- v2 \. ~+ u3 Y. b" r* X
    info[num][1] = wai;2 |# g4 n* @* D# k; l8 |; Y  D1 E
    info[num++][2] = cha;; |( Z4 i3 |% l5 ~+ u3 i
    if(num>10)  //存储10个点
    ( Z+ E+ \* e$ f" |# o/ |- g{0 y3 K; ?4 D; y; v% g9 }
    for(i=0 ;i<10;i++)
    . t$ ]( V) z& c{9 @$ |1 K5 {1 S
    info[0] = info[i+1][0];3 }9 ], {0 O! J; X0 _8 r
    info[1] = info[i+1][1];
    - f0 N2 c5 k3 x1 _info[2] = info[i+1][2];" N: C' ?4 o8 g. L7 Y
    }
    9 [, x; Y- c- J; a+ W+ Znum--;
    % J0 P) k. Z) z% y* f; h1 L% t3 W}9 W3 f1 d+ H5 m4 u2 L
    if(FLAG_show==0)$ W+ o* z, Z0 x
    return 0;; o" r8 b, M- u4 \( z: `
    for(i=0; i<num; i++)
    % l, u6 h6 D, u/ h{6 ~! L9 o) e7 D8 |- |
    t = (float)info[0];  f" }, }+ c* U: V& d6 }& ^* C
    temp = (t/101)*90;
    6 D( a! N0 `. R0 K- Kpos[0][0] = (10-num+i)*25+x+100;
    , O8 t6 \% b6 A0 u) K# z, @/ a$ Gpos[0][1] = y+110-(int)temp;
    1 E! B& U; b1 |9 j' x" [% wt = (float)info[1];9 E+ b8 G! @$ @& r# @
    temp = (t/101)*90;" v% o! Z; m9 O  r
    pos[1][0] = (10-num+i)*25+x+100;
    , W7 q. l1 R, z$ _, ~: Tpos[1][1] = y+210-(int)temp;
    + g) f7 |9 Q  C; S9 ?t = (float)info[2];
    . _& X6 C3 d( i( ^: \% Qtemp = (float)(t/101)*90;2 b" N6 `& D9 E& C9 u7 a) _! v
    pos[2][0] = (10-num+i)*25+x+100;
    7 s; g' ]9 Q- u0 c; }4 f4 v% i' Z7 x# Xpos[2][1] = y+310-(int)temp;; z; e0 n! D0 I( z4 ?
    }
    3 q$ T1 U  `5 g  P" {) Rif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    + |. k" u8 I# ]4 U{
    & |2 r# d2 O$ p9 Y0 y# ?$ Qclearrectangle(x,y,x+400,y+315);
    ' A8 v6 W  P& c, R$ Isettextstyle(20, 10, _T("楷体"));) @/ U, b& I  U1 M: R
    rectangle(x,y,x+400,y+325);7 a2 M* k5 K9 u. a
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    6 h  x4 i# q# u( pouttextxy(x+45,y+10+100,"IO");+ O4 P# A3 o3 G: {1 t  x3 p% H& }
    outtextxy(x+40-15,y+10+200,"change");  U# L8 P3 B9 I* r
    rectangle(x+35,y+30,x+75,y+110);3 M' D  i. e; A* }
    rectangle(x+35,y+130,x+75,y+210);( X2 U9 m3 n5 t0 i4 [7 [. T2 V# k
    rectangle(x+35,y+230,x+75,y+310);' u3 q" x/ W+ V* _- g, ]  L5 r
    outtextxy(x+180,y+310,"PF");2 p8 [7 \- g; {' _* L
    t = (float)com;
    ; {4 L$ d! `# v* I2 q/ ttemp=(t/101)*80;2 [3 g; G4 c& P9 T5 k7 R; i5 `
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);3 h! A" o4 g. T
    t = (float)wai;4 o9 r8 {" K! {, F
    temp=(t/101)*80;
    - f7 J. y/ B- D' G- xfillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    : L: q# y  M4 u" r4 F) R# ut = (float)cha;  V; g6 I8 N) J9 d: U
    temp=(t/101)*80;
    9 |  n# ^% y2 N! ?* s0 m3 q" Gfillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    7 t5 @( [+ \2 X9 bfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    & j6 G0 n/ C1 R; ~7 u{
    6 n; T4 a, [. l8 a# h, rline(x+100,y+110+100*i,x+350,y+110+100*i);5 a1 p/ [; U& E* l; J, y# v
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);% e) q3 B8 ~/ W7 U. ]/ J, u+ J
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    $ E9 r" d$ }  C4 e6 ~) @
    0 L6 Z5 G) s4 O" f$ Aline(x+100,y+110+100*i,x+100,y+20+100*i);
    7 V3 v2 z! K) I! ]/ Zline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    3 i! G3 A8 F$ |, w- `5 n- G$ |line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);/ u3 e0 {5 z( t8 l! ^; P1 n4 A: r& f
    for(j=0;j<num-1;j++)
    0 a2 i5 H! `( q  A$ w% l4 l{+ N: C+ c' \; G! u. u* c
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    ! V- {% Q+ |" t/ H, I7 E" Vline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    7 Z6 w- z* f, p3 r/ ]line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); % l9 ~' f3 S, i0 R/ ^
    }
    4 |. k  n5 B+ r% Y4 H9 _+ d}" |) Z3 o" k/ g" B. [. z& [
    }
    ; F* V% r# d" U8 M. F$ b; ielse if(FLAG_PF==1)3 X3 o, ?( ^9 J
    {3 i' J0 O2 ~) S9 X+ r1 e2 I+ s2 ~
    x=0,y=0;/ d; t: m" {* `, T  d- F/ U' p% ~* b
    for(i=0; i<num; i++)/ ~* h# Z% {- p! `
    {) d, ~2 G+ v1 h; Y! q3 R& h0 f( P4 P
    t = (float)info[0];
      s! x% d+ H: p# U+ N4 z2 k: Wtemp = (t/101)*180;1 b6 t0 s2 S, R6 i4 N+ T
    pos[0][0] = (10-num+i)*50+x+650;
    9 X; s; k( g5 Y' V; g8 Spos[0][1] = y+210-(int)temp;
    7 t$ G/ |3 B* n; I0 a7 }& Et = (float)info[1];
    ' {# I" s3 t9 F$ wtemp = (t/101)*180;
    + Q$ w: ~7 \& A3 ]; _pos[1][0] = (10-num+i)*50+x+650;
    3 |7 {7 P6 B9 zpos[1][1] = y+420-(int)temp;. [, S$ U* d2 s# Y
    t = (float)info[2];) w# z$ A+ E$ [/ P- H2 O+ R! V
    temp = (float)(t/101)*180;4 w9 A6 X# V6 I
    pos[2][0] = (10-num+i)*50+x+650;% F* ~- O" T/ \0 t0 {0 |% r+ ~* j
    pos[2][1] = y+630-(int)temp;# K. q; [$ \9 v& ^
    }
    1 _( s7 V9 [2 b( Gclearrectangle(x,y,x+1200,y+650);
    4 g. P* q: k6 P! Osettextstyle(40, 20, _T("楷体"));
    ! ~( Z# P. q" f: M4 Uouttextxy(x+50,y+50,"PF");* j/ k+ I. R2 b' i% o
    outtextxy(x+280,y+20,"CPU");       //画柱状图& `  P+ _/ H' |
    outtextxy(x+285,y+20+200,"IO");9 `- B. ~8 O0 m, F& A% s
    outtextxy(x+250,y+20+400,"change");
    2 K& O# }8 p/ ^; |0 Grectangle(x+270,y+65,x+330,y+215);: T! o8 Y) c& u! a7 b8 N
    rectangle(x+270,y+265,x+330,y+415);" e8 M* m2 s* p6 z9 l( [5 X8 H; H
    rectangle(x+270,y+465,x+330,y+615);2 F& r( ~: Q5 T1 P9 C
    outtextxy(x+290,y+620,"TT");, s# \0 a9 r# e- J& ~- b; D" F
    t = (float)com;
    / k" \9 g2 E2 h5 m1 ctemp=(t/101)*150;# N0 x' W) z5 J7 s" A! y0 c: y
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);0 f% H6 r( ]6 h# ~& w  T
    t = (float)wai;
    ! f$ l* S0 Z7 D; a/ U, ]) jtemp=(t/101)*150;1 s$ b. {: u+ o6 f4 ?/ k$ g
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);2 H- ~6 D& ~% D0 w! s
    t = (float)cha;5 {0 _8 i+ B/ ~7 l) h) {. ~( k! t; ]% a
    temp=(t/101)*150;
    5 T7 }: _$ H6 n% K6 V/ Gfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    6 t5 }+ y7 `& h8 i4 B, e% n: tfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    8 \1 V9 {7 M  i: W{
    % H" a9 m+ y) k2 m/ y' }. sline(x+650,y+210+210*i,x+1150,y+210+210*i);- O( @5 A& O2 L$ K" o
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);; r$ F& N" O) a/ K$ f
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);0 o1 S  j, z0 J) b& K

    4 w/ @& Z" g) Hline(x+650,y+210+210*i,x+650,y+20+210*i);
    ( L; g8 Q- R6 Pline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    + W) B0 |3 M: ~/ A" T, Qline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    - B% U4 c4 f# b. h: ?) t: ~for(j=0;j<num-1;j++)  ]9 Q0 s/ J6 K5 k! v6 t
    {
    , o+ V5 U6 Y- Q; q# c! H0 r0 Uline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);2 F: i5 g* Z- |9 R: f* U- F
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    / k' s4 e/ `! K; I7 Zline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 6 K( q% @+ a  F- y
    }
    " J) x9 H" e# @4 P8 F" D}" s; |9 T* L+ h
    }! z. U- ?# @, M0 e2 `$ H# S
    return 0;
    2 Y- m- a2 o1 ]( _' j}
    " O" [& ^- W9 ]/ _% Yint drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha). X2 a8 h9 H4 I8 f
    {: r- L: X" q5 _  T7 M  s0 Q+ L3 D
    static int info[11][3],num=0;5 h; V5 i$ v- l! J& g, s
    int i=0,j=0,pos[10][3][2];
    ( m& s% j# r) j+ F% Yfloat temp,t;
    1 }* C: l) {: }1 u" S; N' `) Kinfo[num][0] = com;
    9 L7 u. X) r8 u7 c/ [" zinfo[num][1] = wai;
    % n9 q. Q. v6 d6 s8 einfo[num++][2] = cha;
    " @) a: b3 H0 z) V4 U4 ^if(num>10)  //存储10个点8 y1 a: @  }0 B% u
    {* U9 V* b) e# Z* M( ]$ s" d
    for(i=0 ;i<10;i++)
    / ~5 `5 q' ]7 Y1 ?! T0 e{) D7 C& O' I& g3 N  I6 V# c8 n8 p; B
    info[0] = info[i+1][0];2 v5 N1 u# a  B" V. w8 a( ]
    info[1] = info[i+1][1];
    . A; g( A" v3 ^  u5 Z3 u/ `7 ]$ s, Qinfo[2] = info[i+1][2];
    % Y. G/ _4 a, [3 V; [5 ]}2 W5 M3 t; V" B1 r4 O
    num--;. k( z! z$ D' }1 v3 [
    }
    % L  s! b. Q1 O1 t( Jif(FLAG_show==0)
    & X0 ?9 n: x3 h4 g4 N) ureturn 0;
    7 Q8 n( Y; ]) Wfor(i=0; i<num; i++)$ K1 L0 H( r6 p/ w9 I7 m6 z
    {0 x* `' v" a+ x- o* b/ Q
    t = (float)info[0];+ J3 q/ K# \, z+ x1 G
    temp = (t/101)*90;
    + w3 M2 F, `  z2 U4 M  Bpos[0][0] = (10-num+i)*25+x+100;
    % U3 t7 w0 j. w. v) Ppos[0][1] = y+110-(int)temp;/ m. z$ V% O- D/ G! X
    t = (float)info[1];) K' K7 B( C3 O# o$ E" v, }
    temp = (t/101)*90;
    + ~# t) e* e0 P* P6 R2 g, P8 F2 Kpos[1][0] = (10-num+i)*25+x+100;7 {% O0 t6 R1 S, K: Z/ L+ M. d
    pos[1][1] = y+210-(int)temp;
    8 j; ?4 {3 f3 J( p% pt = (float)info[2];
    ) Z: X! i8 U; I: R& Wtemp = (float)(t/101)*90;
    % b. D2 U! K0 t8 r5 W8 Y3 Opos[2][0] = (10-num+i)*25+x+100;# d* `7 ^( r% N! g
    pos[2][1] = y+310-(int)temp;& Z& Z; C5 J9 r1 t5 I
    }
    ! D2 E0 w+ \* F9 A3 L1 e/ }if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    ; [# m9 v% N6 i7 Y$ t4 J" [9 A- O{ $ [# x) V0 C& R' Q, h$ H
    clearrectangle(x,y,x+400,y+315);$ f* G' [/ h, F* T
    settextstyle(20, 10, _T("楷体"));* V1 X4 J$ J7 C) |' J
    rectangle(x,y,x+400,y+325);
      y- I% J' d! M; Louttextxy(x+40,y+10,"CPU");       //画柱状图
    0 u4 X2 h" t9 T: u: K) w/ Uouttextxy(x+45,y+10+100,"IO");+ S# W* v4 @+ S7 Q% I! }; G
    outtextxy(x+40-15,y+10+200,"change");8 S' i3 S( n3 m& }  H
    rectangle(x+35,y+30,x+75,y+110);3 [' a/ g7 c/ b# b6 U) b5 H# B- ^
    rectangle(x+35,y+130,x+75,y+210);8 H1 b5 q9 n- d
    rectangle(x+35,y+230,x+75,y+310);
    + E' ], |; J: ~; Zouttextxy(x+180,y+310,"SJF");, F( ?. ]6 G; K4 `$ F: ^) u
    t = (float)com;
    % x2 L* j* @. ~4 b5 |, Btemp=(t/101)*80;5 o7 o/ U( ~+ g$ Y
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);0 E; Z9 e# S, t/ S, c
    t = (float)wai;4 p% U( U& C) T+ |0 s
    temp=(t/101)*80;5 c$ M/ F; }0 s" M; P6 l. g
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);0 b% {: }  m2 c9 D3 }% w
    t = (float)cha;
      {! O& \% \. I; `) Mtemp=(t/101)*80;$ Q6 Q5 p: o9 Q5 L
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);9 K" N3 h; n' o( X7 Q
    for(i=0; i<3; i++)   //画坐标   high=90,length=250( L: B4 `6 E) k: L- ~
    {$ n4 m+ O  h; G% J
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    3 ]& e: x" T5 H  V# ^line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);0 b% k- ~2 J( p1 B8 u
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);+ s3 _7 Q( b  y4 A

    ! w0 A( D( e3 Y  V" m$ Q+ U; m; `line(x+100,y+110+100*i,x+100,y+20+100*i);  e" S7 O9 ?) ~7 o  s
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);" K0 k. r, B7 ~% {
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);) ]  o+ B# l1 c% `+ _
    for(j=0;j<num-1;j++)
    % G0 x$ ?) Q# E0 |' q{+ M: W* m' W" O% d4 h
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);# ^; u. V% o0 f+ i4 O* G
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);' f0 F% y5 p6 e4 z: d1 E
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    6 j# z  N. q8 s' i# u/ a}
    % \0 j3 C: B% E4 D}! w# k: P9 ^0 U2 m! _. q* v/ U( d
    }
    , J: h1 i1 n0 s3 s& Velse if(FLAG_SJF==1): y) D9 }. }9 e. P* b* N+ K+ ~
    {* Q/ F/ k' z1 a2 b& f
    x=0,y=0;
      s, O0 s. K7 y6 rfor(i=0; i<num; i++); X! I8 D7 \" i" R% g  o
    {$ m- G" g( _" b; l, a
    t = (float)info[0];9 b% S0 B; B/ q# X! Q- t7 R
    temp = (t/101)*180;
    # T+ K( X; i6 M; L; a0 kpos[0][0] = (10-num+i)*50+x+650;
    6 d0 K! q, ?, i" xpos[0][1] = y+210-(int)temp;5 h. _0 J( r9 q6 k8 U
    t = (float)info[1];. s" G! H+ k* r
    temp = (t/101)*180;
    ( Y. |5 o# X* w. b  T7 ]$ ~& upos[1][0] = (10-num+i)*50+x+650;
    ) Q: E! R5 Q, C' H" n$ ~% v/ E# y* Rpos[1][1] = y+420-(int)temp;
    5 I5 Y; n0 @* V/ p( `& S. r% j* Tt = (float)info[2];5 u8 }4 P) B% D) o
    temp = (float)(t/101)*180;, c. q9 I( ~3 b* Q7 j3 X. G
    pos[2][0] = (10-num+i)*50+x+650;2 G; @- W% w! E( E1 g* A* c
    pos[2][1] = y+630-(int)temp;; I  t+ ]+ W+ z/ [0 _6 s  I
    }
    6 ~6 L) ^- B! b6 xclearrectangle(x,y,x+1200,y+650);4 L4 Q8 L: c5 V$ [
    settextstyle(40, 20, _T("楷体"));
    % q1 c$ A- m2 K& e0 b4 G4 Wouttextxy(x+50,y+50,"SJF");$ N/ j. |2 \3 N6 |( r
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    9 W  }$ _- R! N4 C. ]; Qouttextxy(x+285,y+20+200,"IO");
    & y7 p& ]* L. r) Z" bouttextxy(x+250,y+20+400,"change");! w* y+ }! w! ~( Y* [, k
    rectangle(x+270,y+65,x+330,y+215);
    * s9 D  ]! C/ r. R0 e- krectangle(x+270,y+265,x+330,y+415);
    " ^4 a8 q$ z' G  p' srectangle(x+270,y+465,x+330,y+615);6 m  u6 d( [1 B* c; y# z
    outtextxy(x+290,y+620,"TT");
    $ n& Y7 b; D9 m  x" Dt = (float)com;; y; \- x0 l+ R; O" W9 n* {
    temp=(t/101)*150;4 w6 o1 K0 @2 M7 H5 X
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);  |5 X$ R, a+ M- [5 }$ C
    t = (float)wai;. Q9 o% q6 F$ f* U2 H# a
    temp=(t/101)*150;
    8 c4 H# ~3 h# E) }5 a8 R) Pfillrectangle(x+270,y+415-(int)temp,x+330,y+415);- N, p+ u# D8 A* B% h
    t = (float)cha;& S2 \! I& E& b
    temp=(t/101)*150;7 R8 h% |7 {" A4 O8 R, i/ w3 H& D! c/ m
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    3 j1 D; C8 V' W7 X( Y+ x+ \! _: Vfor(i=0; i<3; i++)   //画坐标   high=90,length=250
    6 H/ Y8 d5 G. R6 E) Q4 I" O: s{
    % ]) B" e+ {. s4 e: yline(x+650,y+210+210*i,x+1150,y+210+210*i);0 l; F- g0 y- X9 I7 U" Y
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    4 S5 e* J* Q. m  Z( j1 Zline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    1 i8 r3 H" Z& O( D5 z% m3 L  d, U7 _6 A3 G7 Q3 s- ]5 ^
    line(x+650,y+210+210*i,x+650,y+20+210*i);4 G# B. |. M0 \
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    ; ]* w6 q- ]4 Fline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    5 Q5 U3 N! F6 k0 N6 |) f* Cfor(j=0;j<num-1;j++)) T8 b$ ^9 U4 n7 |) ], ~/ S3 ^; K% h
    {8 Q6 U& w; ]' W, d7 `" v
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);$ k) {& j0 T, G* n
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    0 ?) R% j/ L, v7 v* aline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 4 W) l" I4 ~, Y% r5 t2 c# j( f
    }
    9 l( V4 J! c: o' W. |}% [' E$ f. m. H( G6 b* x& v# Z
    }5 f$ a4 [% H* |8 A
    return 0;6 d: T7 q; o- v* b1 y
    }3 L2 l* U+ C, ]
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    4 k  P% K8 G' G4 E{
    4 [; c* ~' N. m0 |$ n2 y$ K& bstatic int compute=0,waitio=0,change=0;
    9 G1 V7 o  B7 o" I# dstatic int computeLast=0,waitioLast=0,changeLast=0;
    8 ^! H/ H; D+ b0 _int i=0;7 P6 Y% W4 q3 T% {% R* R0 w4 J
    if(draw==1)) L4 ^6 s2 W- s7 D
    {
    # ]$ A+ l. p0 c6 U//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    ( g9 k1 A$ h8 g; NdrawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    0 Y; u# ]$ G1 L: pcomputeLast=compute;
    ' C) F* i; N1 Q- q" l% m& g( o6 DwaitioLast=waitio;
    * ~9 v% @3 ]% ?! z, N, [$ [changeLast=change;
    # `- ~. P3 J; p  m/ G% M}
    8 L) ^/ n1 L3 Z' l9 d" |7 yif((* memory).p[0].flag==ready)
    8 z) ^( A+ R$ M- C+ }(* memory).p[0].flag=computing;
    3 K) P* l, z  n$ y6 o; d1 R8 Jif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)) }+ a1 \0 z0 J: o6 `
    {' q0 S7 A/ K3 b
    i=(*memory).p[0].computeNum;
    - c) C6 z0 @1 ]& Mif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed- C1 X1 R* v" \& a9 ~
    {
    7 K; u4 k; M2 I2 n6 z1 n(*memory).p[0].flag=IO_waiting;
    0 t+ n% |' `! X0 u0 z* c(*memory).p[0].computeNum--;
    " C0 ^7 x2 ?( f* {. @3 {/ R2 tchange += exchange_IO_Compute;
    ( b7 e0 [0 b  Ccompute++;
    ( L6 d+ r. }  v% v}
    # h/ D4 `+ E7 c3 M3 z8 d8 Delse* u4 W+ ?9 j3 y! ^* f* }/ N
    {
    & R* q. B0 M2 \/ Z9 Y0 k& h, hcompute++;
    - P# ]2 H6 o" n' n}
    " U% y/ I  c( K" U}
    9 A! {- e/ u4 d+ d& \( [else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)' Q" b# v1 d3 p  j  G8 w( a
    {1 O  d3 v& F  ?0 \; I. m

    7 R( T$ `9 v& V7 f+ ]/ ni=(*memory).p[0].ioNum;
    ( b& l$ x4 y- r9 p( S$ Xif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    ' w7 I, O- M' @/ ]' h3 P# j{
    , Z: `- |' `' [; i(*memory).p[0].flag=computing;# t0 k7 p1 i' s& R' [' Q
    (*memory).p[0].ioNum--;
    7 \7 m* O+ N' H- O6 \: ?9 \change += exchange_IO_Compute;
    % S( Y& Z9 W: k6 a& @  ]- o2 Dwaitio++;
      R- l* P0 I4 H) e" G}
    6 O' p/ M1 Q2 h7 }2 r0 F0 |else
    6 o2 z' N  `, i. Z{( e! k: }' W9 ~7 C6 y( x. o
    waitio++;
    % a) P& T; [* b% o4 l: v! ^}8 `; _2 @( d# {8 ^0 }! O
    }
    & T# ^; m0 S" A$ }9 b4 Ielse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)2 k. \3 n' T& n. c7 ?4 [
    {
    + s# q) D3 `' [) d(* memory).p[0].flag=IO_waiting;
    . I' I! P: {( p( C4 d0 Dchange += exchange_IO_Compute;
    4 W4 e7 w6 V. J* Q6 e+ K/ v}
    7 I& T; l8 l4 n) R# J) Zelse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    + S: h6 ?3 M8 G' y+ \1 R{
    9 R; n2 z( J( ^; G% Q8 J5 e(* memory).p[0].flag=computing;4 R* \+ i+ q" \1 Q
    change += exchange_IO_Compute;
    2 f6 u9 l1 y- A5 I* R/ P1 D/ o}( I8 p# p: z" O6 Q, q
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    / b- W0 M8 K. Z; G6 p{
    ( Z0 Y: r) O3 h+ c2 `(*save) = (PCI*)malloc(sizeof(PCI));. {0 x# E, m3 t$ s
    (*save)->next = NULL;
    6 s/ N( {  ?7 L  f9 h(*save)->processID = (*memory).p[0].processID;
    7 T: ?3 `  U8 A0 l7 Z/ m0 L(*save)->comeingTime = (*memory).p[0].produceTime;# \% Q! N! k" D
    (*save)->askMemory = (*memory).p[0].askMemory;
    * H! {- A8 {* q' d(*save)->compute = compute;
    3 j9 v1 J  P; L' T(*save)->waitio = waitio;5 B( ]) B; ~0 f' t  C
    (*save)->exchange = change;  @, n  B5 f, V/ i- }9 j) R
    (*save)->completedTime = systemClock;9 C" F1 S% v2 Z; I  Z% k; r6 @0 l+ A! l
    (*save)->runningTime = (*memory).p[0].runningTime;( T2 R8 T1 C+ C0 h' p3 C& b
    *spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;
    . l9 b8 P* E8 k. H4 q( @compute=waitio=change=0;
    2 G2 H2 z5 a9 H3 ~. PcomputeLast=waitioLast=changeLast=0;: k6 T  |* `  d1 C; g: M" u+ |( L
    High_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);
    ( d' m8 x% n, t# Z! T* y  hchange += exchange_process;
    % M  G5 U+ O' H+ xreturn task_completed;; K$ F+ n7 Y3 G
    }
    1 _0 l' w0 e7 {8 S: [else2 [! Q. x) q( _
    return task_not_completed;
    2 {6 k- v, b" I. P- E}' K9 S9 Y3 }: I4 {/ M  _
    int High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch)
    # ?, T9 p8 n- `! @{
    4 L1 i" @4 y0 i2 astatic int waitTime[initProcessNum],i=0,j=0;* Z" ~( x! ]% P9 ~  j$ w# [
    static double HR_ratio[initProcessNum];
    5 K6 A/ m# M! L9 q0 nif(flag==0)                    //初始化数组
    " X6 j5 P+ h( h% b# ?; V1 W{# N2 O" {) O0 J0 |' {
    for(i=0; i<initProcessNum; i++)0 k# K  ^  ]0 A; r0 i6 T
    {8 w# C* c' W1 l& v
    waitTime=0;6 N1 W" y& }+ L9 C& P# j; Y7 k1 }
    HR_ratio=1;7 y# q% |5 `* M1 V
    }8 g- @, L% A7 p
    }( j* v" T% F) A
    for(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比
    . D1 Y* D, q/ E2 S: q{! w9 _, Q5 L* E  X  s, j( N  q5 q
    waitTime++;( s( O" l) R  g& I+ ?# z# O# C
    HR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);
    6 F' ^' g4 c/ wif(HR_ratio > HR_ratio[j])3 M! p# O. g0 t2 K4 }# Y# v0 u
    j = i;' S) B  d& {: ?+ F! \
    }1 e  Z5 Y3 m! l- R) \9 a( A" F& [
    if(dispatch==1)                    //需要调度一个进程到内存中执行
    5 l6 N- E; G7 Q% y, [$ V{
    9 ?$ M) f9 H, a) V) T' P8 G6 Aif((*storage).p[j].askMemory < *spareMemory). M# F8 S3 @9 \4 b2 ?- u( K( `
    {1 b! y# E, ^& g. t0 m/ c  ~
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;/ O7 i) [- ^, `5 c' F8 x0 e# h6 q
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    7 |( U  x  X; u, T4 T9 J$ b(*memory).p[0].computeNum = (*storage).p[j].computeNum;
    # @0 \1 H3 _, u  a(*memory).p[0].ioNum = (*storage).p[j].ioNum;
    " u3 p% D5 F0 w* D! Z(*memory).p[0].processID = (*storage).p[j].processID;8 Z& K' ?! v/ n; R
    (*memory).p[0].flag = (*storage).p[j].flag;
    0 F8 r+ J; {4 D' m- ?2 m(*memory).p[0].ioTime = (*storage).p[j].ioTime;& v4 K& d" b$ S$ }
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;- a5 l; S7 n5 \& {
    (*memory).p[0].runningTime = systemClock;
    : o% Y9 Y8 a* W  U0 o8 [1 i(*memory).p[0].produceTime = (*storage).p[j].produceTime;* y- A+ p* }+ H) }/ R
    for(i=0; i<(*memory).p[0].ioNum; i++)
    % i9 i: |$ G: a. i) D' E(*memory).p[0].ioClock = (*storage).p[j].ioClock;. }7 e8 @. }1 F% g% \0 f* p
    for(i=0; i<(*memory).p[0].computeNum; i++)5 Q" O7 J5 e6 X* T4 E
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    : N' ]& V1 I- P5 R& u4 X7 f* q(*memory).proNum=1;- d5 W/ W% ?8 d& V0 F3 ^  X
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;4 |* b3 p" X4 f" H
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程( Q( |. ~; n1 r5 i5 t5 t
    (*storage).p[j].produceTime = systemClock;
    - z  Q3 x0 U0 R! D( Y- [MAX_COMING_TIME = (*storage).p[j].comeingTime;% k- {' [  V( A. Y
    waitTime[j] = 0;
    ( Z; B- p& ]8 H, G( MHR_ratio[j] = 1;
    0 t$ D/ c  U) e0 g+ e}* c, t; Z7 c: a, a' M: G1 p8 u1 X
    else
    0 d3 k7 `' s- r: H9 K  O  G- U. o{. T+ {' S* {6 e7 i" s
    printf("A process ask for a memory overed the system capacity\n ");: u. H0 z' l, v7 {7 }
    exit(1);
    " W0 I# A7 n* n0 w  q5 l$ @}
    # x$ T6 h" c8 [; {# H}
    2 v$ D7 {3 o4 lreturn 0;
    : [3 \8 S8 H3 w, f- v}5 a, I" d& ~+ B, o& Y5 E5 h
    int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    ; y. T' D9 I# [4 N+ z{2 @: Q9 D9 _: D
    static int compute=0,waitio=0,change=0;4 |# N2 J( u& T9 y' e# c1 K
    static int computeLast=0,waitioLast=0,changeLast=0;
    % ?7 x  z" e& nint i=0;
      y3 e0 R' k- |+ L( H0 uif(draw==1)
    ; ]7 L& j7 r8 x7 Y  u! ~' Y9 o{" ^9 I8 Y+ ?5 H6 T, b
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);& A6 N, e' T$ W/ _0 U& A
    drawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);, I! W8 H/ g) I7 ]& K0 \
    7 q, v! F* ?# ^% q

    : z* U$ ]3 z: x( J& I0 g" P6 |- q' ZcomputeLast=compute;4 o8 t: L5 [/ S4 r  P6 U
    waitioLast=waitio;
    " i3 W- t( H1 h. I! c" A; @) BchangeLast=change;0 q2 Z  P( V* K" I* B; Z; S
    }8 _5 N$ H' U) [1 m! Q: h9 ]
    if((* memory).p[0].flag==ready)
    ' L2 N: y: s$ c7 g# W  G(* memory).p[0].flag=computing;
    / |& |& L0 P# U( Uif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    9 v  B: ^7 e+ G2 P3 w{& I2 c7 e( ~5 D
    i=(*memory).p[0].computeNum;
    . Z: T" p# m1 R) ^if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed$ J- P8 y& y- x" \
    {$ Q" @# ^9 `5 d9 C9 `+ c2 ?
    (*memory).p[0].flag=IO_waiting;
    . V7 `* Q; |* t0 t(*memory).p[0].computeNum--;
    ! m# Q! o7 I7 ochange += exchange_IO_Compute;
    1 f! u% |, i, pcompute++;
    & R3 _) y# \' i}6 Z$ ]8 I3 e: s2 j* Z
    else
    6 ^: i: i; L% N3 U7 m{
    * @& J/ I. r% Rcompute++;
    8 _1 [: D) ^8 j0 }% P}" Q# F8 s0 w7 S
    }
    + S& q  R* P& zelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)1 R* A0 X/ c. I6 m2 H% N
    {  f* `4 [7 @; \9 c  c. b0 i7 M
    4 f3 B6 G; s3 B3 [6 p# H9 l$ [' Z
    i=(*memory).p[0].ioNum;
    8 H! i1 w: o- S' `) uif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed  e: d& ], W+ r
    {
    6 m0 S. _5 H. h& I- {(*memory).p[0].flag=computing;6 O0 L  l. C+ B+ n/ O
    (*memory).p[0].ioNum--;+ `$ M6 ?1 c. r4 f* Z6 T
    change += exchange_IO_Compute;1 W% ~$ O, B. R0 \
    waitio++;, O7 U, c; G/ ]" J
    }3 b$ [0 ~, y8 O" M! ^; u
    else
    6 ^+ @& P9 t  X  e: x, j  g{
    . N. K2 X: F5 \" L0 {* D, @waitio++;6 W0 s5 [+ l- m0 K% z( S- N2 a
    }
    . u0 C" S5 F7 f: v2 @9 a}
    # y* h* r  |8 p8 [1 xelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)0 `! f( o& s2 @! l
    {6 H' }" W# R* o; a
    (* memory).p[0].flag=IO_waiting;( S, A& O# J: j# }' A" N; Q3 G+ Z
    change += exchange_IO_Compute;
    ) ?9 `6 U1 i) |3 o$ |}
    1 y$ g' ], n) j7 T& r' X$ d' helse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)4 Y2 q# ^% n" l+ w/ B3 P
    {
    ' ^' s3 A  y  R8 p/ c(* memory).p[0].flag=computing;* F; A% k6 G- B
    change += exchange_IO_Compute;- x* w- z( F7 \( B3 ]
    }8 V/ g9 P& x$ i5 M7 F& A, S
    if((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成
    ! Z! w/ _6 t( O/ {$ `: ?9 ~5 b- S{
    6 z: t8 v+ I/ r, w7 M9 `(*save) = (PCI*)malloc(sizeof(PCI));; K6 T$ q/ W6 A; g( }! j
    (*save)->next = NULL;
    % X% J8 D8 e+ y- f( n(*save)->processID = (*memory).p[0].processID;7 c0 ]. V/ h0 q6 a- c- q
    (*save)->comeingTime = (*memory).p[0].produceTime;
    ' t" ~/ [, m" Z$ B1 j(*save)->askMemory = (*memory).p[0].askMemory;  w1 D0 @4 w, K; M, g$ ~5 r$ m: j% R
    (*save)->compute = compute;
    " C+ {1 l+ `2 P3 b) f1 \, X& F' l(*save)->waitio = waitio;
    ' Y/ Z2 d- z: n- k8 T. j(*save)->exchange = change;
    & C' a5 H+ Z  m0 R(*save)->completedTime = systemClock;1 A6 G8 @  j4 C
    (*save)->runningTime = (*memory).p[0].runningTime;
    7 L" p8 @( {$ P4 X9 H*spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;6 e/ L0 ~/ Y  L& Y
    compute=waitio=change=0;4 l( h  f6 t/ m  J
    computeLast=waitioLast=changeLast=0;( F' f  Y) y# m' P, {! `$ w
    Priority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));
    * j: ?  I$ V! ^9 \4 D, vchange += exchange_process;
    / D8 i! W7 i- }% Ereturn task_completed;
    0 j4 N5 M$ W0 v}" |1 [. ^" d' w3 `$ m* u) n
    else
    5 A  E, A% |. e7 L: c5 Yreturn task_not_completed;2 Z7 v9 h' L4 V/ I. M
    }
    . g; [8 }0 C( N+ i" e% E1 F% eint Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)
    % o2 P2 M8 t& N- U  e! d{
    & i( b7 d0 D; a; G) W4 f" Zint priorityNum[initProcessNum],i=0,j=0;5 F& }- }6 W- q7 j
    double temp=0;# l0 B, A  b& X) O
    for(i=0; i<(*storage).proNum; i++)    // setting priority to each process! ?8 W( H" t2 w
    {
      T' J) Y6 g* j9 Q6 F& Q, T% Atemp = (*storage).p.computeTime/(*storage).p.ioTime;# Z$ X5 M" z0 u# d" \
    if(temp > 0.8)
    6 ~4 L. |1 Q3 L6 c4 fpriorityNum = 6;$ z6 E  A- d* H4 W3 l; J) X
    else if(temp > 0.7)
    4 ~5 a8 u9 H! ApriorityNum = 5;
      X9 p, B5 g# D/ relse if(temp > 0.6)3 C- a6 |$ l2 ?$ R# w
    priorityNum = 4;
      j+ _( T; s+ w' s$ Melse if(temp > 0.5)$ J( P! D+ D% L
    priorityNum = 3;
    3 V* n" c. D" kelse if(temp > 0.4)9 q- B( }# B* ~7 V2 p
    priorityNum = 2;1 _1 l* o0 Z% N5 X' t. _- @
    else. h1 h! l7 l- f' f" U. I1 E, G
    priorityNum = 1;
    $ ]: B3 n$ B8 I+ G% t8 j1 lif(priorityNum[j] < priorityNum)3 ^- e  L# a) `4 u0 \
    j = i;6 b! d0 l1 |5 z: L, d* c) i
    }
    9 v- p5 Y  ?" m% a! aif((*storage).p[j].askMemory < *spareMemory)
    8 l2 I4 ^, ]6 `, \0 h, x{) s/ u6 F- c. p# q" L' Y' n# a
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;9 i1 {5 D  V& i
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;- N' D% c, b. Y
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;
    * W& g, m6 I  L(*memory).p[0].ioNum = (*storage).p[j].ioNum;
    ! |: `/ W& Y+ P6 o8 w: F2 Q2 t(*memory).p[0].processID = (*storage).p[j].processID;7 v' X, S8 F+ W- ^( v
    (*memory).p[0].flag = (*storage).p[j].flag;
    ) J1 \) w# I" W8 g, ^* K(*memory).p[0].ioTime = (*storage).p[j].ioTime;9 I. o) U2 D2 r; o$ [
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;
    ' z: \! c' y! G# i) P/ s# P(*memory).p[0].runningTime = systemClock;5 C9 O+ k0 n0 z  O
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;6 e" \2 e' J. j6 j5 D0 z: c% q
    for(i=0; i<(*memory).p[0].ioNum; i++)4 Q, w' l8 o/ l& [
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;; R# z- {* {7 P% e) B
    for(i=0; i<(*memory).p[0].computeNum; i++)
    6 W# O$ W( X# p: O- L5 w% R$ l(*memory).p[0].computeClock = (*storage).p[j].computeClock;
    5 S0 _' p8 ^$ o(*memory).proNum=1;+ c) h# N6 ^! _" f
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    , b* M% w3 @! fproduce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程% v# Y, k# V5 H+ `( c# }7 t
    MAX_COMING_TIME = (*storage).p[j].comeingTime;
    5 D2 U. n- `) r. G% s: M}4 L) T# m# L$ U! k' y
    else
    7 R$ F: z5 h2 A) Z5 z; w{$ U: A* c% t% z
    printf("A process ask for a memory overed the system capacity\n ");
    3 B8 |! C: D! b* Texit(1);8 r1 d% i& \5 x8 |* R% D
    }
    , ?! V+ M; v$ n) }* w) a+ vreturn 0;
    1 U' w; B- R- j}. @3 E3 X' [/ d  T( o& S& H2 i" R
    int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    & w1 G- T; J. `{
    ( y2 n* U/ }7 Y2 J1 g* Fstatic int compute=0,waitio=0,change=0;
    3 D* l4 }: s7 O: d  B% |# }static int computeLast=0,waitioLast=0,changeLast=0;- P5 j) C% w, d6 @1 P, L
    int i=0;
    7 U3 k- U  E( G; }% f" }% eif(draw==1)9 t; d3 y6 ^0 s2 m
    {
    ' w) {( i+ g( E  K//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    : ~  r, t- w' v, \$ ddrawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    6 W, x; A) r1 c. n0 v5 {
    5 E- ~6 g  C5 F: H0 |
    7 q/ T7 |4 Z: t  N$ d( m! wcomputeLast=compute;
    2 T8 R8 V, G" }# Y" v* p. M. |/ wwaitioLast=waitio;" S/ s1 K4 ?! e; e. ?
    changeLast=change;* f. @# m4 X; y2 o4 y
    }
      T2 g4 X5 f; g% c' L' ]- y- S( i8 eif((* memory).p[0].flag==ready)
    $ \7 R/ z" l1 S  o) {& a9 b(* memory).p[0].flag=computing;
    : A) C% B  `7 S1 D* qif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    6 p1 G6 Q% G) m" U& E0 B{$ i3 \0 L5 A' u% g: z! S' d  t& f
    i=(*memory).p[0].computeNum;  ^* d2 h: \: D* f8 E
    if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed2 B8 c" ^# ~# B2 r
    {$ I3 G3 U- X; c0 x0 U
    (*memory).p[0].flag=IO_waiting;9 I  N9 P; ^. \9 a# G9 y; z" {
    (*memory).p[0].computeNum--;5 P1 h. y5 A9 k8 u
    change += exchange_IO_Compute;5 E; h1 ?  q4 x% b
    compute++;. g0 M( J( j6 y; Q4 B
    }
    ; r' I. m- L! Gelse* O; z& W4 @+ ^+ Q5 L. L. R
    {
      U$ _- I. [8 L& Dcompute++;
    8 m5 g8 S, c. p8 w: W* C}+ p$ a( D/ v2 K: G0 F
    }
    6 G* u) \/ Q7 H5 `5 C3 T# zelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)- ^4 |/ k; v+ P4 z9 b& u! a
    {* _  W/ D: E% E+ g( c) W! J

    1 H, P2 V% g& f2 Di=(*memory).p[0].ioNum;, B+ |4 E- k( H4 t
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed# c, j% v3 d8 u( t& R  E3 O
    {/ y' y$ Z+ V  e; S
    (*memory).p[0].flag=computing;
    ) \7 }. }* R( Y; x. J4 o# ](*memory).p[0].ioNum--;2 C% j* B4 k' T# J9 G3 _7 n
    change += exchange_IO_Compute;1 ~' g" v4 e. m
    waitio++;
    & p0 B( w$ p: o. s7 l}
    3 R- Q. j* z# r, P" ^8 ~1 qelse
    + X" y0 l" W! F+ p. z" X  \{! t# a/ |+ ~( H  t
    waitio++;' B$ N2 o+ H: q" {5 L
    }- q& k+ f3 Y) Q) H) }8 S
    }1 O/ A4 e4 N0 r" O- ~
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing): n2 k, j& q; F1 Q# K" Y/ f
    {
    1 a- t0 h$ b& k  A- w' s(* memory).p[0].flag=IO_waiting;$ p" ~8 n" S8 C1 {
    change += exchange_IO_Compute;# ~- z! r9 ]' _8 m
    }
    9 u+ \6 i0 d( K4 c( helse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    ) ^; S1 F8 e9 i& S: z7 u{
    % c+ d# Z- X$ C* V: W5 P1 j0 ]! m(* memory).p[0].flag=computing;
    % I# A1 ?  ]/ z# V0 p% j3 z) kchange += exchange_IO_Compute;1 t) f' \; d  j1 O
    }
      F  R* F6 }& @8 o# r: B( dif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成6 E' \4 v6 F" R% Q3 B
    {$ L$ m$ _* Y7 t) C3 k% I
    (*save) = (PCI*)malloc(sizeof(PCI));
    / d2 C6 R( s  i9 T% c(*save)->next = NULL;
    3 f/ P: O3 B3 t" [3 g6 m(*save)->processID = (*memory).p[0].processID;
    % T& @# O/ @- S; q8 v! c& _(*save)->comeingTime = (*memory).p[0].produceTime;
    " k; k/ Q% j7 G" Z0 ?. E# E' P(*save)->askMemory = (*memory).p[0].askMemory;% m) V/ x5 J; f8 O% c
    (*save)->compute = compute;
    # s* d* F1 L. Y/ M2 e. v' Y) l+ J(*save)->waitio = waitio;
    $ K5 N: s9 ]$ l" }5 w6 {5 p) N(*save)->exchange = change;
    ; M. w! `- [2 y) Y(*save)->completedTime = systemClock;
    / g, h6 k' Q: e! ^- l4 V' O(*save)->runningTime = (*memory).p[0].runningTime;( o5 O( l4 l- {6 r! R" q) l
    *spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;0 p& r8 r8 B' b( c7 S! ^; I
    compute=waitio=change=0;
    $ h) C1 ?6 s) S* |computeLast=waitioLast=changeLast=0;+ H+ I/ M0 Z  r- M0 [
    SJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));. i2 R8 g& l# B, q& C" s$ p
    change += exchange_process;0 g# G5 f) T7 o2 T' z$ f9 G- D
    return task_completed;
    * O5 {& u3 \  I# _}9 B0 M* `3 f3 l; ]2 z
    else  j) R. ]/ \6 k% k1 m& {- O/ K
    return task_not_completed;$ |& ^7 L- L8 L# K
    }' l. H8 h- T9 L+ ]! @# i  x
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)8 b5 z4 V- P  x; q  ?! [
    {) \" x; y0 i, `+ x0 h$ ?
    int i=0,j=0;
    * m1 l  Z: ^' N) K0 q. Yfor(i=1; i<(*storage).proNum; i++)
    4 {# i: b  h" z* r. s) b8 o: P# Z{1 Q3 B; y* n( N+ W/ C: i$ l: ^% G
    if(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime)), u7 {. J1 I& q( g% c7 z
    j=i;3 e8 V2 Q& W+ M0 x1 ~8 H2 J
    }  W: V: L. q2 H. {
    if((*storage).p[j].askMemory > *spareMemory)* d& E# V) f; F* R' f$ F" d
    {
      [; l% t. K6 ^- b; _& |" d) zprintf("The memory asked is overflowed than the system memory.\n");
    / H; @% q; L' G8 @" {exit(0);; C: C- T- W' Z2 T& p/ I
    }% s# a* A! p& U  f  a% d- I9 R
    else/ c! b6 X/ H5 C, z6 F* `. X
    {
    * z- P+ i& R# w- d# ?  ^  _(*memory).p[0].askMemory = (*storage).p[j].askMemory;6 m9 i! l% p8 n9 h: _; `0 [9 R5 q
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    2 |! d* D( j! M9 M% g. Z, z# f(*memory).p[0].computeNum = (*storage).p[j].computeNum;  n. H: a. W" R4 }" y
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;+ c8 h+ f) Z6 |2 q  c% J
    (*memory).p[0].processID = (*storage).p[j].processID;
    ; v' W4 a: k2 v9 _5 y(*memory).p[0].flag = (*storage).p[j].flag;
    ' j( ]5 @2 ^( K+ M& w, x9 A6 }(*memory).p[0].ioTime = (*storage).p[j].ioTime;
    . {* h1 H- P* P- `(*memory).p[0].computeTime = (*storage).p[j].computeTime;: D3 I) ~5 A2 D* \
    (*memory).p[0].runningTime = systemClock;
    6 ^. O5 `( ~/ v) t(*memory).p[0].produceTime = (*storage).p[j].produceTime;
    ' V& n2 }% N3 R+ Ufor(i=0; i<(*memory).p[0].ioNum; i++)
    3 g) |- a1 }4 J2 j+ O+ k(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    & r, |8 U# o& R! r) b2 @for(i=0; i<(*memory).p[0].computeNum; i++); W8 n+ m# o9 M- r  }& H# I
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;& Z1 F9 |" K- K4 g" r
    (*memory).proNum=1;. X' q( g4 \( L* V. w
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    * b# ^8 p0 L3 Z% K& ^5 d  Uproduce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    * [* l5 t9 r# q: B+ F( YMAX_COMING_TIME = (*storage).p[j].comeingTime;# y( s6 ]: O. ~& R, D/ P9 u5 [; I3 Q6 l
    }
    1 L# ~$ }: i6 k! ireturn 0;
      o6 h! y5 q/ ~0 L& j9 n6 X}' Y# X5 P% [5 A
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    ' O+ w' [( m: w4 K4 M{
    ( h; G0 t* B' l. u) Tstatic int compute=0,waitio=0,change=0,clockSegment=100,poi=0;+ }7 g% Q9 v+ U  ~
    static int computeLast=0,waitioLast=0,changeLast=0;
    ! |; d5 r$ N" K. T* \int i=0,j=0,k=0;
    8 k& Z: w  K3 E3 T( ]if((*memory).proNum<=0)
      Z* K' |+ I6 b: M2 }" W5 ?TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);
      B, u" L; X" [) s* @% u  h" ?if(draw==1)' W2 I  H. h/ v' [" P* b8 h
    {
    6 S$ I, \. m, l0 S6 I//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    6 j" B3 c4 Q4 g* PdrawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);0 b8 ^6 ?  u$ C

    ) u5 w3 S9 N( Q% c: K  }, P* A0 g! }! o
    computeLast=compute;) s3 g5 W/ D4 ]8 G0 H  l
    waitioLast=waitio;& Q5 }' L- Y& f: p: L( ?( R
    changeLast=change;- P- N( g2 S' {2 |9 l4 ]
    }. S2 ~) J( Z6 w, \3 T0 |" j1 \
    if(poi>=(* memory).proNum)
    2 x- M6 `, o/ U: I, {6 Xpoi = 0;
    7 g$ u- x3 ~- z9 L" sif((* memory).p[poi].flag==ready)
    8 V, U% g+ c( l) x8 Q- T0 j(* memory).p[poi].flag=computing;5 l2 [/ I: m  O
    if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing)( T; D; N0 h- n1 H$ r
    {
    7 d; Q# N7 d6 K3 R6 X: |i=(*memory).p[poi].computeNum;8 v0 m" E3 ~1 O! |
    if(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed2 D5 u  h2 s$ c1 }. D) _6 U
    {
    6 @. ]/ e/ n( c(*memory).p[poi].flag=IO_waiting;
    ) }) w$ ]6 t# |5 U2 ~( n(*memory).p[poi].computeNum--;
    , B( [+ Q7 u2 d( Qchange += exchange_IO_Compute;1 _# k: u3 c2 w1 z$ K  c, s" r
    compute++;; I  l$ q1 d6 Y. M- `) o0 ?/ }
    }
    . F* Q; Y6 ?/ welse
    + `% T5 e1 e! l' T( p* {+ U' b{) ^, _7 V# ^& P* X  s, k) B
    compute++;
    # u( w- h3 Y5 B/ N" l4 i8 g}
    9 V$ A" T& _# F* k}
    ' I/ R) r& |# W; Q, s$ _else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)
    0 ?! n; k' c/ |{
    3 P2 O6 o  i; S" j, e+ [- {8 z  Y7 i& V, g2 p
    i=(*memory).p[poi].ioNum;
    1 R5 s% K, m4 j/ Bif(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed
    ; y. m# O- H; W- H- m! B) s{2 m6 A! L7 v9 n" y
    (*memory).p[poi].flag=computing;
    ' U8 b. O" [: \(*memory).p[poi].ioNum--;$ \/ b- g; K; n7 r
    change += exchange_IO_Compute;6 p+ V8 ?: S) o/ E0 G8 B
    waitio++;3 c, C; y& J3 p! L
    }
    ) S' V" D+ i3 H! ^else8 d) V- ^0 _9 V" j0 y+ ]7 f
    {
      v; r, H4 k/ n: R8 {9 J! Swaitio++;
      b. {' {5 `9 }2 \5 e) y) G}
    4 y7 V$ J$ y; m}
    7 Z  ]2 |" \8 b; \6 G6 y( r, _else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)' p0 Z0 Q, L1 I! R
    {3 U+ a7 p6 e) h! x) @
    (* memory).p[poi].flag=IO_waiting;1 V/ B3 e# E  L1 M: F9 s0 P
    change += exchange_IO_Compute;
    9 D3 z3 h6 x$ R8 ~4 V2 |) j}! z9 b+ w0 v, |/ ], R- K
    else if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting)8 Z% E; i4 @8 B* f4 n! {$ f2 {
    {  _- q/ O& h% Y) t% g, L
    (* memory).p[poi].flag=computing;, i6 |) k$ L+ H* W
    change += exchange_IO_Compute;
    2 _; l, G- ?( s& B}
    ! s2 U# ?+ T- ]$ G# L& k; `for(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进
    & S( {0 ]# ]) l% ^9 N{
    * {  R: u( x5 Y9 P# N* I$ zif(i!=poi && (*memory).p.flag==IO_waiting)
    0 ]1 F" B( H. m" Q6 i{
    ; x/ {9 ^! _. K; U5 t2 mj=(*memory).p.ioNum;
    3 d$ E" x7 b9 T* Kif(j>0)/ ~- @* t' X* ^9 M
    {4 k% C+ D8 }1 X  N6 c, B3 n
    if(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed
    ! m! }# a/ R' I: H' R{
    " m5 ]/ N8 ^: k' n7 t% q; i" r, r2 n(*memory).p.flag=computing;2 [7 @- ]) C3 i- ^$ O
    (*memory).p.ioNum--;/ X7 @, v4 n" ~# K4 J% R. \! P
    change += exchange_IO_Compute;
    ( u% O4 S. E4 b2 Z% U6 {9 \' j. n& h}1 j- u. ]* K: v4 V+ Y5 f
    }3 @( J& ?: \8 O. s/ B& @' b2 p5 p* g
    }% I) s: x! V- r2 R: ~6 J. O
    }
    + |; m" E  }$ I; pfor(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程
    9 C- Y6 S% g4 }{2 ~  w, t. [! E: r0 b- @4 s5 V
    if((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed
    0 q6 ~% z$ p7 T0 }1 d{
    6 r+ ]+ j. h" u/ T2 H- P, F(*save) = (PCI*)malloc(sizeof(PCI));
    " b' D3 {# ^# V(*save)->next = NULL;6 ]8 [5 Q* I7 ?4 N
           (*save)->processID = (*memory).p.processID;
    ( C) r$ Z  v3 m0 K+ X; W(*save)->comeingTime = (*memory).p.produceTime;
      \  W' m3 a1 d8 f0 @(*save)->askMemory = (*memory).p.askMemory;, [5 `5 N% ^$ J) j/ [. m$ K
    (*save)->compute = compute;$ Z  [+ M- t1 d! n/ K8 z
    (*save)->waitio = waitio;
    0 b1 D3 G; `1 v: N  G4 B- {* C2 `, k8 d(*save)->exchange = change;
    . B4 p. I( Q* m0 Q3 |(*save)->completedTime = systemClock-(*save)->comeingTime;) i3 ]( v9 B) W% r
    (*save)->runningTime = (*memory).p.runningTime;( Z/ k! ~+ a" s5 u, q; B2 B
    (*save)->completedTime = systemClock;
    4 n( ~$ N# a( _- @# {8 ]: _( k4 w*spareMemory = *spareMemory + (*memory).p.askMemory;; ?4 i" z; t5 u" |
    compute=waitio=change=0;
      ^: N! \( |( u6 o/ x/ EcomputeLast=waitioLast=changeLast=0;* l& ^$ Z2 Q+ \. n
    if(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入3 A* o; e7 Y. D
    {4 n3 k( P1 e  I
    if(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程1 L' d# H# ?+ X( I# a. [7 _  j, o
    {+ Y# e; r' X+ |1 I( r
    poi++;( z. \# W/ F7 f, G: N# _+ z
       clockSegment=2000;4 M( v8 i" ?6 ~$ n' s3 f* B, H
    }
    1 B( B/ B' S# q1 H" Z; {4 q; O( S}
    $ {7 v! _$ A, u# c6 x* y+ y6 A9 {else  //没有足够内存调入新进程3 s, J8 K) w" \+ {' A
    {" l3 }* M6 d. G9 \7 U
    if(i < (*memory).proNum-1)
    & z+ J4 n, L. q; s* n( M{
    + v! b0 r3 |! _0 F; afor(j=i; j+1<(*memory).proNum; j++)0 s: Y/ G) {8 y6 y
    {
    + r4 w' F8 M: l(*memory).p[j].askMemory = (*memory).p[j+1].askMemory;! V2 R, A- i# ^5 U+ T
    (*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;
    6 [! Y( e  C) @, v(*memory).p[j].computeNum = (*memory).p[j+1].computeNum;
    : c( I( `! {4 J* p(*memory).p[j].ioNum = (*memory).p[j+1].ioNum;
    % \/ y) |, A  N9 A8 M(*memory).p[j].processID = (*memory).p[j+1].processID;4 {2 l  X% U# Y$ m) |! t
    (*memory).p[j].flag = (*memory).p[j+1].flag;3 `, m' o6 J' f$ D  x4 {) F8 P$ p  w" I
    (*memory).p[j].ioTime = (*memory).p[j+1].ioTime;# T# z& _. {6 }" i7 X' ?
    (*memory).p[j].computeTime = (*memory).p[j+1].computeTime;' E+ T* z. V% H) z
    (*memory).p[j].runningTime = (*memory).p[j+1].runningTime;. v5 V( [- \! e7 [  B! n( F% ]. W
    (*memory).p[j].produceTime = (*memory).p[j+1].produceTime;" \4 s- {# ?5 Y- S. @* Z; U
    (*memory).p[j].completedTime = (*memory).p[j+1].completedTime;! B. @$ ?6 B* T. D! o
    for(k=0; k<(*memory).p[j].computeNum; k++)
    ; Y) P1 F$ Y3 ~; |, j' i1 h(*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];* u+ k4 A  h( l
    for(k=0; k<(*memory).p[j].ioNum; k++)
    8 A& L: C" J- I4 [* b+ K% }! B1 f(*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];# f3 Y3 G' W  o" O, L. e7 m0 M4 ^
    }* L1 C: H) w( f( _. h
    if(i<poi)5 k$ g' S( d6 M+ j- g
    poi--;
    5 e# ?# g6 y5 Pelse if(i==poi)
    ( S( }4 B' E3 M( ?$ u! b1 f* t. JclockSegment=2000;
    ! E: F9 R! X8 i9 `9 a7 ~* A}( R! a5 R9 c& j! M
    i--;0 L2 Q- M( z/ x7 y4 H# ~
    (*memory).proNum--;
    " I: u, T" N+ v/ Z3 C' v6 n, h# ]}8 i2 W( a7 S0 U* H# x3 d& F
    return task_completed;
    0 m* y0 G! e0 v2 G}
    . W" i% \; [# e( f}
    2 l  T/ _+ s) X9 M  }, i" o" k% T# B1 o--clockSegment;$ a4 {- h6 l1 G
    if(clockSegment<=0)
    # e/ g& K7 w, s8 m8 x, X{  K& b, ]  ?3 y" v
    poi=poi+1;
    + \: ^( x2 i% C! I# t9 cif(poi>=(*memory).proNum)
    $ l* G7 @) |4 f1 rpoi=0;1 U( K$ k/ X# s
    clockSegment=100;
    / G$ O; q' v9 ?: W8 j0 U}9 e' `% f% X8 I6 Z& ^
    return task_not_completed;* y: C! u! \; M3 F- n3 A0 R9 U
    }& K! U2 r$ R4 M8 x6 }2 M5 `( k" x
    int TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos)1 n1 u4 G: H2 l6 a
    {
    1 C1 y8 ?' A( E6 s! q8 q  M; eint i=0,j=0,k=0,flag=0,translation=0;
    2 r: J6 f( m& U% xfor(i=0; i<(*storage).proNum; i++)1 ]5 l% W: g- ~# }+ K4 h- @  }: \
    {: Y% x: o, R  k" y1 ~# t3 K
    if((*storage).p.comeingTime>MAX_COMING_TIME)
    9 j9 z* E5 n9 _( m# eMAX_COMING_TIME = (*storage).p.comeingTime;
    % {2 A7 N; V& ?& ]" x}
    3 s& ?- A4 u' M3 o% mif(pos>=0)
    / s* V1 P9 {1 ?! j2 a" K+ O. C{: W" B) z& z; s
    for(i=0; i<(*storage).proNum; i++)  K* z( o6 _( d( Q; S7 n, b
    {
    # p/ K4 Z3 N9 t! ^if((*storage).p.askMemory <= *spareMemory)& g; l: n& v  ]
    {
    ; L0 c( W. [& V1 }& _* E/ qj=pos;+ V; Q( `, n3 M4 E
    (*memory).p[j].askMemory = (*storage).p.askMemory;8 ^( f1 i. Q) |% t6 ?8 [2 o% O
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;
    2 U5 z% q0 \0 c$ X(*memory).p[j].computeNum = (*storage).p.computeNum;; b4 `  A. C9 {/ z
    (*memory).p[j].ioNum = (*storage).p.ioNum;
    * |( H/ y; P5 u, }" i" T. d(*memory).p[j].processID = (*storage).p.processID;3 Y& z  ~& F7 _0 i0 T3 B+ L( r
    (*memory).p[j].flag = (*storage).p.flag;1 |: n4 p/ ?; k# q
    (*memory).p[j].ioTime = (*storage).p.ioTime;
    ! P4 a: U$ R8 [9 y! T(*memory).p[j].computeTime = (*storage).p.computeTime;( M* G4 x2 i) ~' _' }
    (*memory).p[j].runningTime = systemClock;- W, b+ r3 u# e; H4 h" F
    (*memory).p[j].produceTime = (*storage).p.produceTime;( `3 B8 a  ]/ P6 s/ a! U7 w
    for(k=0; k<(*memory).p[j].ioNum; k++)
    7 Z( g* @- m8 h  s* v" z* u(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];4 U: {2 l9 w. r# w- v
    for(k=0; k<(*memory).p[j].computeNum; k++)' K0 o" n1 s7 p: }
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];0 Y$ `* z- P! a/ c2 q
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;9 z; A/ l$ [6 V  }; h, @1 |
    produce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    0 J+ ]; z3 {: p6 Y( |  j" FMAX_COMING_TIME = (*storage).p.comeingTime;
    8 K4 p) Q: f1 t, e  S0 h6 [8 Ytranslation=1;! S, g1 j& J. C  ?4 U$ {
    break;$ V# V$ V2 P" `3 x3 a
    }+ |  B9 `8 s( j) U' s* C2 r' \
    }; e0 b, ?2 i- }- r1 w' q0 h
    }
    / Q' ?4 G2 r- x# K0 f2 Zelse
    $ _2 {6 O5 Z" V, O% A{
    9 [; {4 Q0 x% x3 y& Vwhile(1)
    8 A9 X3 _$ ?, Y' k) N3 {{
    2 |" @4 a  Z: I4 `+ ?flag=0;
    3 H$ Q  w- N% ^# q2 J  rfor(i=0; i<(*storage).proNum; i++)" `/ d) W& d$ x$ l
    {
    ' g, ~+ Q+ N" B  U: E9 M$ Bif((*storage).p.askMemory <= *spareMemory)
    ' i% Q) R/ X$ R( H; ?1 j7 G# p: m0 W{
    ( Z2 f7 D6 V% o6 Z. Z8 [, f. {2 [j=(*memory).proNum;) y) Q4 y: X6 Z
    (*memory).p[j].askMemory = (*storage).p.askMemory;
    ; ^6 I' k. ]! K, ?" P  ]+ q! x(*memory).p[j].comeingTime = (*storage).p.comeingTime;
    & ?* ~6 A! T. _' F6 y(*memory).p[j].computeNum = (*storage).p.computeNum;
    9 ~& u, g6 u. }) t4 V(*memory).p[j].ioNum = (*storage).p.ioNum;$ r, P0 _5 E) \1 E$ K# B2 `' a
    (*memory).p[j].processID = (*storage).p.processID;# W0 n; Y3 a9 C5 B3 e
    (*memory).p[j].flag = (*storage).p.flag;2 C0 P8 U1 G6 L8 S
    (*memory).p[j].ioTime = (*storage).p.ioTime;. M. c3 R, y; W4 {6 U
    (*memory).p[j].computeTime = (*storage).p.computeTime;
    . v4 A  x; Q# f% [(*memory).p[j].runningTime = systemClock;" Z+ I% |! e& F4 v8 L, F& X
    (*memory).p[j].produceTime = (*storage).p.produceTime;- N4 X$ |2 A) W0 M  ^: U; J' ^0 J
    for(k=0; k<(*memory).p[j].ioNum; k++)) Z. F( x+ i( S8 v& A
    (*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    # ^8 I$ Q1 U& J- g  H8 zfor(k=0; k<(*memory).p[j].computeNum; k++)5 ^. X# y  `; j
    (*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];' V, p3 B: i4 @4 [1 n
    (*memory).proNum++;
    & }; \/ }+ {/ u+ d# x*spareMemory = *spareMemory - (*memory).p[j].askMemory;# ^" X% ]. t- G( R6 f8 E7 M8 }
    produce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程# h; `' ~9 E2 O% r5 t4 k0 e
    MAX_COMING_TIME = (*storage).p.comeingTime;
    8 {) Q/ |3 R. a" ^3 Wflag=1;) ?4 Z- Q9 V6 y
    translation=1;7 b* E! S, T6 o8 O- {8 U4 w( v
    }
    2 e$ x; o+ ?, m( r7 i2 S; \9 u) G- p}; K  `$ y8 g- ^0 d; f9 f  Q
    if(flag == 0)1 a1 V. ?# O  X, l& l$ Z
    break;
    ' K! f* G3 w$ Y8 g6 I# G}
    , Z1 \9 I' q) K' L! a2 L7 Y& @}
    % o! h: q% O2 [* V+ y' R( q) Rreturn translation;* k' N0 _6 v* U! G7 d0 D
    }
    * d8 K, E( q2 \" s  q) aint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)5 h# T! N5 Z2 x  C  B- Y
    {! O  e6 x4 S  ^( M& `, [
    static int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;; O( f2 O. k2 a  t4 g3 r9 p) ~
    static int computeLast=0,waitioLast=0,changeLast=0;
    5 C% C/ R3 G, p9 l: X* Xint i=0;
    - n( c9 q4 R7 @/ `4 I& e. e( K4 Eif(draw==1)* W" e+ Q( m2 Y6 L- R2 C
    {
    ( ~% d2 X6 ?& z* d6 ]//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);
    ) x: c7 C! j5 O! n. ydrawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);/ c  f0 v$ w: c+ M: `' H$ U/ g
    * r" ^- V  [. x0 u0 u$ p- b" G

    . k8 L0 ]" Y8 d# Y2 L- r" ^* LcomputeLast=compute;4 L$ c+ r. z3 q
    waitioLast=waitio;: ^& K8 E. y0 J$ q( ~; G6 m
    changeLast=change;. u7 B6 w3 \1 R6 D9 J( p$ L0 x
    }6 }3 E9 M0 A& L! p3 S$ V# }) K
    if(flag==1)  
    : U+ y' a8 r, t" \/ A3 v+ t" @9 \{
    : u1 o0 _% j1 |, Nif((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed8 I( z, R$ {6 m% V. X* w' {1 K* T
    {
    ! k- N* H) n9 Nif(flagiocpt==0)   // implement compute" p$ j  r/ }' }6 A$ K
    {
    ) C1 n1 {, A5 ni=(*memory).p[0].computeNum;& |) x. O/ S; ?. |- Y9 {/ U
    if(i>0 && (*memory).p[0].computeClock[i-1]>0)4 u4 b7 j' V( z1 t
    {8 Z  s2 O5 Z) D4 \
    if(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed
    8 }  o' F( r8 K, O5 t: k{
    ) f0 l/ m( c, d5 I: hflagiocpt = 1;
    ( o0 H/ Z+ Q; a, N5 v9 Y4 @(*memory).p[0].computeNum--;
    8 s; t  t% y3 r' Gchange += exchange_IO_Compute;. {8 e: i, t5 u' u6 N: s
    compute++;
    ( f% A1 C# g* p; @' ^1 O- ?% V}! D  F% w1 ]' f1 c% d, p" {
    else
    ) {6 F& C* ?" C( R: Ucompute++;, c: J' w( K6 n! j2 G

    2 j9 s4 @  x+ d0 W# T}& ^+ D! o: Y% B; E* _
    else
    0 G/ U: G' \8 c: Wflagiocpt = 1;
    % ~% T5 g2 t2 N6 G, D}
    8 y6 [5 u5 B; r9 X. R% Qelse  //wait io0 r' L, x5 h0 H* q# f
    {' @# ?1 {8 o3 N- \, V6 F
    i=(*memory).p[0].ioNum;
    + w7 w" O8 D3 o3 E' \$ cif(i>0 && (*memory).p[0].ioClock[i-1]>0)% V% |* a& Y% B' Y/ o) J
    {
    ! N- ~+ M* c0 d! X- p, Pif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed5 M1 u+ E( s6 Q+ d
    {
    1 }- n! w9 m  H8 n7 cflagiocpt = 0;! F0 m' ~, o1 f+ ]0 f# D
    (*memory).p[0].ioNum--;
    * \0 ^5 B+ `' u) @change += exchange_IO_Compute;
    1 W! e' I# {5 u) K# \; l9 Ywaitio++;
    , Q# ]& p; {; O4 T) w5 ?}
    7 R. b/ f6 }# p* g3 Q0 Celse
    4 a5 n3 b, Y  Q2 p" I0 ^' vwaitio++;; W( L# ?) c8 q* d

    4 H( C5 O: P# I: h}2 t/ g! @: d& P/ A
    else
    ' s0 {3 O. h' H7 Cflagiocpt = 0;
    / ^5 x7 h; h  C0 k* K9 |}: l/ V3 t! L3 |: n! o# n) L
    }
    ( ^; V: g3 `1 \5 s7 B+ ]else  //task is completed
    ) h$ t% _+ T) ]/ b$ v, f{
    ( ]. B: q3 {: c. I7 z9 O! h7 F( N4 ~(*save) = (PCI*)malloc(sizeof(PCI));
    $ _5 ^; E. d! i; x/ d8 x. J5 O) x(*save)->next = NULL;: t7 F  g/ W* d# b4 \  o9 G1 ^8 C; V3 M
           (*save)->processID = (*memory).p[0].processID;- H- D/ D6 k5 }6 T) Z% i' e: L$ ?; Q
    (*save)->comeingTime = (*memory).p[0].produceTime;
    6 W7 x9 p2 r) R- t" [3 B  a8 h# F(*save)->askMemory = (*memory).p[0].askMemory;# |! {6 G+ e) K& t0 M0 |9 O3 y
    (*save)->compute = compute;
    8 H, O. w3 \  z0 ](*save)->waitio = waitio;
    + P3 a& T4 I; A) Z0 E* Q, N* t+ I! e* U(*save)->exchange = change;
    ) u+ M# Q7 d; @. \2 D6 [1 r(*save)->completedTime = systemClock-(*save)->comeingTime;
    + j, ?9 E( ~0 i7 ?( y(*save)->runningTime = (*memory).p[0].runningTime;' @$ d# E5 P( }" n
    (*save)->completedTime = systemClock;
    . t3 Y5 A1 }% p. E0 ^; r4 K//*spareMemory = MAX_MEMORY;$ l  m9 C$ o( [; D& q/ @% ?( \' l
    free((*memory).p[0].ioClock);# q9 j4 a1 M( \. z& B) g
    free((*memory).p[0].computeClock);
    9 s8 g/ k8 M% yfree((*memory).p);
    8 C, N5 x& f  Z: X: j; n" b/ V2 k& Oflag=0;
    9 G0 ^0 Y" B/ r7 J8 S) ?% U  Acompute=waitio=change=0;) q/ l% N7 D% q9 ~9 K1 m
    computeLast=waitioLast=changeLast=0;
    - f  H. N9 S2 D. w+ q% R8 F0 sreturn task_completed;
    9 j4 q2 ?% O5 y4 h" K+ w}
    , O0 D2 r. e5 i- t4 u% P$ H; |}8 `. N, e- |3 B3 x- {& A
    else         
    3 k. x, n" G9 n2 w/ c9 X' [{' }6 ^7 P# b4 [& E- X
    FIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));
    ; r9 S  x9 J. W# N8 K) N* Wchange += exchange_process;
    9 T$ {, Z1 o. p# a9 {9 w2 @//*spareMemory -= (*memory).p[0].askMemory;
    8 @4 }, b: L7 i5 Y7 F5 xflag=1;
    8 O% g( E3 j" @+ z0 f+ h//showProcessInf(*memory);, o( C0 |* I: Y: W3 _6 v2 o
    return task_not_completed;" ~# _0 O* G. Y; c0 S% e& p& e
    }
    : N& X: O" F: ?7 v# breturn task_not_completed;
    7 }' H) q  L7 F0 @1 A3 {' q}
    " Y7 b* S/ v% uint FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)
    ; r) G1 \9 `0 b% p# W  e6 ]{
    4 P* `' R8 k4 Z, l$ ~6 `) B0 pint i=0,j=0,k=0;
    - q4 O, u1 t; X& h3 W* YMAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;
    ( M3 W+ b6 o1 w(*memory).p = (process*)malloc(initProcessNum*sizeof(process));
    # B0 ?4 J( [( K& U  s  V! ~$ @7 ememory->proNum = 1;
    ; _7 ^3 A7 T3 u7 q+ u; Yfor(i=0; i<initProcessNum; i++)( J! Z  y0 j4 f9 u8 o
    {! v) `2 n3 a- w; p; G8 N. `
    if((*storage).p.askMemory <= *spareMemory)
    ; R6 _9 J3 B% \7 A# F{
    ; _+ G7 d% e3 x6 t* ~9 ~(*memory).p[0].askMemory = (*storage).p.askMemory;3 k$ S! P) Z! T) N& p8 s
    (*memory).p[0].comeingTime = (*storage).p.comeingTime;
    1 C% @0 S) F! r$ r, u(*memory).p[0].computeNum = (*storage).p.computeNum;% p7 K7 d3 ]+ w+ |0 U5 c( c
    (*memory).p[0].ioNum = (*storage).p.ioNum;3 K* {$ }& D" |; s8 G; M$ P' W
    (*memory).p[0].processID = (*storage).p.processID;1 T1 ]5 P7 k' y4 Z2 c& k# x! j
    (*memory).p[0].flag = (*storage).p.flag;$ W$ E, N: Z; a* @' W0 M6 `
    (*memory).p[0].ioTime = (*storage).p.ioTime;
    * C0 @$ U$ A; M/ z' o- e(*memory).p[0].computeTime = (*storage).p.computeTime;
    & F  Q. a7 Y9 B/ ?( f9 ~(*memory).p[0].produceTime = (*storage).p.produceTime;3 s& w# v2 b9 H& O
    (*memory).p[0].runningTime = systemClock;. k: v0 |1 b6 f
    (*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));# O1 p4 G4 A( I# O' `3 A: J$ U
    (*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));  l! B& m5 z3 K
    for(k=0; k<(*memory).p[0].ioNum; k++)
    0 a) ^/ }, [, f: |# }- v3 R(*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];3 n  l' ~  ?- s; p* T" U0 Y1 }
    for(k=0; k<(*memory).p[0].computeNum; k++)
    ' O! E" ^/ v5 g3 |7 X. q(*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];
    & M7 q$ P  ^2 J; G5 C2 _8 Nbreak;; q0 I/ x3 ~0 h9 }# x3 ~8 {6 m
    }
    & k% W) Y. \7 N  K$ `; G2 Z8 h}
    2 b/ ?1 S; s" y! @# Vif(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入
    ( Z, b4 {( W7 L{* c: u6 B3 o# }( d* O/ I! S
    produce_one_task(storage,i,ID_FIFO++);9 t9 Y1 |8 x3 y& `6 Y4 M
    MAX_COMING_TIME = (*storage).p.comeingTime;
      U- `- |* Y/ T8 @+ Lsort_by_comingtime(storage,i);* W2 S3 Z' D' b" h2 X& ]8 Y
    }' w, j$ t- U6 r9 w- y
    return 0;! R6 N! P' O- _4 z
    }
    " A: P7 b7 P. p- t1 J- `int sort_by_comingtime(processPool * p,int pos)
    ! O$ {7 B$ t: X- t6 u3 N9 ]{* b7 h! A& m9 h
    int i=0,j=0;' q8 U& v8 k! o
    process temp;
    ; l6 Q1 }4 X! y3 oif(pos<0)/ k% m8 ]6 ?& A5 g
    {# R/ q( w2 i- Q0 H2 U0 P  a! t
    for(i=0; i<initProcessNum; i++)1 O& v! K2 _, \. X: I6 _) Y
    for(j=0; j+1<initProcessNum-i; j++)8 S/ ?3 U* F( L) A- M
    {
    , T( M+ Z; C( [% ~" \if((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)/ ]$ B  w" `' o) h
    {
    - j* p# u( @7 d. z/ R7 htemp = (*p).p[j];0 i7 u- }. I5 P; v! v
    (*p).p[j] = (*p).p[j+1];
    , K- G3 f0 {# A* G) K(*p).p[j+1] = temp;2 ^8 o; N- J- A8 C; X; g
    }
    3 a  N: I  h" A. k}
    ' y0 D# k9 n) M8 `}8 }6 _; T7 ^3 @% z- v
    else if(pos<initProcessNum)
    : E! [" ^5 e6 A% |6 M{
    : W6 L" P1 A. Z% Jfor(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--)
    7 Y8 N3 t0 b; V1 W3 ^; ^* m{
    & P* A' R3 m" ^+ D1 I( M3 N7 O+ Ktemp = (*p).p;
    / ]0 d4 g( U6 S(*p).p = (*p).p[i+1];  f, j: e5 s* O- f8 o: P
    (*p).p[i+1] = temp;
    : z0 U7 H8 J9 h& X}! {2 O& u5 T5 J
    for(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)$ O9 q4 j8 Y' Q; g% _
    {
    ) k) S( V. Q8 _, |& R! ltemp = (*p).p[i-1];
    9 o8 j8 K8 ?7 M3 L5 f" j' j- f(*p).p[i-1] = (*p).p;
    ( f) F$ y! N6 X: D7 G& _! \) O4 ?(*p).p = temp;  J& m& G9 j: ^+ i) H! m% F6 }
    }9 f2 s  ?' Z) W! U+ P
    }
    ( l) p, O) e3 k# p+ E) Felse, \  _, s; o. l& `* K4 V7 U
    printf("position eror\n");- g( r* H% \6 N. k& Z3 _
    return 0;
      ~& @, Q8 C% v1 O}) e1 \3 |- {) i
    int InitPool(processPool * p)  I! v: t+ N( J! G7 A
    {" G, ^4 e) _9 c' `* P7 f" ^
    int i=0;6 k* i# I* F4 y
    (*p).proNum = initProcessNum;
    6 ^$ F% M6 n/ B5 r$ Y+ f(*p).p = (process*)malloc(initProcessNum*sizeof(process));
    / z: o, k& c$ R" ifor(i=0; i<initProcessNum; i++)                                        //init process information
    1 c( R& e2 `! \. v) u0 J{4 K2 L3 A" H8 A% A0 f8 d! h
    (*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));1 e& w+ B( `. J: k5 ?& ~
    (*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));
    " r- C7 c2 t, e; ^  @7 Dproduce_one_task(&(*p),i,ID_FIFO++);
    8 j6 h. P" p4 Q+ v}
    " s3 G: g& o( _9 K& a4 Hreturn 0;0 `& B. c7 [) C4 M4 H* Q
    }
    & V8 B3 Y! r8 O2 O; b- }int produce_one_task(processPool * p,int i,int id)0 q" E7 E+ k5 ^: a) t3 w3 @( h
    {# f: T0 F; c/ Q- t0 I$ M3 o7 F
    int time=MAX_COMING_TIME,j=0,totallTime=0;
    " S# w& T, f/ |3 B(*p).p.processID = initProcessID+id;           . J# G$ c2 }' r7 p8 t# X0 i. X; i
    (*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);7 u# A) O$ E( `# y, e  p) S3 g
    (*p).p.produceTime = systemClock;
    & ]% D( J$ g! q1 T6 S2 v(*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;. E; ~5 G3 m2 i
    (*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;9 h+ w+ K; f( [0 N
    totallTime = (*p).p.computeNum  + (*p).p.ioNum;
    1 p  X( `) F" L0 ~2 w- X9 R& z(*p).p.computeTime=0;
    2 m2 W) I  n. bfor(j=0; j<(*p).p.computeNum; j++)( a! O9 |7 P# j7 Y& l! `% r
    {6 z0 K+ I- ~1 S8 u$ d
    (*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;9 d* T: a$ q( A
    (*p).p.computeTime += (*p).p.computeClock[j];) s. W& D* j  q# \
    }5 d/ J7 Z+ x) q
    (*p).p.ioTime=0;* r- {. {8 s* h
    for(j=0; j<(*p).p.ioNum; j++)
    + q$ K. V8 ^0 l/ E! c( e! C$ k{
    # _* N: ]6 G6 K) }/ l- j(*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;7 q% V4 j7 ]9 [0 |+ m1 Q. F2 e$ ~; K
    (*p).p.ioTime += (*p).p.ioClock[j];
    ; L( M) R# H; g, {6 G6 v& h8 ^}
    2 H$ u9 P) _* }/ {, ](*p).p.askMemory = rand()%(MAX_MEMORY/4);
    1 ]- Q( i) Z7 d9 q(*p).p.flag = ready;
    6 u7 y- P  i; o. Creturn 0;6 O0 _2 W1 r& @: j
    }
    0 y! o5 u! X; ]) kint showProcessInf(processPool p)" L, _4 R6 S' G$ E6 Q+ s( P  ~( E  {
    {4 F6 @4 s" t+ |7 h
    int i=0,j=0;
    ) ]& M* C$ k0 |6 d5 Xfor(i=0;i<p.proNum;i++)
    $ a% w- z* K0 |2 v{# _, l  k! B$ c+ c# c# ~
    printf("ID:%d,%d,%d,%d,%d,%d,%d\n",p.p.processID,p.p.comeingTime,p.p.ioNum,p.p.computeNum,p.p.ioTime,p.p.computeTime
    ( q& L7 s6 ^6 f5 j( b( ^,p.p.askMemory);0 ^8 m- V/ Z+ ]; T0 V# L
    for(j=0;j<p.p.ioNum;j++)
    ! z/ g" y1 P" b7 o* O- K1 E7 Z{: }: K1 I) H! ~& U4 o1 J
    printf("%d ",p.p.ioClock[j]);
    ) K# c0 \( }3 N% H4 f}
    * f6 J. S5 r6 Q- A- n0 I2 O' kprintf("\n");
    4 O# C+ c# Y) w) k! U3 Bfor( j=0;j<p.p.computeNum;j++)
    . `( z. o7 t3 q$ b, c{& Z7 S4 y1 c. V
    printf("%d ",p.p.computeClock[j]);
    # m( D% }; \) E- b3 ]% m}7 B8 D/ F/ |0 |7 j1 L! O; L+ Z* l0 N
    printf("\n");
    , p6 j: n& l. n6 U}, j6 }" q, t, h$ m: S
    return 0;
    ; ~& ]$ \3 n8 U" l! O2 I}7 d" ~  L7 Z8 v9 W7 s4 B) f
    ————————————————7 `# b9 J0 V6 h" }  N
    版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。, n1 ^" |/ D; B$ q" U
    原文链接:https://blog.csdn.net/wang_dong001/article/details/47843519
    # C2 a9 x  h- J8 |5 B
    / ]7 o. R& k7 P6 A! L  U+ G% l1 C; T3 B" E
    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    fastpost qq
    收缩
    • 电话咨询

    • 04714969085

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

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

    蒙公网安备 15010502000194号

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

    GMT+8, 2026-11-1 03:50 , Processed in 0.409312 second(s), 51 queries .

    回顶部