Solving the Unsolvable Using an Oracle

Eli Gafni UCLA [email protected]

ABSTRACT Oracle accepts it. If not, it tells the system that Sol1 is not valid so- In Theory the relation between a Model lution of T . Based on this, the system deliberates again and propose and a Task is Binary: Either the Model solves the Task, or it does another solution Sol2, etc. not. But if it does not, there is no measure of how “close the Model But the system is distributed. What do we mean the system is to solve the Task.” proposes a solution? We propose such a directed closeness measure: Processors can Processors interface with the Oracle. First by announcing to the coordinate among themselves by the power they possess and each Oracle their participation. Then they coordinate through the given proposes an output to an Oracle. The Oracle, based on the set of synchronization power and consequently, a processor proposes a processors participating, and outputs it already approved so far, pair (processor, output) by sending it to the Oracle. The Oracle disapproves or approves the next proposal it examines. If disap- judges whether a proposal can live with the processors’ output it proved, a processor returns to consult its peers to come up with a approved (by answering “yes”) already and the current participating next proposal. set. If the up-to now approved outputs, together with the new We take the number of Oracle queries as a measure to how proposal can be completed to a full valid output, it responds to the close the Model is to the Task. The less the number of queries the processor with a “yes.”Else the Oracle responds with a “no,”in which closer the model is to solve the task, culminating with a traditional case the processor returns to coordinate with other processors to solvability that incurs zero cost. come up with a new output proposal. The complexity is how many Oracle queries in the worst case CCS CONCEPTS a processor may go through. Notice, that a processor also may decide an output without approval from the Oracle. For instance, • Theory of computation → Distributed computing models. this is the case for implementation. Nevertheless, we will see mixed KEYWORDS example: Queries are required for getting a solution, nevertheless, some processors may output without requiring approval from the message adversary, synchronization, model of distributed comput- Oracle, as they are certain their next proposal will necessarily be ing compatible with the other outputs. ACM Reference Format: Thus, the closeness is min-max: For each algorithm assign the Eli Gafni. 2020. Solving the Unsolvable Using an Oracle. In Proceedings of maximum number of queries a processor made, and then take min- 22nd International Conference on Distributed Computing and Networking imum over the algorithms. (ICDCN 2021). ACM, New York, NY, USA, 5 pages. https://doi.org/10.1145/ We consider three variations on the details of the Oracle interac- nnnnnnn.nnnnnnn tion with the system, and conjecture they are all equivalent as far 1 INTRODUCTION as the complexity of Oracle-implementing a given task in a given model. When considering a one-shot distributed problemT called task [12], The three variations are as follows: and a system S, we relate them by a binary notion. The task T is (1) FfA (Free for All) The pair (p ,value) for any specific p either solvable by the system S, or not. But if S does not solve T , j j and any specific value can be submitted many times by dif- the more coordination power it has, makes an intuitive sense that ferent processors, by that learning whether the proposal first the closer it may be to solving T . submitted was approved or not. We propose to quantify this closeness. When we can model a (2) Private The pair (p ,value) for any specific p and any spe- system as an iterated task [11], this measure induces a directed j j cific value can be submitted at most a single time. distance between tasks. (3) Random When a proposal can obtain a “yes” value, but The general idea to do something impossible is to call on extra- nevertheless with all “yes” completions, it is also compatible ordinary powers i.e. an Oracle. The system deliberates and then with a “no” answer, then the Oracle can choose randomly propose to the Oracle a solution Sol1, for T . If Sol1 is a solution, the between the two. Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed There are two interesting potential counter-example to the conjec- for profit or commercial advantage and that copies bear this notice and the full citation ture that the complexity of a pair Model/Task is invariant over the on the first page. Copyrights for components of this work owned by others than ACM three Oracles. must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a In both cases we refute the counter example and show that the fee. Request permissions from [email protected]. complexity coincide. Technically, it was challenging and constitutes ICDCN 2021, Jan 05-08, 2021, Nara, Japan the main technical contribution of the paper. © 2020 Association for Computing Machinery. ACM ISBN 978-x-xxxx-xxxx-x/YY/MM...$15.00 A potential counter-example to separate FfA and Private is the https://doi.org/10.1145/nnnnnnn.nnnnnnn pair read-write wait-free (rw-wf)/Total-Order (TO). ICDCN 2021, Jan 05-08, 2021, Nara, Japan Eli Gafni

Total-Order is repeated consensus processor goes though offer- The algorithm is then straight forward: Processors return IS. ing its id to the consensus (election). It departs with the sequence Processor pi that returns ISi will propose to the Oracle it will of ids once its id was accepted as a consensus value. output the integer |ISi |, where |ISi | is the size of the snapshot ISi . We cannot automatically derive Total-Order from Election as It will either return from the Oracle with “yes” in which case it the communication with the Oracle is pretty restricted. It becomes returns |ISi |. Else, if it returns with a “no” from the Oracle, it outputs easy to emulate sequence of election as a result of the flexibility |ISi | − 1 (no need to query the Oracle since “yes” is guaranteed.) of offering outputs for others. And indeed the complexity ofrw- The paper is organized as follows: wf/Election is O(n), in both FfA and Private is O(n), it is easy to In the next section, the Model section, we just introduce commonly see it is O(n2) in FfA. known notions making the “language” self contained. We then It is non-trivial to get O(n2) for Private, but eventually we found pick up 3 hierarchies of task: The test-and-set hierarchy, the set an algorithm. In hindsight, it is pretty simple, consensus hierarchy, and the total order hierarchy. In each we The pair that could potentially separate Private and Random analyse the complexity of going up a step up the ladder, as well is the pair of read-write wait-free model with access to k + 1- Fetch- as jumping directly from the bottom (rw-wf) to the top. We then and-Add (k + 1-F&A) and the task k-F&A. Notice that for instance conclude. the model above is equivalent to repeated k + 1-F&A a la [11]. The complexity in Private is O(1). The algorithm relies heavily 2 MODEL on the determinism of the Oracle. To get O(1) for Random is not A task is the analogue of a function in distributed computing. At a small feat even after it was achieved. its fundamental theoretical basis it is what distributed computing To make the presentation less abstract, an example of the Oracle does. Processors do not compute, processors coordinate. in action will be instructive. A task, like its analogue the function, is a mathematical object. Given a set P, an input domain I of values, and an output domain O, it is a binary relation between a subset of processors P ⊆ P each 1.1 Motivating Example with input from I, to the same subset of processors, each with an output from O. Consider the task of TightRenaming [2]. Thus, the task of consensus between 2 processors p and p , and The specification of this inputless task, is that for participating 0 1 input and output domain {0, 1}, is the relation: set P of cardinality |P | each processor returns a unique positive integer in the range 1, 2,..., |P |. (1) i ∈ {0, 1},m ∈ {0, 1}, (pi ,m) → (pi ,m) ∀ It is easy to see that the task can implement 2-processors consen- (2) m ∈ {0, 1}, ((p0,m), ((p1,m)) → ((p0,m), ((p1,m)) ∀ sus, and is implementable in a read-write system S that has access (3) m ∈ {0, 1}, ((p0,m), ((p1,m¯)) → ((p0,m), ((p1,m)), ∀ to 2-processors consensus. ((p0,m¯), ((p1,m¯)) Now weaken the system that implements TightRenaming, and The task of F&A is as follows: P ⊆ P, Pi ∈ P returns a subset consider the system S to have access to 3-processor set-consensus, ∀ Si ⊆ P, such that: rather than access to 2-processors consensus. While 2-processors consensus can implement 3-processor set-consensus, the reverse (1) pi ∈ Si , does not hold [4, 7]. Thus, tight-renaming is not implementable (2) i, j Si , Sj satisfy the shared-memory property pi < Sj ⇒ ∀ with 3-processor set-consensus. pj ∈ Si The inputless task of -processors set-consensus has processors (3) i, j pj ∈ Si ⇒ Sj ⊂ Si . k ∀ return win or lose. In any participating set at least one processor The generalization k-F&A just replaces condition (3) with: returns win, while if the participating set P is such that |P | = k (3) i, j pj ∈ Si ⇒ Sj ⊆ Si ∧ |{j| Sj = Si }| ≤ k. then at least on processor returns lose. The∀ task n-F&A is also called the Immediate Sanpshots (IS) task. We know of no algorithm to solve tight renaming in a read-write F&A traditionally is called an object. It implies a specification by system without at least one processor obtaining an n − 1 “no”. I.e. at state-machine. The specification of an object can has an equivalent least one processor just cycles among n − 1 number until obtaining specification as a task [9]. Here we restrict ourselves just to task, a yes. Its an intriguing challenge to prove that - one of the many without getting into explaining what object is. With each task we new interesting question the Oracle setting raises. add its spec, so the reader should ignore the association of the name Can we do better than n − 1 when having in addition to read with the object she/he knows. write an access to 3-processors set-consensus? We will assume familiarity with the SWMR shared-memory SM) The answer is ”yes,we can!” wait-free (WF) model. We will assume familiarity with the notion In fact, a processor will access the oracle at most once in the worst of iterated task. Indeed [1] SWMR SM is just iteration of the task: case. Processor pi returns a set Si ⊆ P, such that: Using 3-processors set-consensus we can solve 2-test-and-set (1) p ∈ S , [3]. In the task k-test-and-set processor return win or lose. In every i i (2) i, j pi ∈ Sj ∨ pj ∈ Si participating set at least one processor returns win, yet, at most k ∀ processors return win. Other tasks we will deal with are k-set consensus: With 2-processor test-and-set we can solve Immediate Snapshots Processor pi returns a set of processor Si , Si ⊆ Psubseteq P, such (IS) with at most 2 processors returning the same IS. that: |{∪jSj |pj ∈ P}| ≤ k. Solving the Unsolvable Using an Oracle ICDCN 2021, Jan 05-08, 2021, Nara, Japan

1-set consensus is called Election, and n − 1-set consensus is Processors follow the recursive version of IS [5, 10]. The algo- called just set-consensus. rithm say IS(n) consists of posting id and snapshoting all posted While every object has a representation as a task the reverse ids. is not true. Both Election and set-consensus are also objects [8], If the size of the snapshot is n return the snapshot, else proceed to but it is conjectured that among all the k-set consensus, these are IS(n − 1). the only two values of k that have a object representation (as a We change the last line: If the size of the snapshot is n propose it state-machine). to the Oracle. If “yes” return the snapshot, else proceed to IS(n − 1). We will also use the tasks k-test-and-set in which pi returns Thus, we get O(n) complexity. Oi = win or Oi = lose, and: Can we do better? 1-F&A is in particular a counter. Intuitively there will be one processor that each time it tries a position it (1) P, 1 ≤ |{j|pj ∈ P, Oj = win}| ≤ k. ∀ collides with another processor that already proposed the value − 1-test and-set is also called just test-and-set. while n 1-test-and- and it was approved, nevertheless this is just an intuition rather − set is equivalent to n 1-set consensus [4, 7]. than a proof Lastly, we generalize Election by considering repeated election through the task k-Total-Order (TO): 3.1.2 Random Oracle. Consider going from (k + 1)-F&A to k-F&A. Processor pi returns a sequence seqi of processors from P, such Using [8] it is easy to see that we can implement both using de- that: terministic objects [6]. Thus, we would like the combination of (1) i, j seqi is related to seqj , through one being prefix of the the algorithm with together with the Oracle to be a system which other,∀ and has no synchronization power more that k-F&A. But if we use a (2) if lenдth(seqi ) ≤ k, then pi appears last in seqi , and more- algorithm in the previous section we can easily extract 2-processor over it is the only appearance of pi in seqi . consensus which cannot be extracted from k-F&A. n-TO is just TO, and 1-TO is Election. k-TO represent k rounds We are facing a situation that before the oracle gets k + 1 pro- of election. posals to return the same value, it is obliged to answer “yes.” As for the working of the Oracle, when it considers a new pro- But once it responds to the first proposal which necessarily has posed output value, it sees the participating set P with input for to be a “yes” from there on it can return “no”s and “yes”’s as long each processor. It already approved some output values to some as it does not return all “yes”. How to do this without being able to processors. Inductively for these approved output values there ex- extract 2-processors consensus from it is the subject of [8]. ists an output tuple for this participating set and inputs, such that We will just abstract it to say that the Oracle has the ability to the approved output values constitutes a sub-tuple. This is usually be random after returning the first “yes” without returning all “yes” referred to a there exists a completion. Thus, if the value is to be and nevertheless the whole system does not have the power to approved it has to satisfy this inductive hypothesis. extract 2-processors consensus. Some values that can be approved might be very special, for each we show we still can use random Oracle to go from (k + 1)-F&A tuple completing it, it can also have another output value that has to k-F&A at O(1) complexity. the same completion. In this case we have the Oracle Random that Processor do IS. can answer “no” even though it can answer “yes,” since it will not From here on the algorithm is restricted to processors with same change the set of completion the Oracle holds. IS. post id, snap :=snap ids 3 ANALYSIS OF 3 HIERARCHIES OF TASKS if |snap| ≤ k return IS, else 3.1 The k-F&A Hierarchy algorithm continues among processors with |snap| = k + 1 3.1.1 Private Oracle. The 1-F&A task also known as just F&A is as post id follows: The input to a processors is its unique id. read(дate) Processor pi returns a subset Si of the participating set that includes If дate =closed then consider Oracle returned “no’ its id. else And, i, j pj ∈ Si ⇒ Sj ⊂ Si . propose (my-id, IS) to Oracle To∀ get k-F&A we replace the last line in the definition above by: If Oracle says “yes,” Return IS. And, i, j pj ∈ Si ⇒ Sj ⊆ Si , and |{pj |Sj = Si }| ≤ k. If “no” We∀ first show for the Private Oracle that the complexity of Take snap :=posted-ids (with former |snap| = k + 1) implementing k-F&A from (k + 1)-F&A is O(1). Do IS’ as follows: Processors return output for (k + 1)-F&A. Each processor posts IS ′(k): Post all ids in you snap its output. Then, each proposes propose its output to the k-F&A Snaps ids posted Oracle. If snap < k then Do Commit-adopt on each posted id in snap A processor pi that gets a “no” response, scans posted outputs and proposing drop ′ set R = {pj , pi |Sj = Si }. It then returns Si \ R. Invoke IS (k − 1) with all ids that got commit drop That (k + 1)-F&A cannot implement k-F&A follows from [4, 7]. Else What is the complexity of implementing 1-F&A, just from read- Do first commit=adopt for your id proposing stay, and then proceed write? We show that as expected it is O(n). to all other ids proposing drop. ICDCN 2021, Jan 05-08, 2021, Nara, Japan Eli Gafni

If your id resulted commit stay then on any of the rotated − id since some pj may have gotten “yes” leave − behind = processors-id with commit drop proposing (pj , (rotated − id) ∗ id − pj ). Return IS := IS \ leave − behind For that we instruct all processors to post their next proposal Else in order in shared memory before proposing it to the Oracle. If pi ′ Invoke IS (k − 1) with my-id and all ids that got commit drop failed in all second round proposal of proposing (pi , (rotated −id) ∗ id − pi ), then, for each processor pj it looks at its last proposal in the second round sec − round − pj and rotate over pj the proposal 3.2 The k-Election Hierarchy (pi , sec − round − pj ∗ id − pi ). If it fails on second round, then Here we show that going from k + 1-Election to k-election in O(1) others started his round and that why it failed. Now since this is length 3, it doesn’t need to append its id and therefor just rotate on bits in Private. 2 Processor post their proposals and then propose it as output. A the last proposals of round 3. Thus the total is O(n ). For n-TO is just a simple generalization of the above. Hence processor that receives a “no” scan the posted values and output 2 one of the values, which is not the one it proposed. complexity is like as in FfA O(n ). It is not fair to compare this to Random as random may narrow ′ the election from k + 1 to less than k. But if it narrow it to k < k it 4 CONCLUSIONS is easy to do it at the cost of (k + 1) − k ′ by just cycling among the posted valued until a “yes” and at most (k + 1) − k ′ “no”s to each origin of the paper is in the following question: If responses pro- processor. vided by state machine do not uniquely determine the state of the We now consider going for 1-Election from read-write and this object, why not consider the object to be in a cloud of states. But just involve cycling through all the ids i.e. n − 1 queries at most. traditionally we think of the object as it did a choice between the This is also a lower bound as by topology [3, 12, 13] processor states by the unknown order it responded to command. Why not initially w.l.o.g propose its value. We then keep n − 1 of them still then let the programmer suggest a state to the object as long as we and one processor has to find who among the n − 1 got a “yes.” By know that the programmer made a choice and potentially consid- differed decision this can take n − 1 queries. ered all possible states. This is essentially what the object does, so why not let the object “listen” to the programmer? 3.3 The Total-Order (TO) Hierarchy This idea of the Object being like an Oracle listening to the programmer gave rise to the question of why restrict it to object. The k-TO task is defined as follows: This seems to be more encompassing and meaningful than the narrow context of objects. Input to processors are their own unique ids. We presented a measure that seem to capture how close is a given Output of pi is a sequence of participating processors ids with model to solve a given task. We do this by employing Oracle. Oracles no repetition. have a long history both in centralized and distributed computing, If the sequence is of length less equal to k it ends up with the id of but nothing we know is reminded us of what is proposed here. pi . Hence we avoided calling anything containing the word Oracle, to Two different sequences relate by one being prefix of the other. qualify as related work. n-TO is usually referred to as TO. We presented 3 variation of the Oracle and Conjecture the Thesis 3.3.1 FfA. From k-TO to k + 1-TO Processor solve k-TO. that they are all resulting the same complexity on a given instance. We identified two potential counter examples and resolved that If pi returns a sequence of size less than k, or has its id at the end of the sequence, return its result from k-TO. they are not. Other processor append each its id to the end of the k length se- We cannot do not consider a models in the form of iterated task quence. Now, using the power of FfA each processor rotate over all that solve another task. But otherwise, for the closeness measure processor ids to propose (id, (k−seq∗id)) where ∗ stands for append. to make sense it should satisfy a triangle inequality: Thus the learn the k +1 winner and can output k −seq ∗winner −id. From read-write to TO Assume the model iterated task T1 does not solve task T2, and With FfA we can essentially execute repeated election. This is iterated T2 does not solve T3, then we would like the complexity of essentially n repetition of the subsection above to result an O(n2) the pair Iterated(T1) / T3 ≤ (iterated(T1)/ T2) + (iterated(T2) / T3). algorithm. Finally, we sell the paper on the idea of the measure. The rest is to show the idea has depth and posing challenging interesting 3.3.2 Private. From k-TO to k + 1-TO Here it is the same as bf problems. So challenging, that the paper presentation is far for top FfA since the output one length k + 1 for pi and pj coincide. notch to say the least. But introducing audiences to the idea, should From read-write to TO trump the injustice of rewarding the author with publishing badly Here is a major difference with FfA. Processor pi cannot propose written paper. an output for pj and any sequence it proposes for itself has to end The paper has the far fetch nevertheless non-negligible potential with pi . of introducing “information theory” into into the area of distributed We will first do the example how to go from read-write to 3-TO: compatibility theory. Processors propose their id. Those that receive “no” say pi rotate Even if the hoped connection does not pan out, the measure is a (pi , (rotated − id) ∗ id − pi ). Now it is not guaranteed to get “yes” newly discovered forest with many trees with low hanging fruits. Solving the Unsolvable Using an Oracle ICDCN 2021, Jan 05-08, 2021, Nara, Japan

5 ACKNOWLEDGEMENT Symposium on Principles of Distributed Computing (New York, NY, USA, 1994) (PODC ’94). ACM, 363–372. https://doi.org/10.1145/197917.198126 The idea of a programmer “talking to an Oracle” emerged in years [7] Soma Chaudhuri and Paul Reiners. [n.d.]. Understanding the Set Consensus of discussions with Giuliano Losa, on how to resolve the Robustness Partial Order Using the Borowsky-Gafni Simulation. In International Workshop Conjecture. on Distributed Algorithms (1996). Springer, 362–379. [8] Eli Daian, Giuliano Losa, Yehuda Afek, and Eli Gafni. 2018. A Wealth of Sub- Consensus Deterministic Objects. In 32nd International Symposium on Distributed REFERENCES Computing, DISC 2018, New Orleans, LA, USA, October 15-19, 2018 (LIPIcs, Vol. 121), Ulrich Schmid and Josef Widder (Eds.). Schloss Dagstuhl - Leibniz-Zentrum für [1] Yehuda Afek and Eli Gafni. [n.d.]. Asynchrony from Synchrony. In International Informatik, 17:1–17:17. https://doi.org/10.4230/LIPIcs.DISC.2018.17 Conference on Distributed Computing and Networking (2013). Springer, 225–239. [9] Eli Gafni. [n.d.]. Snapshot for Time: The One-Shot Case. ([n. d.]). [2] Yehuda Afek, Eli Gafni, and Opher Lieber. [n.d.]. Tight Group Renaming on arXiv:1408.3432 [cs] Groups of Size g Is Equivalent to G-Consensus. ([n. d.]), 111–126. [10] Eli Gafni and Sergio Rajsbaum. [n.d.]. Recursion in Distributed Computing. In [3] Elizabeth Borowsky and Eli Gafni. [n.d.]. Generalized FLP Impossibility Result Symposium on Self-Stabilizing Systems (2010). Springer, 362–376. for T-Resilient Asynchronous Computations. In Proceedings of the Twenty-Fifth [11] Eli Gafni and Sergio Rajsbaum. 2010. Distributed Programming with Tasks. In Annual ACM Symposium on Theory of Computing (New York, NY, USA, 1993) Principles of Distributed Systems - 14th International Conference, OPODIS 2010, (STOC ’93). ACM, 91–100. https://doi.org/10.1145/167088.167119 Tozeur, Tunisia, December 14-17, 2010. Proceedings. 205–218. https://doi.org/10. [4] Elizabeth Borowsky and Eli Gafni. [n.d.]. Implication of the Borowsky-Gafni 1007/978-3-642-17653-1_17 Simulation on the Set-Consensus Hierarchy. In UCLA Tech Report No. 930021. [12] and . [n.d.]. The Topological Structure of Asynchro- [5] Elizabeth Borowsky and Eli Gafni. 1993. Immediate atomic snapshots and fast nous Computability. 46, 6 ([n. d.]), 858–923. https://doi.org/10.1145/331524. renaming. In PODC (Ithaca, New York, United States). ACM Press, New York, NY, 331529 USA, 41–51. https://doi.org/10.1145/164051.164056 [13] Michael Saks and Fotios Zaharoglou. [n.d.]. Wait-Free k-Set Agreement Is Im- [6] Elizabeth Borowsky, Eli Gafni, and Yehuda Afek. [n.d.]. Consensus Power Makes possible: The Topology of Public Knowledge. 29, 5 ([n. d.]), 1449–1483. (Some) Sense! (Extended Abstract). In Proceedings of the Thirteenth Annual ACM