criticalsections - class. The shared variables are the...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 3733 Review Problems: CPU Scheduling and the Critical Section Problem. 1) This problem concerns CPU scheduling on one or more CPUs. Suppose that FCFS scheduling is used and that at a time t = 0, the ready queue contains processes with the following CPU bursts: 3, 5, 9, 4, 7, 6, 1, 8, 2. The processes arrived in the ready queue in the order shown. No other processes enter the ready queue for this problem. Draw Gantt charts for each of the following and calculate the average waiting time assuming everything starts at time 0. a) One CPU becomes available at time t=0. b) 3 CPUs, all CPUs become available at time t=0. 2) Repeat problem 1) using SJF. 3) Consider the following correct solution to the critical section problem that was discussed in
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: class. The shared variables are the integer turn and the integer array flag[2] . There are two processes, P0 and P1. These processes execute the following code in a loop running on a single CPU with a time sharing operating system. P0 code: P1 code: ======= ======= flag[0] = 1; flag[1] = 1; turn = 1; turn = 0; while( (flag[1]==1) && (turn==1) ) ; while( (flag[0]==1) && (turn==0) ) ; <critical section> <critical section> flag[0] = 0; flag[1] = 0; <remainder section> <remainder section> a) Explain why this solution satisfies bounded waiting b) Explain why this solution satisfies progress c) Explain why this solution satisfies mutual exclusion...
View Full Document

This note was uploaded on 09/21/2009 for the course CS 3733 taught by Professor Staff during the Spring '08 term at The University of Texas at San Antonio- San Antonio.

Ask a homework question - tutors are online