QQ登录

只需要一步,快速开始

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

    $ h& D1 k! g; D) {经典任务调度算法的模拟程序
    # i8 ~* e8 n1 }* [# A本科毕业设计写了一个经典任务调度算法的模拟仿真程序,测试了五种调度算法的运行性能。在程序中虚拟了任务的进程,按照不同调度算法策略从进程池中选取任务执行,在任务执行过程中,保存相关的统计参数,最后对这些参数进行处理,反映各个调度算法的实际运行性能,程序中可以通过修改任务的相关参数改变任务特点,测试不同任务环境情况下,调度算法的性能适应性。程序是通过C语言编写的,为了对运行结果图像化,采用了EasyX的图形库。由于计算机中实的任务调度过程比较复杂,在实验中为了简化程序的实现,在某些方面进行了特殊处理。
    ) }- w" s, q" `& r/ C
    . C6 @/ `$ M( y+ ~; ^  `编程平台:VC6.0+EasyX图形库环境。
    * j( [' q  J7 ?7 W) V: u0 M& n) k! X. [
    以下截取部分程序运行图::5 Q% N4 Q7 I5 g" u- y

    0 l+ K/ u, P5 ]源代码:
    # R& p  ]5 C& R# c( y6 ?$ H# o" R5 C
    #include<stdio.h>
    3 x4 N: s) ^2 Z. f' e+ N( a#include<stdlib.h>
    ; e% H% ~" s$ y* o7 G9 z; `#include<easyx.h>
    % i$ d6 F3 K. v  ]: z: {$ `#include<time.h>& }6 t" t0 b% q# J8 ^' t' ]- n$ @
    #include<conio.h>
      E1 {0 M+ S, ?! W& C8 h; A#include<graphics.h>
    , X) j/ n% N0 u$ \& f0 C#define initProcessNum 10
    ; Q3 R0 t" \1 `$ H+ K#define initProcessID 1000) j  Q* M0 b' I  F
    #define MAXProcessRunTime 10000
    % ~; A1 d! Z* ^8 L3 P#define MAX_MEMORY  4000
    0 o& o- U* Y5 ~7 a#define exchange_IO_Compute 109 F2 K2 j! w# Q5 h! j8 I; A2 {& c; m
    #define exchange_process 25$ r' ^0 q0 Y, Z
    #define task_completed 1
    - l# r  ]3 n5 c$ l#define task_not_completed 0, @" u$ M1 e/ o, I% h- n+ k
    #define initclocknum 100; s2 Y' S7 c- J( s; e) N
    enum condition0 H3 P' Z+ c0 ^  T- R- T* Z) P6 t
    {
    - B5 f) X2 E5 D( {( adead,computing,IO_waiting,ready
    2 r- B7 H  T( F3 b* I% a4 |$ f: R};& l# c( C: ?% w; m* O
    struct process
    4 {$ u/ g+ D6 @9 i{
    2 p7 n7 n. D: N% Fint processID;  S5 I1 Z- U7 _. u. g
    int comeingTime;
      h1 E" `) m9 bint ioNum;
    0 R+ x: R9 s& jint computeNum;
    ) |6 |1 I& e. P/ r+ i9 [int * ioClock;1 O  E! v# d/ |- K0 U& }8 U
    int * computeClock;
    0 R9 I. Z2 l* h. @int ioTime;: O/ r! u2 L+ v- k# C+ H1 Z! @+ }
    int computeTime;2 F$ T5 e* p' q' M( A; }9 l1 }) D
    int askMemory;9 i* U0 F8 I0 r( [3 F
    condition flag;
    - O, _* Y* q$ P; G/ jint produceTime;  //生成时间,以下三个数据成员用以计算相关性能( G/ Y, j6 ^  G3 T
    int runningTime;  //第一次占用CPU的时间
    & R" B0 C2 ~7 F+ [& G8 w( ~2 kint completedTime; //进程完成时的时间. ?4 i  E; |- h1 G, s) w7 \
    };, N" k2 g( E; B+ [% j- m
    typedef struct processCmpletedInfo  //保存完成一个作业的相关信息( r. ~1 z2 \, ^
    {4 ^* l' [9 W4 ]: ?
    int processID,comeingTime,askMemory;
    8 U2 K) t( X% n" ]1 J( ]5 p9 dint compute,waitio,exchange,completedTime,runningTime;8 P: f8 @' j; N/ q3 v5 F8 T
    processCmpletedInfo * next;; e/ @' v: C5 Z+ ^( S* d
    }PCI;
    " ~" l% l9 U5 A4 v! d7 _struct processPool( a2 \) r& S$ s) Q+ T
    {# Q6 j1 c0 J( `' T
    process * p;3 y4 W' ]9 I( T6 [) J5 w0 E$ c
    int proNum;
    , y: X0 z# `: T( i: n};
    3 j3 u8 {6 f7 y5 ^4 K* k, gint 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;# I$ z' n  B+ U8 \4 a) N8 H
    int InitPool(processPool * p);
    5 U: p; P4 I4 i0 L5 u  g: Dint produce_one_task(processPool * p,int i,int id);
    ' g9 H6 o" r9 e, B3 kint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw);8 E' i* v3 s- w- F
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);! u! |" X  b  v7 k; ]3 M
    int TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos);, X: j" y! L* Q5 @" m
    int FIFO_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    4 h3 R3 _' h4 ]4 ~8 K: _int ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);" W2 z7 S. L7 ^8 I9 N" W
    int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    , X' x! `: O4 q! y* ^5 gint PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);# K7 P  n1 y* X, A0 L/ w, k; p
    int Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory);
    6 K3 Y2 `4 l9 ?: e" Oint High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int disatch);
    7 R9 e& l! i# d7 d' e& Gint High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw);9 g. _& ?7 ^( N3 I- F

    $ r/ D' w3 |4 ~2 U; U+ N
    # s6 o+ u5 k8 M) g4 U) M5 R+ kint sort_by_comingtime(processPool * p,int pos);7 _" _; N1 o! R0 f* b8 o7 H
    int showProcessInf(processPool p);  O8 Z- {1 q2 N! d) O) q9 {
    int drawPerformance_FIFO(int x,int y,int memorry);
    4 p$ ?9 [0 S; i. O9 z; w+ Q) Aint drawPerformance_HR(int x,int y,int memorry);8 @! G: V! g( _; t  i- s0 w% p
    int drawPerformance_PF(int x,int y,int memorry);
    " |! N3 ^* `4 |5 E& |# uint drawPerformance_TT(int x,int y,int memorry);; X  {: k( m) ]+ R; {1 l
    int drawPerformance_SJF(int x,int y,int memorry);" f. t- b+ O  m! S2 e/ D4 I
    int MouseListening();
    0 c$ h9 u  _, W" y# B: c$ ]6 Bint MouseListening2(int *flagShow,int * showTime);
    7 h% x- u6 ?% n, n6 _* V2 mint showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR);
    4 @$ b4 \" B9 f! W' Q1 K6 r; J
    ! Z0 T8 J+ T9 a  v# V. h3 J, W# D9 r1 G0 |0 B4 c' z1 r
    void main()7 m0 j- c1 S9 v( Z
    {
    ; H! h2 H  n" S2 c" i* d  }" _PCI* FIFO_save_head=NULL,** FIFO_pri=NULL,* Timet_save_head=NULL,** Timet_pri=NULL,* SJF_save_head=NULL,** SJF_pri=NULL,! {; [8 G0 s7 }. D# x( c4 g  f, Y
    *Priority_save_head=NULL,** Priority_pri=NULL,*HR_save_head=NULL,** HR_pri=NULL,* p;
    # G; i0 M( [0 }! _- fint i=0,FIFO_memory=MAX_MEMORY,count=0,Timet_memory=MAX_MEMORY,SJF_memory=MAX_MEMORY,Priority_memory=MAX_MEMORY,HR_memory=MAX_MEMORY,* D+ `% ~; h/ A, T3 q
    flagDraw=0,showTime=100000;
    : t! j% S8 ~7 D$ j- y" ZprocessPool FIFO_p, FIFO_mmy,Timeturn_p,Timeturn_mmy,SJF_p,SJF_mmy,Priority_p,Priority_mmy,HR_p,HR_mmy;% M/ w: X$ D8 D" k$ f, b
    FILE *fp=NULL;* T6 q6 H0 }$ O7 [; l' M% u1 b
    //processPool HR_p,HR_mmy;
    ' r$ R1 u2 ^, K2 h
    - }, I( D, j9 e# w- T/ W, M- y' r: Q6 J- `
    srand((unsigned)time(0));
    ( \; d1 @3 Z" G0 k% ~" rsystemClock=0;9 P' }! V% S9 I2 V2 {
    initgraph( 1200,650,SHOWCONSOLE );! V: D* n5 M* [
    settextcolor(GREEN);
    * `6 ?# e( `, I1 n# S" ]* ], Osetlinecolor(GREEN);  o: }0 F: l7 n; [/ m! U" o
    setfillcolor(GREEN);$ t0 Z0 [2 B8 B7 c$ N
    InitPool(&FIFO_p);
    ! P* o! e8 m# X3 x/ H" bsort_by_comingtime(&FIFO_p,-1);
    ; V3 j1 K1 S1 _InitPool(&Timeturn_p);
    8 Q. X9 @2 h3 c$ E. i9 B- }InitPool(&SJF_p);
    ' @: C! g* ~6 V. sInitPool(&Priority_p);# m* D* ?) M* L" ^
    InitPool(&HR_p);' R, X7 T; V6 B* m. o/ m
    //showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);# f/ U, W! Y- }+ x) S
    //Sleep(10000);
    ( E) M' E% H  c0 D% H$ ]/ E, @
    & t, g! V! _) s  g& {
    * X( g  N8 Y  E4 HTimeturn_mmy.p = (process*)malloc(initProcessNum*sizeof(process));+ m8 A: @* n& N4 V% P
    SJF_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    : P3 ~3 J/ B9 ~+ W* S7 dPriority_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    3 t$ w9 i! q1 V7 B- a' p  QHR_mmy.p = (process*)malloc(initProcessNum*sizeof(process));
    ( u7 F8 J1 C; \) g: m) b4 @# Afor(i=0; i<initProcessNum ;i++)9 v# }0 @7 @: }9 j0 ]( c% Z
    {
    6 y! F9 p6 X/ T& h7 zTimeturn_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));; |, ^+ g4 i$ X  F$ D, `( K
    Timeturn_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    3 \; V: K3 P& B, }3 @6 rSJF_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));) ?$ S/ T1 c" n1 Y. U4 E1 b
    SJF_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));- E# U; x' I+ N. E
    Priority_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    - g& A) ~$ ~; b$ cPriority_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    # B5 W. G5 b& `3 B0 UHR_mmy.p.ioClock= (int*)malloc(initclocknum*sizeof(int));
    " G& g) x" i! v$ YHR_mmy.p.computeClock= (int*)malloc(initclocknum*sizeof(int));
    . H" K' F5 i( m# F! S* W( S0 E: z}- t! w6 `8 }6 `
    Timeturn_mmy.proNum = 0;/ q. |& J! j0 f  K) L% k
    TimeTurining_storage_to_memory(&Timeturn_p,&Timeturn_mmy,&Timet_memory,-1);  u+ e* C' _* N) V  Q- `7 Z/ F0 s
    SJF_storage_to_memory(&SJF_p,&SJF_mmy,&SJF_memory);. Z* M0 G0 h" f+ e5 D
    Priority_storage_to_memory(&Priority_p,&Priority_mmy,&Priority_memory);5 f1 ?/ p9 Y( j! G& H6 e; r
    High_response_ratio_s_to_m(&HR_p,&HR_mmy,&HR_memory,0,1);
    , [  W3 M$ P' W9 r1 r& m//showProcessInf(Timeturn_mmy);" u( H: N" D$ Z: W
    FIFO_pri = &FIFO_save_head;
    " E+ N, ?2 Z6 RTimet_pri = &Timet_save_head;5 v& j  z; J* |! V
    SJF_pri = &SJF_save_head;
    / B5 `( P" v/ P" F8 E. W. S9 ~Priority_pri = &Priority_save_head;
    , B$ k- R/ T" t6 a( v( M+ g    HR_pri = &HR_save_head;1 \9 l) X& z5 E' O2 d
    setbkcolor(WHITE);
    1 t: h: b; j* v$ _3 o; Awhile(1)6 s4 `' P8 o0 L& t& [% J
    {
    & S! z6 J. d# O* W1 k8 ?& k# gif(MouseListening()==1)% E4 N9 J* r$ n) u+ g
    flagDraw=1;
    % ]. @) S2 z; z7 kif(count==100)
    5 ]4 x, t4 Y, k{5 V( c: R- }; X
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,1)==task_completed)9 H# \4 v6 m& [( @) r; ~: F3 D0 i7 n6 y
    {5 ^# {5 X* ]2 h# I1 h5 N# `
    FIFO_pri = &((*FIFO_pri)->next);
    ; `- y' e; j( Z, ^. N
    8 ]+ y7 w" y( B, \//printf("hello");) ]! b- z) c/ k3 B8 C
    }  d( N2 T: l- z- m1 y9 T0 Y
    if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,1)==task_completed)+ V& ?  }6 c8 x  K
    {0 k& Z) L" ~1 @/ ]
        Timet_pri = &((*Timet_pri)->next);: x- u: G+ n/ |' V( s  @. E. Z+ L
    //printf("hello");
    ) g& r# _3 w. [: `6 Q. k}
    1 @8 u/ m/ |/ r, I4 F) Uif(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,1)==task_completed)
    % f4 k/ C8 J6 X6 q$ P: M. p$ D{
    * D  h& v/ S0 z2 z% ]8 N+ O$ DSJF_pri = &((*SJF_pri)->next);
    + I. ~  r* V8 m7 D8 |9 }) ?0 ~& U//printf("hello\n");
    3 Z/ s9 P' w9 p# B; H}% W% ^& D1 `+ ~) f+ @9 D
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,1)==task_completed)
    * q9 t' H  ]! X$ W{. |1 ~- j/ X: K* q+ w. a
    Priority_pri = &((*Priority_pri)->next);
    " o5 i: O& U/ |& {//printf("hello\n");, W4 |3 ^: {9 R0 k% t
    }  ~: [6 E* _: ^. Z6 r0 I; c$ ^
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,1)==task_completed)% X' W, Y# c! c9 s
    {
    - J! d3 D* n0 ]0 R$ G' l# mHR_pri = &((*HR_pri)->next);1 j$ t2 q" z, M
    //printf("hello");' u. L6 A( w. `) |
    }& u, n, N, W% a
    count=0;
    0 [$ l& i  w: G3 H2 a0 p}1 k! _% y( G. J9 V2 Q' a) r
    else  z3 C0 \) ]6 @$ t3 }# h
    {" _& I! v1 t% ^4 Y" Z4 M
    if(FIFO(&FIFO_p,&FIFO_mmy,&FIFO_memory,FIFO_pri,0)==task_completed)
    ; w2 R; y. b) A$ j. g$ M{' [8 h+ l3 w8 ~) U5 A4 F
    FIFO_pri = &((*FIFO_pri)->next);, Q  d* r4 N  [0 E
    // printf("hello");9 e: q( @" X* \% D
    }
    0 x9 ?! t+ F! ~if(TimeTurning(&Timeturn_p,&Timeturn_mmy,&Timet_memory,Timet_pri,0)==task_completed)
    2 @4 R) }6 v5 _, b1 b{$ E0 p+ d! K0 A' m
    Timet_pri = &((*Timet_pri)->next);
    4 R  t, j' H2 l" {// printf("hello");* H! k' |  G( M% V6 o1 v
    }" R. R2 c' k) ~+ c# Y  U1 P
    if(ShortJobFirst(&SJF_p,&SJF_mmy,&SJF_memory,SJF_pri,0)==task_completed)+ a  q! G: k3 }+ r) b5 l6 {
    {
    . _, [2 p, G8 R* \   SJF_pri = &((*SJF_pri)->next);* k9 B1 l9 z5 |" z) t8 F& M
    // printf("hello\n");8 g: X4 J8 I5 V/ \3 X4 ~+ p
    }5 b- @2 u4 K3 `7 n2 `) J0 c
    if(PriorityDispatch(&Priority_p,&Priority_mmy,&Priority_memory,Priority_pri,0)==task_completed)
      ?- p' k: [* u! L" S" ~, q2 Q{9 X8 N$ f& _1 M( W0 a
    Priority_pri = &((*Priority_pri)->next);
    5 g% B' Z4 |1 J2 ~: e# z( r8 g//printf("hello\n");
    # R3 p7 i) A* J0 L; Q}- a3 ^% Q! t4 k8 \- g0 A
    if(High_response_ratio_dispatch(&HR_p,&HR_mmy,&HR_memory,HR_pri,0)==task_completed)
    7 H0 G3 N9 x4 \8 @; T% M{
    & j! ?) i  \, EHR_pri = &((*HR_pri)->next);1 P, d( Z% C% B% K3 g/ C
    //printf("hello");
    ' P4 U0 E6 R% A( L//Sleep(1000);  n' ^# R8 c  A4 m4 |
    }( P- T' C- |7 t, B; K
    count++;
    - E' }7 i& y) L}
    " D; Q  @( s  X  v. ^2 X* Pif(systemClock==showTime)9 a: |, L% a/ h2 |7 X  v
    {
    1 P' I2 I% r# A/*PCI * p=FIFO_save_head;, h& k2 n+ P  Y! y* H5 p& X- ]1 u9 m
    int i=0;
    9 N* Y0 v6 y3 p! |! P! C* W8 a& Lfor( ;p!=NULL;p=p->next)$ G* g% N; P1 k5 P6 K( ~: o9 g
    {
      |) |6 S3 {# [& yprintf("Id %d\n",p->processID);8 |. `, r& O3 T: q$ H  L/ A
    printf("comeingtime %d\n",p->comeingTime);
    . k! R+ D; `& v7 o: bprintf("runningtime %d\n",p->runningTime);  l7 t! k# Z- T+ J! i5 b. c: }- w
    printf("asdmemory %d\n",p->askMemory);( f% R) @  f8 y5 K1 `5 z" I
    printf("completedtime %d\n",p->completedTime);8 c; Y5 I7 p# {: H: M
    printf("compute %d\n",p->compute);
    , B0 n) d. p6 @/ h0 d; t. ?3 B4 wprintf("exchange %d\n",p->exchange);# u& G; T# B3 H" q9 v- t, J
    printf("waitio %d\n",p->waitio);/ {5 A5 |+ a- k
    i++;
    2 a7 O: g# N  _$ J8 h, |0 {. ^& o+ E3 y( l0 N

    - {4 D  r5 d5 \* h% \) O$ m  T}
    1 K& N: T8 z- v' f/ d5 S7 t, i6 aprintf("%d\n",i);*/) N6 {) O, M6 M9 y: @! q2 |
    if( (fp  = fopen( "data.txt", "a" )) == NULL )
    / ]3 q* R; b9 j$ Y# q- c7 P4 G{
    ( f( W4 e) P. }; z" Hprintf( "The file 'data.txt' was not opened\n" );
    : x; |0 m5 u; k+ J- I2 L//return 1;  x' \0 L6 j, X. j' k( `
    }
    & j! c* M- c9 ?, z) ~, T3 U& J9 melse; m; |8 O' I# [7 X5 `! v
    {2 t; s: ^, p: m7 w
    fprintf(fp,"FCFS \n");
    % w- u# B0 K2 b2 Lfor(p=FIFO_save_head;p!=NULL;p=p->next)# i+ u3 R# T! Z: ?: n- A8 t
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,' t- c+ f- ?6 W- X$ K/ u7 o( y4 s
    p->exchange,p->waitio,p->runningTime);
    - l4 s9 @& `8 V; B) d! m1 q& R1 kfprintf(fp,"\nTime turn \n");
    ; E0 j! A2 s. E8 c, }for(p=Timet_save_head;p!=NULL;p=p->next)
    & o2 ^8 u; h9 Pfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,: b' w' b* O/ L
    p->exchange,p->waitio,p->runningTime);
    , ^$ B+ ?# i: M3 l5 dfprintf(fp,"\nShort Job First \n");
    6 q! ^6 C$ ]. d! _1 ?for(p=SJF_save_head;p!=NULL;p=p->next)
    / L, c/ r8 r/ V; k- afprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,
    & h* i  C' W; F$ A$ v/ Q3 Y4 lp->exchange,p->waitio,p->runningTime);
    8 B: J5 j. A3 y( U5 efprintf(fp,"\nPriority  \n");/ n6 g5 W! n6 ?$ l/ P% z4 j- ~3 v
    for(p=Priority_save_head;p!=NULL;p=p->next)
      q8 a  r/ [8 I/ Tfprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,2 E1 D6 s# z0 \- t  a% F; r( _
    p->exchange,p->waitio,p->runningTime);
    * Q  ~9 X7 ~/ J  {( Bfprintf(fp,"\nHigh response \n");
    ! ?$ M- A2 @& }: @5 s- b8 F3 X& {for(p=HR_save_head;p!=NULL;p=p->next)" g. D3 h8 n; C% k6 J$ ?
    fprintf(fp,"%d %d %d %d %d %d %d %d\n",p->processID,p->askMemory,p->comeingTime,p->completedTime,p->compute,! s6 I" o& `3 m1 P
    p->exchange,p->waitio,p->runningTime);
    ) h: Z" b4 Q0 `fclose(fp);
    / `* ^! s( O. u}7 F' h' _( N6 k; g
    showRunningResult(FIFO_save_head,Timet_save_head,SJF_save_head,Priority_save_head,HR_save_head);9 c6 U3 j. _/ V8 L
    MouseListening2(&flagDraw,&showTime);
    3 o3 ~! R3 z+ u( r}
    & v& K9 H1 z9 E0 k3 BsystemClock++;; E$ y3 t1 |0 [
    if(flagDraw==0)% j6 l' u- I7 y& J( }: K& X
      Sleep(10);
    $ M) T) \  ]% {9 L}! \0 g$ Y- e% T) F# _

    $ a, f, |: P* t8 |
    4 j% ?0 k/ q- L$ j}/ ?/ o# ?" p( ~2 \; h' e
    int showRunningResult(PCI* FIFO,PCI * timet,PCI * SJF,PCI* PR,PCI* HR)
    " J: Y3 l* Y# W2 D{
    9 J$ L0 m3 j* }) a' Q& N7 PPCI * p=NULL,* name[5];* z7 d4 l, b. `# @& w
    int count=0,i=0;; o/ o, ?4 O6 P# A
    char ch[5][10]={"FCFS","timet","SJF","PR","HR"};
    - K& R2 V. W# ^' o# Vdouble turnover=0,wait=0,c=0,w=0,change=0,pos[4]={0,0,0,0};
    $ I$ \8 N: C6 _6 Cstruct info6 q9 O8 p' {, h# z* ~
    {
    ' V' ]* q$ v/ G5 j) U8 echar name[10];
    / Q- {8 {6 y! a, odouble throughput,turnover,wait,CPU_rate;$ G' v- t) C* F
    }inf[5];
    8 E7 n( F* T$ ~  a3 Dname[0]=FIFO,name[1]=timet,name[2]=SJF,name[3]=PR,name[4]=HR;
    ; l) ^/ b" @2 k+ g. Z3 H4 ~printf("调度算法..........A\n");2 U7 b; G$ j0 f( t
    printf("吞吐量............B\n");$ W: b" t8 N1 S) y) h
    printf("平均周转时间......C\n");
    / g9 _1 K2 Z( h+ a  w4 a& [) {printf("等待时间..........D\n");% j/ D* I8 {4 W! y
    printf("CPU利用率.........E\n");
    - x8 n' y/ a5 B3 y+ s8 h& kprintf("A\tB\tC\t\tD\t\tE\n");
    ! ^& q6 L! X) O# |* u& s/ W1 a; qfor(i=0;i<5;i++)
    ; F- z1 c& W* ^* f9 n& i{
    8 k. ~; X& M4 E8 i) O: b- C  Lcount=0,turnover=0,wait=0,c=0,w=0,change=0;# T* U  D0 _; I* Z/ x/ W
    for(p=name; p!=NULL; p=p->next)
    # b/ ^- }. A2 [' r4 u0 J{' q  \& A. K, x2 o$ f9 E
    count++;
    $ Q- Y# ]4 L2 ]turnover += p->completedTime - p->comeingTime;
    : E3 T! t/ Y0 e, A) T+ w" }, Ewait += p->runningTime - p->comeingTime;2 n. T# r" o; q, R( I* v2 h9 L
    c += p->compute;: a, Z% W8 I' t7 E
    w += p->waitio;. X: U* M" x4 |0 ]2 Y" t
    change += p->exchange;: {/ w2 E) m& j( l8 i
    }
    " H4 T+ I  X- s. c+ Zturnover = turnover/count;/ M% l' r/ p  A! d  e2 Z/ d' z# Y
    printf("%s\t%d\t%.2f\t\t%.2f\t\t%.2f\n",ch,count,turnover,wait,c/(c+w+change));
    5 O2 _1 T5 {( d2 ^6 fstrcpy(inf.name,ch);" K, n0 X) f+ E) V* l7 Z
    inf.throughput=count;/ f% G2 H! x* V4 r
    inf.turnover=turnover;  S1 ]$ Q) g# {: |0 W4 O, ~+ H& X
    inf.wait=wait;
    1 @! q8 A7 ^" ]; f; ^; P9 d4 Yinf.CPU_rate=c/(c+w+change);( _8 X6 c) `' W. e0 E# [
    }. X- v# O1 g& \: ^2 d2 g) S; W
    //画图
    5 l& E4 O( ?* E3 J' m  K//cleardevice();
    9 O' @$ B5 {: ?line(0,600,1200,600);
    - X: L3 R' n2 j; W: S8 d5 m* L' mline(10,600,10,200);* X2 y' d4 D# ]9 R
    line(10,200,5,205);! q* K1 {: b/ m0 D
    line(10,200,15,205);6 o; L0 ?& T8 {
    line(310,600,310,200);
    8 x- q. y# S  W- q5 x' [line(310,200,305,205);" b; S4 ^( t& `% T, b
    line(310,200,315,205);4 t2 g* d/ r% a2 O" L
    line(610,600,610,200);  k% c9 r; f' u3 Z6 t
    line(610,200,605,205);- o; f1 _5 y" ]) {7 c
    line(610,200,615,205);
    / E+ H/ |' z5 `" M2 j7 x3 F+ Lline(910,600,910,200);3 v% n8 @+ n. a/ c7 n* u
    line(910,200,905,205);/ i. @: p; w# m- ^! w
    line(910,200,915,205);//最高的长度400,宽度均为40, X& ^: D8 `3 _% D
    for(i=0;i<5;i++)" K; ^/ R3 ^- [, ^5 p
    {0 p9 N& w/ ~" v1 t/ V4 n( I3 Y6 r, [" E
    if(inf.throughput>pos[0])+ u& X- X, Q4 ?! l0 j3 `- m! p6 g
    pos[0]=inf.throughput;$ M; |% {2 g; O4 O
    if(inf.turnover>pos[1])( W4 o/ j! z% n( F3 t( z
    pos[1]=inf.turnover;) v. I, L; H; m; H! S9 R- ]8 K
    if(inf.wait>pos[2])* m: Q) `( K2 O" `- C" N- ~+ h) v7 P
    pos[2]=inf.wait;
    9 l8 [) I$ ]4 M6 V; S: zif(inf.CPU_rate>pos[3])
    . T, e5 Y! e" Z# _: ipos[3]=inf.CPU_rate;
    5 u& {8 @; \; \, n}
    2 ^% H8 y$ {8 l/ gsettextstyle(30, 15, _T("楷体"));
    4 B3 Z9 a! G( o2 K1 O% l, r) x' Ofor(i=0;i<5;i++)
    5 N# O1 U/ A7 W- h{
    ' F. |/ t6 n2 d5 a; K) z  Pswitch (i)
    " S7 j$ I& M, Q6 w5 n{) M8 j: @4 n3 J2 E
    case 0:
    7 A* O" S& |3 M( a+ R: Csetfillcolor(BLUE);5 R) D! \6 M1 ^, X3 N, S1 Q
    fillrectangle(100,50,150,100);
    0 R) w# D  ?/ K4 louttextxy(160,50,"FCFS");3 ~* L& K. ]- `, s+ P( c8 K
    break;7 t+ o5 c6 W3 Q4 F% {' v
    case 1:
    . X4 O) x+ A' u8 N) |! L/ p. }0 V. Vsetfillcolor(RED);8 [# m; ?( h# I8 k. t% y
    fillrectangle(250,50,300,100);& Y, ^$ k* x; a; C/ R" F
    outtextxy(310,50,"timeTurn");+ `& |, T8 B  S4 T% P6 W
    break;" u! d  `9 C4 e0 e
    case 2:' v$ m: F. A3 y8 ?, U7 v7 a3 k! N
    setfillcolor(YELLOW);
    / X( O" S6 V' K1 j2 G# p; {fillrectangle(450,50,500,100);( j" l$ s* b& A' u$ y' Y$ ~
    outtextxy(510,50,"SJf");
    6 `) W1 x3 p+ U2 {+ Nbreak;
    4 g5 V% h0 G" _' _case 3:! r! J' P/ {& J& I( b
    setfillcolor(BROWN);
    8 a& v1 }3 q( y; [* p* o8 _4 Z  D- Hfillrectangle(580,50,630,100);
    5 Q4 Z  w- U6 p2 _: Houttextxy(640,50,"PR");/ `: d$ E0 p$ t8 ?0 ]" T2 ]
    break;& E2 }. D8 }4 M# I: O8 p
    case 4:
    7 w. u& R. m$ _, |setfillcolor(GREEN);
    9 |5 F- ?( p! L6 _! y5 s  afillrectangle(690,50,740,100);' K+ T0 A* x! C9 k9 y" I
    outtextxy(750,50,"HR");3 k8 g4 w/ p; q/ ^% {
    break;; {; V2 e) h% E4 ]' Y
    }0 y. g# i$ {, e9 C% z
    fillrectangle(50+i*40,600-(int)(inf.throughput*400/pos[0]),90+i*40,600);
    . e( C/ o3 g& W4 E" i% `% ~: U3 pfillrectangle(350+i*40,600-(int)(inf.turnover*400/pos[1]),390+i*40,600);) @/ p* j  M, @8 v7 w$ @1 T
    fillrectangle(650+i*40,600-(int)(inf.wait*400/pos[2]),690+i*40,600);
    8 t4 a! [: F+ u" tfillrectangle(950+i*40,600-(int)(inf.CPU_rate*400/pos[3]),990+i*40,600);, B; \, X1 |3 z) A

    . M4 Q% A1 Y) M/ c0 E9 g- b: a# d3 x. l+ S1 |& z$ V. h7 B: s- W8 c
    }
    / N, _. p. C+ f; D7 A, W# I    outtextxy(100,150,"吞吐量");
    1 U6 K5 ~5 H$ w9 }outtextxy(350,150,"平均周转时间");
    & f( S( M" q( F2 Zouttextxy(650,150,"平均等待时间");
    * Z$ Y7 x6 B2 zouttextxy(950,150,"CPU利用率");
    ! q9 A' t2 ~9 M0 Kreturn 0;, ?1 K9 j1 I0 m0 l- \: z
    }
    ; C2 c4 ?9 @' P9 M5 z) ?int MouseListening()
    + W7 b( v& H" o{$ I9 w3 h$ A8 ]
    MOUSEMSG p;* U' q+ K  S& b7 c% I+ F
    if(MouseHit())) Z6 E1 I: O: }5 P4 ~: J/ D! O! U
    {
    " D1 V" Z% C7 j+ x# i" C2 y* Lp=GetMouseMsg();" i/ l' |) M3 q% m
    if(p.mkLButton==true)
    6 X" l- D+ b. A, E/ M/ P{" ^4 N1 o  G& }# H1 r# {6 O
    if(p.x>0 && p.y>0 && p.x<400 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)3 \$ [; [& M; ]) a
    FLAG_FIFO = 1;# x' G' @* X3 j" h
    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)1 J1 R$ a% Q" C( W
    FLAG_TT = 1;
    : X  q! O; T; `% celse if(p.x>800 && p.y>0 && p.x<1200 && p.y<325 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    % C* R: A2 }( y) W) ^4 k1 AFLAG_PF = 1;3 H4 E* C6 B( z/ X( u7 x- p! O4 O: `
    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)
    1 s5 e) ?+ y& K1 Y, cFLAG_SJF = 1;
    & g% s: l8 |% \) h: R  L( @* M( telse if(p.x>400 && p.y>325 && p.x<800 && p.y<650 && (FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO) == 0)
    2 u/ f' p; I; ?5 ]4 t$ f3 {FLAG_HR=1;
    5 @) l2 ^, L4 V+ U& W+ @else if(FLAG_HR + FLAG_SJF +FLAG_PF + FLAG_TT + FLAG_FIFO >0)
    * N; r4 Z. M1 _{. P% _# v  e- ~! H7 N5 b5 x- M
    FLAG_HR=FLAG_SJF=FLAG_PF=FLAG_TT=FLAG_FIFO=0;, @! c% b7 z7 D9 X" w* c5 a
    clearrectangle(800,325,1200,650);
    - `  \6 @2 d: l7 V; r% f7 Q3 h}
    + z- H! a. c* A5 K) j1 y* \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 )
    7 ]+ S3 c- b% a{9 ^3 U; P1 ~" D. y$ {: d7 Z  l
    FLAG_show=0;8 E1 B* }8 o0 Y5 ]1 F7 d
    cleardevice();
    ! t/ x) N0 s1 ]9 Z* J# ?7 q% Areturn 1;
    ! D, m6 ~' F4 p}
    * U; A# m1 n% w( ^- ]/ \# c' m}
    2 a# u3 J$ Z! ^# O  d/ }! q}4 E3 D7 q5 v4 h0 ~
    return 0;) P! }, ~5 s% i/ A
    }
    9 X+ |' T8 o9 ^& G* Q2 M; n7 _int MouseListening2(int *flagShow,int * showTime)
    6 j9 {. w% i2 @4 b9 e{
    4 e1 o1 a2 |* M; B" ~$ w* X4 q8 yMOUSEMSG p;
    * i, p8 W0 |7 prectangle(1150,0,1200,50);
    . s, ^9 C9 ~$ G/ C$ ]outtextxy(1160,10,"X");
    7 r' Y; r; B! z" E6 h: B2 n* |while(1)4 D& s5 U# ^! ]# e. M
    {
    2 A7 N* N8 ^, ^- t  mif(MouseHit())
    : a1 w9 \% A. ?% ^7 z4 b{0 G# r1 g& i3 m- D
    p=GetMouseMsg();, R; P8 i& J( W2 t
    if(p.mkLButton==true)- d7 @9 s) w' m
    {5 x! `( Y) v( S: C: z7 W- T
    if(p.x>1150 && p.y>0 && p.x<1200 && p.y<50 )
    / H1 s+ m: b2 ]) y. x{
    1 R1 w$ c/ t0 V+ J4 I! v2 I- F8 O(*flagShow) = 0;
    $ b; W. M& i" s& y: g& K! T/ R3 A(*showTime) += (*showTime);
    - ?$ Z0 o# b3 I8 ]+ v' Y% vFLAG_show=1;
    % z8 ?2 L8 p( i8 |5 Ybreak;) j# e) R/ Y8 x. Y# [8 A
    }
    # `3 v& T# S. n8 U% M) m' Y
    2 N, V2 z* N6 Z}( m) _  @& m1 g0 L# l/ c0 A9 R
    }8 ^5 p1 F, {. H" C
    Sleep(20);
    ) y: B% }3 v( Y. B1 v}3 T# f+ n' n' ~8 J) Q: i+ g; i
    cleardevice();
    6 H  ]: W  K$ z# Ereturn 0;/ g6 [% r7 H% o1 \! C/ u+ K' L3 o( Q
    }3 T1 h# p* @: M3 M/ C
    int drawPerformance_FIFO(int x,int y,int memorry,int com,int wai,int cha)  [- b# e. ]/ j6 s8 F
    {
    % W6 D2 Q, Y8 P* ~! k9 O: |; ~static int info[11][3],num=0;
    + D8 `4 X9 H& I( h6 f# U0 eint i=0,j=0,pos[10][3][2];  e4 a/ [# U+ ^3 D+ {8 j
    float temp,t;2 }( m0 e* S& j' ?% D. Y
    //画按钮,不属于FIFO图的范围
    5 q* E8 o3 c) dif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0 && FLAG_show==1)& {4 ], c; t6 M) v! x
    {
    9 m) P' e& [; A- _0 b4 _  rsettextstyle(30, 15, _T("楷体"));3 d% C5 M+ X* {! X4 a& Z% N
    rectangle(890,455,1110,510);
    2 J" D2 m" z" j5 C5 V, V: a& Arectangle(900,465,1100,500);
    * \% F( R$ U+ x5 j+ p3 pouttextxy(910,468,"查看运行结果");
    : F9 F2 }$ ?5 Q1 E}
    : M. i2 v9 d7 l6 `9 J* q" f//结束画按钮; X" W4 [, Q1 \2 l9 ^$ `8 @$ T
    info[num][0] = com;
    4 o/ C; O$ y$ ~+ F& e) w, J  J0 ninfo[num][1] = wai;
    0 M/ s2 r5 q# n$ E4 finfo[num++][2] = cha;0 v+ r, G8 A8 |5 P( ]) R8 Z& R+ \
    if(num>10)  //存储10个点
    8 T" U* T& ^- k* z9 I1 @8 F4 E{
    % ~/ ?7 t3 e0 H" d% \7 pfor(i=0 ;i<10;i++)
    9 e$ j* J; G2 b$ t{/ W3 M/ l$ C  J* U
    info[0] = info[i+1][0];
    # e% A4 ]0 B9 O+ B* Jinfo[1] = info[i+1][1];
    ' S: ?& b  M& R% t( ]! z" Zinfo[2] = info[i+1][2];
    / X: `. c, i6 Z( K5 U% a5 u}
      _: a8 C  S$ G, e+ A2 z& I( Nnum--;
    8 n8 }. P$ R; u' v( e' H$ p( {' o}
    6 Q2 D) ~; ?; I* G4 @if(FLAG_show==0)
      f$ S9 b, M3 i5 greturn 0;& e2 W, f. p+ E& C0 k$ h% m
    for(i=0; i<num; i++): @9 I2 H6 }  F: n; `
    {
    8 S6 C/ k2 X* j" w0 q  _2 |1 T! D' st = (float)info[0];  ~/ h" B9 ^- a% w
    temp = (t/101)*90;3 ]/ t1 [! q* B! U1 z. ^
    pos[0][0] = (10-num+i)*25+x+100;! d  A; K% H' L& x
    pos[0][1] = y+110-(int)temp;: ^5 Y- @. h; u) n3 o! ~% Q4 _, S
    t = (float)info[1];
    - \6 h  L1 w8 g, V7 z1 ^* N2 Btemp = (t/101)*90;
    1 j+ e7 _1 E3 a9 Y5 M1 g$ Dpos[1][0] = (10-num+i)*25+x+100;
    ( G! q9 n. ^" Q; Z7 wpos[1][1] = y+210-(int)temp;
    9 n# S" p- J! q2 F5 Dt = (float)info[2];: n" I. Z' I2 ]2 G3 s1 n  j; ?3 z4 x7 M2 y
    temp = (t/101)*90;
    ) q; E$ n/ D- I7 u! G: X% z  @$ a8 e+ cpos[2][0] = (10-num+i)*25+x+100;: m1 t' \) Q9 _% h; w4 p. Y8 z
    pos[2][1] = y+310-(int)temp;) `& i/ r1 Z/ o# U8 q; U4 n
    }
    8 m' R& \/ ?- A. T" Oif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)5 W! g! L4 g/ X
    {
    ( P0 [/ l5 K7 Uclearrectangle(x,y,x+400,y+315);
    " i( d9 j: k3 c0 Z# d, fsettextstyle(20, 10, _T("楷体"));
      Q& E- n, D" y2 j+ ]% Yrectangle(x,y,x+400,y+325);
    2 H8 D' I  o+ F- g% f, V) n0 a& louttextxy(x+40,y+10,"CPU");       //画柱状图
    8 m3 Z1 s& t/ ?" c3 {* j* }5 \outtextxy(x+45,y+10+100,"IO");# c) x0 s5 [  J+ R9 P% S4 q
    outtextxy(x+40-15,y+10+200,"change");0 J- V: ~, k; {
    rectangle(x+35,y+30,x+75,y+110);
    - q$ b8 D# ~4 ]& @6 ?  Y9 a% yrectangle(x+35,y+130,x+75,y+210);
    - x6 y# ?  a3 i0 [2 @- ~) H% L+ mrectangle(x+35,y+230,x+75,y+310);
    6 w7 d+ W  w$ @8 K9 S9 a8 nouttextxy(x+180,y+310,"FCFS");
    3 g! I6 c+ \3 mt = (float)com;
    9 d. a1 g! A8 p5 i  L2 etemp=(t/101)*80;1 Q# E5 T% s8 p& L+ @
    fillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    1 L% s( N$ q$ w- e! U+ N# k7 ?  @t = (float)wai;
    , @, ^: |& |( b4 [) b: c+ Qtemp=(t/101)*80;
    4 B% t0 q$ `: X9 vfillrectangle(x+35,y+210-(int)temp,x+75,y+210);: x% Z3 k$ s5 E2 J) _) u- a! r* k
    t = (float)cha;% m; c) G8 S: X' S- L
    temp=(t/101)*80;0 q" l% ]/ A3 n+ I) N8 }/ g( L- }
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);" X$ B+ o( I' f' G3 s3 O% G
    for(i=0; i<3; i++)   //画坐标   high=90,length=2505 i- ~+ Y; P7 }1 a, D
    {5 p2 a; M0 k/ e7 _) b8 f, F
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    ' ?+ V) G; Y# d4 g: ]line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    ! q, m$ ~, D- G8 Tline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);5 O1 m4 t8 n0 e% l

    4 N6 \4 p2 S/ F% \# ^line(x+100,y+110+100*i,x+100,y+20+100*i);
    ! O0 R% E* w( U, V5 m0 f, aline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);. F- S( N, V7 |9 Z9 b" L' i; t. K
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);7 \/ g6 [2 |8 F" j4 ?) ~9 S5 |- o+ Z
    for(j=0;j<num-1;j++)
    8 `5 p0 c+ u2 k# A4 |4 \{4 k9 `# q. |, n( P  K* u) W
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    " j8 c5 a, w, |; jline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);! g3 t5 Z- V& x) W4 K
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 0 _7 t; K2 p- Q+ r0 C/ ~
    }
    * X3 y7 `6 S* ]6 Q5 g9 W! k# O}+ b2 d/ y/ G; W. i& C( ?) L- C
    }) J9 U, Z5 [1 K, g* ?  r4 ~4 E5 {
    else if(FLAG_FIFO==1)
    + w8 ?+ f- M4 l{$ N' W  u: f0 ^; Y. N: F
    x=0,y=0;. n$ h+ P- M' T6 M+ l
    for(i=0; i<num; i++): T) Z2 x6 X$ @: c! m& ?/ }
    {
    , ?0 h" l/ |  Z* X( _. Et = (float)info[0];
    6 g- z4 F( d* ^: y7 R9 ftemp = (t/101)*180;
    ( \3 a! H/ W# s6 ?- N7 \0 J* @pos[0][0] = (10-num+i)*50+x+650;
    # N+ n- U1 C8 i; T4 b8 X9 Qpos[0][1] = y+210-(int)temp;: l! o3 [5 W$ w% R: W7 ~8 \1 {( H
    t = (float)info[1];7 k- `" j# ^: a& U4 X
    temp = (t/101)*180;
    9 ~2 J5 I6 n1 @" D6 npos[1][0] = (10-num+i)*50+x+650;, a, x3 e1 t9 s! {, u* W
    pos[1][1] = y+420-(int)temp;, H# ~  _! ^, R' q
    t = (float)info[2];( e$ J! _' l6 |
    temp = (float)(t/101)*180;" R( }0 a: s# f& f
    pos[2][0] = (10-num+i)*50+x+650;) E+ ?% e  M3 H# l# J7 E
    pos[2][1] = y+630-(int)temp;4 g* p8 f% @4 h3 O! }! u9 a
    }! I* e! j0 N. n# g
    clearrectangle(x,y,x+1200,y+650);" s/ p$ ~" y( Y8 h8 B  Q" C
    settextstyle(40, 20, _T("楷体"));$ r9 I8 W$ I8 x! f
    outtextxy(x+50,y+50,"FCFS");
    " T% t1 ]6 d  `outtextxy(x+280,y+20,"CPU");       //画柱状图
    3 k# ^6 P& v! Z0 Z, qouttextxy(x+285,y+20+200,"IO");
    # i) S2 l+ v) H6 Louttextxy(x+250,y+20+400,"change");3 x8 f) ]  u! {
    rectangle(x+270,y+65,x+330,y+215);) r8 d" [  [% Y5 o$ [0 J
    rectangle(x+270,y+265,x+330,y+415);6 ~' r9 D; P, l* D7 o' o
    rectangle(x+270,y+465,x+330,y+615);4 \/ _/ E7 E' H' Z# R. x1 D
    outtextxy(x+290,y+620,"TT");0 F5 K( G* |" H
    t = (float)com;( @1 b2 d  f) A4 [; p
    temp=(t/101)*150;
    / ]$ _' {% p8 d% G  H9 Ufillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    / b" h+ V/ |3 G- Tt = (float)wai;
    & ?+ ^$ K5 [& z; F6 Ytemp=(t/101)*150;
    ; S% \3 l1 T! C; J* {! {fillrectangle(x+270,y+415-(int)temp,x+330,y+415);! ^4 h/ C- E: ^- f& v$ t
    t = (float)cha;
    & Y/ ~. B/ K% T3 p: Wtemp=(t/101)*150;, J8 S- ?  U. v+ e0 T/ l
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);' g  K0 m7 q8 `1 I- t! D4 ~' k
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    3 Y9 l  D6 \  Q6 I  X6 g* N{
    1 V5 `0 d4 n: `, y0 A- n- Bline(x+650,y+210+210*i,x+1150,y+210+210*i);
    8 K; j" _/ h1 z8 A* ^5 Jline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    2 k% I7 ^/ {- X7 nline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);& G- W' ^8 K( O: |

    , ^/ [4 ^. S& v2 [line(x+650,y+210+210*i,x+650,y+20+210*i);
    * a! |7 s2 l0 Z) f" Q5 U+ Hline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
    $ ?' P5 m7 [3 Q$ k+ P7 X0 Qline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);9 O' c4 }% Z5 ?6 |
    for(j=0;j<num-1;j++)
    ' I+ a9 h. \1 n0 ~% C7 u{
    / j7 p3 r1 i3 i$ {line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    4 ~) R' h8 O# F+ w8 w/ b( Rline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);2 d7 i& W; w' S: Y5 k
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    8 f+ J0 w: B% ]# }7 E. {, N7 M" w}
    - @& d) X6 E& ~" |, X& j+ c+ i9 y& O}
    - K2 c7 V2 x" @, `- s. U}! J0 W$ T) g) O' E4 z" f
    2 ^0 Z/ ~: U* T6 p& h2 i' I

    , k& {# P, r! N$ d& Rreturn 0;
    / Y' Z2 F& m- Z8 l; H. c! \0 g9 H}
    ' F& J  G% R. {; \1 n/ ~( }) m, o$ pint drawPerformance_HR(int x,int y,int memorry,int com,int wai,int cha)
    % m' O" r6 @& c{. \2 |4 Z5 S$ c0 U; W' M
    static int info[11][3],num=0;! M, v- m5 Z! d' Z
    int i=0,j=0,pos[10][3][2];
    5 j1 J# x' b2 rfloat temp,t;6 j; m+ P* h7 m  C
    info[num][0] = com;# P  H! `' M% n5 h% a( |
    info[num][1] = wai;
    + q% O# U- C9 G; Y- pinfo[num++][2] = cha;2 e" n2 ~+ N0 C6 y) {
    if(num>10)  //存储10个点
    2 i$ S$ b9 V- ], b{
    . R: Z$ _4 o% a# i4 \5 H- Lfor(i=0 ;i<10;i++)* W9 V& t. ?5 D% X0 B
    {1 G* w" o" W$ y0 D6 A+ g, _; d; ?
    info[0] = info[i+1][0];
    6 b% C# C; N+ U! Oinfo[1] = info[i+1][1];
    * `/ X5 f  B" u# I. R* h1 O+ m* \, tinfo[2] = info[i+1][2];
    % z* _4 S3 ]  K}
    ) T5 [* b2 B0 [3 M0 C& snum--;
    ; Z! I& M1 A  t: I0 {/ v1 B2 M}
    + s% @7 q$ S# O+ `: S5 u) tif(FLAG_show==0)
    ) W1 w1 {) \7 @return 0;
    & W$ U) j- Z9 tfor(i=0; i<num; i++)
    : v: t: \, |& m( Y$ X{7 L9 ~5 @  \" S! t: a0 w
    t = (float)info[0];
    : D$ {# v5 R, _temp = (t/101)*90;
    / G% [  h9 R. vpos[0][0] = (10-num+i)*25+x+100;; ]1 P4 g5 f5 s4 P
    pos[0][1] = y+110-(int)temp;
    ; C- {+ @# k# B3 v  d: h1 Ut = (float)info[1];
    1 Y6 l2 t8 Y: Y" l! G7 Stemp = (t/101)*90;
    " A0 V7 h8 k" m6 X  K1 ~  O- Vpos[1][0] = (10-num+i)*25+x+100;5 m, D" i+ B1 }. O0 Z) S
    pos[1][1] = y+210-(int)temp;8 Q/ j2 w7 `( D. F3 M0 X
    t = (float)info[2];
    2 t1 |. w6 g& u2 ctemp = (float)(t/101)*90;
    7 v0 |5 s, x, ^" mpos[2][0] = (10-num+i)*25+x+100;
    / ]' U: O4 J6 Z* A8 [pos[2][1] = y+310-(int)temp;
    - `! J. m) b: y& M3 G4 P- b}
    % S+ r1 ]; d) [  ^. fif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)
    + R9 F2 h4 I0 V8 M% x  V4 a6 m1 ^{
    . [8 b( K9 ~3 E2 ^) j* c* D9 g. Mclearrectangle(x,y,x+400,y+315);
    * L) C" E5 D& @9 w" h7 Usettextstyle(20, 10, _T("楷体"));! I# T# I: W( U# ^$ ?$ O# J0 j* j
    rectangle(x,y,x+400,y+325);  T6 f( E1 ~! g; F
    outtextxy(x+40,y+10,"CPU");       //画柱状图
    , u& O. M; B" Y$ Kouttextxy(x+45,y+10+100,"IO");) ^, }* Z: i' j0 t& h- `
    outtextxy(x+40-15,y+10+200,"change");
    3 I1 F2 p* G* c, z* arectangle(x+35,y+30,x+75,y+110);
    6 }# m# i6 |9 e4 e5 j0 krectangle(x+35,y+130,x+75,y+210);
    * N, l- U, u! v5 Jrectangle(x+35,y+230,x+75,y+310);; D* A. k: B- ~: C3 k& S4 k
    outtextxy(x+180,y+310,"HR");& F8 W3 ?% C( x* t% I( x' v/ N
    t = (float)com;2 ], q1 G: c' ~
    temp=(t/101)*80;
    & r. h; c9 _" e& {% Cfillrectangle(x+35,y+110-(int)temp,x+75,y+110);; _2 I' f3 ~, q. W
    t = (float)wai;# N9 C+ ?% W, C9 U" n, G
    temp=(t/101)*80;
    / ^# d% S* S9 ^7 [: A& ^fillrectangle(x+35,y+210-(int)temp,x+75,y+210);; g" `) m1 u  @, y2 ]8 B% V4 c4 R5 O
    t = (float)cha;/ D, B3 O: O! g
    temp=(t/101)*80;2 e# V! n2 y) t: J
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);4 R" }( C8 t2 W5 [1 `1 h( k
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
      l& a3 A) H, U! j{) [9 D/ V/ E+ j* D
    line(x+100,y+110+100*i,x+350,y+110+100*i);8 f" v. S( w3 F! _
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);% T6 s) k$ K9 E; s) j1 `$ y# `
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);2 m7 E0 Z1 }- c- j

    0 t0 O# E6 `" ]4 a9 L4 n9 u# Aline(x+100,y+110+100*i,x+100,y+20+100*i);, p$ I, k: G3 v9 Q
    line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    ) J  c1 z0 p0 E3 ^) R" Oline(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    : W* }  O9 D2 P- `6 l0 m  i0 T" afor(j=0;j<num-1;j++)/ d& G. a* G4 P0 y& J
    {/ m' l% t3 I. w3 _
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);: F7 T' E" @3 f' Q
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    . R: m; v" ~# I7 o$ h$ Xline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    # I% Z2 Q7 O# Q' e}
    8 }& Z! N1 W) m0 \' T# e" y}3 v8 e4 b: q$ q; m. o( b; [
    }
    - i4 Y. ~1 w$ p7 R  I+ aelse if(FLAG_HR==1)
    7 c1 O* q' L- F) w4 g* V% i{
    : E" k2 C8 }& Ex=0,y=0;
    ) {( k6 k5 ^5 j) k/ Afor(i=0; i<num; i++)
    / B! U+ Z; F4 j' J; G{
    " @+ e  ?( n- W! ?5 R2 D- _t = (float)info[0];
    7 n2 x; |5 k, a: x; M; Mtemp = (t/101)*180;9 y' F6 g6 f# q2 W6 U
    pos[0][0] = (10-num+i)*50+x+650;
    % W  u! G! w: O! ^pos[0][1] = y+210-(int)temp;; H  f+ w5 f3 f" o5 g+ N( e3 T
    t = (float)info[1];% ]* o2 H/ P' O
    temp = (t/101)*180;! J1 s7 k2 [2 }9 @1 O. A
    pos[1][0] = (10-num+i)*50+x+650;; N1 N: F% _/ y, {' j/ i) O" o
    pos[1][1] = y+420-(int)temp;# E9 ?9 a4 F- x  I! N" {: C
    t = (float)info[2];. i1 x$ R4 D" d; E- A% @( {
    temp = (float)(t/101)*180;" H1 i9 i; v/ u7 \2 _( [
    pos[2][0] = (10-num+i)*50+x+650;$ R- [. o5 j5 }
    pos[2][1] = y+630-(int)temp;; H3 X1 k: b0 `  v6 K8 Y
    }
    : w& T; i: k7 j: L; O; mclearrectangle(x,y,x+1200,y+650);* |7 b$ t; ]: {4 S( |
    settextstyle(40, 20, _T("楷体"));
    & [; r/ h! p: `% o- E& Y  ~outtextxy(x+50,y+50,"HR");2 A" Z" u% \& D/ e
    outtextxy(x+280,y+20,"CPU");       //画柱状图. E( |& e3 M$ \% X2 |+ a& I
    outtextxy(x+285,y+20+200,"IO");
    ; H1 Y/ X" C1 o% Zouttextxy(x+250,y+20+400,"change");+ ?. l  ?; k. s0 M0 r8 y. K( Z
    rectangle(x+270,y+65,x+330,y+215);  O( w, [/ v) E8 |" u, L/ g2 K
    rectangle(x+270,y+265,x+330,y+415);" e5 U4 A+ i3 v
    rectangle(x+270,y+465,x+330,y+615);" T8 }! E8 t  X' ~6 M  A6 v# ?
    outtextxy(x+290,y+620,"TT");/ {2 O9 I" M+ d- g2 t3 q$ C6 `
    t = (float)com;
    0 b' s. D! X7 {, d( ntemp=(t/101)*150;7 \0 B% [. v* V! J% R
    fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    % N+ c5 J+ j" U$ n" D3 d0 et = (float)wai;/ V6 n. P9 G' |% N# Q( ^; V
    temp=(t/101)*150;
    ; y( H/ g: h- d; I- L* Mfillrectangle(x+270,y+415-(int)temp,x+330,y+415);: V' O2 K( y, ]
    t = (float)cha;
      K% b9 T% I* H( Y+ ltemp=(t/101)*150;
    ! n# T' e1 ^2 A2 U* ofillrectangle(x+270,y+615-(int)temp,x+330,y+615);/ Q4 W$ f6 C! F( ?
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    ! _/ j2 ~: _5 H{
    $ ]+ c! O* `( U8 Q$ bline(x+650,y+210+210*i,x+1150,y+210+210*i);
    ' f  `1 ~+ U+ J1 Nline(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);" R" }8 ]/ m8 @0 r: t; @
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);7 W( ]0 e0 p9 k& r
    2 y0 v. T3 ^: S6 A1 S5 a! O% K* w! B
    line(x+650,y+210+210*i,x+650,y+20+210*i);& ]. P; {6 U; j# w# L7 I
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);
      H2 a3 ^8 t% y/ Dline(x+650,y+20+210*i,x+650+10,y+20+10+210*i);) p' D& p3 ]& {4 Y
    for(j=0;j<num-1;j++)% }  r  q: k: N9 u4 w
    {) B7 @, [& b% z& D: o  Z8 h0 e0 d
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);( B- v4 g# V  v, A, \$ Y
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    $ ]) W/ Z1 \" Mline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    / y* G; P% ^, l: i' K5 V5 R}
    0 q- t% Q) y( ]}# s+ _* Z( K" J5 P. Q' M
    }
    & v  D1 J7 M2 E5 Y; c) n
      h. {' c. r1 z# F# p3 p! B4 G" w' _0 C- P( H* K* N
    return 0;% \: q: `4 n) z6 S; G' c5 Q4 v
    }
    " T4 O- E* |# G) k% X8 Vint drawPerformance_TT(int x,int y,int memorry,int com,int wai,int cha)
    8 h9 k! f( q& f{0 m+ K- P/ _) h+ Q& z" F2 q( n3 M) b
    static int info[11][3],num=0;3 U5 J0 W% `2 y* O$ o1 Q
    int i=0,j=0,pos[10][3][2];
    9 ]' P$ A1 r" W9 E' t+ D- z6 Ufloat temp,t;( Q: T; }  {1 x, n2 q" {
    info[num][0] = com;0 Z" W* B+ f5 P$ a
    info[num][1] = wai;+ B8 i; A2 {/ o) O! L5 R: ^; }+ N  j
    info[num++][2] = cha;) x8 ]9 `5 g8 O9 W6 q8 T
    if(num>10)  //存储10个点
    . A0 a1 _. K% T1 x: U; B{# P2 ^+ f% _# X* C
    for(i=0 ;i<10;i++)
    3 A( M' i( o7 F) y{
    2 j9 x4 [4 q8 vinfo[0] = info[i+1][0];
    . }# d: h- P' h) ninfo[1] = info[i+1][1];' Y& |/ E3 P  D; g8 @4 t2 Z9 z
    info[2] = info[i+1][2];8 {; X* h8 O2 U: v5 S( f
    }. o2 l+ n7 s5 G1 D  W: B; j
    num--;
    % l; s3 h, [3 ~}
      d' i$ k" k! o& vif(FLAG_show==0)+ q8 W8 I& _/ C: o) G! E% q
    return 0;
    2 Y( }- z0 g! [3 M: h! [2 ofor(i=0; i<num; i++)
    ' f0 f3 o9 B/ p  f{3 T7 b; |( d5 v6 e) |! x( Z  V+ j
    t = (float)info[0];
    3 c7 t4 ^  g+ Ftemp = (t/101)*90;  H# e# `( E7 A' Q
    pos[0][0] = (10-num+i)*25+x+100;
    * a. g( n3 l; l0 a+ _6 J! ~) I# `pos[0][1] = y+110-(int)temp;9 l  W$ C- d4 R0 P) g
    t = (float)info[1];% }6 d1 }% o: F# C: J
    temp = (t/101)*90;
    * V3 y# |' {7 X4 m) [2 \pos[1][0] = (10-num+i)*25+x+100;
    * p) c- I, s8 _7 y- Z, `; ]! B4 W! ~, U& `pos[1][1] = y+210-(int)temp;
    - p" `$ `7 V% Nt = (float)info[2];
    , x% n) M& F! _2 t, htemp = (float)(t/101)*90;3 |: _$ e; C7 w. @. ]# K
    pos[2][0] = (10-num+i)*25+x+100;
    * s, \) H# Q: B# V$ O% jpos[2][1] = y+310-(int)temp;
    0 w% [4 T% x# T6 }, ^/ z}, `+ Z$ J1 A$ Y6 P
    if(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)( e& i' `5 ]* S5 ^, e
    {- U9 E5 C4 ^; }6 f
    clearrectangle(x,y,x+400,y+315);: W- c4 z+ r4 Y. P' ~
    settextstyle(20, 10, _T("楷体"));3 N; M+ v: p$ J, ~) l
    rectangle(x,y,x+400,y+325);
    4 [: y( o/ Q% routtextxy(x+40,y+10,"CPU");       //画柱状图' B2 ?( h" D# Q. `6 `# L
    outtextxy(x+45,y+10+100,"IO");
      X. r3 s' p% x2 ~: ?outtextxy(x+40-15,y+10+200,"change");1 L" E" _( l: W, w  R! V
    rectangle(x+35,y+30,x+75,y+110);
    , F8 ?$ o% _$ }( U8 Nrectangle(x+35,y+130,x+75,y+210);
    5 t1 X! f5 F+ prectangle(x+35,y+230,x+75,y+310);, A% H  L: m/ y( I8 q4 D! A
    outtextxy(x+180,y+310,"TT");( \) Z0 ~9 Q/ v3 {; g9 e
    t = (float)com;) h/ R* l# g. j
    temp=(t/101)*80;
    2 K/ ^4 U+ m# m+ j) F! t4 cfillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    * b! D3 T6 j% E! [8 }t = (float)wai;8 O: N6 o/ c% n* O( a) f
    temp=(t/101)*80;4 E* h0 f$ P+ B- k; z
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    " y" p# D' p1 }( ~' |% C# F" gt = (float)cha;
    ! w4 X! C( ]/ B! l# p& Etemp=(t/101)*80;
    : v& }2 {6 U$ c& cfillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    3 V& H* s. G* f1 {7 b5 D1 k! \for(i=0; i<3; i++)   //画坐标   high=90,length=250- v* j0 j: q# ]( }- k( u
    {: \5 A* m5 V# M1 v. E' _( T
    line(x+100,y+110+100*i,x+350,y+110+100*i);2 j4 Y/ z& ]( m: ~: o, `
    line(x+350,y+110+100*i,x+350-5,y+110-5+100*i);5 I0 l5 `# }9 ^$ d1 l1 m  O( W' W
    line(x+350,y+110+100*i,x+350-5,y+110+5+100*i);+ c1 X2 l& Y2 b; r$ l0 e4 V

    0 j0 I  C; T: l+ o7 U8 zline(x+100,y+110+100*i,x+100,y+20+100*i);
    , Z* e( }, F5 C3 [, `" Cline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);9 @; Z3 Q& n$ T$ G+ }+ p" v! R
    line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    # B( S5 `8 w4 u( \for(j=0;j<num-1;j++). N1 q' C& h, ^  E& [8 i1 s- y
    {
    6 j8 U9 I& H6 y7 h0 Sline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    4 i9 Q9 g) ^2 [1 L3 T( X4 g# gline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    $ M& S/ K5 Y( mline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); 9 e! L8 m0 M8 p
    }& G7 O3 w2 P4 ^( M. [# z! b
    }
    ( l: |9 v( c$ S% p: c}
    ' x) ?/ Y% R% x9 D" ielse if(FLAG_TT==1)
    7 d' K$ {8 [3 }{
    4 Y+ D- z! [" j& h$ Y3 Bx=0,y=0;, Z6 j5 j' A8 Q! `2 y* @
    for(i=0; i<num; i++)
    # F  w7 [5 X; I( X' n{6 ?9 O+ v8 u7 H( e
    t = (float)info[0];
      b! g" _$ P/ v5 b3 W( y5 ltemp = (t/101)*180;
    0 d& q8 D: g" T8 h5 Gpos[0][0] = (10-num+i)*50+x+650;% A$ x3 J+ E; s% U5 Y, _+ o
    pos[0][1] = y+210-(int)temp;
    ( m2 i. t8 A# E# V! T9 @+ Tt = (float)info[1];
    0 [4 M6 \3 x" ^/ ?temp = (t/101)*180;" e) F6 u# ?! O: ~# |" R+ c* S
    pos[1][0] = (10-num+i)*50+x+650;
    * a. A  E" j4 b( W; ?$ D2 ^) x- Mpos[1][1] = y+420-(int)temp;0 h2 O7 _) C* j" C( W- b  r) y
    t = (float)info[2];. l- }' M( ?" t5 R
    temp = (float)(t/101)*180;2 _5 I6 i% s; X; |  F/ A
    pos[2][0] = (10-num+i)*50+x+650;0 v0 ]9 V+ I7 L( {- [5 s* P: U
    pos[2][1] = y+630-(int)temp;
    1 P! q$ K1 Z7 z7 r3 d}
    - V9 P$ Q6 x" G" T5 k7 {clearrectangle(x,y,x+1200,y+650);
    0 J3 R: |5 [; b& U" M; Y8 l) T; \settextstyle(40, 20, _T("楷体"));0 G/ ?8 m5 ^3 a; u3 w3 D4 A, L
    outtextxy(x+50,y+50,"TT");) }. [5 q1 C! W9 D% G. g* x
    outtextxy(x+280,y+20,"CPU");       //画柱状图
    % C, W2 }6 d& X/ N2 g% W# douttextxy(x+285,y+20+200,"IO");
    & `8 {. X. f% q8 o; I' ?. K5 Oouttextxy(x+250,y+20+400,"change");* {6 l; J: ]: S* b1 Q0 \1 ^6 t8 f2 c
    rectangle(x+270,y+65,x+330,y+215);6 @, P! x8 A3 u; e
    rectangle(x+270,y+265,x+330,y+415);2 v  C8 r3 P( j) w7 r& N7 f
    rectangle(x+270,y+465,x+330,y+615);# C% H7 }8 f6 n$ }8 {5 l
    outtextxy(x+290,y+620,"TT");5 m" `# x% S: M  r$ l" V  B8 n
    t = (float)com;: V- L& h  [. b* v( ~1 `( j
    temp=(t/101)*150;
    ! ~; V/ d' m9 \, w8 nfillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    2 x# R! g) F1 {, f; F0 r! e3 X* Yt = (float)wai;
    ' i" g% M, M6 c* n+ x8 l* z7 etemp=(t/101)*150;
    * u2 K2 S5 b2 I0 v) B" _fillrectangle(x+270,y+415-(int)temp,x+330,y+415);
    + d6 W( Q% c* U  h- s9 vt = (float)cha;
    / t5 s& @3 O1 qtemp=(t/101)*150;
    ( G/ p$ X* e3 A9 {5 Bfillrectangle(x+270,y+615-(int)temp,x+330,y+615);; T7 B  d# P) B- M1 s
    for(i=0; i<3; i++)   //画坐标   high=90,length=250
    ' _& |  [  p1 a4 ?2 S8 `{
    # L! U2 h& _) h* ~8 \, wline(x+650,y+210+210*i,x+1150,y+210+210*i);5 n7 N* r* N3 l
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    " `# f8 d$ X7 Q9 lline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);) s  [- d' X8 F" J4 o2 T9 {! O

    , n: \; y# P' g9 s4 p7 }line(x+650,y+210+210*i,x+650,y+20+210*i);
      J; u) `( n3 Dline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);" }- H2 |' g/ l1 b+ s
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);5 B+ U& D7 ~" l/ o1 }6 V0 ^! z) v4 E
    for(j=0;j<num-1;j++)/ H0 m; _- q" e1 ^4 P3 S
    {
    1 D% z0 r; B2 T( ?' Jline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);9 i/ x9 a+ y" U  L$ `* L
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    $ d% @& E, o- e: I0 ?! f8 Aline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    + X! a( B  j% |3 a}7 H& |5 w6 G0 o: F- e
    }$ {# O- {! c# ]/ Z4 `
    }
    , Q: `4 Q4 X$ ?8 X, {. V/ t( f% r( |: j1 c7 b( M& E( C8 P

    6 e" x9 i7 n5 d2 I; Z1 e: mreturn 0;5 U+ n! ?0 Q3 F: }
    }1 Q- U1 z) y/ T; M4 s+ u
    int drawPerformance_PF(int x,int y,int memorry,int com,int wai,int cha)& [# M6 s" c9 K* k
    {
    8 R3 ~' x9 M* zstatic int info[11][3],num=0;
    ' {- g% F4 }5 z8 s8 o7 Zint i=0,j=0,pos[10][3][2];5 E: e2 D, Z/ m- k' Q
    float temp,t;  Q* e& v8 B& U1 y
    info[num][0] = com;
    - q( u! X* Q1 i" @. a! F' Sinfo[num][1] = wai;
    : n9 S/ Q( \* C. dinfo[num++][2] = cha;9 p, }' S4 q! Y- {! I
    if(num>10)  //存储10个点' k, o7 z  Y) v# T0 s
    {
    6 G9 u9 {8 b' F: Y! Cfor(i=0 ;i<10;i++)$ `" n# ^8 c- G) }+ Y6 d: C
    {
    & G$ Z" A0 V9 ?, C; q) U9 cinfo[0] = info[i+1][0];  q( @: ]" i4 j& ~4 j! S  h
    info[1] = info[i+1][1];
    . h8 D0 r/ G2 z# A" Z  H2 \info[2] = info[i+1][2];! E4 P% ^7 b( _' V) N3 v
    }  C& ^$ c+ k$ g- k) G5 W
    num--;
    0 v- r: K4 o- V% H+ g1 A, q( Q}; i2 g; @9 K. S
    if(FLAG_show==0)
    ; Q) y5 Z# n8 ^% ]4 ^return 0;$ E1 |# b/ \/ g2 K4 d. P
    for(i=0; i<num; i++)! J& x1 u+ r+ i$ d: m! U+ |
    {
    ) e7 W; A6 k& h6 Gt = (float)info[0];" f1 H6 ]* }3 a. E# m, e5 |0 b7 D
    temp = (t/101)*90;
    2 T/ Y# V1 g0 \0 q' y6 t1 Kpos[0][0] = (10-num+i)*25+x+100;1 R+ ^- }0 O; N6 e6 S3 ]
    pos[0][1] = y+110-(int)temp;8 `- l% Z$ h2 Q. S2 c
    t = (float)info[1];$ z  m- p; J+ k; o3 n+ e5 W
    temp = (t/101)*90;' g& o( e  s4 {( ^1 C' n
    pos[1][0] = (10-num+i)*25+x+100;3 }2 U- Y$ b4 l8 }" ^; p3 k' `
    pos[1][1] = y+210-(int)temp;
    # [, T! A, Y: q2 [: ^1 H6 ~: Et = (float)info[2];' Y) f7 ^  R- ]; N  m
    temp = (float)(t/101)*90;$ K8 K' U! u" ?
    pos[2][0] = (10-num+i)*25+x+100;* X: m% o4 D: G
    pos[2][1] = y+310-(int)temp;
    3 \$ J* A/ r# S- {5 n}
    + j/ A& z+ y# [9 d0 jif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)9 j; K0 c" o$ a8 X- c. `
    {8 N2 r$ T2 N, T1 E: `) u' U  R& p! l
    clearrectangle(x,y,x+400,y+315);
    # |' W9 A; Q8 k8 Q8 b: ]settextstyle(20, 10, _T("楷体"));) x) u: z4 C* C' B1 S# ^4 W% w( f( v5 A
    rectangle(x,y,x+400,y+325);
    ) i& M6 |+ r4 v8 zouttextxy(x+40,y+10,"CPU");       //画柱状图! s- W& D* d) h7 l: ~' S
    outtextxy(x+45,y+10+100,"IO");
    ; ^0 X6 G; [; e; G8 t1 gouttextxy(x+40-15,y+10+200,"change");
    ' V0 M! A. Q: S6 Q, Urectangle(x+35,y+30,x+75,y+110);
    # z, L/ N( x" a9 ?) w$ G& q' Frectangle(x+35,y+130,x+75,y+210);- T0 Z2 D* }( ^: j! r! p
    rectangle(x+35,y+230,x+75,y+310);
    2 m) F. `/ i0 ]  ?  A7 s) Jouttextxy(x+180,y+310,"PF");! i6 @  z5 \) i% Z
    t = (float)com;* V. S+ |' f/ {( ^& f$ B$ D! P" @
    temp=(t/101)*80;
    8 E; B& a' o( w8 sfillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    7 _8 L( B1 P$ }( ~- q! k8 X- Jt = (float)wai;- j; Z# M( X& M0 P& M
    temp=(t/101)*80;' u" X- S( w' C- [  b
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    % A  ?% A& n/ e" k& V% Dt = (float)cha;
    8 W. Q) E$ K( }8 o2 vtemp=(t/101)*80;" x/ `7 b- g8 ]
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);
    , U3 o1 ~# F9 b9 J- y2 o( D4 dfor(i=0; i<3; i++)   //画坐标   high=90,length=250) V9 u) H+ G4 A$ u# U
    {
    6 p3 o5 Z/ @4 G* B2 A6 Qline(x+100,y+110+100*i,x+350,y+110+100*i);
    7 \0 V  Y+ T" h' uline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    : m  s3 b2 S) T. r5 C1 L1 R% z/ g" Pline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    " R6 Z& ]: A' r) ^9 l" T! y7 d, h6 i( o
    line(x+100,y+110+100*i,x+100,y+20+100*i);
      W+ G  f5 {+ L% Cline(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
      v. Q0 t0 `; F! B; B' W2 |line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);
    5 U( K6 M. r; \0 T9 }8 A2 o7 ufor(j=0;j<num-1;j++)
    0 \* k, B# {! a. |$ n' o; A# N0 w% p{* }2 \& _" Y4 Q3 s" T3 l
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);, e' P5 R. e% l. t" G' e& G
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    . j) l* X: T6 v8 T( T9 a7 G- tline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); ; v; _/ s0 [: X0 I2 J
    }' b# G/ \+ v0 \$ v) Q) r
    }
    6 i8 ~4 `: N- d6 S* a; i( r0 P}$ T, k% j' b" E) W
    else if(FLAG_PF==1)
    ; t, j4 \( H2 U7 P7 y7 s0 A& }{; T, S/ G  w' `9 W3 Y3 b, T. F
    x=0,y=0;. h$ m/ {  q4 M# ~
    for(i=0; i<num; i++)5 D$ I9 K4 w: o$ p: V7 v
    {1 G  m! Z& O7 s8 Q
    t = (float)info[0];) d/ n5 W% J6 ^% v* b: F
    temp = (t/101)*180;
    % f8 S* Z" ^* g4 u/ Lpos[0][0] = (10-num+i)*50+x+650;
    ; C' n- z. S, Ypos[0][1] = y+210-(int)temp;
    9 [# `1 I! M$ u6 K1 St = (float)info[1];4 d: {0 K# u& B; M) L9 _# e$ p
    temp = (t/101)*180;
    " T( b. ]' A' ?5 b1 _" Ipos[1][0] = (10-num+i)*50+x+650;: [  {! t. a3 k* @$ N
    pos[1][1] = y+420-(int)temp;
    1 X% K9 r. n1 Et = (float)info[2];
    / t; m8 ?; P" C: y0 Ktemp = (float)(t/101)*180;
    2 j  k, c9 r. P% C* t& q$ fpos[2][0] = (10-num+i)*50+x+650;
    3 [0 A9 h* e3 {pos[2][1] = y+630-(int)temp;
    4 A& P! k  r+ z8 W}. v3 C4 s+ w* D" `4 g" m# R; a/ {
    clearrectangle(x,y,x+1200,y+650);6 }4 y7 f  p, b7 R
    settextstyle(40, 20, _T("楷体"));& S1 w- S: i3 b+ h
    outtextxy(x+50,y+50,"PF");
    ! k, K  e1 @, r& G5 J& g5 wouttextxy(x+280,y+20,"CPU");       //画柱状图
    ' u* j) {3 `. }3 zouttextxy(x+285,y+20+200,"IO");& V3 a! L! _& K2 \! b9 g
    outtextxy(x+250,y+20+400,"change");! ?* E- e; S: l+ P8 v
    rectangle(x+270,y+65,x+330,y+215);9 e2 M8 g/ a# E" E! }& T
    rectangle(x+270,y+265,x+330,y+415);; v$ m* l% O* \6 O. H# k. B
    rectangle(x+270,y+465,x+330,y+615);
    1 n  B& B. X8 ?0 n1 [+ B' H# iouttextxy(x+290,y+620,"TT");
    % N( |4 {% I* j1 Rt = (float)com;
    . S9 w9 F9 R& Y+ i6 @8 a( etemp=(t/101)*150;
    + I& X  y: e* N6 T8 d+ k0 G* _) tfillrectangle(x+270,y+215-(int)temp,x+330,y+215);
    * d0 y0 q8 u! v) o+ m6 j# Ct = (float)wai;" G" i# X( g$ L! K$ Q3 K) A, _- b
    temp=(t/101)*150;
    / }) Q6 x1 G4 D3 @; W9 ?0 x2 rfillrectangle(x+270,y+415-(int)temp,x+330,y+415);1 R3 Q$ M  H- i: Z$ S/ G& n
    t = (float)cha;3 ^# m$ r3 w6 [# e+ V2 F
    temp=(t/101)*150;
    ! s1 x% X- w' Q4 T, k+ O  Bfillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    ( J# V; b- I; }for(i=0; i<3; i++)   //画坐标   high=90,length=250
    $ W9 `- y) W! F+ U5 s& A{
    + N- Q4 K1 T- p1 L# v- Wline(x+650,y+210+210*i,x+1150,y+210+210*i);6 t0 {. M/ H+ w/ B: K- V* r
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);9 @" w) \; e3 }0 B$ l8 t6 m9 S
    line(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);
    0 |, [* r: @. Q" C8 k7 V& Z' X
      `0 b/ F' e& q$ }1 t  C2 j. Kline(x+650,y+210+210*i,x+650,y+20+210*i);  e3 g: p4 }! s; c
    line(x+650,y+20+210*i,x+650-10,y+20+10+210*i);; g& s1 D" Z5 O4 L& |! m
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);& V1 {6 Y1 g# w5 \
    for(j=0;j<num-1;j++)
    6 X; \: q4 F( ^1 O& a& x{: d, R; d0 Q+ E; L+ D" \' R
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    * b. }) m  Z- J: i" N6 {! lline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);+ ~% U+ ?* Q( T' C# G+ m9 W; D- s
    line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    ' |' n& X, I# Q; k0 S7 t( a}
    + U" {+ Q6 k" K  e2 W}1 x. H. y$ r5 ~* e
    }
    . D. n9 M* H2 }* H7 sreturn 0;
    + M+ K9 L4 y7 O6 y9 n% k}
    * U3 [, ^4 E% W( G/ w" Y! \: Xint drawPerformance_SJF(int x,int y,int memorry,int com,int wai,int cha)
    / a: T: ^: H: i) y{
    3 h: q$ P4 u' l8 nstatic int info[11][3],num=0;* k5 W. i- D( Z6 J0 N0 e
    int i=0,j=0,pos[10][3][2];
    # B- z% J# r+ ]7 A; f6 qfloat temp,t;
    - R! C- |5 v" D* k4 H" Zinfo[num][0] = com;/ {, O7 Y+ ^2 J7 V) w9 O, M
    info[num][1] = wai;9 N6 z9 }1 g6 k" Y% ^# M& C
    info[num++][2] = cha;
    & ~/ M! q  x$ u8 yif(num>10)  //存储10个点4 l$ g3 Y: {- o, }. c
    {9 p* B. i1 j/ n
    for(i=0 ;i<10;i++)1 q* N# [  i6 ]) l- W( k0 a4 C
    {5 a- x( H$ c( s6 [( G& ^
    info[0] = info[i+1][0];! J2 J( @2 q; i; N
    info[1] = info[i+1][1];7 J; }; n6 B6 x3 Q. l7 L. R0 x
    info[2] = info[i+1][2];
    % n& T2 F0 K% W- z}# e6 O/ p2 ^/ x, U1 q: \
    num--;- U( W" C, A+ J( J+ F0 I8 J  h/ z
    }6 P' J+ b9 J) ]
    if(FLAG_show==0)
    ' I" q; R" R8 b8 a7 s( yreturn 0;1 y3 V% L7 [9 s& a( c2 a5 b
    for(i=0; i<num; i++)0 y# l  h+ W" h0 u4 f( ?  ?; I
    {# F; B% S+ ]) Y
    t = (float)info[0];3 |  j% I! X8 t- p2 K! E7 D
    temp = (t/101)*90;
    ( @3 a# _1 f1 n! H8 h+ j  spos[0][0] = (10-num+i)*25+x+100;
    + t% b7 d) o% f% M% V7 ypos[0][1] = y+110-(int)temp;* B% o  e/ {9 o# K  ^* m9 y1 @
    t = (float)info[1];
    $ e' u6 O' F% p; E! e: Itemp = (t/101)*90;
    8 g( |* H2 b) C- V/ x; `# j! Lpos[1][0] = (10-num+i)*25+x+100;
    7 X9 b  G/ o% q- D1 g+ |pos[1][1] = y+210-(int)temp;
    ' {6 P2 c6 W5 N# q+ ft = (float)info[2];
    # w8 Z- G/ S1 f& Mtemp = (float)(t/101)*90;
    5 b# o1 b# u# P: h- r. @pos[2][0] = (10-num+i)*25+x+100;
    : u8 k3 w) [8 \pos[2][1] = y+310-(int)temp;! F- O; c( e6 x# K8 F
    }
      c4 H( k/ g9 A1 zif(FLAG_FIFO+FLAG_HR+FLAG_SJF+FLAG_PF+FLAG_TT==0)5 c  R6 d- ?2 Y4 E" i% U/ U
    {
    ( K9 U* Z8 Y+ i& j: Qclearrectangle(x,y,x+400,y+315);
    * r% X7 c8 u; A3 _9 Csettextstyle(20, 10, _T("楷体"));
    . d1 v4 }" S6 grectangle(x,y,x+400,y+325);
    ! c+ f7 I; [0 Z7 {9 `outtextxy(x+40,y+10,"CPU");       //画柱状图0 \: z1 F* w' ~
    outtextxy(x+45,y+10+100,"IO");5 l% z* z0 c$ E5 {! O8 l
    outtextxy(x+40-15,y+10+200,"change");
    * o" ?- q: {3 ~. U" i% J+ V7 frectangle(x+35,y+30,x+75,y+110);
    $ H2 T. h/ e  i: L# l8 crectangle(x+35,y+130,x+75,y+210);
    7 c& S* K- ?# orectangle(x+35,y+230,x+75,y+310);
    0 ]8 }1 x" ]/ P  M9 {outtextxy(x+180,y+310,"SJF");
    , r: h/ |9 N9 b* P* L. R! T, N7 Ht = (float)com;
    ( j* n( ^% M& v5 Z# k$ G' Btemp=(t/101)*80;
    6 B. r9 {3 X( B# W8 n) [, Ffillrectangle(x+35,y+110-(int)temp,x+75,y+110);
    & _$ \/ M0 x7 l, p; x% ]8 zt = (float)wai;
    . ?! I# B) U9 ttemp=(t/101)*80;+ a* E: v: ~5 {- u' t. ?
    fillrectangle(x+35,y+210-(int)temp,x+75,y+210);
    # ]( G! c0 P8 O# i- et = (float)cha;( b- G2 v' F& R
    temp=(t/101)*80;. Z/ `, @* @+ h0 F
    fillrectangle(x+35,y+310-(int)temp,x+75,y+310);. V7 B, {4 w  N2 Q+ k
    for(i=0; i<3; i++)   //画坐标   high=90,length=2501 H# m' B$ q2 B2 d8 b
    {: a' H: u) o- a2 d
    line(x+100,y+110+100*i,x+350,y+110+100*i);
    ! E  d4 E0 ~! y0 K+ P+ lline(x+350,y+110+100*i,x+350-5,y+110-5+100*i);
    3 `- u0 K$ C. m+ y& b9 ?4 eline(x+350,y+110+100*i,x+350-5,y+110+5+100*i);
    * E  b. d% a) U& L1 F' x! Y4 U1 J3 r- k& G3 u. ?9 I6 k/ m# E( ^  x
    line(x+100,y+110+100*i,x+100,y+20+100*i);
    % y! Z0 c) z+ N& [line(x+100,y+20+100*i,x+100-5,y+20+5+100*i);
    1 n2 P  a6 P1 a9 c- R# H$ ]. U0 }line(x+100,y+20+100*i,x+100+5,y+20+5+100*i);6 x2 G% `# u& n
    for(j=0;j<num-1;j++)
    $ n; a% g) ~; O# g8 X{' J% H3 Y' A7 B2 l/ O
    line(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);
    , ~; _2 v1 a% B+ m0 @) zline(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    / K0 G! j9 H9 S& R; `3 Z1 Mline(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]); - }- k0 C( ^' q0 u- K6 p7 H( h
    }
    0 b* l& N0 o  ?* s0 M}
    ) s9 R( d: r8 w5 F& N$ u}* f3 A1 U$ y+ E5 R! g2 o/ o
    else if(FLAG_SJF==1); z5 D$ v' F* S% F" u9 o# A+ r/ t; e
    {: I" v9 F9 @1 |$ h: j& ?
    x=0,y=0;8 M- G% t* U+ K0 e, O  C' D. K
    for(i=0; i<num; i++)
    + b9 W0 p, K& q" G( V{
    ' L  b9 u8 Y! e& \% St = (float)info[0];: U/ K3 G  A3 Y9 W% ^3 F
    temp = (t/101)*180;
    . J& X& i5 L8 n5 c8 e1 \8 zpos[0][0] = (10-num+i)*50+x+650;
    + _( m, S* K% t' Q& Opos[0][1] = y+210-(int)temp;( o" ^4 e5 k6 _0 S
    t = (float)info[1];
    * F9 J! m: d% E; d# Q% ?temp = (t/101)*180;+ \0 X7 ^$ d  c  S( m5 g% v3 z! ^
    pos[1][0] = (10-num+i)*50+x+650;
    3 @6 l, k) H; m- u% rpos[1][1] = y+420-(int)temp;, U: g" G# d9 Y; W3 H" ^2 ?& J
    t = (float)info[2];
    4 J# p- K: i8 p4 ^+ p# O" Ttemp = (float)(t/101)*180;& S1 U& x1 u9 {
    pos[2][0] = (10-num+i)*50+x+650;
    8 [  x1 E& V% C2 vpos[2][1] = y+630-(int)temp;
    # `2 |: u, E! `7 Q' r}
    / }1 ?, e" m/ r: hclearrectangle(x,y,x+1200,y+650);
    * u8 T  ?$ d) vsettextstyle(40, 20, _T("楷体"));  W5 Q- _1 [+ C, l
    outtextxy(x+50,y+50,"SJF");# \, r$ ^# M; T1 l4 {2 ?$ F1 m. b
    outtextxy(x+280,y+20,"CPU");       //画柱状图3 Z6 p+ _& n  W8 H  c5 u
    outtextxy(x+285,y+20+200,"IO");
    . {+ V' a. G$ G3 F3 z3 g, bouttextxy(x+250,y+20+400,"change");! M1 D. \7 u) \" p6 p# f. d) |
    rectangle(x+270,y+65,x+330,y+215);" M* }, O8 R- P  |
    rectangle(x+270,y+265,x+330,y+415);
    9 Y. _7 ~, e: B; d* u- w* hrectangle(x+270,y+465,x+330,y+615);' E% I8 S; V. {6 R: i, w* C! v' X( m
    outtextxy(x+290,y+620,"TT");) N8 P6 y  {( [- S) g
    t = (float)com;
    $ S  ~3 I3 g& k+ p+ l9 w) `6 ctemp=(t/101)*150;
    5 M0 v) Y4 O: t) O+ }fillrectangle(x+270,y+215-(int)temp,x+330,y+215);
      M; |4 G/ S2 W( Nt = (float)wai;7 j8 _+ C9 {) ^) u' b
    temp=(t/101)*150;( T  S$ t: ^6 }2 M/ y7 S2 j7 v. z6 U
    fillrectangle(x+270,y+415-(int)temp,x+330,y+415);" P" m% f7 r* m* i" L1 r, H
    t = (float)cha;. q: g/ l$ ^# K
    temp=(t/101)*150;% U0 a! }1 N* b  A! [- s1 [) }% h
    fillrectangle(x+270,y+615-(int)temp,x+330,y+615);
    6 j) i# A$ V6 x/ ?for(i=0; i<3; i++)   //画坐标   high=90,length=2506 v1 l' q3 u% e% T9 n
    {2 S7 v* k' |+ K9 ^' U0 u" Z
    line(x+650,y+210+210*i,x+1150,y+210+210*i);2 P3 J) i* O( T( w9 B6 p1 C4 _
    line(x+1150,y+210+210*i,x+1150-10,y+210-10+210*i);
    1 D; o, @7 z, }8 l1 d7 vline(x+1150,y+210+210*i,x+1150-10,y+210+10+210*i);1 x* B+ m. ~1 {, L1 \; p

    ; F2 N" A# v# Q$ C$ wline(x+650,y+210+210*i,x+650,y+20+210*i);
    * n" d) `% T8 ~$ V6 I( Y3 P( W9 wline(x+650,y+20+210*i,x+650-10,y+20+10+210*i);* h: G7 p: [+ N2 V/ H1 ~
    line(x+650,y+20+210*i,x+650+10,y+20+10+210*i);
    ) |7 K+ _% [5 K9 v2 D8 R+ ~( E1 ufor(j=0;j<num-1;j++)
    , F# a. `7 y$ k* _3 s1 K. @$ ?0 z1 F* l{
    % I6 _5 ]; a( I- Bline(pos[j][0][0],pos[j][0][1],pos[j+1][0][0],pos[j+1][0][1]);; J: |  w# ?* Q3 W
    line(pos[j][1][0],pos[j][1][1],pos[j+1][1][0],pos[j+1][1][1]);
    / J7 ~2 {( i7 E; ?, ?$ |line(pos[j][2][0],pos[j][2][1],pos[j+1][2][0],pos[j+1][2][1]);
    / ?. ^7 d' Z7 q}/ W3 t* `. u4 m3 e1 }9 U
    }
    - W, A% C9 H6 ]' E) I1 N}- X' S/ s8 }; a& {9 G0 l
    return 0;
    ) E3 Z- o: t6 \}4 H, R# I9 p. _& Z* ~
    int High_response_ratio_dispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)+ U: @: _; F$ |3 o
    {
    ! Q1 V6 z: b0 X* S3 {3 \static int compute=0,waitio=0,change=0;
    6 s( U5 ^4 O9 o6 Pstatic int computeLast=0,waitioLast=0,changeLast=0;% \: z4 a8 D! ~& h
    int i=0;
    7 z& e$ M2 T5 a3 o  R" dif(draw==1), p" M7 a% `4 R
    {
      N! _' P7 w% W4 z; {& T//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);; h( Q! J3 _) g4 I) s* y5 K6 P
    drawPerformance_HR(400,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);! S! E! O& R' a; |* ^( P/ K: u
    computeLast=compute;0 r  v5 C9 H/ H, @" G5 n
    waitioLast=waitio;
    : f- \( }* h& T# R3 [# J3 JchangeLast=change;6 ~" Q: o! R5 ?8 V2 c% P+ D# L0 ^3 c6 E
    }/ ?# C/ u$ O$ O% `# g8 w
    if((* memory).p[0].flag==ready)& e& _& k, |4 _$ z0 l
    (* memory).p[0].flag=computing;
    7 _/ b/ j; C0 Z2 u6 C2 gif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    7 Q' C2 l: O2 m{& S* o' a( C0 r$ i- v, d+ x
    i=(*memory).p[0].computeNum;
    & E! H9 I$ P8 I# cif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed* k# e4 K' j3 a$ X# |5 f
    {
    , S8 A& ^) a% q(*memory).p[0].flag=IO_waiting;
    ( }2 K- ~& l/ l6 z" U+ Z(*memory).p[0].computeNum--;
    ' J3 `8 o) y# lchange += exchange_IO_Compute;1 o0 X9 M( D4 {* D1 U2 x' z
    compute++;
    2 H& u! ?+ k5 J" l' d% y& u}
    5 n) v/ u" j3 j7 o0 @else5 ]# {0 C: o. k
    {
    ) G( D+ P, W% H& Z8 M: f$ s1 }; I# acompute++;
    2 @2 y/ K4 H/ C$ t3 y: ?6 k$ }}4 _9 A+ F! u8 F9 T( p  L
    }2 n* ]3 U1 F' J+ O  F: }- r3 D
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    5 `! s& R/ _' R4 V0 C1 Q' a9 G{& P  |) S6 ?. c

    . ^# B! U1 Y  y4 F7 zi=(*memory).p[0].ioNum;
    9 D: X% G4 u5 jif(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed  l" m; }4 u9 h
    {
    / |: e1 m, i9 t8 i/ ](*memory).p[0].flag=computing;
    7 ^: j; A; h# B- p+ X7 Q0 k! }(*memory).p[0].ioNum--;
    * _1 {* U: G7 c% m# ]( ychange += exchange_IO_Compute;
    2 W3 r) \5 D- O. z6 j6 B3 vwaitio++;/ V: O/ P( Y7 H6 A: y
    }
    7 w, h% q% Y% W, ?" }6 Melse7 ~) W" H* N8 o! _: r8 g
    {' G, O+ V/ b. ]4 B! `
    waitio++;2 s6 K8 R5 U" G9 k; D
    }7 C2 @6 R3 Z- ]2 l) J) V
    }
    ) g* C9 N5 a& T1 |6 P3 Q  z' velse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)( j/ P$ |1 V8 y* i! }0 L2 K
    {0 \1 l! E; F. L% ]5 y5 Z
    (* memory).p[0].flag=IO_waiting;* `! u/ `) c, G  c* c/ l
    change += exchange_IO_Compute;
    & o# t4 z" X2 _3 F$ X" V0 H}
    " C" y. i9 [6 P! H0 l: kelse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)! `0 y9 c' R( E! m+ Q* u& V
    {
    . h6 [2 A1 o; T) E/ m1 w5 [0 P" D( F(* memory).p[0].flag=computing;
    2 H7 L3 C) i6 l5 fchange += exchange_IO_Compute;
    3 ?% @5 |& Q0 O2 \! m/ G9 v}
    ' G! @: @6 S7 t  N/ m% x2 Q' qif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成$ a5 N$ L( ^* ]% z' f. f
    {' R6 `) P8 o+ t8 d# F) i2 J" j
    (*save) = (PCI*)malloc(sizeof(PCI));* Z& C( p* `. H8 {
    (*save)->next = NULL;; _& D0 \: h1 Y+ @- n2 _& d& H$ A
    (*save)->processID = (*memory).p[0].processID;1 z+ ^  ?% u$ z1 B
    (*save)->comeingTime = (*memory).p[0].produceTime;
      e0 v1 z) ^0 P# @. ^" ](*save)->askMemory = (*memory).p[0].askMemory;
    ( z3 m) F* G7 x( h(*save)->compute = compute;( P9 v5 b9 n) ^* B  K
    (*save)->waitio = waitio;: B# _2 U7 w7 h5 a& ]
    (*save)->exchange = change;/ X% `% R6 }& s/ c9 T7 \, O  o
    (*save)->completedTime = systemClock;: q9 X% n( E% A: F+ M
    (*save)->runningTime = (*memory).p[0].runningTime;
    / p6 g$ {7 U% h3 `$ X*spareMemory = MAX_MEMORY;         //*spareMemory + (*memory).p[0].askMemory;
    * d) V6 N2 f7 \% Y. Gcompute=waitio=change=0;
    3 T6 u$ {3 k' F1 e, P2 RcomputeLast=waitioLast=changeLast=0;
    ! f' X6 Q1 V( ?. mHigh_response_ratio_s_to_m(&(*storage),&(* memory),&(*spareMemory),1,1);
      ?' T- T- b0 J/ |! @% p3 Xchange += exchange_process;
    ; |! w) f8 t0 n. Ureturn task_completed;
    3 Z7 N+ `( `" ?6 O4 d/ N  N}
    " c9 c8 u) E1 f6 melse" E! N, L6 r4 f  i# p! @
    return task_not_completed;  {  U1 i) a2 \- k+ C! G
    }
    1 U6 X, c; x  u2 v* c& T* D4 ]int High_response_ratio_s_to_m(processPool *storage,processPool* memory,int *spareMemory,int flag,int dispatch)% o' y$ f5 B. ]( @5 T" S# {$ Y
    {
      f0 w- L: ~" a& _* W9 f2 `9 qstatic int waitTime[initProcessNum],i=0,j=0;/ [5 G1 m' d3 s% y/ O' n9 @# A
    static double HR_ratio[initProcessNum];; a( P' M* z2 M
    if(flag==0)                    //初始化数组
    5 z, ~( t+ x& o$ J{. @' N/ }$ F5 b4 Z0 O
    for(i=0; i<initProcessNum; i++)
    0 y3 Q5 M* B8 E/ z; I' ?" p( T{
    & W% `3 \+ [! h4 v" B( |waitTime=0;0 H% T4 ~0 h2 g: _) ?! @
    HR_ratio=1;. ~/ a9 `7 z; h
    }
    6 K% y: M( n9 z7 u% D% t* R}
    ; }( {: f1 W$ _% B0 rfor(i=0; i<(*storage).proNum; i++)  //等待时间增加,重置响应比& I2 |1 K2 ?$ R
    {* U6 Y" @# y) \) d% F
    waitTime++;' a/ X- a6 ~1 f' I
    HR_ratio = (waitTime+(*storage).p.computeTime+(*storage).p.ioTime)/((*storage).p.computeTime+(*storage).p.ioTime);9 e6 M4 g( q5 u3 w( X/ T* j. n
    if(HR_ratio > HR_ratio[j])
    - }; q2 ?! t! Sj = i;. n" f3 @& G$ _9 U4 v! c1 E
    }4 F/ l. n) z3 W
    if(dispatch==1)                    //需要调度一个进程到内存中执行
    % q  H3 j! n7 b3 _5 L! i{
    " f, X- y3 e. H  D* [1 x% _if((*storage).p[j].askMemory < *spareMemory)7 E" \, H2 K  h0 p" `! S
    {2 |$ O; k3 U1 C" ^. }2 k4 z
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;
    : m' O8 s8 ]+ \(*memory).p[0].comeingTime = (*storage).p[j].comeingTime;
    * s% |/ W9 N4 I: b1 r(*memory).p[0].computeNum = (*storage).p[j].computeNum;9 X9 X  t! I! A! Q
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;
    - s1 d- ^& @# Z( j' J/ i(*memory).p[0].processID = (*storage).p[j].processID;
    8 o0 O; U1 z' s; H; M(*memory).p[0].flag = (*storage).p[j].flag;
    $ z9 F: K3 @/ b1 ](*memory).p[0].ioTime = (*storage).p[j].ioTime;/ O/ z$ n# C7 A8 ~
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;
    : L/ C, }5 I+ h% Z4 X(*memory).p[0].runningTime = systemClock;3 H# l( d9 W4 a& M7 P% ]2 _" a
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;
    5 h6 h6 D8 d9 {! M6 i4 tfor(i=0; i<(*memory).p[0].ioNum; i++)
    2 T# x" U& Y0 A" c4 o$ H8 v: G6 d(*memory).p[0].ioClock = (*storage).p[j].ioClock;
    , w" D  X. b% U3 C  o' ^3 zfor(i=0; i<(*memory).p[0].computeNum; i++)
    # m, s8 q+ N# U! \(*memory).p[0].computeClock = (*storage).p[j].computeClock;; N& |( A. l6 T6 {& P1 O7 G1 i
    (*memory).proNum=1;8 A% r* ?6 z: O  `
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    ( X  v& \- q: b8 z. @6 \3 o# P; Uproduce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    9 N/ [1 e- s/ Q8 Q. [/ g" h(*storage).p[j].produceTime = systemClock;
    ) v2 f( d; _5 f% VMAX_COMING_TIME = (*storage).p[j].comeingTime;
    6 ]; m4 B  l# _9 _, Z. EwaitTime[j] = 0;
    " H- d8 o: M8 ^% NHR_ratio[j] = 1;
    6 s. n& ?* z& ]1 @. @}6 ]% V' V/ V" N- m
    else" A- s: I! H9 A! `
    {
    $ ]6 w" N! H3 N0 |+ j( Aprintf("A process ask for a memory overed the system capacity\n ");
    4 Y; q6 {9 ?2 C* u$ B$ G0 u) `" Cexit(1);/ n  m& q: P) ~6 t# g' g
    }
    0 U* j7 i  d# D, h; C1 }( B. M}
    3 z, T* [* \7 w0 a- [return 0;: o5 j/ J; z% m4 x9 _9 L
    }
    4 I/ S5 N, w( j, L: b6 ?int PriorityDispatch(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
    ; ?7 y' Q7 G) N( [{$ \, Q4 C7 ?/ N! s
    static int compute=0,waitio=0,change=0;
    + G5 z: }, }( b5 M1 D: v4 jstatic int computeLast=0,waitioLast=0,changeLast=0;2 ], X9 H7 {1 p& I( C
    int i=0;4 y. K  S3 `' [) {# b3 t# j
    if(draw==1)
    5 T3 s1 L" N% a* e6 P5 M{
    ) x( J$ c! u3 o6 ?' {; D//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);/ n3 R5 P& g( ^& c( B% y
    drawPerformance_PF(800,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);
    " j1 C% Y7 n/ r: X; c$ u0 T; s8 ?2 G8 I3 @

    ) f& N* t& T1 d% `& w- {( XcomputeLast=compute;7 x7 K; G5 Q7 k5 U- r# e
    waitioLast=waitio;7 Z  J" v" g* Y) }
    changeLast=change;- P- H7 j$ b# d# v0 ~
    }
    5 F" _3 I& `; o) @" ]if((* memory).p[0].flag==ready)
    & A2 d# v5 Y# P* v' M(* memory).p[0].flag=computing;
      U. |/ T+ h' kif((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)
    8 M) s; B+ V8 I. d{
    1 D# ^6 ^2 t2 ~9 Bi=(*memory).p[0].computeNum;
    : f, C, k4 Z* v2 Cif(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed' Q! G+ ^: l. O" e: B2 J7 H, s
    {
    9 j* \3 Q+ o7 u0 Q4 j  Q* }7 b(*memory).p[0].flag=IO_waiting;7 A* G* g- ~5 r4 e
    (*memory).p[0].computeNum--;
      O. \5 R0 F  x1 F9 g$ hchange += exchange_IO_Compute;
    ! U, ^" R! U! \/ e" a' icompute++;
    7 p. W3 W1 Z3 N9 v& ?}7 E( C& p& l! C2 `& U
    else" s  a7 R- d( t" t+ t" g
    {
    8 n& c# l+ s/ ?1 ]5 ~compute++;
    : ^3 G/ e) J1 Q0 B7 X}
    ( E- y, L$ N5 A# i* b, V6 B}
    6 O$ D' u4 e: x% uelse if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    ) o2 Y2 V3 m9 F{/ k9 {8 Y* s, t
    ' o. ]4 A. N! ]* W2 ^  _% k( s( _
    i=(*memory).p[0].ioNum;" L% W3 ?' c# X, o
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed
    # x* g# }/ d  T: Z  h{' H% ]( X) H) \' l0 i
    (*memory).p[0].flag=computing;  v# k7 t# w# V! [$ Z- m
    (*memory).p[0].ioNum--;5 D7 e. T7 e7 P' S' z
    change += exchange_IO_Compute;* A. B1 L& B5 {* u
    waitio++;
    % `  E9 {9 r: D! I}( S" h$ U: {0 F8 v* p7 M
    else
    4 o' V, F) Z4 o{$ i/ ^) I8 o( |; I+ o
    waitio++;
    9 T' I1 o" F& W) c1 O( b1 `! b}
    7 u6 r* I0 c9 ]7 b* b  h- r6 Y}; \" _# a  ]" M3 l1 e
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing). K8 M8 B% Q, H9 r4 w
    {9 I) ^3 E) t' K& Q; K
    (* memory).p[0].flag=IO_waiting;
    ' N! R& @, Y' U6 s% [change += exchange_IO_Compute;7 z* O* Z  m2 d. W
    }
    ! D" J& |9 p0 ^: |. K; felse if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)
    3 h2 a7 D4 F) R( `9 h{4 b8 k6 K2 ^4 w4 x$ v2 t6 `7 E, J
    (* memory).p[0].flag=computing;
    , ]( ^$ ?9 k9 Gchange += exchange_IO_Compute;
    % c$ w) v( J% s0 m: A}
    * g/ G& B( ]( c9 p# m% Sif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成0 Z7 Q5 r. n4 i# c
    {
    0 f7 @7 @0 c/ X/ P, L! n(*save) = (PCI*)malloc(sizeof(PCI));
    ( g2 E* ?/ ]' \! }, T* A5 t(*save)->next = NULL;" Z* m' _5 _* h& h4 f3 ^- l
    (*save)->processID = (*memory).p[0].processID;# B, u& U4 `' a! T7 O
    (*save)->comeingTime = (*memory).p[0].produceTime;
    0 Q7 I) i$ ^, {1 S5 o8 A(*save)->askMemory = (*memory).p[0].askMemory;
    2 y' ?3 ^( L3 _& X8 U7 M(*save)->compute = compute;- p% I! C4 b2 X5 T. |6 i2 m& ~
    (*save)->waitio = waitio;9 M9 X6 r5 ^% e5 e+ H: q6 u
    (*save)->exchange = change;
    # p/ c9 ?- e$ G  j# F(*save)->completedTime = systemClock;8 f2 k' G% U0 Z4 Q/ T3 V! R
    (*save)->runningTime = (*memory).p[0].runningTime;
    8 z" p# q+ k' p' a: L8 k*spareMemory = MAX_MEMORY;      //*spareMemory + (*memory).p[0].askMemory;+ x) h! a+ n6 z7 S
    compute=waitio=change=0;
    # }( m3 J) e$ N% bcomputeLast=waitioLast=changeLast=0;
    + v+ ^4 T" _) tPriority_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));- ?1 ~+ [9 O) M0 R. V8 F
    change += exchange_process;
    , a1 _2 `8 [: |9 p7 C$ G: Ireturn task_completed;
    7 U' Z+ M3 j. Y! t3 C, _( Q* r}
    / x8 w2 r! s, [7 }# Q' eelse
    & m7 u4 v% I+ f# g8 C9 h+ B2 |return task_not_completed;( k( X$ n# [2 o& M
    }
    $ X  i0 `$ Y3 e( U5 W: ^" Lint Priority_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)8 `3 j" M  E+ a
    {1 N' k# a9 o2 O
    int priorityNum[initProcessNum],i=0,j=0;
    ) u/ Z/ t7 z8 }: X/ d* _3 D# |double temp=0;" B& B4 X2 ]5 [: L5 i6 `9 w
    for(i=0; i<(*storage).proNum; i++)    // setting priority to each process1 `) U& r' [. Z- Y3 e2 X" q
    {% V( }8 N4 N7 p" k
    temp = (*storage).p.computeTime/(*storage).p.ioTime;# O; }' P- v0 L/ J
    if(temp > 0.8)$ f9 k* x5 C8 R& C7 [. Q$ z
    priorityNum = 6;
    # i  h: M, O7 Q& c' H  `else if(temp > 0.7)0 r  _. H7 \$ _1 |* {
    priorityNum = 5;2 S4 }# L6 a1 v$ d
    else if(temp > 0.6)
    : e9 F4 g5 O$ kpriorityNum = 4;
    $ x) F2 X5 A8 ]- ^else if(temp > 0.5)8 X* z$ J9 O; ^: k9 o
    priorityNum = 3;" R( Y9 a9 F- I, ^
    else if(temp > 0.4)
    7 ?) D) x+ z/ C' \. z, |! x& FpriorityNum = 2;' B, X& |8 a9 X
    else" }  ?( ?' t) F
    priorityNum = 1;
    . ]' b8 |* M9 ^. y6 Xif(priorityNum[j] < priorityNum)
    7 ~3 }# V8 j5 D! n& n+ zj = i;% y' H: z/ e. n% ]; H
    }; y- g. J. ]) J3 \' n  r! {
    if((*storage).p[j].askMemory < *spareMemory)/ u' d3 q- G: T% |7 ~
    {# M+ r" O- s& h% R7 ~5 w, w; c
    (*memory).p[0].askMemory = (*storage).p[j].askMemory;3 z* w7 q$ D" T; o8 }: N5 t+ P3 g
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;6 E3 t, Q1 u+ q3 P; c5 q$ w" A
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;+ U3 j9 u8 y& E1 z! E0 U2 W+ r% g& i
    (*memory).p[0].ioNum = (*storage).p[j].ioNum;+ j3 |% i7 p$ L$ [
    (*memory).p[0].processID = (*storage).p[j].processID;
    * J! Y) J5 ]4 X' l4 j9 B: K(*memory).p[0].flag = (*storage).p[j].flag;7 d; W# c9 R* L
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;4 z: ?6 x# i2 j* C* y. w" A
    (*memory).p[0].computeTime = (*storage).p[j].computeTime;$ K5 E8 p4 L9 H% M) s+ e5 Z
    (*memory).p[0].runningTime = systemClock;6 |5 o: S+ t# K( l) I8 R
    (*memory).p[0].produceTime = (*storage).p[j].produceTime;, Q8 U6 p6 f' U/ g1 s: g+ t
    for(i=0; i<(*memory).p[0].ioNum; i++)/ A# F. x6 B  y( N3 S
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;
    , t5 ?6 K7 P, k  G4 Z' \3 R5 dfor(i=0; i<(*memory).p[0].computeNum; i++)
    ) x9 M, u+ T) r/ g1 [(*memory).p[0].computeClock = (*storage).p[j].computeClock;1 {1 k  m8 s6 v9 F
    (*memory).proNum=1;% ~7 |' Q1 X2 o# X" I# {
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;! X+ A! p# h" q9 L5 W7 S
    produce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    0 D9 H) w1 X. n8 R4 jMAX_COMING_TIME = (*storage).p[j].comeingTime;
    - u- L( A$ u3 L% t" u}8 E( d0 s% j7 X; r
    else
    5 b' E7 E4 l$ k2 h) i2 l+ y, w{
    " r) X; G$ Y, C% f% ?2 A5 u: N. Qprintf("A process ask for a memory overed the system capacity\n ");4 \0 E" [1 S3 N2 K) l
    exit(1);+ D+ L/ G7 k4 s5 |2 o7 \
    }: ^* A7 G9 c7 U
    return 0;
    4 J1 m- @9 P. B, w1 g}
    1 _6 G' V0 Y- O- q% K' yint ShortJobFirst(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw); `! @- K4 r  o, `
    {# r/ L9 K3 X8 h  }+ n* k0 F6 e
    static int compute=0,waitio=0,change=0;/ H3 A# e  |+ ?" h
    static int computeLast=0,waitioLast=0,changeLast=0;$ E* Z& l2 H/ @
    int i=0;
    & E- y8 U7 m2 g5 i  l8 p" rif(draw==1)
    ) A6 m: z" G4 Z* u. L& y  K" k{
    " A- w$ c) E2 ?% V//printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);& P4 C* d3 p/ E1 I, g7 k
    drawPerformance_SJF(0,325,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);1 b! P9 ~+ J+ C8 H

    1 t+ w* ]/ Z% z- r
    ( V/ B$ M. G$ FcomputeLast=compute;
    ' _! N) w9 \( I. D, L5 wwaitioLast=waitio;& [1 O, e5 D. D: Y
    changeLast=change;
    - G  W6 g6 n& u2 B4 _}5 U& L* }; K, F; w0 p2 U
    if((* memory).p[0].flag==ready)+ ^: ]( c2 L. S: v! ], x
    (* memory).p[0].flag=computing;  I, J; o# `1 _  B
    if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==computing)- ^/ g" b& N. ~0 G) a2 p
    {5 X5 }# E. L0 ^: q3 o
    i=(*memory).p[0].computeNum;
    7 v2 f" G& |8 j, h* ^8 N8 G# ?if(--((*memory).p[0].computeClock[i-1])<=0)// one compute tase is completed
    & t) X& d& n6 |7 w! r  k3 k- M; s* K{
      e4 t1 Y' L  Z4 p) o(*memory).p[0].flag=IO_waiting;
    2 H) \" H) w" L9 i(*memory).p[0].computeNum--;! A: e( W! I" X$ r0 n  |9 ?
    change += exchange_IO_Compute;) F5 ~. m" D8 S, O, m+ `
    compute++;
    7 D  H, Z% L; F% f* X5 F. Z1 s& C/ H}
    " z' p" E% Q% o6 \- Lelse
    ) s6 [1 @  Z$ n1 r) `( X{) s! N8 Q# v2 l0 t2 t$ K* E+ t- v1 j
    compute++;
    7 H5 `! P3 ^% u& j: R}. t2 i" y( W+ f3 j! t, G8 g6 M  S! ?
    }# i2 \) l# }3 O  z& o! l
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==IO_waiting)
    4 e5 S  g0 T) e" ~{
    $ [$ A8 J: [, s
    4 S4 `' F9 S& M8 O  g( O8 hi=(*memory).p[0].ioNum;+ f, H/ A; G) @/ L
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed" ~4 m- K: E' G
    {
    8 m" G! l7 m, D8 g. @/ s, D& ^(*memory).p[0].flag=computing;
    & g& s1 g$ @3 L& [(*memory).p[0].ioNum--;( ]# f" }2 z6 A) ]& u8 T" M
    change += exchange_IO_Compute;
    , O( A4 C& ?- N  o& A8 Z2 ]waitio++;
    8 F( @9 n5 O$ L$ O& i( L$ M( l}2 V2 v. a8 w8 E$ l) }1 D
    else
    * Q; L# t8 {$ {: s; w) F{
    $ K3 O$ W) H) y$ {waitio++;, G- s3 o! r9 W
    }
    * O' O; @6 {; }, n: i}7 b) c  Q& R4 j! c3 k
    else if((* memory).p[0].ioNum>0&&(* memory).p[0].flag==computing)
    2 t$ j8 d7 m7 b7 b( ^; w' `{
    ! H$ w! e; V! V4 z) T+ C" `# I  `(* memory).p[0].flag=IO_waiting;
    ! X& r5 l4 N0 `1 }# K( gchange += exchange_IO_Compute;- h% ]% ]4 u2 Q2 n6 K" ?, S5 s
    }" Q8 i7 S9 M2 u  a" ^- o
    else if((* memory).p[0].computeNum>0&&(* memory).p[0].flag==IO_waiting)0 b9 ?6 l! I/ v7 a5 r
    {" w/ a) o% g! x6 P- ^+ _
    (* memory).p[0].flag=computing;2 c- S; K, d: \2 N+ a( M
    change += exchange_IO_Compute;
    $ R' V! Y9 y0 z5 R}
    2 N) T' x, I' N7 ?7 f0 eif((* memory).p[0].computeNum<=0&&(* memory).p[0].ioNum<=0)  //一个作业已经完成3 c$ C% a$ [2 ^# X" f% a( u8 _
    {
    7 o$ q  O+ [' l3 j' M$ {" U6 a- l0 i0 y(*save) = (PCI*)malloc(sizeof(PCI));
    ) ?1 V& Z& U  Y  r(*save)->next = NULL;) n- B8 m  w. S3 e8 C* L$ i- g
    (*save)->processID = (*memory).p[0].processID;: H$ @& B& g$ C* R" p2 a- m
    (*save)->comeingTime = (*memory).p[0].produceTime;
    ' I2 ?5 j0 ?% n: S+ ]( D: W( ~( U(*save)->askMemory = (*memory).p[0].askMemory;) U. j& o& R: ?9 l/ V' G2 E8 _
    (*save)->compute = compute;
    & t5 h3 ]: b0 t(*save)->waitio = waitio;! l: t% B/ g3 J5 C# a
    (*save)->exchange = change;
    ) p6 R  [2 ]: \$ O(*save)->completedTime = systemClock;% Q: B1 L% m* ]" n2 N3 T
    (*save)->runningTime = (*memory).p[0].runningTime;
    9 X8 F# g' l) @0 I  F3 ?*spareMemory = MAX_MEMORY;//*spareMemory + (*memory).p[0].askMemory;* s% D0 {" w; G9 c* r
    compute=waitio=change=0;5 v6 {  ^" O( r( L7 n
    computeLast=waitioLast=changeLast=0;
    8 Y- P1 m9 x* o. u/ {1 y$ PSJF_storage_to_memory(&(*storage),&(* memory),&(*spareMemory));4 o5 |3 E- ~: I
    change += exchange_process;
    - d; b; g' Z9 o, B" r! h: lreturn task_completed;
    * W1 [9 Q( Z0 e) n, h" C0 T% r) |}
    5 Q; A; t( o+ F* t" Telse
    0 v5 J. z: r9 [+ A% Hreturn task_not_completed;0 f* E' a1 D/ P* }4 Q! S" E
    }
    5 e  |% D2 d0 U) [. K  |int SJF_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory)- b, ~/ C& R& H, t0 v: q9 e
    {# N0 L% U  I3 b# r/ v
    int i=0,j=0;4 V3 a9 \6 ~5 c) m- }# B) _. m0 [
    for(i=1; i<(*storage).proNum; i++)9 q+ D: q9 b2 @, {$ Q8 \
    {: O( ^/ J- T+ `
    if(((*storage).p.computeTime+(*storage).p.ioTime)<((*storage).p[j].computeTime+(*storage).p[j].ioTime))
    $ O( h6 h/ o: N- J3 wj=i;$ R0 I" L, v" b. W
    }
    & d+ e* t- ~. Hif((*storage).p[j].askMemory > *spareMemory). L; g# X' c( F- @& t" b1 Q
    {1 Y& ^3 I- u2 V- p: M: J" ^
    printf("The memory asked is overflowed than the system memory.\n");6 N2 b( f& i( n! B" e9 K
    exit(0);" k# z& }+ a! _& }  @1 \7 |7 T7 V
    }8 _) y3 ~- _: A' @* \
    else/ ?5 y4 c' R) {0 \" U3 Z: E: ~& n' \
    {
    1 t4 i- {* f( {( w% _# u(*memory).p[0].askMemory = (*storage).p[j].askMemory;. |! j: B6 X$ u; t$ Y, g. ^
    (*memory).p[0].comeingTime = (*storage).p[j].comeingTime;& @/ |, y( j' D0 M; P
    (*memory).p[0].computeNum = (*storage).p[j].computeNum;
    5 I8 |- ~1 O$ \/ k2 ^8 h, c(*memory).p[0].ioNum = (*storage).p[j].ioNum;
    ! D( t, f# Y8 O# i( S(*memory).p[0].processID = (*storage).p[j].processID;( K  {  c( H- S: J2 V/ J: o& g5 \8 V8 t
    (*memory).p[0].flag = (*storage).p[j].flag;) }" |( J5 e' f
    (*memory).p[0].ioTime = (*storage).p[j].ioTime;
    ' q* Z$ {6 K" \2 ?* ]/ ]) D(*memory).p[0].computeTime = (*storage).p[j].computeTime;# C" C3 m- m5 L
    (*memory).p[0].runningTime = systemClock;
    0 ]/ D# k' o. l1 M. B$ U! B9 T: y(*memory).p[0].produceTime = (*storage).p[j].produceTime;  F- B! X; F# {3 l& R% @
    for(i=0; i<(*memory).p[0].ioNum; i++)# w$ J* n+ p! h* m5 Z
    (*memory).p[0].ioClock = (*storage).p[j].ioClock;
      o- ~  ~- [" s' w: L" P$ cfor(i=0; i<(*memory).p[0].computeNum; i++)! F. E8 V  m) Y- Z2 P& L! Z
    (*memory).p[0].computeClock = (*storage).p[j].computeClock;
    / C0 U- F, z0 @9 X; C9 S* ^(*memory).proNum=1;) T# M" x: F( r/ C! m! T" S
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;
    ' U% }2 W- d" ~4 |0 E, `* Tproduce_one_task(&(*storage),j,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    ' V  m* y* ]: u+ _/ }MAX_COMING_TIME = (*storage).p[j].comeingTime;8 G* F$ X+ S+ {) c
    }
    - A, _8 Q1 t0 T1 B& X5 y& k# ]return 0;
    / o9 ~9 C1 J0 a( d  L}4 ]! j4 P; ^& L. m  N" x* O
    int TimeTurning(processPool *storage,processPool* memory,int *spareMemory,PCI ** save,int draw)
      Q$ \+ Y% W* U2 B0 A2 \+ [9 n: D{
    3 R/ K" T8 \1 ], H/ Zstatic int compute=0,waitio=0,change=0,clockSegment=100,poi=0;
    8 D$ O, v4 E9 R' X, v9 ^$ b( r# Zstatic int computeLast=0,waitioLast=0,changeLast=0;6 [+ g- j* O) S4 l' z# E
    int i=0,j=0,k=0;$ Q2 H0 L. F: a) ?
    if((*memory).proNum<=0)
      L% F4 w2 |: a- ]6 D( }TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),-1);
    ( {" P& d- _$ v3 x6 ?) y2 xif(draw==1)
    8 A- j& a# t* s5 y& f1 T; w  Z{2 |  [7 [5 _# y# X4 X- z( m
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);& D: `8 h3 Z& U9 U
    drawPerformance_TT(400,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);& V- n6 m$ s6 k) Q

    % s) S$ q5 H- [' n4 a& n9 A" l/ j# N) t6 z) S
    computeLast=compute;" M3 F- l/ k( w7 {; Q4 D( t
    waitioLast=waitio;
    2 K6 J5 Z* f. \$ y, q) u0 h  jchangeLast=change;' C: J5 a2 z" ]' @9 j; k* J
    }& C3 x$ S$ h$ F$ m
    if(poi>=(* memory).proNum)7 h, t& B- v8 I4 v# d& K( q/ K
    poi = 0;6 T! E. e# Z$ B6 D5 {
    if((* memory).p[poi].flag==ready)
    ' f  w4 C4 u6 B. B& ^% u, J  r(* memory).p[poi].flag=computing;
    0 z& s- s8 m, o* L# Vif((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==computing)9 @2 c- D; u. r
    {$ c! B2 s% |/ o: x
    i=(*memory).p[poi].computeNum;
    7 a2 z8 X. Y) {2 Y4 C' W: ^if(--((*memory).p[poi].computeClock[i-1])<=0)// one compute tase is completed
    9 y" p, t1 r! H, V" F3 Q8 N{; I! ~6 D- \) ?* P. K1 e
    (*memory).p[poi].flag=IO_waiting;7 F6 R) B) s! w* S. I
    (*memory).p[poi].computeNum--;
    " M3 i) r: Q! `" g# J( achange += exchange_IO_Compute;
    1 L( ?" x, V7 {1 l0 Qcompute++;3 S4 t: s) y3 j% b$ Y1 ]
    }4 r0 y: h: L) W9 \6 f
    else+ b  D% m; }, F. H" w/ q
    {  F: K6 V  M1 W: Y# q1 j/ s; t
    compute++;) _* d$ |3 w# p& s2 R& |: Y
    }
    5 C/ t$ M, C. K7 ]9 r0 A3 T: y: k}
    ) u" W. y2 C( qelse if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==IO_waiting)
    * L, U, N5 \( O  h8 h# H{
    ( q7 C' Z! [* t4 _! o0 N# X+ }+ F: {4 _5 Q! n- L) `( U9 F
    i=(*memory).p[poi].ioNum;
    ) _( k- E) p$ M8 h& t  Zif(--((*memory).p[poi].ioClock[i-1])<=0)// one io tase is completed$ Q+ `: f' n! J" X  Z
    {
    5 [7 @% j7 ^6 L% A(*memory).p[poi].flag=computing;9 t  j8 z+ Z# J
    (*memory).p[poi].ioNum--;* e2 O# l/ p4 o
    change += exchange_IO_Compute;2 H8 J% T6 N; n. ^* ]7 P7 W4 z
    waitio++;
    # c) [0 s- y8 [* [2 O}& u4 S) Z* e1 p: r5 Q3 V. q
    else  A( Z/ g# B& ]$ `
    {
    , r, L" s5 K/ N6 t0 p3 ^waitio++;
    / g" s% m8 R7 O}7 u3 r6 U, b7 a; Z- D( e' _- o
    }% n; [3 H& h! C+ ]% ^6 |
    else if((* memory).p[poi].ioNum>0&&(* memory).p[poi].flag==computing)
    * [  @6 A0 g( L' T. y  H{. f- K0 d% \4 r5 Z+ a
    (* memory).p[poi].flag=IO_waiting;: {9 Z4 n- ?# D0 \
    change += exchange_IO_Compute;
    + e/ r3 ?5 J& N$ q}) `) k3 `. b/ r9 F
    else if((* memory).p[poi].computeNum>0&&(* memory).p[poi].flag==IO_waiting)% y. S( c8 ^* C% E: t& S" `1 k
    {
    ! ^; n# g) r+ F3 c(* memory).p[poi].flag=computing;/ Z- u" c+ f. H
    change += exchange_IO_Compute;" U7 l  ?1 V  {, r! e0 ^/ ?- q( f+ V
    }* U3 H! n. C' m# V3 X9 o+ x
    for(i=0; i<(*memory).proNum; i++)  //其他等待io的进程可以并行推进
    + }: g4 m! s0 w0 x0 x{
    % G7 Z( V, h. h1 k$ R0 ^& l6 Lif(i!=poi && (*memory).p.flag==IO_waiting)' _9 N+ d% }- W  m8 D
    {/ A$ X% K$ c7 d/ p  O% M
    j=(*memory).p.ioNum;
    ) O3 ?. ?# Q& P) iif(j>0)6 ?4 L2 y9 x- B* X8 O' x$ M
    {
    9 ^6 ?; k& m; zif(--((*memory).p.computeClock[j-1])<=0)// one compute tase is completed
    8 W6 E$ |- t, `{
    ' F6 O5 U/ V2 }- S(*memory).p.flag=computing;
    ' H- f& ~$ [( H; W* ]4 K% ^+ A* G(*memory).p.ioNum--;
    2 x& F9 ~7 w* o' g% T$ G/ nchange += exchange_IO_Compute;
    2 f5 w4 p# j3 S" W4 p}2 h. d" n2 i1 a, ?
    }
    ! c' G' s6 g  o; E}
    $ u5 M+ u! V6 F9 w" x; M' f; E) Q}9 @  j# N, u- v
    for(i=0; i<(*memory).proNum; i++)  //处理已经运行完毕的进程: I: v, ?" o6 P- a4 Z
    {) r; M# Z7 u6 }% n& R/ y6 _) a
    if((*memory).p.ioNum <= 0 && (*memory).p.computeNum <= 0) // a task is completed
    : U- P+ m, a% w: f{
    : ^+ N& }4 e2 p' n7 l. B9 c# c(*save) = (PCI*)malloc(sizeof(PCI));
    & f! K+ \1 T5 N" H  T; ^(*save)->next = NULL;8 d0 \% W: ~, A+ N
           (*save)->processID = (*memory).p.processID;$ v4 [8 c) s8 h; d; j1 ^
    (*save)->comeingTime = (*memory).p.produceTime;
    8 S( V2 d! p- I/ ](*save)->askMemory = (*memory).p.askMemory;! E0 @0 I1 x6 y$ `# A# T$ T% O
    (*save)->compute = compute;$ \% f, W" T+ \0 C! V
    (*save)->waitio = waitio;
    9 B: P+ Y$ N* o: U( o6 I$ `(*save)->exchange = change;8 ]: p" s+ x: y9 h
    (*save)->completedTime = systemClock-(*save)->comeingTime;
    & h2 u% Y$ Y% B! `1 M(*save)->runningTime = (*memory).p.runningTime;
    % Q0 m$ T& S+ k  {/ q% U4 G# s(*save)->completedTime = systemClock;
    4 h* W; ?: X' w*spareMemory = *spareMemory + (*memory).p.askMemory;% ]: X: G8 H! p. m1 a2 A* G2 W" \
    compute=waitio=change=0;
    8 N' l/ ?2 ]* [4 B' h/ ^computeLast=waitioLast=changeLast=0;2 a4 t. J5 ?% {* |! `
    if(TimeTurining_storage_to_memory(&(*storage),&(*memory),&(*spareMemory),i)==1) // 调入一个新进程进入$ D/ L( C/ s6 d7 I; V% c* v
    {6 T4 U8 l  M$ K/ t$ Y  y4 g9 O
    if(i==poi) //占用CPU的进程已经运行完,将时间片分给其他进程( {/ T+ h( e0 g, }/ N
    {
    9 O4 |. _$ H* a, d# t" _% E& h" V0 |poi++;5 r7 a& j) }8 q9 `! b0 o
       clockSegment=2000;7 M" \: a2 {$ D8 x+ q: }
    }- d: m& t$ a2 D7 g4 @+ ?
    }( N* F% ?# X  m; }1 |/ g- ]
    else  //没有足够内存调入新进程1 q$ a% f  B6 g, A  i  A
    {
    9 y/ _3 U: {# B: n! l# p  Rif(i < (*memory).proNum-1)8 T' j/ G% l. v9 M$ M* P
    {
    0 ^8 d) b5 E. c* K  Bfor(j=i; j+1<(*memory).proNum; j++)
    ) [0 Q; g" P& }5 ]1 G* c* ?4 P* e{4 }$ v: v$ O4 `
    (*memory).p[j].askMemory = (*memory).p[j+1].askMemory;$ W/ |. o- b$ a$ n, O
    (*memory).p[j].comeingTime = (*memory).p[j+1].comeingTime;8 e8 Q1 Z- q( Q- m
    (*memory).p[j].computeNum = (*memory).p[j+1].computeNum;) n% Y3 D4 s* h6 B
    (*memory).p[j].ioNum = (*memory).p[j+1].ioNum;
    : B3 w% h- S  a; H4 w(*memory).p[j].processID = (*memory).p[j+1].processID;
    # F3 C4 a  E5 X- i4 I1 K  V: K(*memory).p[j].flag = (*memory).p[j+1].flag;
    ( r5 l6 [/ |/ W; ~(*memory).p[j].ioTime = (*memory).p[j+1].ioTime;' O  s' W4 S; O3 ?( m* K, Z
    (*memory).p[j].computeTime = (*memory).p[j+1].computeTime;
    $ k; t3 g2 N0 a/ i- h' y! {+ K  q(*memory).p[j].runningTime = (*memory).p[j+1].runningTime;# S) i, b1 }: Z
    (*memory).p[j].produceTime = (*memory).p[j+1].produceTime;
    ) C$ f1 k% ?: Y(*memory).p[j].completedTime = (*memory).p[j+1].completedTime;
      f, j  \) q& B& tfor(k=0; k<(*memory).p[j].computeNum; k++)/ ?0 C% I( a( m: v2 l1 c+ h% c( X- O! [
    (*memory).p[j].computeClock[k] = (*memory).p[j+1].computeClock[k];
    ' K# O* {$ O/ n0 r3 i. Wfor(k=0; k<(*memory).p[j].ioNum; k++)9 v* M3 h9 q; J  B
    (*memory).p[j].ioClock[k] = (*memory).p[j+1].ioClock[k];
    # ^& M# `! W) g3 j5 S! Y1 T, g}
    " z7 ]1 Y) t0 Q2 t  |4 d0 j; L+ nif(i<poi)
    * m/ v4 n' a  {0 Gpoi--;, J6 f7 H& L; b/ ?- O/ O
    else if(i==poi)
    6 m, o% D, r4 {! `& @clockSegment=2000;
      J3 L1 r0 C# {0 ]# {$ L% H  R}
    $ J( h9 p' g+ S0 pi--;, Z4 k, E! E2 D6 R, D) o2 w
    (*memory).proNum--;: K# r7 W+ D) r% c; `& d, W9 r
    }
    7 ]! o7 `7 m* e3 u; p5 r4 @7 J8 freturn task_completed;
    . U; |( m, E1 V/ S# H}
    7 g7 |- F+ @, I  e5 Z" R- C$ {. Z}1 f9 N2 t# `+ n9 ]
    --clockSegment;: j  J5 ^; h6 d& ?* e
    if(clockSegment<=0)/ o; K- Y) w/ A
    {9 t7 d" O  C' C- O
    poi=poi+1;+ N0 G3 v& j# q: B
    if(poi>=(*memory).proNum)
    & g2 N4 t" t# ]8 t- Ipoi=0;& G: F) D; E6 l  n+ {( U
    clockSegment=100;
    + U! S7 F) b  x0 g2 q}1 }+ x. h+ {6 [! H8 Z! r$ R$ i
    return task_not_completed;
    0 X2 _# q  F2 s3 X# a( P" q% m}
    6 a5 E9 O3 x# B* Bint TimeTurining_storage_to_memory(processPool *storage,processPool* memory,int *spareMemory,int pos)( D+ d7 J- C9 S4 G# V) q7 E- [& k6 @
    {
    * a" L0 ~" D/ i, W/ \int i=0,j=0,k=0,flag=0,translation=0;% ^1 p& T! `' X
    for(i=0; i<(*storage).proNum; i++)2 z7 A" H% i) E; [, p
    {$ I% l/ ]1 T' A
    if((*storage).p.comeingTime>MAX_COMING_TIME)# ?0 L1 z" m7 b# P! \4 _8 L
    MAX_COMING_TIME = (*storage).p.comeingTime;, A, L4 f1 M/ I/ b2 D
    }6 s$ g- d) z7 M" }+ T. j
    if(pos>=0)
    2 a0 ]. b: S. B$ R1 S  B{8 _% N$ V3 s9 Z+ e  r- w/ i
    for(i=0; i<(*storage).proNum; i++)
    ) k- A$ H0 v3 ^5 y( V% f{
    & p, n0 z0 v9 w9 I7 J5 sif((*storage).p.askMemory <= *spareMemory)' W$ a4 y9 {. f8 ?( g% ^% t( ^
    {
    1 Q; E$ B/ X4 G! jj=pos;
    + v7 K+ q9 V/ H" }9 v- m% h(*memory).p[j].askMemory = (*storage).p.askMemory;, A; i! e3 c; v6 q& D: T3 b, a% d
    (*memory).p[j].comeingTime = (*storage).p.comeingTime;9 Q1 a, f/ C) e2 K" ]
    (*memory).p[j].computeNum = (*storage).p.computeNum;
    3 Z7 _3 `$ \9 s7 Q* L+ l(*memory).p[j].ioNum = (*storage).p.ioNum;( L& h8 F9 b7 m9 m& Z
    (*memory).p[j].processID = (*storage).p.processID;% ^0 I% v3 z7 p- x
    (*memory).p[j].flag = (*storage).p.flag;; o* R, G+ v. R$ @& e
    (*memory).p[j].ioTime = (*storage).p.ioTime;
    - m# k4 ]7 \# X; G5 u$ H7 V9 V8 x" L(*memory).p[j].computeTime = (*storage).p.computeTime;
    % H1 a, d1 }  m& G% F; `(*memory).p[j].runningTime = systemClock;3 W) i' b  [% t0 T9 T
    (*memory).p[j].produceTime = (*storage).p.produceTime;& D: ^/ N* ]; F- o
    for(k=0; k<(*memory).p[j].ioNum; k++)
    4 i: J* b. W/ R2 C9 T& |4 j: W+ U(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];
    7 v0 ^. W# H" jfor(k=0; k<(*memory).p[j].computeNum; k++)
    & T. _9 k9 S: ^: W(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];- D) d+ E, m' K
    *spareMemory = *spareMemory - (*memory).p[j].askMemory;; q! G1 p# c  U) ~/ O1 m
    produce_one_task(storage,i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程' p' P2 X3 c0 s7 e" P' \9 F
    MAX_COMING_TIME = (*storage).p.comeingTime;  J: B+ M  G7 \! i& l4 Y
    translation=1;7 Z  O9 L& t* J
    break;
    0 R4 o- f9 k0 _8 X/ [}
    + u$ O' [! t  d( l5 W2 \}
    & r- r) Y/ C2 E: g}$ E3 r# g- e0 h
    else
    ' {. H5 o& a8 p9 i7 Q' }{' T+ J0 w( j; X7 c2 `
    while(1)
    $ h6 {9 A8 d% d$ H* X7 C) P1 e{7 `. g. v' c/ F* L2 [: |1 |
    flag=0;2 Z! z5 j) }0 M
    for(i=0; i<(*storage).proNum; i++)* l. e+ v: a9 o7 `8 Q. y
    {
    9 H7 h6 t3 B1 l& d1 d3 ?/ vif((*storage).p.askMemory <= *spareMemory)
    ; o4 i+ {2 @  i7 w{
    8 S/ t2 S. Y0 {7 C! o2 m* Mj=(*memory).proNum;9 X+ b) |9 H( Y5 A6 t6 x8 X3 D6 g
    (*memory).p[j].askMemory = (*storage).p.askMemory;
    ( E9 P0 ~' O4 m6 k- w+ M' k(*memory).p[j].comeingTime = (*storage).p.comeingTime;
    " f0 i/ W0 b# [& S6 a* [9 H& v1 u(*memory).p[j].computeNum = (*storage).p.computeNum;
    0 Z! }( w1 U1 [$ t+ D' y(*memory).p[j].ioNum = (*storage).p.ioNum;
    . s! B& e. Z; V(*memory).p[j].processID = (*storage).p.processID;
    2 G: C9 f/ `1 D* H" q+ I4 q(*memory).p[j].flag = (*storage).p.flag;
    ' K% D- Z% M+ ^: M7 p* Y(*memory).p[j].ioTime = (*storage).p.ioTime;
    4 S9 k2 d& D$ a(*memory).p[j].computeTime = (*storage).p.computeTime;1 O6 t$ u2 `0 k) O- I0 z8 }4 P
    (*memory).p[j].runningTime = systemClock;
    & g& M2 `+ V2 L( z/ p" U(*memory).p[j].produceTime = (*storage).p.produceTime;
    : T; A2 a9 b. [  w$ Yfor(k=0; k<(*memory).p[j].ioNum; k++)
      K* a, M: _* v0 f( q! z8 H(*memory).p[j].ioClock[k] = (*storage).p.ioClock[k];1 _5 n* ?$ ?6 x! w, [
    for(k=0; k<(*memory).p[j].computeNum; k++)
    - c6 \1 k% u% J! q' m; ?/ @(*memory).p[j].computeClock[k] = (*storage).p.computeClock[k];" A( k! u+ K/ H9 m) Q' o; i
    (*memory).proNum++;
    8 C' C, q2 u0 W1 i*spareMemory = *spareMemory - (*memory).p[j].askMemory;0 ], ^& D# O$ U) Q+ T, L" C: F
    produce_one_task(&(*storage),i,ID_FIFO++);           //调入一个进程后,再在进程池中新生成一个进程
    0 ~' C! x' b' s- F/ l; G# HMAX_COMING_TIME = (*storage).p.comeingTime;
    - [( S- P9 f0 V. J' s6 Vflag=1;7 {1 r# q$ V. j$ i4 U8 c2 N
    translation=1;. p2 T6 q( M) {4 J; B! }, K- l
    }0 F3 U, j; o- t/ P2 d
    }& n7 q; _/ a4 F  d3 R: b
    if(flag == 0)
    2 i3 ~& `# `" q$ p+ c% J/ A, Qbreak;. h9 k7 K5 o8 n) |% m8 A
    }
    $ Q1 C' B" K9 R% a% Q3 w+ g}
    * q) J' {/ M8 \4 Z1 K7 O. _return translation;$ [- Z/ @$ L8 s6 o9 W9 \
    }
    , K- R. ?  Y1 g) a0 Y4 Pint FIFO(processPool *storage,processPool* memory,int * spareMemory,PCI ** save,int draw)% J! x7 K! J( A0 Q5 y
    {
    $ F3 M) S% G% L7 j6 A) o- Estatic int compute=0,waitio=0,change=0,flag=0,flagiocpt=0;
    ( Q  }6 @: A$ x$ @# v- H9 lstatic int computeLast=0,waitioLast=0,changeLast=0;
    $ ~$ R1 Y/ C! f/ Hint i=0;
      e/ r$ f0 \) s* T9 |! \$ z5 |if(draw==1): L1 w$ s% g5 R  w4 ~* {; Z
    {' v) ~6 Y) J# K7 ]& |; S
    //printf("%d %d %d\n",compute-computeLast,waitio-waitioLast,change-changeLast);/ m% J/ p/ i2 b3 k6 u2 A5 O' B
    drawPerformance_FIFO(0,0,MAX_MEMORY-(*spareMemory),compute-computeLast,waitio-waitioLast,change-changeLast);$ X8 ]2 L  y0 Q% e

    6 h5 O% m) A* J1 d; r  I0 T* R- O/ {' }: c8 h8 i/ F& }4 c
    computeLast=compute;8 E1 Y6 E* a4 E9 a1 V
    waitioLast=waitio;
    ! H. e7 o/ b& e$ N2 `" M" IchangeLast=change;! @6 t% j% h4 U; X/ Z: q* a
    }
    6 [) d" x6 S( ~6 m# u! O& e/ Dif(flag==1)    p5 {  k  p; }( S: u
    {, c& P# ]: {1 e5 _: Q; s
    if((*memory).p[0].ioNum>0||(*memory).p[0].computeNum>0)  //task is not completed" ~9 {6 F9 k; f# w
    {5 r1 S: l9 H8 J/ i
    if(flagiocpt==0)   // implement compute
    - S4 h% b* y' x% E$ ?9 r  F{3 e, A. q6 n: y6 }; B! o5 p
    i=(*memory).p[0].computeNum;0 o; u' V: A6 W
    if(i>0 && (*memory).p[0].computeClock[i-1]>0)
    " |8 E& B, m- D! c{* c1 U6 N. p3 h9 a' W/ T1 v
    if(--((*memory).p[0].computeClock[i-1])<=0)// ome compute tase is completed
    . e: G9 m! n" ^9 V: p# K3 ~{# p/ ~; I* f! @, N% M+ U' O
    flagiocpt = 1;
    $ ]) P3 c* P$ Q. W(*memory).p[0].computeNum--;/ _+ Y5 ^2 B" {! O& z
    change += exchange_IO_Compute;
    ) i& y$ P6 E3 s1 s* Pcompute++;
    # ?6 C: j1 P0 ^/ k- Q}. G  a/ v9 @3 a3 m' Z8 @9 E; L) Z
    else
    7 K9 b' Q( u. b3 z2 ucompute++;- }: c' o  Z/ a. A! ]7 r1 M

    & d6 G- l' Y- v: ]+ m6 C# D}
    ; y% j0 W+ \. F# P: Uelse4 B" W' v5 b$ Z2 G4 n
    flagiocpt = 1;
    7 J, M& \) i- F1 P}
    ! y4 M1 ~" F" k6 L7 q! felse  //wait io3 [( c" E' c* F3 m
    {  @) _7 }, a# _( H2 N
    i=(*memory).p[0].ioNum;
    - Z2 o6 g$ s, X, }( g/ c. K8 wif(i>0 && (*memory).p[0].ioClock[i-1]>0)
    2 s! R  k# g" S3 Z6 k$ i5 Z2 z{2 e8 E) v& k4 m2 P  E. b
    if(--((*memory).p[0].ioClock[i-1])<=0)// one io tase is completed8 u5 w5 U& \( W+ I( n( L
    {+ C& S' A8 K# C3 Z5 H7 ^- t! `& V
    flagiocpt = 0;6 L! Y, m, b) z+ W2 n8 }/ Z: X
    (*memory).p[0].ioNum--;! e7 L$ i% t; s
    change += exchange_IO_Compute;/ J3 L+ ?0 [6 z" i6 e4 s& ?
    waitio++;
    2 O% [9 j5 V; p}
    * I* _1 \: W% E6 l9 _; yelse
    ! ?* C8 A) q% c% N+ j6 H6 D$ uwaitio++;8 X# K5 X5 [) I$ w

    ' G7 J0 B1 [. c$ I# s* N7 v" Y8 G}/ A* |. b5 K2 J
    else1 F; `% G' g$ V. x) O
    flagiocpt = 0;8 X- e, t4 P4 @' K% c" T
    }3 M5 s' V  h8 k& C. N" t
    }
    ; M" ^" j& }* P& Velse  //task is completed: v! U7 u+ Z: B# Z9 y& S  x: v
    {' ~; ~1 V4 n/ S& B  o( T
    (*save) = (PCI*)malloc(sizeof(PCI));6 W! N+ I; @4 r: s3 `# g" K
    (*save)->next = NULL;
    + e0 K& q4 X0 c) g3 M* @/ M5 j( {       (*save)->processID = (*memory).p[0].processID;0 c8 `4 ^, J6 E4 ~/ P$ B7 o
    (*save)->comeingTime = (*memory).p[0].produceTime;; C& A% Y+ A+ n6 y
    (*save)->askMemory = (*memory).p[0].askMemory;
    / Q$ P( L/ I  z: o(*save)->compute = compute;4 B& e( T+ E* e" N# F' U: M# `
    (*save)->waitio = waitio;) O/ _$ I# y# U# t! K
    (*save)->exchange = change;
    ) c7 G0 V: r+ t; G# M* n(*save)->completedTime = systemClock-(*save)->comeingTime;
    : J% u. s" P5 V' `: D3 k2 Y(*save)->runningTime = (*memory).p[0].runningTime;& x$ R5 N4 r4 {- b, ?/ i
    (*save)->completedTime = systemClock;
    - Y- V4 j7 b0 @2 G" u0 R, W//*spareMemory = MAX_MEMORY;. |% h% O% ~7 T/ }: w# u
    free((*memory).p[0].ioClock);- A3 y* j9 u% |) r3 h$ t! A
    free((*memory).p[0].computeClock);
    + N/ C7 @7 K6 B+ |% V9 rfree((*memory).p);
    : D  W( I3 p; A# `5 Sflag=0;. q! r5 G0 F0 q$ g  v2 ?
    compute=waitio=change=0;1 H; Y6 r% v/ W% A
    computeLast=waitioLast=changeLast=0;6 g( x- Q) I/ x3 T2 s
    return task_completed;( v; g) P, R3 n& X. W0 E2 X
    }
    0 N( f, s8 b+ D1 d9 a}
    # M, }8 D) z& r7 v$ b& velse         
    2 [5 L, w& G5 }# s# P* m% L( H{* q3 {* b2 v: G) k3 s
    FIFO_storage_to_memory(&(*storage),&(*memory),&(*spareMemory));: r. E7 O5 f  F9 A3 }1 P
    change += exchange_process;
    / N2 m, z, v8 [2 ~/ f6 O% g5 M//*spareMemory -= (*memory).p[0].askMemory;
    % W% q( Z& W# \; K1 A& x# Mflag=1;- T+ q! K" D8 t% m+ I( X3 t$ U& Z
    //showProcessInf(*memory);
    9 h' F  A3 W' w) areturn task_not_completed;, l9 l: N1 I  [: x# n8 D3 w& W" r
    }
    7 F" s+ v4 k" Vreturn task_not_completed;
    / p) P. f7 N! N8 F}
    " S' ~7 p2 v" }6 v8 f  H2 h  T( Tint FIFO_storage_to_memory(processPool *storage,processPool* memory,int * spareMemory)1 Y, o3 |  H. M/ x7 R  F
    {2 V. L6 S2 r! A; a- n4 K% b3 K
    int i=0,j=0,k=0;
    : r  a, r9 i+ I$ |MAX_COMING_TIME = (*storage).p[initProcessNum-1].comeingTime;$ t3 B9 u7 n9 c
    (*memory).p = (process*)malloc(initProcessNum*sizeof(process));1 @  j6 s, W: f% M' D
    memory->proNum = 1;
    % b  P- P/ ]7 R7 G9 t, l3 g. {; J: Ffor(i=0; i<initProcessNum; i++)+ R3 ?$ O9 i, S6 R8 l1 ^
    {4 @+ L, V/ y9 L. ^3 k& s0 |8 o: M
    if((*storage).p.askMemory <= *spareMemory)  p7 b# C" I; Q6 P6 I+ K! Y3 b
    {
    7 c7 \; G. `7 H  x# ?5 K2 @(*memory).p[0].askMemory = (*storage).p.askMemory;" L* J5 K& ~, c0 d
    (*memory).p[0].comeingTime = (*storage).p.comeingTime;
    ( _) f$ o% l$ K/ o% v0 C(*memory).p[0].computeNum = (*storage).p.computeNum;
    4 ]; }! N5 U! b  C' M2 d/ f(*memory).p[0].ioNum = (*storage).p.ioNum;
    7 J) p" t: k% A# b* P8 M(*memory).p[0].processID = (*storage).p.processID;( }# J  v; M) W1 N
    (*memory).p[0].flag = (*storage).p.flag;# y" y( X4 z2 k' B3 ?' p0 ]
    (*memory).p[0].ioTime = (*storage).p.ioTime;& D8 F) {1 g6 N( @' k
    (*memory).p[0].computeTime = (*storage).p.computeTime;
    6 M; t" z% W' V, q% r# e! I' i$ Q) c(*memory).p[0].produceTime = (*storage).p.produceTime;
    ( ~0 K6 P3 \9 J, \(*memory).p[0].runningTime = systemClock;6 L1 K9 \1 F, ?+ i) d! \
    (*memory).p[0].computeClock = (int*)malloc((*memory).p[0].computeNum*sizeof(int));( M" }; E# T" l/ u1 I. P
    (*memory).p[0].ioClock = (int*)malloc((*memory).p[0].ioNum*sizeof(int));
    ( ~* I( ?: \; \! c4 X9 _for(k=0; k<(*memory).p[0].ioNum; k++)
    $ K0 M) p1 `0 {(*memory).p[0].ioClock[k] = (*storage).p.ioClock[k];- H6 _, Z% d( a& m
    for(k=0; k<(*memory).p[0].computeNum; k++)
    7 p+ e2 f8 R! `9 _" D(*memory).p[0].computeClock[k] = (*storage).p.computeClock[k];% ?( ]/ r; G9 a& J& `
    break;
    & q. b* z4 I- x/ _; q}
    8 x9 Z/ A0 f4 S4 H! S! F}9 G1 d% E( j9 `2 j" X. j
    if(i<initProcessNum)  //调用一个作业进入内存后,并再生成一个作业等待调入
    ' l" {$ }9 P) R# I4 y/ L" N4 g- e{4 _5 a4 `* I5 k8 r; t: |
    produce_one_task(storage,i,ID_FIFO++);
    ' t' K% o( a2 b/ pMAX_COMING_TIME = (*storage).p.comeingTime;
    # @0 m3 H; C" y: F$ nsort_by_comingtime(storage,i);
    ; U: W1 K; Q" s  ]2 a) e# E}
    + n* X2 K% Q3 Z. f7 }7 treturn 0;
    + |& D% }8 i; z; Q: r) V}
    ; ?; t# v$ {/ Yint sort_by_comingtime(processPool * p,int pos)
    6 D2 P# H' K/ j  x{: e: s' k( M" i9 T
    int i=0,j=0;
    ; g" S! ?: ^5 U6 Zprocess temp;/ J9 w& \5 j: V1 U+ `* f' c7 E
    if(pos<0)
    ; d* v* w+ }% o: j. H) V9 f) g( M{1 u3 [7 ^/ r% @: Y
    for(i=0; i<initProcessNum; i++)
    - `% S! [6 r' c& y: \for(j=0; j+1<initProcessNum-i; j++)
    0 k6 G* |1 B* c6 P* ]$ n6 P# d& F1 e{
    0 E/ P; n/ }' w/ U% h6 gif((*p).p[j].comeingTime>(*p).p[j+1].comeingTime)' G! o7 c/ J/ Z8 v- D
    {
      a* k. h- ]9 a( mtemp = (*p).p[j];2 k6 ?9 S3 [( i# y' b
    (*p).p[j] = (*p).p[j+1];
    , Q) [9 f0 w0 y* ]& ]8 J; H(*p).p[j+1] = temp;5 l8 [0 E$ E& z7 G9 L
    }! [0 e" D6 m$ F" W' j8 S$ P6 A
    }
    , U0 W1 V- g9 S- m$ a& g}
    / L4 e; M$ K2 g) j* k3 l' R* _else if(pos<initProcessNum)
    & K* M8 j* m5 T7 g! h5 O. j$ j{. F1 J9 f+ g5 V3 G% z
    for(i=pos-1; i>=0 && (*p).p.comeingTime > (*p).p[i+1].comeingTime; i--)
    : L2 h4 W0 z. n1 P0 G& ?{
    8 }, H9 L( @  O" t/ t( etemp = (*p).p;
    2 Q5 V# t. X5 I! E/ p(*p).p = (*p).p[i+1];
    ( I: i5 e' G% b* Z(*p).p[i+1] = temp;: v* y3 c3 A! T" ?# N
    }
    " [0 u! N! g2 u' y' H% t# afor(i=pos+1; i<initProcessNum && (*p).p[i-1].comeingTime > (*p).p.comeingTime; i++)
    7 T% x8 b1 x; s5 E{( w, B1 F3 b+ t0 s1 d# W" q5 G* m
    temp = (*p).p[i-1];, F- N# v8 d# ~: [
    (*p).p[i-1] = (*p).p;
    5 T! [! w% H6 a) E6 p1 m8 y" E(*p).p = temp;
    4 Z9 n# F+ T+ T}9 F9 I- |7 ^3 M5 f4 `
    }  X3 ~; h( @! F( {
    else
    6 |3 F/ I  U' `' N% c: w& Uprintf("position eror\n");
    # S+ `3 V7 L4 d$ n/ Z7 Ereturn 0;& k1 B  z3 D7 [
    }
    & |; @$ s$ L( ^) E: ]: P3 k3 Wint InitPool(processPool * p)& X8 m: u6 u# U: Y
    {
    4 E0 l9 P& m" ]4 Z+ A+ ?! Sint i=0;
    % X3 A6 U# z1 `" D(*p).proNum = initProcessNum;+ j4 q; g% t9 x' n
    (*p).p = (process*)malloc(initProcessNum*sizeof(process));
    5 t  G/ s9 Z. T" a, f2 Pfor(i=0; i<initProcessNum; i++)                                        //init process information/ j! h/ ]# [! X) J$ [% T: ]/ r2 W
    {1 c* ^$ ]" Q6 i6 n
    (*p).p.computeClock = (int*)malloc(initclocknum*sizeof(int));: I" ]6 P& \; s( ^% P
    (*p).p.ioClock = (int*)malloc(initclocknum*sizeof(int));
    ( `- d( D- H/ x3 g; B7 [5 _produce_one_task(&(*p),i,ID_FIFO++);8 B2 D% `7 f( m+ L; ?/ z& o
    }0 ^& F6 d! {) ^# q- ?
    return 0;
    5 v' [  Y; Y- i( T}+ e) c2 b1 i! ?; }5 W# x6 q
    int produce_one_task(processPool * p,int i,int id)" B1 b, [; d7 w4 M' j
    {
    - h: N, h5 E$ T8 W, H* _int time=MAX_COMING_TIME,j=0,totallTime=0;
      N: K$ G  b& r0 P(*p).p.processID = initProcessID+id;           * A9 \9 p2 U: f
    (*p).p.comeingTime = time+rand()%(MAXProcessRunTime/5);0 v6 _% Y9 v' B$ e) e
    (*p).p.produceTime = systemClock;& r* r. R9 W- R. h( s* Y1 l
    (*p).p.ioNum = rand()%4+20;                                        //IO number setting to 2--5;
    & T# ^- M3 A3 W* ^(*p).p.computeNum = rand()%4+30;                                   //computNum setting to 3--6;7 t/ `' T5 t% {# j- t7 I
    totallTime = (*p).p.computeNum  + (*p).p.ioNum;
    4 h9 J: I' R1 X0 w- G9 F2 {(*p).p.computeTime=0;; f" Y7 p& {2 _& R- B
    for(j=0; j<(*p).p.computeNum; j++)" r, l" h2 O$ q- C0 O
    {
    . L* ^; P, L/ d2 e(*p).p.computeClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;
    6 P+ {2 K$ e  G, |* W0 g$ L(*p).p.computeTime += (*p).p.computeClock[j];9 j/ n9 m& S0 l5 @0 `' J: |
    }  S8 [$ L+ \+ I
    (*p).p.ioTime=0;( T5 y: Z3 l2 I( ~% G
    for(j=0; j<(*p).p.ioNum; j++)0 r/ ]1 q: L% O% ^
    {
    7 R. |+ S0 O4 Y$ j! {1 r0 ^(*p).p.ioClock[j]=rand()%(MAXProcessRunTime/totallTime)+1;  C1 h3 n3 `, T3 {- I
    (*p).p.ioTime += (*p).p.ioClock[j];
    $ p& g- {6 a0 L+ L}7 c! u; D6 }+ Y8 a8 M
    (*p).p.askMemory = rand()%(MAX_MEMORY/4);0 {2 ]# e8 ?) D9 n$ I, B
    (*p).p.flag = ready;
    2 y# @* U" d1 sreturn 0;
    & ?& Q# N4 N0 j- Q. f8 u) f( R}
    ' p# e, Z; X* O5 w: Mint showProcessInf(processPool p)* g0 b) n- n9 ?, Z7 o' G3 \4 T
    {
    " `% d8 V: ~3 O7 B* M/ [/ A) Dint i=0,j=0;! U+ V. {3 ^+ R6 q
    for(i=0;i<p.proNum;i++)* n, t) @- s% b* ~
    {4 w2 y% A8 a8 F1 z1 Z
    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
    # a- S6 T( s% }* j,p.p.askMemory);/ q5 M' z" @* N9 B  B
    for(j=0;j<p.p.ioNum;j++)
    : [0 r% m* u4 E" [3 y{  q- V0 Y( V! Q* @3 {# C* w+ k0 f
    printf("%d ",p.p.ioClock[j]);
    ' l6 w! |+ A% x, c7 e}' q7 P2 q  g& H% @9 E3 U2 O' g
    printf("\n");% q9 R8 R1 w7 _8 r1 e! m  c. n
    for( j=0;j<p.p.computeNum;j++)! H9 B$ d6 m7 c$ Z# W
    {4 s& D  X: B4 i  v
    printf("%d ",p.p.computeClock[j]);* O$ }# e; P) d  H, @6 n% ]
    }+ b1 {8 D# I' }
    printf("\n");5 q2 g$ M) r' A5 j6 ]* P* ^- {, |
    }6 j! \. R+ m1 ?- `( v
    return 0;
    4 `7 U  `! @' b8 H# N( s. i}
    " g' @; x5 l. R4 m8 c————————————————
    $ `6 X% F1 T' ]- R/ v版权声明:本文为CSDN博主「wang_dong001」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
      T" S9 C- ]- O1 A& S原文链接:https://blog.csdn.net/wang_dong001/article/details/47843519
    : y* r  m5 i- z1 p  R6 M8 g4 b; R
    # Y0 W0 V7 F, z$ E( U6 X: s; F7 ], I6 K. H# s
    zan
    转播转播0 分享淘帖0 分享分享0 收藏收藏0 支持支持0 反对反对0 微信微信
    您需要登录后才可以回帖 登录 | 注册地址

    qq
    收缩
    • 电话咨询

    • 04714969085
    fastpost

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

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

    蒙公网安备 15010502000194号

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

    GMT+8, 2026-4-19 21:11 , Processed in 0.479519 second(s), 51 queries .

    回顶部