当前位置:网站首页>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 ;
边栏推荐
- 鸿蒙发力!HDD杭州站·线下沙龙邀您共建生态
- Leetcode daily practice (sum of two numbers)
- 正则匹配以什么开头、以什么结尾,以非什么开头,以非什么结尾
- 鴻蒙發力!HDD杭州站·線下沙龍邀您共建生態
- Taishan Office Technology Lecture: the first difficulty is vertical positioning
- Smart wind power | Tupu software digital twin wind turbine equipment, 3D visual intelligent operation and maintenance
- Use redis to automatically cancel orders within 30 minutes
- LeetCode每日一练(主要元素)
- 分布式Session解决方案
- [pygame Games] ce jeu "eat Everything" est fantastique? Tu manges tout? (avec code source gratuit)
猜你喜欢
Event listening mechanism
Bit.Store:熊市漫漫,稳定Staking产品或成主旋律
Mihayou sued Minmetals trust, which was exposed to product thunderstorms
Popularization of MCU IO port: detailed explanation of push-pull output and open drain output
数据中心表格报表实现定制统计加班请假汇总记录分享
Weekly snapshot of substrate technology 20220411
The role of the symbol @ in MySQL
Google Earth Engine(GEE)——Export. image. The difference and mixing of toasset/todrive, correctly export classification sample data to asset assets and references
Hung - Mung! HDD Hangzhou station · salon hors ligne vous invite à construire l'écologie
【Pygame小游戏】这款“吃掉一切”游戏简直奇葩了?通通都吃掉嘛?(附源码免费领)
随机推荐
QT5.5.1桌面版安装配置过程中的疑难杂症处理(配置ARM编译套件)
2022年中国音频市场年度综合分析
C système de gestion de la charge de travail des enseignants en langues
等保2.0密码要求是什么?法律依据有哪些?
Kubernetes基础自学系列 | Ingress API讲解
Taishan Office Technology Lecture: the first difficulty is vertical positioning
深耕数字化,引领云原生,服务更多开发者
继手机之后 报道称三星也削减了电视等家电产品线的产量
Hierarchical clustering and case analysis
Cesium realizes satellite orbit detour
Relation and operation of ORM table
localDateTime类型的时间(2019-11-19T15:16:17) 用oracle的时间范围查询
Google Earth Engine(GEE)——Export. image. The difference and mixing of toasset/todrive, correctly export classification sample data to asset assets and references
Extract field year / quarter effect based on date
Unity 阴影——阴影平坠(Shadow pancaking)
Regular matching starts with what, ends with what, starts with what, and ends with what
Array represents a collection of several intervals. Please merge all overlapping intervals and return a non overlapping interval array. The array must exactly cover all the intervals in the input. 【Le
Julia constructs diagonal matrix
The two trump brand products of Langjiu are resonating in Chengdu, continuously driving the consumption wave of bottled liquor
If you want to use DMS to handle database permissions, can you only use Alibaba cloud ram accounts (Alibaba cloud RDS)