Question: Question 1: Synchronization (30 pts] Consider a shared database with two classes of users: Readers - never modify database. Writers read and modify database. As

 Question 1: Synchronization (30 pts] Consider a shared database with two

classes of users: Readers - never modify database. Writers read and modify

Question 1: Synchronization (30 pts] Consider a shared database with two classes of users: Readers - never modify database. Writers read and modify database. As discussed in lecture, concurrency functionality can be implemented with the following scheme Scheme A: Shared Data: Semaphore rw_mutex initialized to 1 Semaphore mutex initialized to 1 Integer read_count initialized to o Writer Process: do wait (rw_mutex); i* writing is performed / signal(rw_mutex); } while (true); Reader Process: do wait (mutex); read_count++; if (read_count == 1) wait (rw_mutex); signal (mutex); 7 reading is performed / wait (mutex); read_count--; if (read_count == 0) signal (rw_mutex); signal (mutex); } while (true); Now consider a new class of user called Scrubbers. Scrubbers perform an action which is to scrub items in the database. We can have an arbitrary number of scrubbers scrubbing the same item at once. An item should not be read or written while it is being scrubbed. An item should not scrubbed while it is being written or read. Write down a scheme in a format like scheme A above which implements the concurrency functionality of Readers, Writers, and Scrubbers. [30 pts] Question 1: Synchronization (30 pts] Consider a shared database with two classes of users: Readers - never modify database. Writers read and modify database. As discussed in lecture, concurrency functionality can be implemented with the following scheme Scheme A: Shared Data: Semaphore rw_mutex initialized to 1 Semaphore mutex initialized to 1 Integer read_count initialized to o Writer Process: do wait (rw_mutex); i* writing is performed / signal(rw_mutex); } while (true); Reader Process: do wait (mutex); read_count++; if (read_count == 1) wait (rw_mutex); signal (mutex); 7 reading is performed / wait (mutex); read_count--; if (read_count == 0) signal (rw_mutex); signal (mutex); } while (true); Now consider a new class of user called Scrubbers. Scrubbers perform an action which is to scrub items in the database. We can have an arbitrary number of scrubbers scrubbing the same item at once. An item should not be read or written while it is being scrubbed. An item should not scrubbed while it is being written or read. Write down a scheme in a format like scheme A above which implements the concurrency functionality of Readers, Writers, and Scrubbers. [30 pts]

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!