

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Consider a system that uses persistent queues that do not support transactions. Each queue supports the atomic operations
While (true) do { Write(Last = 0); // 0 is a value that is different from any request StartTransaction; ReadTop(r, RequestQueue); s = ProcessRequest(r); Write(Last = r); Write(Reply = s); Commit; Enqueue(Reply, ReplyQueue); Dequeue(x, RequestQueue); }
In the above server program, Last and Reply are transactional data items in stable storage, so Write operations on them are undone if the transaction that invokes them aborts. If the server fails, the values of local variables r, s, and x are lost. After the server recovers, before restarting execution of the above program it runs the following recovery program: ReadTop(r, RequestQueue) If Last = r then {Dequeue(x, RequestQueue); Enqueue(Reply, ReplyQueue)}
Although the server fails occasionally, it is highly available. Assume that ProcessRequest() supports transactions. If its transaction aborts, it is undone as if it was never called.
For the following questions, answer true or false and provide a brief explanation.
a) The above programs ensure that for each request r, it is processed exactly once, even in the presence of server failures (assuming no other kinds of failures).
b) The above programs ensure that each reply is enqueued at least once, even in the presence of server failures (assuming no other kinds of failures).
c) Consider the atomic operation EnqueueDequeue(r, qn1, s, qn2) which enqueues r on queue qn1 and dequeues the top element of qn2 and returns it in s. In the server program, replace the last two lines by EnqueueDequeue(s, ReplyQueue, x, RequestQueue). In the recovery program, replace the then-clause by EnqueueDequeue(Reply, ReplyQueue, x, RequestQueue). Now the programs ensure that each reply is enqueued exactly once, even in the presence of server failures (assuming no other kinds of failures).
Problem 3.
atomically.
docsity.com