Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

3. Concurrency : Readers and Writers access a shared resource. There is mutual e

ID: 3713458 • Letter: 3

Question

3. Concurrency: Readers and Writers access a shared resource. There is mutual exclusion, except that multiple Readers can access the resource simultaneously, but not when a Writer is using it. Let us assume that reading takes 20 msec and writing takes 30 msec, and that Reader-1 tries to access the resource at time t=0 (initially, the resource is free). Then Writer-1 tries to access the resource at time t=5, and Reader-2 tries to access the resource at time t=10. When do these three threads start and terminate their use of the resource?

Answers: IDIS Reader-1 starts at 0 and ends at 20 msec Writer-1 starts at Reader-2 starts at and ends at and ends at msec msec

Explanation / Answer

Reader 1starts at 0 and ends at 20msec.

Writer 1 starts at 30 and ends at 60 msec

Reader2 starts at 10 and ends at 30 msec.

Here Readers can access simultaneously so When Reader 1 is reading, within that time Reader 2 can start reading from t=20, when Reader 2 finished then writer can write at t=30 for next 30 Msec.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote