Two Phase Commit Protocol. Distributed Systems. Remote Procedure Calls (RPC) Network & Distributed Operating Systems. Network OS.

Similar documents
Distributed Systems Theory 4. Remote Procedure Call. October 17, 2008

CHAPTER - 4 REMOTE COMMUNICATION

MODELS OF DISTRIBUTED SYSTEMS

Chapter 4 Communication

C 1. Recap: Finger Table. CSE 486/586 Distributed Systems Remote Procedure Call. Chord: Node Joins and Leaves. Recall? Socket API

COMMUNICATION IN DISTRIBUTED SYSTEMS

MODELS OF DISTRIBUTED SYSTEMS

Today CSCI Communication. Communication in Distributed Systems. Communication in Distributed Systems. Remote Procedure Calls (RPC)

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 22: Remote Procedure Call (RPC)

Remote Invocation. Today. Next time. l Overlay networks and P2P. l Request-reply, RPC, RMI

Operating Systems. 18. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Spring /20/ Paul Krzyzanowski

Distributed Systems 8. Remote Procedure Calls

Overview. Communication types and role of Middleware Remote Procedure Call (RPC) Message Oriented Communication Multicasting 2/36

Distributed Systems. How do regular procedure calls work in programming languages? Problems with sockets RPC. Regular procedure calls

Outline. Definition of a Distributed System Goals of a Distributed System Types of Distributed Systems

416 Distributed Systems. RPC Day 2 Jan 12, 2018

Desarrollo de Aplicaciones en Red. El modelo de comunicación. General concepts. Models of communication. Message Passing

02 - Distributed Systems

RPC flow. 4.3 Remote procedure calls IDL. RPC components. Procedure. Program. sum (j,k) int j,k; {return j+k;} i = sum (3,7); Local procedure call

02 - Distributed Systems

CS555: Distributed Systems [Fall 2017] Dept. Of Computer Science, Colorado State University

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

416 Distributed Systems. RPC Day 2 Jan 11, 2017

DISTRIBUTED FILE SYSTEMS & NFS

REMOTE PROCEDURE CALLS EE324

Remote Invocation. Today. Next time. l Indirect communication. l Request-reply, RPC, RMI

Remote Procedure Call (RPC) and Transparency

Chapter 3: Client-Server Paradigm and Middleware

Remote Procedure Call

Middleware. Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004

Remote Procedure Calls (RPC)

Notes. Submit homework on Blackboard The first homework deadline is the end of Sunday, Feb 11 th. Final slides have 'Spring 2018' in chapter title

DS 2009: middleware. David Evans

Last Class: RPCs. Today:

Remote Procedure Calls

CPE731 Middleware for Distributed Systems

Distributed Systems Lecture 2 1. External Data Representation and Marshalling (Sec. 4.3) Request reply protocol (failure modes) (Sec. 4.

Distributed File Systems. Distributed Systems IT332

Lecture 06: Distributed Object

Distributed Systems. The main method of distributed object communication is with remote method invocation

CS454/654 Midterm Exam Fall 2004

Chapter 4 Communication

Dr Markus Hagenbuchner CSCI319 SIM. Distributed Systems Chapter 4 - Communication

RMI: Design & Implementation

Lecture 5: Object Interaction: RMI and RPC

Communication. Distributed Systems Santa Clara University 2016

Building up to today. Remote Procedure Calls. Reminder about last time. Threads - impl

CHAPTER 3 - PROCESS CONCEPT

1.264 Lecture 16. Legacy Middleware

Distributed Systems. Lehrstuhl für Informatik IV RWTH Aachen. Organisation. Classification of the lecture. Literature

Process! Process Creation / Termination! Process Transitions in" the Two-State Process Model! A Two-State Process Model!

Distributed Systems. 03. Remote Procedure Calls. Paul Krzyzanowski. Rutgers University. Fall 2017

Outline. EEC-681/781 Distributed Computing Systems. The OSI Network Architecture. Inter-Process Communications (IPC) Lecture 4

Distributed Systems. Lehrstuhl für Informatik 4. RWTH Aachen. Organization. Literature. Classification of the lecture

CS 167 Final Exam Solutions

CSCI-1680 RPC and Data Representation. Rodrigo Fonseca

Lecture 15: Network File Systems

Distributed Systems Principles and Paradigms

SAI/ST course Distributed Systems

Interprocess Communication Tanenbaum, van Steen: Ch2 (Ch3) CoDoKi: Ch2, Ch3, Ch5

Reminder from last time

Outline. Interprocess Communication. Interprocess Communication. Communication Models: Message Passing and shared Memory.

Web Services - Concepts, Architecture and Applications Part 3: Asynchronous middleware

Module 3 - Distributed Objects & Remote Invocation

Lecture 8: February 19

COMMUNICATION PROTOCOLS: REMOTE PROCEDURE CALL (RPC)

Operating Systems (ECS 150) Spring 2011

Administrivia. Remote Procedure Calls. Reminder about last time. Building up to today

03 Remote invoaction. Request-reply RPC. Coulouris 5 Birrel_Nelson_84.pdf RMI

CSci Introduction to Distributed Systems. Communication: RPC

CSCI-1680 RPC and Data Representation John Jannotti

CSCI-1680 RPC and Data Representation. Rodrigo Fonseca

CS 417 9/18/17. Paul Krzyzanowski 1. Socket-based communication. Distributed Systems 03. Remote Procedure Calls. Sample SMTP Interaction

Lecture 8: February 17

Distributed Operating Systems

CS4513 Distributed Computer Systems

Diagram of Process State Process Control Block (PCB)

Chapter 5 Remote Invocation. Gandeva Bayu Satrya, ST., MT. Telematics Labz. Informatics Department Telkom

a. Under overload, whole network collapsed iii. How do you make an efficient high-level communication mechanism? 1. Similar to using compiler instead

Chapter 17: Distributed Systems (DS)

Distributed Technologies - overview & GIPSY Communication Procedure

Page 1. Goals for Today" Remote Procedure Call" Raw messaging is a bit too low-level for programming! RPC Details"

Producer Consumer in Ada

Recovery and Logging

Remote Invocation. To do. Request-reply, RPC, RMI. q Today q. q Next time: Indirect communication

3. Remote Procedure Call

Advanced Distributed Systems

What is a file system

Time and Space. Indirect communication. Time and space uncoupling. indirect communication

Communication. Outline

Announcements. SQL: Part IV. Transactions. Summary of SQL features covered so far. Fine prints. SQL transactions. Reading assignments for this week

9. Distributed Shared Memory

Indirect Communication

Chapter 3: Processes. Operating System Concepts 9 th Edition

Distributed Systems. Definitions. Why Build Distributed Systems? Operating Systems - Overview. Operating Systems - Overview

CAS 703 Software Design

CPS 512 midterm exam #1, 10/7/2016

Operating System Support

PART B UNIT II COMMUNICATION IN DISTRIBUTED SYSTEM PART A

Today: Distributed Objects. Distributed Objects

Transcription:

A distributed system is... Distributed Systems "one on which I cannot get any work done because some machine I have never heard of has crashed". Loosely-coupled network connection could be different OSs, or different parts of the OS processes must communicate via messages What advantages does a network of sites offer? More work can get done Ability to share devices, programs and data Greater reliability Easier to expand Two Phase Commit Protocol With distributed systems we want to ensure that if something goes wrong at one site we don t end up with inconsistent data. A transaction is some event that has to be completely successful or not done at all (atomic). We need stable storage usually replicated on several devices can be done with two copies. make the change to one (check for success) make the change to the other (check for success) if ever the copies disagree copy the original data from the second back to the first 2PC transaction coordinator and all sites involved in a transaction have stable storage logs. All transactions can be undone and redone safely. Log entries and messages Commit request phase <prepare> - started the protocol, sent to all sites <ready> - recorded and returned if ok, <abort> if not ok Commit phase <commit> - if all reply in time, sent to all sites <abort> - sent by coordinator to all sites if something went wrong 1 2 Network & Distributed Operating Systems Remote Procedure Calls (RPC) Network OS Communications layer on top of a normal OS. Possibly different OS. User is aware of different machines. Some can copy files across the network but not share them. e.g. ftp In this case the file location is explicitly known. Others can share files but the location is still part of the name. Distributed OS Aim to have the system look like one machine. Birrell & Nelson 1984 Hide the message passing system so that it looks like a series of procedure calls. Most requests for service wait until the request is fulfilled semantically just like a procedure call. Programmer doesn t have to package and unpackage data in the messages. Also adds flexibility because sometimes the service might actually be local. There is no difference (except speed) between accessing local and remote resources (location transparency). The Distributed OS can move resources and processes (migration transparency). 3 4

Client and Server stubs Client makes ordinary procedure call to the local stub. Stub marshals parameters (may need to locate server as well). Stub sends request via local kernel. Remote kernel passes request to Server stub. Server stub unpacks message request and parameters. Makes ordinary procedure call to Server. And then vice-versa. The stubs at both ends need to be constructed from the same interface specification - to ensure consistency. Care has to be taken about different versions of the service. A different version may take slightly different parameters or return different types etc. RPC messages Messages are highly structured what procedure to execute parameters version number (service may survive a long time and code may be written to different versions) timestamp (could be used for synchronization purposes) source address where to send the results possibly the type of machine the request comes from Finding the server include port numbers at compile time or have a binder or rendezvous/matchmaker service Server usually registers with a binder or name server client end sends the request to find the server multiple servers the binder can spread the load binder can periodically check on servers - deregistering those that don't respond binder could do the security work otherwise servers have to check each call 5 6 Zero Service Configuration Discovery There are many different zero configuration services which don t require a binder. Zeroconf (Apple s Bonjour) Multicast DNS - is service here? Flexible - protocols can be decided at access time UPnP - Universal plug and play A UPnP device can join a network and get an IP address Announce its name to control points Provide a list of its functions Interrogate other devices Protocols are strictly defined Both are designed for small LANs. Marshalling Heterogeneous networks. Data formats in the different machines may be different. ASCII, Unicode, EBCDIC for strings Big or little endian for integers Different floating point formats Stubs need to know about this. Different solutions client stub converts to the server format server stub converts from the client format convert to and from a canonical format no one needs to know other machines formats (we don't want to have to convert from format A to canonical to A and then back again) e.g. NFS s XDR - external data representation 7 8

Reference parameter problem RMI & CORBA & DRb The references no longer make sense. either disallow reference parameters or copy the parameter to and fro either in one chunk or whenever the server makes a change to it (this is just like distributed shared memory) Copy/restore semantics aren't quite the same. e.g. pointer as a reference parameter the same parameter passed twice in the parameter list we can check for this Sometimes we don't need to copy the data both ways e.g. input buffer (only needs to be copied from the server to the client) Our interface specification should be able to express this. Remote Method Invocation Java technology RPC with objects Solves object reference problem by sending serialized versions of the object. If the object passed as a parameter is itself actually on the remote site it is just sent by reference. Common Object Request Broker Architecture Similar to RMI Works with a wide variety of languages not just Java Needs a common description language to specify interfaces IDL Interface Definition Language Distributed Ruby Very similar but simpler than Java RMI. Normally objects are passed by copying. If you include DRbUndumped in a class then all references to such objects are sent back to the original object. 9 10 Linda tuplespace Rinda example Another technique to share services over a network. Rather than explicitly sending messages we can share data in a tuplespace. The tuplespace is a logically shared (sometimes distributed) memory consisting of tuples. A tuple is a list of parameters, some of which are empty, e.g, < hi, 15, 12.5> Tuples are put into the tuplespace by the out or write primitive and retrieved from the tuplespace by matching contents and types with the in or take primitive. The example above could be matched with < hi, _, _> JavaSpaces are an implementation of Linda tuplespaces. Rinda is the Ruby version of Linda. Linda originally worked with C and Fortran. lindypy is a Python 2.6 implementation. # Provides a TupleSpace and waits for broadcast # messages to find it. require 'rinda/tuplespace' Rinda::RingServer.new(Rinda::TupleSpace.new) DRb.thread.join # Finds the TupleSpace by broadcasting, # then acts as a simple service. tuple_space = Rinda::RingFinger.primary # take the question question = tuple_space.take([numeric, Numeric]) # put the answer tuple_space.write([question[0]+question[1]]) # Finds the TupleSpace by broadcasting, # then acts as a client. tuple_space = Rinda::RingFinger.primary # put something in the tuplespace tuple_space.write([1, 2]) # read the answer answer = tuple_space.take([numeric])[0] puts answer 11 12

Tuplespace advantages Processes don't communicate directly with each other but instead access the tuplespace. It doesn't matter if one process dies, as long as another that deals with the same tuple is available (and the tuple hasn't been removed yet). Tuplespace problems scale naturally. Adding more processes which handle particular requests is trivial. (The tuplespace itself doesn't scale well. It is usually stored on one server. It can become a bottleneck. There are techniques to replicate tuplespaces.) The space itself deals with synchronization. Each tuple operation is atomic. Process Migration Moving a process from one site to another while it is running. Why would we like to do process migration? To enable us to do proper load balancing. If the process can be subdivided we can increase performance by having different parts running simultaneously on different machines. To move the process closer to the resources it is currently accessing. To move the process closer to the user. To enable us to keep a process going when the site it is executing on has to be taken down. 13 14 What do we need? We need location and migration transparency of processes resources used by the process What defines a process? PCB Resources files communication channels memory devices - including windows, keyboard, mouse Threads Need some compatible machine (or virtual machine) architecture. Internal and external reference problems References to resources within the program. References to the process from outside e.g. other processes communicating with it. How can that be done? Need a way of referring to all resources indirectly via global tables (like we did with our distributed file systems). We can extend the ideas of a distributed file system to refer to other objects, including processes. All process identifiers have no host information in the identifier. e.g. A process table keeps track of which site each process is running on. When the process is moved the table is updated. Caching of information can be used for efficiency but we need ways to recover when the cache data is out of date. Not all processes need to be stored in this table. Processes specific to a site which are not visible away from the site. 15 16

Doing the migration Current uses In reality process migration is not used for load balancing. Minimise the amount of down time Process must be stopped at some stage Stop, copy, notify How much do we copy? Only the working set get the remaining pages by demand paging Can t be used if the host is going down. Everything, but don't stop the process then copy pages which were dirtied during the copy Both approaches only stop the process while the working set is moving. It is too expensive. Most processes only run for a few seconds. Transferring a process can easily take a few seconds. It is still useful when a machine needs to be closed down for maintenance and it has running processes which we don't want to kill. Common use - idle workstations Move processes when no longer idle. Generally load balancing is only done when a process starts or when it has to move. Where is the best place to run this process? The textbook also talks about Computation Migration this means sending messages (or RPCs) to get work done on another site. 17 18 Before next time Read from the textbook 8.1 Background 8.3 Contiguous Memory Allocation 8.5 Paging 8.4 Segmentation Interesting read on Windows 8 memory management http://arstechnica.com/information-technology/ 2011/10/how-windows-8s-memorymanagement-modifications-make-for-abetter-user-experience/ 19