Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

English Given the following code of readers and writers, indicate which of the following statements are correct. Note that incorrect answers imply a penalty in

image text in transcribed

English Given the following code of readers and writers, indicate which of the following statements are correct. Note that incorrect answers imply a penalty in the final score 1: R = 0; init (mer, 1); init (men, 1); init (w, 1); 2: /* Readers */ 3 : wait (mer); 4: nR++ 5 : if (n==1) 6 : wait (w); 7: signal (meR); 8 : ... reading ... 9: wait (mer); 10: nR--; 11: if (nR==0) 12: signal (w); 13: signal (meR); 14: /* Writers */ 15: wait (mew); 16: wait (w); 17: ... writing.. 18: signal (w); 19: signal (meW); Select one or more Il semaforo meW in linee 15 e 19 usato per evitare che due scrittori eseguano in sequenza le loro sezioni critiche quando un lettore vuole entrare nella sua sezione critica / Semaphore meW in lines 15 and 19 is used to avoid that two writers execute in sequence their critical section when a reader wants to enter in its critical section La rimozione dell'istruzione signal(meR) in linea 7 genera un codice con race conditions. / Removing the instruction signal(meR) in line 7 leads to race conditions. Gli scrittori possono soffrire di starvation. / Writers may suffer from starvation. Quando uno scrittore all'interno della propria sezione critica (linea 17), eventuali lettori sono tutti bloccati sul semaforo w (linea 6). / When a writer is inside its critical section (line 17), possible readers are all blocked on semaphore w (line 6) La rimozione dell'istruzione signal(meW) in linea 19 genera un codice con stallo/deadlock, ma solo per gli scrittori / Removing the instruction signal(meW) in line 19 leads to deadlock, but only for writers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database Administration The Essential Reference

Authors: Brian Laskey, David Kreines

1st Edition

1565925165, 978-1565925168

More Books

Students also viewed these Databases questions

Question

12-5 How will MIS help my career?

Answered: 1 week ago