Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started