1 / 69
文档名称:

操作系统实验报告.doc

格式:doc   大小:4,035KB   页数:69页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

操作系统实验报告.doc

上传人:sdnmy78 2022/7/19 文件大小:3.94 MB

下载得到文件列表

操作系统实验报告.doc

相关文档

文档介绍

文档介绍:-
. z.
-
- 5
E 13
完成顺序:ABCDE
思考
.
答:在时间片轮转算法中,时间片的大小对系统性能有很大的影响,如选择很小的时间片将有利于短作业,因为它能较快地完成,但会频繁地发生中断、进程上下文的切换,从而增加系统的开销,降低了CPU效率;反之,如选择太长的时间片,使得每个进程都能在一个时间片完成,时间片轮转算法便退化为FCFS算法,无法满足交互式用户的需求。一个较为可取的大小是,时间片略大于一次典型的交互所需要的时间。这样可使大多数进程在一个时间片完成。
实验代码:
*include ""
*include ""
*include ""
*include "cstdlib"
struct process
{
char name;
int arri_time;//arrived time
int serv_time;//servered time
int have_done_time;//已经运行时间
int done_time;//完成时间
int turn_around_time;//周转时间
float wei_turn_around_time;//带权周转时间
struct process * ne*t;
};
int time=-1;
int time_slice=1
;//时间片初始值为1
-
. z.
-
- . -zj资料-
Isempty(struct process* head)
{
if (head->ne*t==NULL)
return true;
else return false;
}
void pushline(struct process* head,struct process* rn)
{
if (rn==NULL)
return;
struct process* *;
*=head;
while (*->ne*t!=NULL)
{
*=*->ne*t;
}
*->ne*t=rn;
}
void popline(struct process* head,struct process** *)
{
if(!Isempty(head))
{
**=head->ne*t;
head->ne*t=(**)->ne*t;
(**)->ne*t=NULL;
}
}
void isnewe(struct process* head,struct process* readyline)
{
struct process* *;
if (head->ne*t==NULL)
return;
if (head->ne*t->arri_time==time&&head->ne*t!=NULL)
{
cout<<time<<" time "<<"a new process arrive"<<endl;
popline(head,&*);
pushline(readyline,*);
}
-
. z.
-
- . -zj资料-
}
void main()
{
struct process* head;
struct proce