How to schedule two processes if arrival time is same
In a single CPU process scheduler, if two processes arrive at the same time in what order will they execute in case of FCFS, SJF, Non preemptive priority and RR ? Below information is given about processes:
{
"Name": "P1",
"ArrivalTime": 0,
"Brust": 10,
"Priority": 3
},
{
"Name": "P2",
"ArrivalTime": 0,
"Brust": 1,
"Priority": 1
},
{
"Name": "P3",
"ArrivalTime": 0,
"Brust": 2,
"Priority": 3
},
{
"Name": "P4",
"ArrivalTime": 0,
"Brust": 1,
"Priority": 4
},
{
"Name": "P5",
"ArrivalTime": 0,
"Brust": 5,
"Priority": 2
}
Technically speaking, 2 processes can not arrive at the exact same time. Arrival of a process means that the process (PCB) is added to a queue (any scheduling algorithm basically reads / writes / updates this queue and / or it's elements). Now, when you are modifying data structures like a queue, you will add one element at a time (in a multi-threaded environment, the processes which add elements to the queue would be synchronized). HTH.
链接地址: http://www.djcxy.com/p/84872.html上一篇: CFS调度程序:更改任务的vruntime以减慢速度
下一篇: 如果到达时间相同,如何安排两个过程