模拟进程调度(delphi写的)

2008-04-09 04:21:09来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls, ExtCtrls, Grids, Calendar, Gauges, jpeg;

type
TForm1 = class(TForm)
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape6: TShape;
Shape7: TShape;
Shape8: TShape;
Shape9: TShape;
Shape10: TShape;
Shape11: TShape;
Shape12: TShape;
StaticText1: TStaticText;
StaticText2: TStaticText;
StaticText3: TStaticText;
StaticText4: TStaticText;
StaticText5: TStaticText;
StaticText6: TStaticText;
StaticText7: TStaticText;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Edit10: TEdit;
Edit11: TEdit;
Edit12: TEdit;
Edit13: TEdit;
Edit14: TEdit;
Edit15: TEdit;
Edit16: TEdit;
Edit17: TEdit;
Edit18: TEdit;
Edit19: TEdit;
Edit20: TEdit;
Edit21: TEdit;
Edit22: TEdit;
Edit23: TEdit;
Edit24: TEdit;
Edit25: TEdit;
Edit26: TEdit;
Edit27: TEdit;
Edit28: TEdit;
Button1: TButton;
Edit29: TEdit;
Timer1: TTimer;
Timer2: TTimer;
ListBox1: TListBox;
Gauge1: TGauge;
Gauge2: TGauge;
Gauge3: TGauge;
Gauge4: TGauge;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit30: TEdit;
Image1: TImage;
Label5: TLabel;
Button2: TButton;
Timer3: TTimer;
Button4: TButton;
Button5: TButton;
Button3: TButton;
Label6: TLabel;
Button6: TButton;
Timer4: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Timer2Timer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer3Timer(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Timer4Timer(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;

type

pcb=record
name:string;
arv:integer;
svt:integer;
stt:integer;
fnt:integer;
zzsj:integer;
dqsj:real;
fnhflg:bool;
sttflg:bool;
end;
pcbx=array[1..4]of pcb;
var
nullflag:bool=false;
forword:bool=false;
subtemp:integer=0;
j:integer=1;
openflg:bool=true;
tempid:integer=1;
fnhnum:integer=0;
pcbnum:integer=0;
ntp:bool=false;
tempok:bool=false;
flag:bool=false;
Form1: TForm1;
showt:tdatetime;
count:integer=-1;
pro:integer=0;
//pcbnum:integer=1;
writeflg:integer=0;
pcbs:pcbx;
ho,min,sec,msec:word;
method:integer=1;
implementation

uses Unit3;

{$R *.dfm}


procedure TForm1.Timer1Timer(Sender: TObject);
var
w:integer;
f:integer;
begin
if flag=true and nullflag=false then // 改 false 远为 true
begin
count:=count 1;
listbox1.Items.Add(inttostr(count));

for w:=1 to 4 do
begin
if pcbs[w].arv=count then
begin
timer2.Enabled:=false;
pcbnum:=pcbnum 1;
timer2.Enabled:=true;
end;
end;
if openflg=false then
begin
if (count=pcbs[tempid].stt pcbs[tempid].svt) then
begin
pcbs[tempid].fnhflg:=true;

fnhnum:=fnhnum 1;
if fnhnum=4 then
begin
flag:=false;
pcbs[1].fnt:=pcbs[1].stt pcbs[1].svt;
pcbs[1].zzsj:=pcbs[1].fnt-pcbs[1].arv;
pcbs[1].dqsj:=pcbs[1].zzsj/(pcbs[1].fnt-pcbs[1].stt);
pcbs[2].fnt:=pcbs[2].stt pcbs[2].svt;
pcbs[2].zzsj:=pcbs[2].fnt-pcbs[2].arv;
pcbs[2].dqsj:=pcbs[2].zzsj/(pcbs[2].fnt-pcbs[2].stt);
pcbs[3].fnt:=pcbs[3].stt pcbs[3].svt;
pcbs[3].zzsj:=pcbs[3].fnt-pcbs[3].arv;
pcbs[3].dqsj:=pcbs[3].zzsj/(pcbs[3].fnt-pcbs[3].stt);
pcbs[4].fnt:=pcbs[4].stt pcbs[4].svt;
pcbs[4].zzsj:=pcbs[4].fnt-pcbs[4].arv;
pcbs[4].dqsj:=pcbs[4].zzsj/(pcbs[4].fnt-pcbs[4].stt);
edit13.Text:=inttostr(pcbs[1].stt);
edit14.Text:=inttostr(pcbs[1].stt pcbs[1].svt);
edit15.Text:=inttostr(pcbs[1].zzsj);
edit16.Text:=floattostr(pcbs[1].dqsj);
edit17.Text:=inttostr(pcbs[2].stt);
edit18.Text:=inttostr(pcbs[2].stt pcbs[2].svt);
edit19.Text:=inttostr(pcbs[2].zzsj);
edit20.Text:=floattostr(pcbs[2].dqsj);
edit21.Text:=inttostr(pcbs[3].stt);
edit22.Text:=inttostr(pcbs[3].stt pcbs[3].svt);

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:[Delphi]根据 高斯正态分布随机函数RandG发生的数据 绘正态分布

下一篇:制作一个简单的setup