当前位置:网站首页>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 ;
边栏推荐
- 等保三级密码复杂度是多少?多久更换一次?
- 深耕数字化,引领云原生,服务更多开发者
- How to modify / display GPIO status through ADB shell
- 利用Redis实现订单30分钟自动取消
- About how vs2019c # establishes the login interface, the user name and password entered must match the records in the access database
- Adaoracle supports multi chain distributed Oracle with wide area node quotation
- What are the password requirements for waiting insurance 2.0? What are the legal bases?
- 10 minutes to master the installation steps of MySQL
- Openssf security plan: SBOM will drive software supply chain security
- Bit. Store: long bear market, stable stacking products may become the main theme
猜你喜欢

A distribution fission activity is more than just a circle of friends!

What is RPC
![[Niuke's questions] nowcoder claims to have remembered all Fibonacci numbers between 1 and 100000. To test him, we gave him a random number N and asked him to say the nth Fibonacci number. If the nth](/img/70/fa79ba38e28c41ed28bce2ec73cd79.png)
[Niuke's questions] nowcoder claims to have remembered all Fibonacci numbers between 1 and 100000. To test him, we gave him a random number N and asked him to say the nth Fibonacci number. If the nth

Alibaba cloud liupeizi: Inspiration from cloud games - innovation on the end

LeetCode每日一练(两数之和)

【Pygame小遊戲】這款“吃掉一切”遊戲簡直奇葩了?通通都吃掉嘛?(附源碼免費領)

Mobile terminal click penetration

继手机之后 报道称三星也削减了电视等家电产品线的产量

智慧风电 | 图扑软件数字孪生风机设备,3D 可视化智能运维

Event listening mechanism
随机推荐
【Pygame小游戏】这款“吃掉一切”游戏简直奇葩了?通通都吃掉嘛?(附源码免费领)
[Niuke's questions] nowcoder claims to have remembered all Fibonacci numbers between 1 and 100000. To test him, we gave him a random number N and asked him to say the nth Fibonacci number. If the nth
Openssf security plan: SBOM will drive software supply chain security
Etcd visualization tool: kstone deployment (I), rapid deployment based on Helm
Redis Series 2: data persistence improves availability
Realize simple three-D cube automatic rotation
Adaoracle supports multi chain distributed Oracle with wide area node quotation
Google Earth Engine(GEE)——Export. image. The difference and mixing of toasset/todrive, correctly export classification sample data to asset assets and references
Slow bear market, bit Store provides stable stacking products to help you cross the bull and bear
SQL parsing practice of Pisa proxy
Yyds dry inventory solution sword finger offer: a path with a certain value in the binary tree (3)
Annual comprehensive analysis of China's audio market in 2022
Hierarchical clustering and case analysis
MySQL中符号@的作用
关于VS2019C#如何建立登陆界面输入的用户名和密码需与Access数据库的记录相匹配
[pyGame games] this "eat everything" game is really wonderful? Eat them all? (with source code for free)
3.3 one of the fixed number of cycles
A distribution fission activity is more than just a circle of friends!
National food safety risk assessment center: do not blindly and unilaterally pursue "zero addition" and "pure natural" food
Does polardb-x open source support mysql5.7?