当前位置:网站首页>模拟进程调度
模拟进程调度
2022-06-27 15:45:00 【51CTO】
模拟进程调度,至少实现3种调度算法,
调度算法:先来先服务,短作业优先,优先级+时间片轮转
输出进程调度顺序 所有进程调度完,输出平均等待时间和平均带权周转时间
$$ 平均带权周转时间 = \frac{1}{作业个数} \cdot \sum\frac{作业完成时刻 - 作业到达时刻}{服务时间} $$ 在指定文件编写代码(可以自行在文件中添加函数等):
在文件exp8_process_schedule/process_schedule.h定义PCB、进程创建、调度等 ;
在文件process_schedule.c实现进程调度模拟操作 ;
测试文件test_data_5.csv和test_data_200.csv(实际测试,可以先取用进程少的测试test_data_5.csv,确保结果与逻辑结果一致无误,再用进程多的进行测试),格式如下:

int main() {
int n, t = 1;
int proNum, choice;
PCB pro[MAXSIZE], temp_pro[MAXSIZE];
printf("\n\n\t\t\t\t\t<<-------------进程初始化----------——>>\n");
proNum = init_process(test_data1, pro);
for (int i = 0; i < proNum; i++)
{
char tmp[256] = { 0 };
printf("\n%s,%d,%d,%d\n", pro[i].name, pro[i].arrivetime, pro[i].running_time ,pro[i].priority);
}
printf("proNum %d\n", proNum);
while (t) {
menu();
memcpy(temp_pro, pro, (sizeof(pro) / sizeof(pro[0])) * sizeof(PCB));
scanf("%d", &n);
while (n <= 0 || n > 5) {
printf("\t\t\t指令不正确,请重新输入指令: ");
scanf("%d", &n);
}
switch (n) {
case 1: {
fifo(temp_pro, proNum);
break;
}
case 2: {
sjf(temp_pro, proNum);
break;
}
case 3: {
hpf(temp_pro, proNum);
break;
}
case 4: {
rr(temp_pro, proNum);
break;
}
case 5: {
t = 0;
break;
}
}
getchar();
printf("\n\t按任意键继续.......");
getchar();
system("cls");
}
system("cls");
printf("\n\n\t\t\t\t\t您已成功退出系统 q==610098308\n");
return EXIT_SUCCESS;;
}
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
代码整理中;
边栏推荐
- Principle Comparison and analysis of mechanical hard disk and SSD solid state disk
- The array of C language is a parameter to pass a pointer
- What should the ultimate LAN transmission experience be like
- # Cesium实现卫星在轨绕行
- Expert: those who let you go to a good school with a low score are all Scams
- 开源二三事|ShardingSphere 与 Database Mesh 之间不得不说的那些事
- localDateTime类型的时间(2019-11-19T15:16:17) 用oracle的时间范围查询
- What is the level 3 password complexity of ISO? How often is it replaced?
- What are the password requirements for waiting insurance 2.0? What are the legal bases?
- Source NAT address translation and server mapping web page configuration of firewall Foundation
猜你喜欢
![[pygame Games] ce jeu](/img/3c/e573106ec91441a554cba18d5b2253.png)
[pygame Games] ce jeu "eat Everything" est fantastique? Tu manges tout? (avec code source gratuit)

Jialichuang EDA professional edition all offline client release

一场分销裂变活动,不止是发发朋友圈这么简单!

Open source 23 things shardingsphere and database mesh have to say

3.2 multiple condition judgment

鸿蒙发力!HDD杭州站·线下沙龙邀您共建生态
MySQL中符号@的作用
The role of the symbol @ in MySQL

开源二三事|ShardingSphere 与 Database Mesh 之间不得不说的那些事

【Pygame小游戏】这款“吃掉一切”游戏简直奇葩了?通通都吃掉嘛?(附源码免费领)
随机推荐
鴻蒙發力!HDD杭州站·線下沙龍邀您共建生態
LeetCode每日一练(两数之和)
Distributed session solution
关于VS2019C#如何建立登陆界面输入的用户名和密码需与Access数据库的记录相匹配
Vulnerability recurrence ----- 34. Yapi remote command execution vulnerability
华为云DevCloud重磅发布四大新能力,创下国内两项第一
[pygame Games] ce jeu "eat Everything" est fantastique? Tu manges tout? (avec code source gratuit)
目前PolarDB-X是不支持数据库自制服务DAS么?
【Pygame小遊戲】這款“吃掉一切”遊戲簡直奇葩了?通通都吃掉嘛?(附源碼免費領)
分布式Session解决方案
ORM表关系及操作
鸿蒙发力!HDD杭州站·线下沙龙邀您共建生态
Bit. Store: long bear market, stable stacking products may become the main theme
特殊函数计算器
P. Simple application of a.r.a method in Siyuan (friendly testing)
A large number of missing anchor text
National food safety risk assessment center: do not blindly and unilaterally pursue "zero addition" and "pure natural" food
开源二三事|ShardingSphere 与 Database Mesh 之间不得不说的那些事
#yyds干货盘点# 解决剑指offer:二叉树中和为某一值的路径(三)
Mihayou sued Minmetals trust, which was exposed to product thunderstorms