Operating System Problem (1)

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/jywlchuang/article/details/90753661

In a single CPU computer system, there are two external devices R1, R2 and the three processes P1, P2, P3. The system uses preemptive priority scheduling process mode programs, and processes be used in parallel for all I / O devices, the priority, the order using the device and the device occupies three times the process as shown in Table 3-7. Table 3-7 equipment device and occupancy time sequence
P1 high R2 (30ms) → CPU (10ms) → R1 (30ms) → CPU (10ms) P2 in R1 (20ms) → CPU (30ms) → R2 (40ms) P3 Low CPU (40ms) → R1 (10ms)
assumed that the operating system overhead is negligible, to complete all three processes from input to operation, the CPU utilization is about __ (26) __%; R2 is about utilization ____ (27) ____% (equipment utilization time refers to the use of the apparatus and process group completed the ratio of occupied time).
Alternative answer:
(26) A.60 B.67 C.78 D.90 (27) A.70 B.78 C.80 D.89
analysis:
Here Insert Picture Description
First, P1 process uses only: Resource 30ms, so the P1 before 30ms marked as R2. At the same time the use of R1 P2 resources 20ms, P3 simultaneously apply for CPU 40ms, when P3 application using CPU, no other process application using CPU, so P3 successfully obtained the right to use the CPU (P1 or P2 at this time if the CPU also apply if , P3 is not right to use the CPU, because the lowest priority of P3).
When the system time is 20ms, P3 lost CPU resources, which is why at this time because P2 has finished using the R1, it began to apply for a CPU, a higher priority than P2 P3, so the system to recover from the hands of P3 CPU usage right (mode because the system uses preemptive scheduling scheme), the CPU allocated to P2 used, when the system time is 30ms, and from the hands of the system used to recover P2 of the CPU, the CPU is assigned to the use of P1, P1 because the system the higher priority than P2. And so on, we will complete the system of space-time diagram.
We can see from Figure 5-2, three processes to run need 100ms, CPU working 90ms, so CPU utilization is 90%, R2 worked so 70ms, R2 utilization rate was 70%.

Guess you like

Origin blog.csdn.net/jywlchuang/article/details/90753661