250 likes | 261 Views
Learn how to implement a virtual shared variable in a MANET for concurrent, robust, and efficient operations using a focal point object model. This study explores algorithms for atomic read/write memory in mobile wireless systems.
E N D
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch
Lecture 32 • Topic: • Atomic Memory • Sources: • Dolev, Gilbert, Lynch, Shvartsman, Welch. Geoquorums Discrete Algs for Mobile Wireless Sys
Application: Atomic Read/Write Memory • How to implement a virtual shared variable in a MANET? • support concurrent operations • robust • efficient • Use virtual infrastructure to help: • Associate shared focal point objects (of a particular data type) with certain geographic locations • FPO called virtual object in previous slides • Use a quorum system, whose quorums are sets of focal point objects, to implement a robust and efficient shared read/write variable Discrete Algs for Mobile Wireless Sys
Focal Point Object Model • Associate an abstract object (FPO) with each of certain fixed geographic locations, called focal points • Each FPO is implemented by all the mobile nodes currently in the focal point (geographic location) • use replicated state machine approach • assumes the existence of a reliable local broadcast service, for all nodes w/in a focal point to communicate with each other • Focal points should be locations expected to be populated by mobile nodes at all times • If a focal point becomes depopulated, corresponding FPO fails permanently Discrete Algs for Mobile Wireless Sys
Atomic Read/Write Variable • Implement atomic r/w shared variable algorithm on top of the FPO model • Current state of atomic r/w variable is replicated at several FPOs • provides fault-tolerance and availability • Replication is controlled with a quorum system: • to read or write the shared r/w variable, certain sets of FPOs (i.e., certain quorums) are accessed • unlike previous work that used quorums to implement shared data in MANETs, the quorum elements are FPOs (i.e., geographic locations), not mobile nodes Discrete Algs for Mobile Wireless Sys
Atomic Read/Write Variable (cont'd) • Algorithm assumes existence of a reliable GeoCast service • nodes can contact all nodes currently in a given FP just by knowing location of the FP • Algorithm uses GPS info • Algorithm can switch between different quorum systems to improve efficiency Discrete Algs for Mobile Wireless Sys
Aside on Atomic Objects • Atomic objects appear at two levels of abstraction: • FPOs • the read/write shared variable • The FPO model and the algorithm that implements it are general: any data type can be represented by an FPO • The r/w shared variable algorithm uses FPOs of a specific data type (called "get/put" variables) Discrete Algs for Mobile Wireless Sys
Abstract Data Types (ADTs) • ADT specifies • set of invocations • set of responses • set of legal sequences of matching (invocation,response) pairs • how we expect the object to behave in the absence of concurrency Discrete Algs for Mobile Wireless Sys
ADT Examples • read/write variable • invocations: Read, Write(v) • responses: Return(v), Ack • legal sequences: all sequences of (Read,Return(v)) and (Write(v),Ack) pairs in which each Read Returns value of latest preceding Write • stack variable: • invocations: Push(v), Pop • responses: Ack, Return(v) • legal sequences: all sequences of (Push(v),Ack), (Pop,Return(v)) pairs in which each pop returns value that was pushed most recently (with some provision for attempts to pop an empty stack) Discrete Algs for Mobile Wireless Sys
Concurrency and ADTs • An invocation and its matching response are not simultaneous • in fact, other operations or partial operations can intervene • Various consistency conditions have been proposed to specify what the behavior should be in this case • This paper focuses on a strong condition called atomicity or linearizability: each operation should "appear" to take effect at some instant between its invocation and its response. • must be able to reorder the invocations and responses so that there are no overlapping operations and • new sequence is legal (according to ADT spec) and • new sequence respects relative order of non-overlapping operations Discrete Algs for Mobile Wireless Sys
Focal Point Emulator • Algorithm that allows mobile nodes moving in and out of a focal point to implement an atomic object (of any ADT) for that FP • nodes communicate with distributed clients through GeoCast service • Relevant processes: • client application • FPE Client: runs on every mobile node that wants to access this particular atomic FPO • FPE Server: runs on every node but is only active when that node is in the FP corresponding to the object Discrete Algs for Mobile Wireless Sys
FPE Algorithm Information Flow • Application client sends invocations to and receive responses from FPE Client • FPE Client tags invocation and GeoCasts it to appropriate FP • Tagged invocation is received by all FPE Servers in the FP • FPE Servers use local bcast service (LBCast) to coordinate and determine an ordering of the invocations • FPE Servers update their local replicas of the data object (using the ADT specification) and GeoCast responses back to the FPE client • FPE client filters duplicate responses and sends response to application client Discrete Algs for Mobile Wireless Sys
More Detail on FPE Server Algorithm • When node enters FP, it executes a join protocol to get recent version of simulated state of FPO • When node gets a GeoCast msg containing an invocation, it resends it to the FP using LBCast • causes it to become ordered w.r.t. all other LBCast msgs • Bookkeeping to eliminate duplicates • Each node executes invocations on its local replica in LBCast order • After executing each invocation, node GeoCasts response to appropriate FPE Client Discrete Algs for Mobile Wireless Sys
Correctness of FPE Algorithm • Main point is to show that there is a total ordering of the FPO operations that satisfies the definition of atomicity: • For the total ordering of the operations, use the order of the first LBCast message sent on behalf of each operation • Now we have atomic focal point objects, of any type we like: • can use them in algorithms to solve other problems Discrete Algs for Mobile Wireless Sys
Implementing an Atomic R/W Shared Variable Using FPOs • Algorithm is called Operation Manager (OM). • It uses quorum systems: • It is robust: can tolerate some of the focal point objects failing (i.e., becoming depopulated) • It is flexible: can change the quorum system (reconfigure) on the fly to improve performance Discrete Algs for Mobile Wireless Sys
Aside on Quorum Systems • A quorum is set of elements, in our case a set of focal points (or FPOs) • A quorum system is a collection of quorums satisfying certain properties, in our case… • Quorums are partitioned into put-quorums and get-quorums • Every get-quorum must intersect every put-quorum • If up to f focal points fail, then at least one get-quorum and one put-quorum must survive intact • f is a fault-tolerance parameter Discrete Algs for Mobile Wireless Sys
Configurations • A configuration is a particular quorum system. • Consider situation when there are several pre-defined quorum systems • Algorithm will be able to switch between them dynamically Discrete Algs for Mobile Wireless Sys
Reconfiguration Example • Suppose focal points are grouped into clusters based on geographical proximity. • Quorum system 1: All FPs in one cluster form a get-quorum. The put-quorums consist of all sets containing one FP from each cluster • accessing a get-quorum will likely be cheap (find a close-by cluster) • accessing a put-quorum will be more expensive (must communicate all over the place) • Quorum system 2: All FPs in one cluster form a put-quorum. The get-quorums consist of all sets containing one FP from each cluster • has the reverse performance Discrete Algs for Mobile Wireless Sys
Reconfiguration Example (cont'd) • Suppose read operations on the shared r/w variable primarily use get-quorums and write operations primarily use put-quorums. • If, in the application using the shared r/w variable, reads are more common than writes, configuration (1) is preferable to configuration (2), and vice versa. • If relative mix of reads and writes changes over time, we liked to dynamically reconfigure (go from using (1) to using (2)). Discrete Algs for Mobile Wireless Sys
What Kind of FPOs are Needed by OM Algorithm? • Each FPO (the individual elements of the quorums) is an instance of special ADT called a put/get variable. • State: • value: value of r/w variable being implemented • tag: counter, allows ops to be ordered • config-id: largest config-id seen so far • confirmed-set: a set of tags • recon-ip: indicates if a reconfig is in progress • Operations: • put: updates value under some circumstances, returns some info • get: returns value and some other info, also modifies state • confirm: adds its parameter to confirmed-set • recon-done: indicates that reconfig is finished Discrete Algs for Mobile Wireless Sys
Highlights of OM Algorithm • Uses the put/get shared variables provided by the FPs as replicas: • uses put operation to update them • uses get operation to retrieve values • Write operation: takes one phase, a put phase, that propagates new value to (at least) a quorum of FPOs • choose a set of FPOs and invoke put ops on them • If responses indicate agreement over current config, done • O.w. (a reconfig might be in progress), wait for a response from at least one quorum in every config • invoke confirm op on FPOs Discrete Algs for Mobile Wireless Sys
Highlights of OM Algorithm (cont'd) • Read operation: takes either 1 phase (a get phase that retrieves value from a quorum of FPOs) or 2 phases (a get phase followed by a put phase) • choose a set of FPOs and invoke get op on them • if responses indicate agreement over current config, then wait for response from all FPOs in any quorum of that config • o.w. wait for response from at least one quorum in every config • choose value associated with largest tag of all responses • If tag is confirmed, return value • o.w. go to second phase, a put phase (similar to Write) Discrete Algs for Mobile Wireless Sys
Highlights of OM Algorithm (cont'd) • A separate component is assumed to control the decision when to reconfigure the quorum system and what the new configuration should be. • Important point is that the set of possible configurations is fixed and known in advance. • Algorithm for doing reconfiguration is similar to a 2-phase read. Discrete Algs for Mobile Wireless Sys
Correctness of OM Algorithm • Must show that the read and write operations implemented by OM algorithm satisfy atomicity: • there is a way to order them that is legal and respects relative order of non-overlapping operations. • Use the value of the tag variable in the OM's state at the time when a read or write completes to order the operations. • Key point is to show that if operation o1 finishes before operation o2 starts, then o2 does not precede o1 in the ordering. • Case analysis… Discrete Algs for Mobile Wireless Sys
Open Questions • Other uses of FPO model? • routing, resource allocation,… • Hybrid systems? • some areas have fixed infrastructure, other's don't, move seamlessly between them • Recovery of FPOs and the algorithms on top the FPO layer? • How to choose reconfigurations? How many? • use competitive analysis to decide on the fly what the currently best config is • Other implementations of the FPO model? • leader-based • get rid of powerful LBCast and GPS assumptions • how to choose a good set of FPs, how to map them, how to change them on the fly Discrete Algs for Mobile Wireless Sys