Distributed systems abstractions (PDCS 9, CPE 6*)

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

RPC Robert Grimm New York University Remote Procedure Calls.
Jaringan Informasi Pengantar Sistem Terdistribusi oleh Ir. Risanuri Hidayat, M.Sc.
Distributed components
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Rheeve: A Plug-n-Play Peer- to-Peer Computing Platform Wang-kee Poon and Jiannong Cao Department of Computing, The Hong Kong Polytechnic University ICDCSW.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Mobile IP Overview: Standard IP Standard IP Evolution of Mobile IP Evolution of Mobile IP How it works How it works Problems Assoc. with it Problems Assoc.
CORBA Case Study By Jeffrey Oliver March March 17, 2003CORBA Case Study by J. T. Oliver2 History The CORBA (Common Object Request Broker Architecture)
OCT1 Principles From Chapter One of “Distributed Systems Concepts and Design”
DISTRIBUTED PROCESS IMPLEMENTAION BHAVIN KANSARA.
Lecture slides prepared for “Business Data Communications”, 7/e, by William Stallings and Tom Case, Chapter 8 “TCP/IP”.
SALSA: Language and Architecture for Widely Distributed Actor Systems. Carlos Varela, Abe Stephens, Department of.
DEVS Namespace for Interoperable DEVS/SOA
Distributed Systems: Concepts and Design Chapter 1 Pages
Architectures of distributed systems Fundamental Models
IBM TSpaces Lab 1 Introduction. Summary TSpaces Overview Basic Definitions Basic primitive operations Reading/writing tuples in tuplespace HelloWorld.
Advanced Computer Networks Topic 2: Characterization of Distributed Systems.
OS2- Sem ; R. Jalili Introduction Chapter 1.
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
ECI – electronic Commerce Infrastructure “ An application to the Shares Market ” Demetris Zeinalipour ( Melinos Kyriacou
C. Varela1 Mobility, garbage collection, load balancing, visualization (SALSA) Fault-tolerance, hot code loading (Erlang) (PDCS 9; CPE 7*) Carlos Varela.
C. Varela1 Actors in SALSA and Erlang (PDCS 9, CPE 5*) Support for actor model in SALSA and Erlang Carlos Varela Rennselaer Polytechnic Institute October.
The Client-Server Model And the Socket API. Client-Server (1) The datagram service does not require cooperation between the peer applications but such.
© Chinese University, CSE Dept. Distributed Systems / Distributed Systems Topic 1: Characterization of Distributed & Mobile Systems Dr. Michael R.
C. Varela1 Distributed systems abstractions (PDCS 9, CPE 6*) Carlos Varela Rennselaer Polytechnic Institute October 20, 2015 * Concurrent Programming in.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public ITE PC v4.0 Chapter 1 1 Communicating over the Network Network Fundamentals – Chapter 2.
Manish Kumar,MSRITSoftware Architecture1 Remote procedure call Client/server architecture.
Remote Method Invocation A Client Server Approach.
TEXT: Distributed Operating systems A. S. Tanenbaum Papers oriented on: 1.OS Structures 2.Shared Memory Systems 3.Advanced Topics in Communications 4.Distributed.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Object Interaction: RMI and RPC 1. Overview 2 Distributed applications programming - distributed objects model - RMI, invocation semantics - RPC Products.
Distributed Systems Architectures. Topics covered l Client-server architectures l Distributed object architectures l Inter-organisational computing.
Applications Active Web Documents Active Web Documents.
Echo Networking COMP
Carlos Varela Rennselaer Polytechnic Institute November 1, 2016
Module 8: Networking Services
Chapter 1 Introduction to Computers, Programs, and Java
Definition of Distributed System
Rensselaer Polytechnic Institute
Network Load Balancing
Part 3 Design What does design mean in different fields?
Rennselaer Polytechnic Institute
CHAPTER 3 Architectures for Distributed Systems
Carlos Varela Rennselaer Polytechnic Institute November 3, 2017
#01 Client/Server Computing
Client-Server Interaction
Advanced Operating Systems
Carlos Varela Rennselaer Polytechnic Institute October 6, 2017
Interpreter Style Examples
AGENT OS.
Lecture 4: RPC Remote Procedure Call Coulouris et al: Chapter 5
Distributed (Systems) Programming Universal Actors, SALSA, World-Wide Computer Carlos Varela RPI C. Varela.
Object Oriented Programming
Mobile Agents M. L. Liu.
Concurrency control abstractions (PDCS 9, CPE 5*)
Architectures of distributed systems Fundamental Models
Lecture 4: RPC Remote Procedure Call CDK: Chapter 5
Computer communications
Architectures of distributed systems Fundamental Models
Lecture 2: Overview of TCP/IP protocol
Carlos Varela Rennselaer Polytechnic Institute October 4, 2016
CS4470 Computer Networking Protocols
Architectures of distributed systems
Architectures of distributed systems Fundamental Models
Concurrent Programming Actors, SALSA, Coordination Abstractions
Distributed System using Web Services
Exceptions and networking
#01 Client/Server Computing
Presentation transcript:

Distributed systems abstractions (PDCS 9, CPE 6*) Carlos Varela Rennselaer Polytechnic Institute October 20, 2017 * Concurrent Programming in Erlang, by J. Armstrong, R. Virding, C. Wikström, M. Williams C. Varela

Overview of programming distributed systems It is harder than concurrent programming! Yet unavoidable in today’s information-oriented society, e.g.: Internet, mobile devices Web services Cloud computing Communicating processes with independent address spaces Limited network performance Orders of magnitude difference between WAN, LAN, and intra-machine communication. Localized heterogeneous resources, e.g, I/O, specialized devices. Partial failures, e.g. hardware failures, network disconnection Openness: creates security, naming, composability issues. C. Varela

SALSA Revisited SALSA Advantages for distributed computing Simple Actor Language System and Architecture An actor-oriented language for mobile and internet computing Programming abstractions for internet-based concurrency, distribution, mobility, and coordination C. Varela and G. Agha, “Programming dynamically reconfigurable open systems with SALSA”, ACM SIGPLAN Notices, OOPSLA 2001 Intriguing Technology Track, 36(12), pp 20-34. Advantages for distributed computing Actors encapsulate state and concurrency: Actors can run in different machines. Actors can change location dynamically. Communication is asynchronous: Fits real world distributed systems. Actors can fail independently. C. Varela

World-Wide Computer (WWC) Distributed computing platform. Provides a run-time system for universal actors. Includes naming service implementations. Remote message sending protocol. Support for universal actor migration. C. Varela

Abstractions for Worldwide Computing Universal Actors, a new abstraction provided to guarantee unique actor names across the Internet. Theaters, extended Java virtual machines to provide execution environment and network services to universal actors: Access to local resources. Remote message sending. Migration. Naming service, to register and locate universal actors, transparently updated upon universal actor creation, migration, garbage collection. C. Varela

Universal Actor Names (UAN) Consists of human readable names. Provides location transparency to actors. Name to locator mapping updated as actors migrate. UAN servers provide mapping between names and locators. Example Universal Actor Name: uan://wwc.cs.rpi.edu:3030/cvarela/calendar Name server address and (optional) port. Unique relative actor name. C. Varela

Theater address and port. WWC Theaters Theater address and port. Actor location. C. Varela

Universal Actor Locators (UAL) Theaters provide an execution environment for universal actors. Provide a layer beneath actors for message passing and migration. When an actor migrates, its UAN remains the same, while its UAL changes to refer to the new theater. Example Universal Actor Locator: rmsp://wwc.cs.rpi.edu:4040 Theater’s IP address and (optional) port. C. Varela

SALSA Language Support for Worldwide Computing SALSA provides linguistic abstractions for: Universal naming (UAN & UAL). Remote actor creation. Location-transparent message sending. Migration. Coordination. SALSA-compiled code closely tied to WWC run-time platform. C. Varela

Universal Actor Creation To create an actor locally TravelAgent a = new TravelAgent(); To create an actor with a specified UAN and UAL: TravelAgent a = new TravelAgent() at (uan, ual); To create an actor with a specified UAN at current location: TravelAgent a = new TravelAgent() at (uan); C. Varela

TravelAgent a = new TravelAgent(); Message Sending TravelAgent a = new TravelAgent(); a <- book( flight ); Message sending syntax is the same (<-), independently of actor’s location. C. Varela

Remote Message Sending Obtain a remote actor reference by name. TravelAgent a = (TravelAgent) TravelAgent.getReferenceByName(“uan://myhost/ta”); a <- printItinerary(); C. Varela

Reference Cell Service Example module dcell; behavior Cell implements ActorService{ Object content; Cell(Object initialContent) { content = initialContent; } Object get() { standardOutput <- println (“Returning: ”+content); return content; void set(Object newContent) { standardOutput <- println (“Setting: ”+newContent); content = newContent; implements ActorService signals that actors with this behavior are not to be garbage collected. C. Varela

Reference Cell Tester module dcell; behavior CellTester { void act( String[] args ) { if (args.length != 2){ standardError <- println( “Usage: salsa dcell.CellTester <UAN> <UAL>”); return; } Cell c = new Cell(0) at (new UAN(args[0]), new UAL(args[1])); standardOutput <- print( “Initial Value:” ) @ c <- get() @ standardOutput <- println( token ); C. Varela

Reference Cell Client Example module dcell; behavior GetCellValue { void act( String[] args ) { if (args.length != 1){ standardOutput <- println( “Usage: salsa dcell.GetCellValue <CellUAN>”); return; } Cell c = (Cell) Cell.getReferenceByName(args[0]); standardOutput <- print(“Cell Value:”) @ c <- get() @ standardOutput <- println(token); C. Varela

Address Book Service Hashtable name2email; module addressbook; import java.util.* behavior AddressBook implements ActorService { Hashtable name2email; AddressBook() { name2email = new HashTable(); } String getName(String email) { … } String getEmail(String name) { … } boolean addUser(String name, String email) { … } void act( String[] args ) { if (args.length != 0){ standardOutput<-println(“Usage: salsa -Duan=<UAN> -Dual=<UAL> addressbook.AddressBook”); C. Varela

Address Book Add User Example module addressbook; behavior AddUser { void act( String[] args ) { if (args.length != 3){ standardOutput<-println(“Usage: salsa addressbook.AddUser <AddressBookUAN> <Name> <Email>”); return; } AddressBook book = (AddressBook) AddressBook.getReferenceByName(new UAN(args[0])); book<-addUser(args(1), args(2)); C. Varela

Address Book Get Email Example module addressbook; behavior GetEmail { void act( String[] args ) { if (args.length != 2){ standardOutput <- println(“Usage: salsa addressbook.GetEmail <AddressBookUAN> <Name>”); return; } getEmail(args(0),args(1)); void getEmail(String uan, String name){ try{ AddressBook book = (AddressBook) AddressBook.getReferenceByName(new UAN(uan)); standardOutput <- print(name + “’s email: “) @ book <- getEmail(name) @ standardOutput <- println(token); } catch(MalformedUANException e){ standardError<-println(e); C. Varela

Erlang Language Support for Distributed Computing Erlang provides linguistic abstractions for: Registered processes (actors). Remote process (actor) creation. Remote message sending. Process (actor) groups. Error detection. Erlang-compiled code closely tied to Erlang node run-time platform. C. Varela

Erlang Nodes To return our own node name: To return a list of other known node names: nodes() To monitor a node: monitor_node(Node, Flag) If flag is true, monitoring starts. If false, monitoring stops. When a monitored node fails, {nodedown, Node} is sent to monitoring process. C. Varela

Actor Creation To create an actor locally travel is the module name, agent is the function name, Agent is the actor name. To create an actor locally Agent = spawn(travel, agent, []); To create an actor in a specified remote node: Agent = spawn(host, travel, agent, []); host is the node name. C. Varela

ta is the registered name (an atom), Agent is the actor name (PID). Actor Registration ta is the registered name (an atom), Agent is the actor name (PID). To register an actor: register(ta, Agent) To return the actor identified with a registered name: whereis(ta) To remove the association between an atom and an actor: unregister(ta) C. Varela

Agent = spawn(travel, agent, []), Message Sending Agent = spawn(travel, agent, []), register(ta, Agent) Agent ! {book, Flight} ta ! {book, Flight} Message sending syntax is the same (!) with actor name (Agent) or registered name (ta). C. Varela

Remote Message Sending To send a message to a remote registered actor: {ta, host} ! {book, Flight} C. Varela

Reference Cell Service Example -module(dcell). -export([cell/1,start/1]). cell(Content) -> receive {set, NewContent} -> cell(NewContent); {get, Customer} -> Customer ! Content, cell(Content) end. start(Content) -> register(dcell, spawn(dcell, cell, [Content])) C. Varela

Reference Cell Tester -module(dcellTester). -export([main/0]). main() -> dcell:start(0), dcell!{get, self()}, receive Value -> io:format(”Initial Value:~w~n”,[Value]) end. C. Varela

Reference Cell Client Example -module(dcellClient). -export([getCellValue/1]). getCellValue(Node) -> {dcell, Node}!{get, self()}, receive Value -> io:format(”Initial Value:~w~n”,[Value]) end. C. Varela

Address Book Service -module(addressbook). -export([start/0,addressbook/1]). start() -> register(addressbook, spawn(addressbook, addressbook, [[]])). addressbook(Data) -> receive {From, {addUser, Name, Email}} -> From ! {addressbook, ok}, addressbook(add(Name, Email, Data)); {From, {getName, Email}} -> From ! {addressbook, getname(Email, Data)}, addressbook(Data); {From, {getEmail, Name}} -> From ! {addressbook, getemail(Name, Data)}, addressbook(Data) end. add(Name, Email, Data) -> … getname(Email, Data) -> … getemail(Name, Data) -> … C. Varela

Address Book Client Example -module(addressbook_client). -export([getEmail/1,getName/1,addUser/2]). addressbook_server() -> 'addressbook@127.0.0.1'. getEmail(Name) -> call_addressbook({getEmail, Name}). getName(Email) -> call_addressbook({getName, Email}). addUser(Name, Email) -> call_addressbook({addUser, Name, Email}). call_addressbook(Msg) -> AddressBookServer = addressbook_server(), monitor_node(AddressBookServer, true), {addressbook, AddressBookServer} ! {self(), Msg}, receive {addressbook, Reply} -> monitor_node(AddressBookServer, false), Reply; {nodedown, AddressBookServer} -> no end. C. Varela

Exercises How would you implement the join block linguistic abstraction considering different potential distributions of its participating actors? CTM Exercise 11.11.3 (page 746). Implement the example using SALSA/WWC and Erlang. PDCS Exercise 9.6.3 (page 203). PDCS Exercise 9.6.9 (page 204). PDCS Exercise 9.6.12 (page 204). Write the same distributed programs in Erlang. C. Varela