You are on page 1of 6
ser saat Course’, ae Name: Operating Syste : "se's Number: 12140398 ee) xam’s Period: 12-13 Questions’ Number: 4 Total Mark: 30 Pages' Number:4 Patest - Ka cL tine Technical Universi” K*4eerie Tnstructor’s Name: ™ So Nagham Hamad ypdvo Be* & Student’s Name! PAT = vam gpa Student’s Number “gale Section’s Numbe™* at Si xa v First Sesser 2021-2022 Exam’s Date: 12/12 Zombie process j PTOCess is the process that finishes execution, and the system finds that the pare ae nt had already terminated False 2. Given the following code, how many processes are generated re — z 1 wie ork(), N 2 pi = for, if(pid4=0 && pid2==0) i) fork); zh a. 4 processes processes ©. 6 processes d. 3 processes == 3. When the unbounded buffer used 28 communicatio "y consumer, then the sender is considered n link between producer Blocking send [7b] unbiocking 208 Rendezvous ic fF that aco je in the process S885 sha r ne eee red data is calleq ical 90080" crite ondition Pee erie Sytem. Palestine Technical University -Kadoorie Instructor’s Name: Thaer Samar Fos Number: 12140308 ; spxam’s Period: 12-13 Questions’ Number: 4 Total Mark: 30 Pages' Number:4 Nagham Hamad Student’s Name: Student’s Number: Section’s Number: Fist Semester 2081-2022 Exam’s Date: 12/12/2021 4 ‘ Q2: (9 points) Critical Section Problem Given the following code, please specify for ech one of the three requirements of Critical Section Problem whether it is satisfied or not with clear explanation shared variables boolean flag [2] = { false , false }; int turn ; // initially either 0 or 1 , randomly Iwo processes; i= 0, 1 while (true ) { flag [i] = true ; while (flag [1 -i]) { if (tum ==1-i) { flag [i] = false while (turn 3 //do nothing flag [i ]=true; 3 I critical section tum=1-i; flag [i ] = false ; remainder section } p i wdhle Ltn) § Play Le = bra 5 ohde ( Mog V1) f tam ne 1) i; Bay (03 = Bake § able hm cal) ¢ Se a DesloJe tah 5 5 oD Moh! ele bameo Pain rele ee Bg Play fi] 2 tru Pz inter ahile loop and Sb Play Fifa Po 2 cnt while cand ener CL Ro Geb cs ond seb tanzl ¥ Donk onihing and P, > set Pag Poe ost tm @ ee Potter ate et and base bane Me p Mle (Fran) f My fie wile (Ay Cay of f Pl ben 230) Play E19 = Re Ohile(hunzse) ¥ Cy OIs tne 5 Se abyorbim will rok leh 9 |) [ Pascss to ghar <6 becouse thetlle hen 1% her chen hen 0B ah Oe and ahem Ken ay a washing me : A cg ' XK le aco. My [23 Progress © hen Pp 3 oil] be ini Nyy - ay a ed St so ib gss\\ Ry Me) Pot, ot co dbo" oer irse's Name: Operating Systems Course's Number: 12140308 Exam’s Period: 12-13 sweestions’ Number: 4 Second Exam First Semester 2021-2022 Nagham Hamad Student’sName:_ Student’s Number: Section’s Number: Exam’s Date: 12/12/2021 5 Ordering & synchronization Assume thi at to order the Soe © 4 processes A, B, C and D, You were asked to use semaphores "°F these processes taking the following into account ~ Process T Process A.B and Process 4 | eee work before D CESS A Can work gga! Pees C can workin parallel oi P * the second time after Process C and Process D finish Based on the given for each process Semaphore si =. +s2= n infor "mation, fill the values of semaphores and the necessary code Jaa f=) Process A{ Process Bf Process C{ ey, While(true){ M, eee Signal (s) Bion! (s2) Signals.) / } } } i srse's Number: 12140308. ‘Exam’s Period: 12-13 Questions’ Number: 4 Total Mark: 30 ‘@kes' Number:4 Second Exam Sie Student’s Name: Student’s Number: Section’s Number: NO Q4: (10 points) CPU Scheduling Answer below questions based on the following table that shows information about. Processes arrived into the ready queue Process 1D Arrival time CPU burst time Pl 0 10% P2 3 4 Se. P3 3 5 P4 7 7 Ps 7 aes 7) @ points) Draw the Gantt chart for FCFS Me est ft " aeyae ‘Chart for SRTF alg 26 Ww (2 points) Draw ‘the Gantt cl | je ej fe fs ° + oe ee 4, G pointy Which algorithm is beterin tem ofthe average waiting fife (make y it clear how you get the answer) #710) 2 bok Ws Jo TS Grte@ye 5 22 5/ wy-ctFanytesn| TIA). errs o 7 Bees, 5 SO eS inet eaten ahaa (ER 4. G points) Which algorithm is better in term of the average response time (make it clear how you get the answer) B3 20-4 2 1/ FoRe (s7- 2% oH SS 5404541840 Vy +a 5 212 So SRP RO) = mp 3 25/ RTA) = wee) / RelA le 9 4. 7 RrlPs) ey) Page 4 0f 4 . orFel 412419 - (qa We a z

You might also like