# 題目 * 林子皓 Q1:What are the criteria for executing a schedule A1: CPU utilization Throughput Turnaround time Waiting time Response time Q2:use RR to calculate the average waiting time.(time quantum = 3),and explain the order in which the processes are completed. | Process | Burst time | | -------- | -------- | |P1|10| |P2|1| |P3|2| |P4|6| |P5|3| Ans:(12+3+4+12+9)/5=8 * 楊秉沅 Q1:Please use SRTF scheduling to calculate the average waiting time. | Process | Arrival time | Burst time | | -------- | -------- | -------- | |P1|0|10| |P2|1|7| |P3|2|5| |P4|3|7| |P5|4|2| Ans:(21+7+2+12+0)/5=8.4 Q2:A scheduling algorithm assigns priority proportional to the waiting time of a process. Every process starts with priority zero (the lowest priority). The scheduler re-evaluates the process priorities every Q time units and decides the next process to schedule. Which one of the following is TRUE if the processes have no I/O operations and all arrive at time zero? (A)This algorithm is equivalent to the first-come-first-serve algorithm (B)This algorithm is equivalent to the round-robin algorithm. \(C)This algorithm is equivalent to the shortest-job-first algorithm. (D)This algorithm is equivalent to the shortest-remaining-time-first algorithm Ans:\(B) * 王尚鵬 Q1: The dispatcher helps the CPU switch context, change to user mode, and jump to the appropriate location in the user program to resume execution. Why is frequent context switching bad to system performance? A1: Switching too frequently results in high dispatch latency, which can slow down the system. Q2: Processes P1, P2, and P3 have burst times of 18 ms, 3 ms, and 24 ms, respectively. Please use the SJF scheduling algorithm to determine the sequence of execution and calculate the average waiting time. Use ">" to denote the sequence, e.g., P3 > P2 > P1. A2: The sequence of execution is as follows: P2 > P1 > P3. Average waiting time: (0 + 3 + 21) / 3 = 8 ms. * 楊閔恩 1. In CPU Scheduling, there is a type of scheduling called Round Robin. This scheduling has a parameter called q, which represents the time quantum. If q is set too large, this scheduling will become first in, first out. Please explain why. Ans:If q is large enough that each process can complete its entire work in a single round, then all processes will execute in the order they entered the queue without interruption. Thus, the behavior of Round Robin will become equivalent to simple FIFO.