Advanced Operating Systems Lecture notes http gost isi

  • Slides: 106
Download presentation
Advanced Operating Systems Lecture notes http: //gost. isi. edu/555 Dr. Clifford Neuman University of

Advanced Operating Systems Lecture notes http: //gost. isi. edu/555 Dr. Clifford Neuman University of Southern California Information Sciences Institute Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Administration v. Assignment 1 has been posted v. Interim TA Contact Information q Young-Jin

Administration v. Assignment 1 has been posted v. Interim TA Contact Information q Young-Jin Kim § Temporary Office RTH 418 (213) 821 -5627 § Office Hours M/F 10 AM 11: 30 AM Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

CSci 555: Advanced Operating Systems Lecture 2 – Communications Models September 7, 2007 Dr.

CSci 555: Advanced Operating Systems Lecture 2 – Communications Models September 7, 2007 Dr. Clifford Neuman University of Southern California Information Sciences Institute Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Outline: Communications Models v Communication Models: q General concepts. q Message passing. q Distributed

Outline: Communications Models v Communication Models: q General concepts. q Message passing. q Distributed shared memory (DSM). q Remote procedure call (RPC) [Birrel et al. ] § Light-weight RPC [Bershad et al. ] q DSM case studies § IVY [Li et al. ] § Linda [Carriero et al. ] Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

COVERED LAST LECTURE Communication Models v. Support for processes to communicate among themselves. v.

COVERED LAST LECTURE Communication Models v. Support for processes to communicate among themselves. v. Traditional (centralized) OS’s: q Provide local (within single machine) communication support. q Distributed OS’s: must provide support for communication across machine boundaries. § Over LAN or WAN. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

COVERED LAST LECTURE Communication Paradigms v 2 paradigms q Message Passing (MP) q Distributed

COVERED LAST LECTURE Communication Paradigms v 2 paradigms q Message Passing (MP) q Distributed Shared Memory (DSM) v Message Passing q Processes communicate by sending messages. v Distributed Shared Memory q Communication through a “virtual shared memory”. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

COVERED LAST LECTURE Message Passing v Basic communication primitives: q Send message. Send q

COVERED LAST LECTURE Message Passing v Basic communication primitives: q Send message. Send q Receive message. Receive Sending Q. . . Receiving Q. . . v Modes of communication: q Synchronous versus asynchronous. v Semantics: q Reliable versus unreliable. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Synchronous Communication v. Blocking send q Blocks until message is transmitted q Blocks until

Synchronous Communication v. Blocking send q Blocks until message is transmitted q Blocks until message acknowledged v. Blocking receive q Waits for message to be received v. Process synchronization. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Asynchronous Communication v Non-blocking send: sending process continues as soon message is queued. v

Asynchronous Communication v Non-blocking send: sending process continues as soon message is queued. v Blocking or non-blocking receive: q Blocking: § Timeout. § Threads. q Non-blocking: proceeds while waiting for message. § Message is queued upon arrival. § Process needs to poll or be interrupted. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Reliability of Communication v Unreliable communication: q “best effort” - send and hope for

Reliability of Communication v Unreliable communication: q “best effort” - send and hope for the best q No ACKs or retransmissions. q Application must provide its own reliability. q Example: User Datagram Protocol (UDP) § Applications using UDP either don’t need reliability or build their own (e. g. , UNIX NFS and DNS (both UDP and TCP), some audio or video applications) Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Reliability of Communication v Reliable communication: q Different degrees of reliability. q Processes have

Reliability of Communication v Reliable communication: q Different degrees of reliability. q Processes have some guarantee that messages will be delivered. q Example: Transmission Control Protocol (TCP) q Reliability mechanisms: § Positive acknowledgments (ACKs). § Negative Acknowledgments (NACKs). q Possible to build reliability atop unreliable service (E 2 E argument). Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Distributed Shared Memory v. Motivated by development of sharedmemory multiprocessors which do share memory.

Distributed Shared Memory v. Motivated by development of sharedmemory multiprocessors which do share memory. v. Abstraction used for sharing data among processes running on machines that do not share memory. v. Processes think they read from and write to a “virtual shared memory”. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

DSM 2 v. Primitives: read and write. v. OS ensures that all processes see

DSM 2 v. Primitives: read and write. v. OS ensures that all processes see all updates. q Happens transparently to processes. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

DSM and MP v DSM is an abstraction! q Gives programmers the flavor of

DSM and MP v DSM is an abstraction! q Gives programmers the flavor of a centralized memory system, which is a well-known programming environment. q No need to worry about communication and synchronization. v But, it is implemented atop MP. q No physically shared memory. q OS takes care of required communication. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Caching in DSM v For performance, DSM caches data locally. q More efficient access

Caching in DSM v For performance, DSM caches data locally. q More efficient access (locality). q But, must keep caches consistent. q Caching of pages for of page-based DSM. v Issues: q Page size. q Consistency mechanism. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Approaches to DSM v. Hardware-based: q Multi-processor architectures with processor-memory modules connected by high-speed

Approaches to DSM v. Hardware-based: q Multi-processor architectures with processor-memory modules connected by high-speed LAN (E. g. , Stanford’s DASH). q Specialized hardware to handle reads and writes and perform required consistency mechanisms. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Approaches to DSM v. Page-based: q Example: IVY. q DSM implemented as region of

Approaches to DSM v. Page-based: q Example: IVY. q DSM implemented as region of processor’s virtual memory; occupies same address space range for every participating process. q OS keeps DSM data consistency as part of page fault handling. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Approaches to DSM v. Library-based: q Or language-based. q Example: Linda. q Language or

Approaches to DSM v. Library-based: q Or language-based. q Example: Linda. q Language or language extensions. q Compiler inserts appropriate library calls whenever processes access DSM items. q Library calls access local data and communicate when necessary. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

DSM Case Studies: IVY v Environment: ”loosely coupled” multiprocessor. q Memory is physically distributed.

DSM Case Studies: IVY v Environment: ”loosely coupled” multiprocessor. q Memory is physically distributed. q Memory mapping managers (OS kernel): § Map local memories to shared virtual space. § Local memory as cache of shared virtual space. § Memory reference may cause page fault; page retrieved and consistency handled. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

IVY v. Issues: q Read-only versus writable data. q Locality of reference. q Granularity

IVY v. Issues: q Read-only versus writable data. q Locality of reference. q Granularity (1 Kbyte page size). § Bigger pages versus smaller pages. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

IVY v. Memory coherence strategies: q Page synchronization § Invalidation § Write broadcast q

IVY v. Memory coherence strategies: q Page synchronization § Invalidation § Write broadcast q Page ownership § Fixed: page always owned by same processor § Dynamic Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

IVY Page Synchronization v Invalidation: q On write fault, invalidate all copies; give faulting

IVY Page Synchronization v Invalidation: q On write fault, invalidate all copies; give faulting process write access; gets copy of page if not already there. q Problem: must update page on reads. v Write broadcast: q On write fault, fault handler writes to all copies. q Expensive! Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

IVY Memory Coherence v. Paper discusses approaches to memory coherence in page-based DSM. q

IVY Memory Coherence v. Paper discusses approaches to memory coherence in page-based DSM. q Centralized: single manager residing on a single processor managing all pages. q Distributed: multiple managers on multiple processors managing subset of pages. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

DSM Case Studies: Linda v Language-based approach to DSM. v Environment: q Similar to

DSM Case Studies: Linda v Language-based approach to DSM. v Environment: q Similar to IVY, ie, loosely coupled machines connected via fast broadcast bus. q Instead of shared address space, processes make library calls inserted by compiler when accessing DSM. q Libraries access local data and communicate to maintain consistency. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Linda v. DSM: tuple space. v. Basic operations: q out (data): data added to

Linda v. DSM: tuple space. v. Basic operations: q out (data): data added to tuple space. q in (data): removes matching data from TS; destructive. q read (data): same as “in”, but tuple remains in TS (non-destructive). Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Linda Primitives: Examples vout (“P”, 5, false) : tuple (“P”, 5, false) added to

Linda Primitives: Examples vout (“P”, 5, false) : tuple (“P”, 5, false) added to TS. q “P” : name q Other components are data values. q Implementation reported on the paper: every node stores complete copy of TS. q out (data) causes data to be broadcast to every node. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Linda Primitives: Examples vin (“P”, int I, bool b): tuple (“P”, 5, false) removed

Linda Primitives: Examples vin (“P”, int I, bool b): tuple (“P”, 5, false) removed from TS. q If matching tuple found locally, local kernel tries to delete tuple on all nodes. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Remote Procedure Call v Builds on MP. v Main idea: extend traditional (local) procedure

Remote Procedure Call v Builds on MP. v Main idea: extend traditional (local) procedure call to perform transfer of control and data across network. v Easy to use: analogous to local calls. v But, procedure is executed by a different process, probably on a different machine. v Fits very well with client-server model. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

RPC Mechanism 1. Invoke RPC. 2. Calling process suspends. 3. Parameters passed across network

RPC Mechanism 1. Invoke RPC. 2. Calling process suspends. 3. Parameters passed across network to target machine. 4. Procedure executed remotely. 5. When done, results passed back to caller. 6. Caller resumes execution. Is this synchronous or asynchronous? Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

RPC Advantages v. Easy to use. v. Well-known mechanism. v. Abstract data type q

RPC Advantages v. Easy to use. v. Well-known mechanism. v. Abstract data type q Client-server model. q Server as collection of exported procedures on some shared resource. q Example: file server. v. Reliable. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

RPC Semantics 1 v. Delivery guarantees. v“Maybe call”: q Clients cannot tell for sure

RPC Semantics 1 v. Delivery guarantees. v“Maybe call”: q Clients cannot tell for sure whether remote procedure was executed or not due to message loss, server crash, etc. q Usually not acceptable. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

RPC Semantics 2 v“At-least-once” call: q Remote procedure executed at least once, but maybe

RPC Semantics 2 v“At-least-once” call: q Remote procedure executed at least once, but maybe more than once. q Retransmissions but no duplicate filtering. q Idempotent operations OK; e. g. , reading data that is read-only. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

RPC Semantics 3 v “At-most-once” call q Most appropriate for non-idempotent operations. q Remote

RPC Semantics 3 v “At-most-once” call q Most appropriate for non-idempotent operations. q Remote procedure executed 0 or 1 time, ie, exactly once or not at all. q Use of retransmissions and duplicate filtering. q Example: Birrel et al. implementation. § Use of probes to check if server crashed. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

RPC Implementation (Birrel et al. ) User call Caller User stub pck args RPC

RPC Implementation (Birrel et al. ) User call Caller User stub pck args RPC runtime Call packet xmit Callee RPC Server runtime stub rcv unpk Server call work Result return unpk result rcv xmit pck result Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE return

RPC Implementation 2 v. RPC runtime mechanism responsible for retransmissions, acknowledgments. v. Stubs responsible

RPC Implementation 2 v. RPC runtime mechanism responsible for retransmissions, acknowledgments. v. Stubs responsible for data packaging and un-packaging; q AKA marshalling and unmarshalling: putting data in form suitable for transmission. Example: Sun’s XDR. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Binding v How to determine where server is? Which procedure to call? q “Resource

Binding v How to determine where server is? Which procedure to call? q “Resource discovery” problem § Name service: advertises servers and services. § Example: Birrel et al. uses Grapevine. v Early versus late binding. q Early: server address and procedure name hard-coded in client. q Late: go to name service. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Synchronous & Asynchronous RPC Synchronous Client Server Asynchronous Client Server Copyright © 1995 -2005

Synchronous & Asynchronous RPC Synchronous Client Server Asynchronous Client Server Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

RPC Performance v Sources of overhead q data copying q scheduling and context switch.

RPC Performance v Sources of overhead q data copying q scheduling and context switch. v Light-Weight RPC q Shows that most invocations took place on a single machine. q LW-RPC: improve RPC performance for local case. q Optimizes data copying and thread scheduling for local case. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

LW-RPC 1 v. Argument copying q RPC: 4 times q copying between kernel and

LW-RPC 1 v. Argument copying q RPC: 4 times q copying between kernel and user space. q LW-RPC: common data area (A-stack) shared by client and server and used to pass parameters and results; access by client or server, one at a time. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

LW-RPC 2 v. A-stack avoids copying between kernel and user spaces. v. Client and

LW-RPC 2 v. A-stack avoids copying between kernel and user spaces. v. Client and server share the same thread: less context switch (like regular calls). user 1. copy args 2. traps client A 4. executes & returns 3. upcall server kernel Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

CSci 555: Advanced Operating Systems Lecture 3 – Distributed Concurrency, Transactions, Deadlock 14 September

CSci 555: Advanced Operating Systems Lecture 3 – Distributed Concurrency, Transactions, Deadlock 14 September 2007 DRAFT SLIDES MAY CHANGE BEFORE NEXT WEEK Dr. Clifford Neuman University of Southern California Information Sciences Institute (lecture slides written by Dr. Katia Obraczka) Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Today v. Concurrency and Synchronization [Hauser et al. ] v. Transactions [Spector et al.

Today v. Concurrency and Synchronization [Hauser et al. ] v. Transactions [Spector et al. ] v. Distributed Deadlocks [Chandy et al. ] v. Replication [Birman and Gifford] v. Time in Distributed Systems [Lamport and Jefferson] Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Concurrency Control and Synchronization v How to control and synchronize possibly conflicting operations on

Concurrency Control and Synchronization v How to control and synchronize possibly conflicting operations on shared data by concurrent processes? v First, some terminology. q Processes. q Light-weight processes. q Threads. q Tasks. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Processes v. Text book: q Processing activity associated with an execution environment, ie, address

Processes v. Text book: q Processing activity associated with an execution environment, ie, address space and resources (such as communication and synchronization resources). Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Threads v OS abstraction of an activity/task. q Execution environment expensive to create and

Threads v OS abstraction of an activity/task. q Execution environment expensive to create and manage. q Multiple threads share single execution environment. q Single process may spawn multiple threads. q Maximize degree of concurrency among related activities. q Example: multi-threaded servers allow concurrent processing of client requests. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Other Terminology v. Process versus task/thread. q Process: heavy-weight unit of execution. q Task/thread:

Other Terminology v. Process versus task/thread. q Process: heavy-weight unit of execution. q Task/thread: light-weight unit of execution. P 2 P 1 t 2 t 11 t 12 Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Threads Case Study 1 v Hauser et al. v Examine use of user-level threads

Threads Case Study 1 v Hauser et al. v Examine use of user-level threads in 2 OS’s: q Xerox Parc’s Cedar (research). q GVX (commercial version of Cedar). v Study dynamic thread behavior. q Classes of threads (eternal, worker, transient) q Number of threads. q Thread lifetime. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Thread Paradigms v Different categories of usage: q Defer work: thread does work not

Thread Paradigms v Different categories of usage: q Defer work: thread does work not vital to the main activity. § Examples: printing a document, sending mail. q Pumps: used in pipelining; use output of a thread as input and produce output to be consumed by another task. q Sleepers: tasks that repeatedly wait for an event to execute; e. g. , check for network connectivity every x seconds. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Synchronization v. So far, how one defines/activates concurrent activities. v. But how to control

Synchronization v. So far, how one defines/activates concurrent activities. v. But how to control access to shared data and still get work done? v. Synchronization via: q Shared data [DSM model]. q Communication [MP model]. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Synchronization by Shared Data v. Primitives flexibility structure q Semaphores. q Conditional critical regions.

Synchronization by Shared Data v. Primitives flexibility structure q Semaphores. q Conditional critical regions. q Monitors. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Synchronization by MP v. Explicit communication. v. Primitives send and receive § Blocking send,

Synchronization by MP v. Explicit communication. v. Primitives send and receive § Blocking send, blocking receive: sender and receiver are blocked until message is delivered (redezvous) § Nonblocking send, blocking receive: sender continues processing receiver is blocked until the requested message arrives § Nonblocking send, nonblocking receive: messages are sent to a shared data structure consisting of queues (mailboxes) Deadlocks ? • Mailboxes one process sends a message to the mailbox and the other process picks up the message from the mailbox Example: Send (mailbox, msg) Receive (mailbox, msg) Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Transactions v Database term. q Execution of program that accesses a database. v In

Transactions v Database term. q Execution of program that accesses a database. v In distributed systems, q Concurrency control in the client/server model. q From client’s point of view, sequence of operations executed by server in servicing client’s request in a single step. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Transaction Properties v. ACID: Atomicity: a transaction is an atomic unit of processing and

Transaction Properties v. ACID: Atomicity: a transaction is an atomic unit of processing and it is either performed entirely or not at all Consistency: a transaction's correct execution must take the database from one correct state to another Isolation: the updates of a transaction must not be made visible to other transactions until it is committed Durability: if transaction commits, the results must never be lost because of subsequent failure Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Transaction Atomicity v “All or nothing”. v Sequence of operations to service client’s request

Transaction Atomicity v “All or nothing”. v Sequence of operations to service client’s request are performed in one step, ie, either all of them are executed or none are. v Start of a transaction is a continuation point to which it can roll back. v Issues: q Multiple concurrent clients: “isolation”. 1. Each transaction accesses resources as if there were no other concurrent transactions. 2. Modifications of the transaction are not visible to other resources before it finishes. 3. Modifications of other transactions are not visible during the transaction at all. q Server failures: “failure atomicity”. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Transaction Features v Recoverability: server should be able to “roll back” to state before

Transaction Features v Recoverability: server should be able to “roll back” to state before transaction execution. v Serializability: transactions executing concurrently must be interleaved in such a way that the resulting state is equal to some serial execution of the transactions v Durability: effects of transactions are permanent. q A completed transaction is always persistent (though values may be changed by later transactions). q Modified resources must be held on persistent storage before transaction can complete. May not just be disk but can include battery-backed RAM. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Concurrency Control Maintain transaction serializability: § establish order of concurrent transaction execution § Interleave

Concurrency Control Maintain transaction serializability: § establish order of concurrent transaction execution § Interleave execution of operations to ensure serializability v. Basic Server operations: read or write. v 3 mechanisms: q Locks. q Optimistic concurrency control. q Timestamp ordering. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Locks v Lock granularity: affects level of concurrency. q q 1 lock per shared

Locks v Lock granularity: affects level of concurrency. q q 1 lock per shared data item. Shared Read § Exists when concurrent transactions granted READ access § Issued when transaction wants to read and exclusive lock not held on item q Exclusive Write § Exists when access reserved for locking transaction § Used when potential for conflict exists § Issued when transaction wants to update unlocked data • Many Read locks simultaneously possible for a given item, but only one Write lock • Transaction that requests a lock that cannot be granted must wait Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Lock Implementation v. Server lock manager q Maintains table of locks for server data

Lock Implementation v. Server lock manager q Maintains table of locks for server data items. q Lock and unlock operations. q Clients wait on a lock for given data until data is released; then client is signalled. q Each client’s request runs as separate server thread. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Deadlock v Use of locks can lead to deadlock. v Deadlock: each transaction waits

Deadlock v Use of locks can lead to deadlock. v Deadlock: each transaction waits for another transaction to release a lock forming a wait cycle. T 1 T 2 v Deadlock condition: cycle in the wait-for graph. v Deadlock prevention and detection. q require all locks to be acquired at once Problems? q Ordering of data items: once a transaction locks an item, it cannot lock anything occurring earlier in the ordering v Deadlock resolution: lock timeout. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE T 3

Optimistic Concurrency Control 1 v. Assume that most of the time, probability of conflict

Optimistic Concurrency Control 1 v. Assume that most of the time, probability of conflict is low. v. Transactions allowed to proceed in parallel until close transaction request from client. v. Upon close transaction, checks for conflict; if so, some transactions aborted. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Optimistic Concurrency 2 v Read phase q q Transactions have tentative version of data

Optimistic Concurrency 2 v Read phase q q Transactions have tentative version of data items it accesses. § Transaction reads data and stores in local variables § Any writes are made to local variables without updating the actual data Tentative versions allow transactions to abort without making their effect permanent. v Validation phase q Executed upon close transaction. q Checks serially equivalence. q If validation fails, conflict resolution decides which transaction(s) to abort. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Optimistic Concurrency 3 v. Write phase q If transaction is validated, all of its

Optimistic Concurrency 3 v. Write phase q If transaction is validated, all of its tentative versions are made permanent. q Read-only transactions commit immediately. q Write transactions commit only after their tentative versions are recorded in permanent storage. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Timestamp Ordering v. Uses timestamps to order transactions accessing same data items according to

Timestamp Ordering v. Uses timestamps to order transactions accessing same data items according to their starting times. v. Assigning timestamps: q Clock based: assign global unique time stamp to each transaction q Monotonically increasing counter. v. Some time stamping necessary to avoid “livelock”: where a transaction cannot acquire any locks because of unfair waiting algorithm Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Local versus Distributed Transactions v Local transactions: q All transaction operations executed by single

Local versus Distributed Transactions v Local transactions: q All transaction operations executed by single server. v Distributed transactions: q Involve multiple servers. v Both local and distributed transactions can be simple or nested. q Nesting: increase level of concurrency. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Distributed Transactions 1 s 111 T 1 c T 2 s 11 c s

Distributed Transactions 1 s 111 T 1 c T 2 s 11 c s 112 s 1 T 3 s 3 Simple Distributed Transaction s 12 Nested Distributed Transaction Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE s 121

Distributed Transactions 2 v. Transaction coordinator q First server contacted by client. q Responsible

Distributed Transactions 2 v. Transaction coordinator q First server contacted by client. q Responsible for aborting/committing. q Adding workers. v. Workers q Other servers involved report their results to the coordinator and follow its decisions. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Atomicity in Distributed Transactions v Harder: several servers involved. v Atomic commit protocols q

Atomicity in Distributed Transactions v Harder: several servers involved. v Atomic commit protocols q 1 -phase commit § Example: coordinator sends “commit” or “abort” to workers; keeps re-broadcasting until it gets ACK from all of them that request was performed. § Inefficient. § How to ensure that all of the servers vote + that they all reach the same decision. It is simple if no errors occur, but the protocol must work correctly even when server fails, messages are lost, etc. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

2 -Phase Commit 1 v. First phase: voting q Each server votes to commit

2 -Phase Commit 1 v. First phase: voting q Each server votes to commit or abort transaction. v. Second phase: carrying out joint decision. q If any server votes to abort, joint decision is to abort. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

2 -Phase Commit 2 v Phase I: Each participant votes for the transaction to

2 -Phase Commit 2 v Phase I: Each participant votes for the transaction to be committed or aborted. q Participants must ensure to carry out its part of commit protocol. (prepared state). q Each participant saves in permanent storage all of the objects that it has altered in transaction to be in 'prepared state'. v Phase II: q Every participant in the transaction carries out the joint decision. q If any one participant votes to abort, then the decision is to abort. q If all participants vote to commit, then the decision is to commit. q Coordinator 1. Prepared to commit? Can com mit? Yes/No Do commi 3. Committed. 5. End. Workers t/aborted a / d e t t i m ve com 2. Prepared to commit/abort 4. Committed/aborted. Ha Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Concurrency Control in Distributed Transactions 1 v Locks q Each server manages locks for

Concurrency Control in Distributed Transactions 1 v Locks q Each server manages locks for its own data. q Locks cannot be released until transaction committed or aborted on all servers involved. q Lock managers in different servers set their locks independently, there are chances of different transaction orderings. q The different ordering lead to cyclic dependencies between transactions and a distributed deadlock situation. q When a deadlock is detected, a transaction is aborted to resolve the deadlock Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Concurrency Control in Distributed Transactions 2 v. Timestamp Ordering q Globally unique timestamps. §

Concurrency Control in Distributed Transactions 2 v. Timestamp Ordering q Globally unique timestamps. § Coordinator issues globally unique TS and passes it around. § TS: <server id, local TS> q Servers are jointly responsible for ensuring that they performed in a serially equivalent manner. q Clock synchronization issues Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Concurrency Control in Distributed Transactions 3 v. Optimistic concurrency control q Each transaction should

Concurrency Control in Distributed Transactions 3 v. Optimistic concurrency control q Each transaction should be validated before it is allowed to commit. q The validation at all servers takes place during the first phase of the 2 -Phase Commit Protocol. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Camelot [Spector et al. ] v Supports execution of distributed transactions. v Specialized functions:

Camelot [Spector et al. ] v Supports execution of distributed transactions. v Specialized functions: q Disk management § Allocation of large contiguous chunks. q Recovery management § Transaction abort and failure recovery. q Transaction management § Abort, commit, and nest transactions. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Distributed Deadlock 1 v When locks are used, deadlock can occur. v Circular wait

Distributed Deadlock 1 v When locks are used, deadlock can occur. v Circular wait in wait-for graph means deadlock. v Centralized deadlock detection, prevention, and resolutions schemes. q Examples: § Detection of cycle in wait-for graph. § Lock timeouts: hard to set TO value, aborting unnecessarily. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Distributed Deadlock 2 v. Much harder to detect, prevent, and resolve. Why? q No

Distributed Deadlock 2 v. Much harder to detect, prevent, and resolve. Why? q No global view. q No central agent. q Communication-related problems § Unreliability. § Delay. § Cost. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Distributed Deadlock Detection v. Cycle in the global wait-for graph. v. Global graph can

Distributed Deadlock Detection v. Cycle in the global wait-for graph. v. Global graph can be constructed from local graphs: hard! q Servers need to communicate to find cycles. v. Example from book. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Distributed Deadlock Detection Algorithms 1 v [Chandy et al. ] v Message sequencing is

Distributed Deadlock Detection Algorithms 1 v [Chandy et al. ] v Message sequencing is preserved. v Resource versus communication models. q Resource model § Processes, resources, and controllers. § Process requests resource from controller. q Communication model § Processes communicate directly via messages (request, grant, etc) requesting resources. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Resource versus Communication Models v In resource model, controllers are deadlock detection agents; in

Resource versus Communication Models v In resource model, controllers are deadlock detection agents; in communication model, processes. v In resource model, process cannot continue until all requested resources granted; in communication model, process cannot proceed until it can communicate with at least one process it’s waiting for. v Different models, different detection alg’s. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Distributed Deadlock Detection Schemes v. Graph-theory based. v. Resource model: deadlock when cycle among

Distributed Deadlock Detection Schemes v. Graph-theory based. v. Resource model: deadlock when cycle among dependent processes. v. Communication model: deadlock when knot (all vertices that can be reached from i can also reach i) of waiting processes. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Deadlock Detection in Resource Model v. Use probe messages to follow edges of wait-for

Deadlock Detection in Resource Model v. Use probe messages to follow edges of wait-for graph (aka edge chasing). v. Probe carries transaction wait-for relations representing path in global wait-for graph. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Deadlock Detection Example 1. Server 1 detects transaction T is waiting for U, which

Deadlock Detection Example 1. Server 1 detects transaction T is waiting for U, which is waiting for data from server 2. 2. Server 1 sends probe T->U to server 2. 3. Server 2 gets probe and checks if U is also waiting; if so (say for V), it adds V to probe T->U->V. If V is waiting for data from server 3, server 2 forwards probe. 4. Paths are built one edge at a time. Before forwarding probe, server checks for cycle (e. g. , T->U->V->T). 5. If cycle detected, a transaction is aborted. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Replication requires synchronization v Keep more than one copy of data item. v Technique

Replication requires synchronization v Keep more than one copy of data item. v Technique for improving performance in distributed systems. v In the context of concurrent access to data, replicate data for increase availability. q Improved response time. q Improved availability. q Improved fault tolerance. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Replication 2 v But nothing comes for free. v What’s the tradeoff? q Consistency

Replication 2 v But nothing comes for free. v What’s the tradeoff? q Consistency maintenance. v Consistency maintenance approaches: q Lazy consistency (gossip approach). § An operation call is executed at just one replica; updating of other replicas happens by lazy exchange of “gossip” messages. q q Quorum consensus is based on voting techniques. Process group. Stronger consistency Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Quorum Consensus v. Goal: prevent partitions from producing inconsistent results. v. Quorum: subgroup of

Quorum Consensus v. Goal: prevent partitions from producing inconsistent results. v. Quorum: subgroup of replicas whose size gives it the right to carry out operations. v. Quorum consensus replication: q Update will propagate successfully to a subgroup of replicas. q Other replicas will have outdated copies but will be updated off-line. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Weighted Voting [Gifford] 1 v. Every copy assigned a number of votes (weight assigned

Weighted Voting [Gifford] 1 v. Every copy assigned a number of votes (weight assigned to a particular replica). v. Read: Must obtain R votes to read from any up-to-date copy. v. Write: Must obtain write quorum of W before performing update. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Weighted Voting 2 v. W > 1/2 total votes, R+W > total votes. v.

Weighted Voting 2 v. W > 1/2 total votes, R+W > total votes. v. Ensures non-null intersection between every read quorum and write quorum. v. Read quorum guaranteed to have current copy. v. Freshness is determined by version numbers. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Weighted Voting 3 v On read: q Try to find enough copies, ie, total

Weighted Voting 3 v On read: q Try to find enough copies, ie, total votes no less than R. Not all copies need to be current. q Since it overlaps with write quorum, at least one copy is current. v On write: q Try to find set of up-to-date replicas whose votes no less than W. q If no sufficient quorum, current copies replace old ones, then update. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Time in Distributed Systems v. Notion of time is critical. v“Happened before” notion. q

Time in Distributed Systems v. Notion of time is critical. v“Happened before” notion. q Example: concurrency control using TSs. q “Happened before” notion is not straightforward in distributed systems. § No guarantees of synchronized clocks. § Communication latency. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Event Ordering v. Lamport defines partial ordering (→): 1. If X and Y events

Event Ordering v. Lamport defines partial ordering (→): 1. If X and Y events occurred in the same process, and X comes before Y, then X→Y. 2. Whenever X sends a message to Y, then X→Y. 3. If X→Y and Y→Z, then X→Z. 4. X and Y are concurrent if X→Y and Y→Z Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Causal Ordering v“Happened before” also called causal ordering. v. In summary, possible to draw

Causal Ordering v“Happened before” also called causal ordering. v. In summary, possible to draw happened-before relationship between events if they happen in same process or there’s chain of messages between them. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Logical Clocks v. Monotonically increasing counter. v. No relation with real clock. v. Each

Logical Clocks v. Monotonically increasing counter. v. No relation with real clock. v. Each process keeps its own logical clock Cp used to timestamp events. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Causal Ordering and Logical Clocks 1. Cp incremented before each event. Cp=Cp+1. 2. When

Causal Ordering and Logical Clocks 1. Cp incremented before each event. Cp=Cp+1. 2. When p sends message m, it piggybacks t=Cp. 3. When q receives (m, t), it computes: Cq=max(Cq, t) before timestamping message receipt event. Example: text book page 398. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Total Ordering v. Extending partial to total order. v. Global timestamps: q (Ta, pa),

Total Ordering v. Extending partial to total order. v. Global timestamps: q (Ta, pa), where Ta is local TS and pa is the process id. q (Ta, pa) < (Tb, pb) iff Ta < Tb or T a=Tb and pa<pb q Total order consistent with partial order. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Virtual Time [Jefferson] v. Time warp mechanism. v. May or may not have connection

Virtual Time [Jefferson] v. Time warp mechanism. v. May or may not have connection with real time. v. Uses optimistic approach, i. e. , events and messages are processed in the order received: “look-ahead”. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Local Virtual Clock v. Process virtual clock set to TS of next message in

Local Virtual Clock v. Process virtual clock set to TS of next message in input queue. v. If next message’s TS is in the past, rollback! q Can happen due to different computation rates, communication latency, and unsynchronized clocks. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Rolling Back v Process goes back to TS(last message). v Cancels all intermediate effects

Rolling Back v Process goes back to TS(last message). v Cancels all intermediate effects of events whose TS > TS(last message). v Then, executes forward. v Rolling back is expensive! q Messages may have been sent to other processes causing them to send messages, etc. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Anti-Messages 1 v. For every message, there is an antimessage with same content but

Anti-Messages 1 v. For every message, there is an antimessage with same content but different sign. v. When sending message, message goes to receiver input queue and a copy with “-” sign is enqueued in the sender’s output queue. v. Message is retained for use in case of roll back. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Anti-Message 2 v. Message + its anti-message = 0 when in the same queue.

Anti-Message 2 v. Message + its anti-message = 0 when in the same queue. v. Processes must keep log to “undo” operations. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Implementation v. Local control. v. Global control q How to make sure system as

Implementation v. Local control. v. Global control q How to make sure system as a whole progresses. q “Committing” errors and I/O. q Avoid running out of memory. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Global Virtual Clock v Snapshot of system at given real time. v Minimum of

Global Virtual Clock v Snapshot of system at given real time. v Minimum of all local virtual times. v Lower bound on how far processes rollback. v Purge state before GVT. v GVT computed concurrently with rest of time warp mechanism. q Tradeoff? Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

ISIS 1 v Goal: provide programming environment for development of distributed systems. v Assumptions:

ISIS 1 v Goal: provide programming environment for development of distributed systems. v Assumptions: q DS as a set of processes with disjoint address spaces, communicating over LAN via MP. q Processes and nodes can crash. q Partitions may occur. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

ISIS 2 v. Distinguishing feature: group communication mechanisms q Process group: processes cooperating in

ISIS 2 v. Distinguishing feature: group communication mechanisms q Process group: processes cooperating in implementing task. q Process can belong to multiple groups. q Dynamic group membership. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Virtual Synchrony v. Real synchronous systems q Events (e. g. , message delivery) occur

Virtual Synchrony v. Real synchronous systems q Events (e. g. , message delivery) occur in the same order everywhere. q Expensive and not very efficient. v. Virtual synchronous systems q Illusion of synchrony. q Weaker ordering guarantees when applications allow it. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Atomic Multicast 1 v All destinations receive a message or none. v Primitives: q

Atomic Multicast 1 v All destinations receive a message or none. v Primitives: q ABCAST: delivers messages atomically and in the same order everywhere. q CBCAST: causally ordered multicast. § “Happened before” order. § Messages from given process in order. q GBCAST § used by system to manage group addressing. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Other Features v Process groups q Group membership management. v Broadcast and group RPC

Other Features v Process groups q Group membership management. v Broadcast and group RPC q RPC-like interface to CBCAST, ABCAST, and GBCAST protocols. q Delivery guarantees § Caller indicates how many responses required. – No responses: asynchronous. – 1 or more: synchronous. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE

Implementation v. Set of library calls on top of UNIX. v. Commercially available. v.

Implementation v. Set of library calls on top of UNIX. v. Commercially available. v. In the paper, example of distributed DB implementation using ISIS. v. HORUS: extension to WANs. Copyright © 1995 -2005 Clifford Neuman and Dongho Kim - UNIVERSITY OF SOUTHERN CALIFORNIA - INFORMATION SCIENCES INSTITUTE