代写 CPU scheduling with Multilevel Feedback Queue
Page 1 of 2
Programming Assignment Two
Write a program to implement CPU scheduling with Multilevel Feedback Queue. Please refer to
slides 28-29 of Lecture 5 ch5_CPU_Scheduling.pdf for Multilevel Feedback Queue and its example.
At the beginning of all .c and .h files, put the comment including the information: author, student
id, date and file purpose.
Task 1
Write a program that include three queues, Q1, Q2, and Q3.
Q1, Q2 both use FCFS+RR, Q3 uses FCFS.
Q1: quantum is 4, Q2: quantum is 8.
Each process will go to Q1 first.
If a process is not finished in one quantum in Q1, it will be moved to Q2; If it is not finished in
one quantum in Q2, it will be moved to Q3 where it will be finished according to FCFS rule.
Processes in Q1 have highest priory while in Q3 have lowest priority.
In your program, you should ask the user to enter the burst time in the sequence of their arrival
(assume that they all arrive at 0 in the sequence P1, P2, P3, …, Pn). Then your program will
output the processes in the sequence they use CPU. Here are two examples:
Example 1:
================================================
Enter the number of processes to schedule: 3
Enter the burst time of P1: 17
Enter the burst time of P2: 15
Enter the burst time of P3: 7
The scheduling sequence is: P1, P2, P3, P1, P2, P3, P1, P2
================================================
Example 2:
================================================
Enter the number of processes to schedule: 2
Enter the burst time of P1: 3
Enter the burst time of P2: 10
The scheduling sequence is: P1, P2, P2
================================================
Task 2
Task 2 is like Task 1, using Multilevel feedback queue to CPU scheduling with more rules.
1) We assume that there are 5 levels of priority, indicated from 1 to 5, where 1 is the highest
priority and 5 is the lowest priority.
2) User will input the burst time and the priority for each process. There are at most 5 queues,
from Q1 to Q5, each contains processes with corresponding priority, i.e., Q1 for processes
with priority 1, Q2 for processes with priority 2, and so on.
3) The queue with priority 5 uses FCFS algorithm, while others use FCFS+RR. User inputs RR
quantum.
4) If a process cannot finish during the given quantum, its priority number will be increased by
1 and move to the end of corresponding queue.
Page 2 of 2
5) Assume that all processes arrive at time 0.
Example:
================================================
Enter the quantum for Q1, Q2, Q3, and Q4: 6 4 8 7
Enter the number of processes to schedule: 3
Enter the burst time and priority of P1: 24, 1
Enter the burst time and priority of P2: 10, 5
Enter the burst time and priority of P3: 17, 3
The scheduling sequence is: P1, P1, P3, P1, P3, P1, P2, P3
================================================
Submission
1. Given a startup program, merge main functions of task1 and task2 into one, so that users can
test both task1 and task2 in one program.
Example:
================================================
Enter a task number (1 or 2) or 0 to exit: 3
Please enter 0, 1 or 2.
Enter a task number (1 or 2) or 0 to exit: 2
Enter the quantum for Q1, Q2, Q3, and Q4: 6 4 8 7
Enter the number of processes to schedule: 3
Enter the burst time and priority of P1: 24,1
Enter the burst time and priority of P2: 10,5
Enter the burst time and priority of P3: 17,3
The scheduling sequence is: P1, P1, P3, P1, P3, P1, P2, P3
Enter a task number (1 or 2) or 0 to exit: 1
Enter the number of processes to schedule: 2
Enter the burst time of P1: 3
Enter the burst time of P2: 10
The scheduling sequence is: P1, P2, P2
Enter a task number (1 or 2) or 0 to exit: 1
Enter the number of processes to schedule: 3
Enter the burst time of P1: 17
Enter the burst time of P2: 15
Enter the burst time of P3: 7
The scheduling sequence is: P1, P2, P3, P1, P2, P3, P1, P2
Enter a task number (1 or 2) or 0 to exit: 0
Press any key to continue...
================================================
请加QQ:99515681 邮箱:99515681@qq.com WX:codehelp
- 刘诗诗亮相央视春晚《年锦》,唐风造型国色天香惊艳四座
- 3月征期定了! 截止15日!
- 矿用阻燃网线MHSYV-5-420.5:欧孚光电厂家守护神5
- 贺岁短剧《过年不回家》首发范湉湉版温情预告 讲述都市男女现状引共鸣
- 明星的宠儿“FILTERS滤镜之谜”面膜的背后究竟是什么?
- 民生银行湖州分行与华蒙星集团就亲子活动开展交流
- 汪小敏巡回演唱会开年再度开启,深圳、珠海两站火力全开
- 焕新鞋盒上线,足力健老人鞋“舒服”再升级
- 共享学术盛宴 |余萍院长受邀参加中华医学会整形外科分会第二十次全国学术交流会
- American Express揭示2024年主要旅行趋势
- 宏宇、萨米特、新明珠、金意陶、简一、科达、力泰、道氏、SITI B&T、POPPI……35家参展商发布亮点
- “硅基仿生”获评深圳知名品牌,展现深圳亮丽新名片
- 2024"庄周奖”长寿之道 中医春晚 暨全球文化科技大会
- IMCAS 2024: Galderma to Present Latest Updates From Its Unparalleled Aesthetics Portfolio Reinforcin
- 中阳县容大煤业召开2023年工作总结表彰大会
- 老板全新消存一体机亮相AWE2024,带来餐具健康进阶新选择
- 2024全国群体会在青岛召开 舒华体育携运动促健康解决方案亮相
- 精艺 | 一台便携式灵巧焊机器人构建的钢铁世界
- 著名导演孙宇新作——话剧《温哥华的女人》4月27日温哥华隆重上演
- 传承千年砚文化 抒写时代新辉煌 ——记甘肃省洮砚开发公司发展巡礼
- 长沙中医药新地标:问止中医诊所、精一书院长沙分部,正式开业
- 晶大养生茶:品味自然,养生之道
- 信美相互人寿走进清檬养老西红门养老照料中心开展志愿服务活动
- 创新大赛专访丨安联人力荣膺2023年度人力资源服务质量标杆品牌:以科技驱动人力资源行业的发展,做企业和员工值得信赖的伙伴
- instagram群发营销软件,ins解封养号采集工具等你解锁
- 余宗遥《亚洲超星团》三公舞台再现高能 对手称其沧海遗珠
- Bear Robotics获得科技巨头LG Electronics提供的6000万美元C轮融资
- Novotech Publishes Candidiasis and Rheumatoid Arthritis Clinical Trial Landscape Reports to Support
- 杨旭文主演新剧《狮城山海》开机 颠覆形象展露演员可塑性
- 驰宇陨石(神域星石)关帝古佛神牌 专家鉴定会在浙江平湖胜利召开
推荐
- 奥运冠军刘翔更新社交账号晒出近照 时隔473天更新动态! 2月20日凌晨2点,奥运冠军刘翔更新社交账号晒 资讯
- 抖音直播“新红人”进攻本地生活领域 不难看出,抖音本地生活正借由直播向本地生活 资讯
- 透过数据看城乡居民医保“含金量” 缴费标准是否合理? 记者从国家医保局了解到,近期,全国大部分地区 资讯
- 大家一起关注新疆乌什7.1级地震救援见闻 看到热气腾腾的抓饭马上就要出锅、村里大家 资讯
- 一个“江浙沪人家的孩子已经不卷学习了”的新闻引发议论纷纷 星标★ 来源:桌子的生活观(ID:zzdshg) 没 资讯
- 私域反哺公域一周带火一家店! 三四线城市奶茶品牌茶尖尖两年时间做到GMV 资讯
- 新增供热能力3200万平方米 新疆最大热电联产项目开工 昨天(26日),新疆最大的热电联产项目—&md 资讯
- 中央气象台连发四则气象灾害预警 暴雪橙色预警+冰冻橙色预警+大雾黄色预警+ 资讯
- 王自如被强制执行3383万 据中国执行信息公开网消息,近期,王自如新增一 资讯
- 产业数字化 为何需要一朵实体云? 改革开放前,国内供应链主要依靠指标拉动,其逻 资讯