题目内容
A database is shared among several concurrent processes. Reader processes want only to read the database, whereas writer processes want to update the database. Readers can access the shared data simultaneously, while the writers should have exclusive access to the shared database. Now you need to solve the problem using semaphores.The semaphore mutex is used to ensure mutual exclusion when the variable readcount is updated. he readcount variable keeps track of how many processes are currently reading the object. The semaphore wrt functions as a mutual-exclusion semaphore for the writers.(1) Initialize the semaphore mutex and wrt.(2 points)(2) Given the code of writer processes, please write the code of reader processes.(8 points)
查看答案
搜索结果不匹配?点我反馈