Two processes P and Q are connected in a ring using two channels, and they constantly rotate a message m. At any one time, there is only one copy of m in the system. Each process’s state consists of the number of times it has received m, and P sends m first. At a certain point, P has the message and its state is 101. Immediately after sending m, P initiates the snapshot algorithm. Explain the operation of the algorithm in this case, giving the possible global state(s) reported by it.
What will be an ideal response?
P sends msg m
P records state (101)
P sends marker
Q receives m, making its state 102
Q receives the marker and by marker-receiving rule, records its state (102) and the state of the channel from P to Q as {}
Q sends marker (marker-sending rule) (Q sends m again at some point later)
P receives marker
P records the state of the channel from Q to P as set of messages received since it saved its state = {} (marker- receiving rule).
You might also like to view...
Suppose you have created several messages for the Scene class. You would then send these messages to a Scene object by referring to the object as ____,
A. receiver B. scene C. target D. this
Why is the constant O(1) algorithm desirable?
a. Such algorithms are very efficient and fast b. Because the constant can be removed c. Because the data input size is constant d. Because there is only one data element
It can be wasteful to double a vector’s size when more space is needed. For example, a full vector of 1,000,000 elements resizes to accommodate 2,000,000 elements when a new element is added, leaving 999,999 unused elements. You can use ______ and to __________ control space usage better.
Fill in the blank(s) with the appropriate word(s).
Which of the following is the term for compressing a file?
A) Flattening B) Squeezing C) Reducing D) Zipping