Vous êtes sur la page 1sur 3

5.1 Why is it important for the scheduler to distinguish I/O-bound programs from CPU-bound programs? 5.

2 Discuss how the following pairs of scheduling criteria conflict in certain settings. a. CPU utilization and response time b. Average turnaround time and maximum waiting time c. I/O device utilization and CPU utilization 5.3 Consider the exponential average formula used to predict the length of the next CPU burst. What are the implications of assigning the following values to the parameters used by the algorithm? a. = 0 and T0 = 100 milliseconds b. = 0.99 and T0 = 10 milliseconds 5.4 Consider the following set of processes, with the length of the CPU burst given in milliseconds: Process P1 P2 P3 P4 P5 Burst Time 10 1 2 1 5 Priority 3 1 3 4 2

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0. a. Draw four Gantt charts that illustrate the execution of these processes using the following scheduling algorithms: FCFS, SJF, nonpreemptive priority (a smaller priority number implies a higher priority), and RR (quantum = 1). b. What is the turnaround time of each process for each of the scheduling algorithms in part a? c. What is the waiting time of each process for each of the scheduling algorithms in part a? d. Which of the algorithms in part a results in the minimum average waiting time (over all processes)? 5.5 Which of the following scheduling algorithms could result in starvation? a. First-come, first-served b. Shortest job first c. Round robin d. Priority 5.6 Consider a variant (bin th) of the RR scheduling algorithm in which the entries in the ready queue are pointers to the PCBs. a. What would be the effect of putting two pointers to the same process in the ready queue? b. What would be two major advantages and two disadvantages of this scheme? c. How would you modify the basic RR algorithm to achieve the same effect without the duplicate pointers? 5.7 Consider a system running ten I/Obound tasks and one CPU-bound task. Assume that the I/Obound tasks issue an I/O operation once for every- millisecond of CPU computing and that each I/O operation takes 10 milliseconds to complete. Also assume that the context-switching overhead is 0.1

millisecond and that all processes are long-running tasks. What is the CPU utilization for a roundrobin scheduler when: a. The time quantum is 1 millisecond b. The time quantum is 10 milliseconds 5.8 Consider a system implementing multilevel queue scheduling. What strategy can a computer user employ to maximize the amount of CPU time allocated to the user's process? 5.10 Explain the differences in the degree to which the following scheduling algorithms discriminate (phn bit) in favor (thin ) of short processes: a. FCFS b. RR c. Multilevel feedback queues 1. Liu c xy ra trng hp tr hon v hn nh (starvation hay indefinite blocking) vi gii thut FCFS? 2. Vic phc v khch trong nh hng Thc khch s n v gi mn n cho mnh,Mi mn n cn thi gian chun b khc nhau Mc tiu: Gim thi gian i trung bnh ca cc thc khch Cch lm no s ph hp? Thng thng cc nh hng s phc v theo kiu FCFS (!) 3. Phn bit s khc nhau trong cch tip cn u tin cho tin trnh ngn trong cc gii thut 4. FCFS: Cho lc gantt sau:

Process P1 P2 P3 P4 P5

Thi im vo 0 4 8 38 40

Hy tnh cc thng s: a) Thi gian hon thnh trung bnh b) Thi gian i trung bnh 5. Process Burst Time Tt c u n thi im 0 P1 10 a)Xt cc gii thut FCFS, SJF, v RR vi quantum time = 10 P2 29 Gii thut no cho P3 3 b)Thi gian i trung bnh nh nht? P4 7 c)Thi gian p ng trung bnh tt nht? P5 12 d)Thi gian hon thnh trung bnh ca process nh nht? 6. Priority Scheduling. Cho bng sau:

Tin trnh u tin Thi gian x l P1 3 15 P2 1 3 P3 5 6 P4 2 4 P5 4 23 Cc tin trnh c vo theo th t P1,P2,P3,P4,P5 ti thi im 0 V lc gantt v tnh thi gian i trung bnh. 7. Round Robin. Tnh thi gian i trung bnh v thi gian hon thnh trung bnh Burst Process Time P1 10 P2 29 P3 3 P4 7 P5 12 a) Quantum time = 10 b) Quantum time = 5
Cu 2 : Xt tp cc tin trnh sau ( vi thi gian yu cu CPU v u tin km theo ): Tin trnh Th t vo ReadyList Thi gian CPU u tin P1 0 4 1 P2 1 2 3 P3 2 7 3 P4 3 1 1 P5 4 3 2 Gi s cc tin trnh cng c a vo h thng ti thi im 0. Hy cho bit kt qa iu phi hot ng ca cc tin trnh, thi gian lu li trong h thng v thi gian ch theo thut ton : a. FIFO b. SJF c. Round Robin(quantum=2)

Vous aimerez peut-être aussi