当前位置:网站首页>Simulated process scheduling
Simulated process scheduling
2022-06-27 16:38:00 【51CTO】
Simulate process scheduling , At least achieve 3 Scheduling algorithms ,
Scheduling algorithm : First come, first served , Short job preferred , priority + Time slice rotation
Output process scheduling sequence All processes are scheduled , Output average waiting time and average weighted turnaround time
$$ Average weighted turnaround time = \frac{1}{ Number of assignments } \cdot \sum\frac{ When the homework is finished - Homework arrival time }{ Service time } $$ Write code in the specified file ( You can add functions to the file by yourself ):
In the file exp8_process_schedule/process_schedule.h Definition PCB、 Process creation 、 Scheduling, etc ;
In the file process_schedule.c Implementation of process scheduling simulation operation ;
The test file test_data_5.csv and test_data_200.csv( Actual test , You can take tests with fewer processes first test_data_5.csv, Ensure that the result is consistent with the logical result , Then test with more processes ), The format is as follows :

int main() {
int n, t = 1;
int proNum, choice;
PCB pro[MAXSIZE], temp_pro[MAXSIZE];
printf("\n\n\t\t\t\t\t<<------------- Process initialization ----------——>>\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 Incorrect instruction , Please re-enter the instruction : ");
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 Press any key to continue .......");
getchar();
system("cls");
}
system("cls");
printf("\n\n\t\t\t\t\t You have successfully exited the system 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.
Code sorting ;
边栏推荐
- 3.2 multiple condition judgment
- Deeply digitise, lead cloud nativity and serve more developers
- 等保2.0密码要求是什么?法律依据有哪些?
- logstash排除特定文件或文件夹不采集上报日志数据
- Annual comprehensive analysis of China's audio market in 2022
- Li Chuang EDA learning notes 16: array copy and array distribution
- 面试半年,上个月成功拿到阿里P7offer,全靠我啃烂了这份2020最新面试题!
- Hung - Mung! HDD Hangzhou station · salon hors ligne vous invite à construire l'écologie
- 智慧风电 | 图扑软件数字孪生风机设备,3D 可视化智能运维
- Introduce you to ldbc SNB, a powerful tool for database performance and scenario testing
猜你喜欢

Drawing for example study of flashcc

事务的四大特性

EMQ helps Qingdao Yanbo build a smart water platform

Data center table reports realize customized statistics, overtime leave summary record sharing

Detailed explanation of various GPIO input and output modes (push-pull, open drain, quasi bidirectional port)

What is RPC

Leetcode daily practice (sum of two numbers)

【牛客刷题】NowCoder号称自己已经记住了1-100000之间所有的斐波那契数。 为了考验他,我们随便出一个数n,让他说出第n个斐波那契数。如果第n个斐波那契大于6位则只取后6位。

阿里云刘珅孜:云游戏带来的启发——端上创新

Google Earth Engine(GEE)——Export. image. The difference and mixing of toasset/todrive, correctly export classification sample data to asset assets and references
随机推荐
Taishan Office Technology Lecture: the first difficulty is vertical positioning
#yyds干货盘点# 解决剑指offer:二叉树中和为某一值的路径(三)
华为云首次解读云原生2.0十大典型架构,加速构建现代化应用
等保三级密码复杂度是多少?多久更换一次?
New method of cross domain image measurement style relevance: paper interpretation and code practice
P4251 [scoi2015] small convex play matrix (still a little confused)
Bit. Store: long bear market, stable stacking products may become the main theme
事务的四大特性
Handling of difficult and miscellaneous problems during the installation and configuration of qt5.5.1 desktop version (configuring arm compilation Kit)
继手机之后 报道称三星也削减了电视等家电产品线的产量
Logstash excludes specific files or folders from collecting report log data
数据中心表格报表实现定制统计加班请假汇总记录分享
Deeply digitise, lead cloud nativity and serve more developers
A distribution fission activity is more than just a circle of friends!
Raspberry pie preliminary use
localDateTime类型的时间(2019-11-19T15:16:17) 用oracle的时间范围查询
Weekly snapshot of substrate technology 20220411
Use redis to automatically cancel orders within 30 minutes
基于 Nebula Graph 构建百亿关系知识图谱实践
MySQL中符号@的作用