Communication. Communication. Distributed Systems. Networks and protocols Sockets Remote Invocation Messages Streams. Fall /10/2001 DoCS

Similar documents
Distributed Objects and Remote Invocation. Programming Models for Distributed Applications


Chapter 5: Remote Invocation. Copyright 2015 Prof. Amr El-Kadi

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

COMMUNICATION PROTOCOLS: REMOTE PROCEDURE CALL (RPC)

Chapter 5: Distributed objects and remote invocation

Communication. Overview

An Introductory 4.4BSD Interprocess Communication Tutorial

Communication. Distributed Systems Santa Clara University 2016

IPC. Communication. Layered Protocols. Layered Protocols (1) Data Link Layer. Layered Protocols (2)

Sockets. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University Embedded Software Lab.

Socket Programming. Dr. -Ing. Abdalkarim Awad. Informatik 7 Rechnernetze und Kommunikationssysteme

Lab 0. Yvan Petillot. Networks - Lab 0 1

Chapter 4 Communication

Context. Distributed Systems: Sockets Programming. Alberto Bosio, Associate Professor UM Microelectronic Departement

CSci Introduction to Distributed Systems. Communication: RPC

Lecture 5: Object Interaction: RMI and RPC

Distributed Information Processing

Socket Programming TCP UDP

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

CHAPTER - 4 REMOTE COMMUNICATION

Types (Protocols) Associated functions Styles We will look at using sockets in C Java sockets are conceptually quite similar

Department of Computer Science

Chapter 4 Communication

DISTRIBUTED COMPUTER SYSTEMS

SOCKET PROGRAMMING. What is a socket? Using sockets Types (Protocols) Associated functions Styles

Socket Programming 2007/03/28

Distributed Systems 8. Remote Procedure Calls

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

CS321: Computer Networks Introduction to Application Layer

PA #2 Reviews. set_name, get_name, del_name. Questions? Will be modified after PA #4 ~

Sockets. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Advanced Topics in Distributed Systems. Dr. Ayman A. Abdel-Hamid. Computer Science Department Virginia Tech

CSC209H Lecture 9. Dan Zingaro. March 11, 2015

Introduction and Overview Socket Programming Higher-level interfaces Final thoughts. Network Programming. Samuli Sorvakko/Nixu Oy

Introduction and Overview Socket Programming Lower-level stuff Higher-level interfaces Security. Network Programming. Samuli Sorvakko/Nixu Oy

Introduction and Overview Socket Programming Higher-level interfaces Final thoughts. Network Programming. Samuli Sorvakko/Nixu Oy

Hyo-bong Son Computer Systems Laboratory Sungkyunkwan University

Communication. Layered Protocols. Topics to be covered. Layered Protocols. Introduction

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

Slides for Chapter 5: Remote Invocation

Communication Basics, RPC & RMI. CS403/534 Distributed Systems Erkay Savas Sabanci University

Remote Procedure Calls

SAI/ST course Distributed Systems

RPC and RMI. 2501ICT Nathan

Lecture 06: Distributed Object

CLIENT-SIDE PROGRAMMING

CompSci 356: Computer Network Architectures. Lecture 3: Network Architecture Examples and Lab 1. Xiaowei Yang

ECE 435 Network Engineering Lecture 2

Anatomy of a network. Chapter 3: Network and Communication. Transmission links. Representing data: bits and bytes. Representing data: Frames

CS321: Computer Networks Socket Programming

CS 640: Computer Networking

Application Programming Interfaces

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

RPC. Remote Procedure Calls. Robert Grimm New York University

DISTRIBUTED OBJECTS AND REMOTE INVOCATION

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

Applications. RMI, RPC and events. Request reply protocol External data representation. Operating System

Modulo II Socket, RMI e Corba

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

RMI: Design & Implementation

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

Remote Procedure Call

Interprocess Communication

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

3. Remote Procedure Call

Distributed Systems. Communication (2) Schedule of Today. Distributed Objects. Distributed Objects and RMI. Corba IDL Example

Distributed Systems. Chapter 02

System Models and Communication

The BSD UNIX Socket Interface (CS 640 Lecture) Assignment 1. Interprocess Communication (IPC) Work Individually (no groups)

Chapter 3: Client-Server Paradigm and Middleware

416 Distributed Systems. RPC Day 2 Jan 12, 2018

Module 3 - Distributed Objects & Remote Invocation

Interprocess Communication

ICT 6544 Distributed Systems Lecture 5

UNIX Network Programming. Overview of Socket API Network Programming Basics

Project 3. Reliable Data Transfer over UDP. NTU CSIE Computer Networks 2011 Spring

ECE 435 Network Engineering Lecture 2

Tutorial on Socket Programming

UNIT 1 TCP/IP PROGRAMMING CONCEPTS

Distributed Systems. Communication (2) Lecture Universität Karlsruhe, System Architecture Group

Socket Programming. CSIS0234A Computer and Communication Networks. Socket Programming in C

CSc 450/550 Computer Networks Network Architectures & Client-Server Model

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

CS 3516: Computer Networks

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

Client-server model The course that gives CMU its Zip! Network programming Nov 27, Using ports to identify services.

Parallelism. Master 1 International. Andrea G. B. Tettamanzi. Université de Nice Sophia Antipolis Département Informatique

Socket Programming. Sungkyunkwan University. Hyunseung Choo Copyright Networking Laboratory

Networks and Operating Systems Chapter 3: Remote Procedure Call (RPC)

TCP: Three-way handshake

Inter-process Communication: RPC

Structured communication (Remote invocation)

Sockets. 1 Introduction. (Reference:, Gray Chapter 10) Network Programming Lecture Notes by. Turhan TUNALI

System Programming. Introduction to computer networks

DS 2009: middleware. David Evans

May Gerd Liefländer System Architecture Group Universität Karlsruhe (TH), System Architecture Group

CORBA (Common Object Request Broker Architecture)

Architecture of Software Intensive Systems

Simple network applications using sockets (BSD and WinSock) Revision 1 Copyright Clifford Slocombe

Transcription:

Communication Distributed Systems Fall 2002 Communication Process Process Networks and protocols Sockets Remote Invocation Messages Streams 9/10/2001 DoCS 2002 2

Layered Protocols (1) Layers, interfaces, and protocols in the OSI model. 9/10/2001 DoCS 2002 3 Layered Protocols (2) 2-2 A typical message as it appears on the network. 9/10/2001 DoCS 2002 4

Middleware Protocols An adapted reference model for networked communication. 9/10/2001 DoCS 2002 5 The TCP/IP Layers Application mail, file transfer, web Application Transport Internet tcp, udp ip Internet Internet Transport Internet Media access Media access Media access Media access 9/10/2001 DoCS 2002 6

Layers, Protocols & Messages Application M M Transport H t M H t M Internet H i H t M H i H t M Media access H m H i H t M H m H i H t M 9/10/2001 DoCS 2002 7 Transport Protocols TCP Stream Reliable Sequenced UDP Message / datagram Unreliable 9/10/2001 DoCS 2002 8

TCP for Client / Server request response UDP TCP T/TCP 9/10/2001 DoCS 2002 9 The Application Layer ISO: session, presentation, application Internet: monolithic application Examples SSL - authentication, secure transmission SMTP - electronic messages FTP - bulk transfer HTTP - document retrieval 9/10/2001 DoCS 2002 10

The Middleware Layer Applications, services RMI and RPC This chapter request-reply protocol marshalling and external data representation Middleware layers UDP and TCP 9/10/2001 DoCS 2002 11 Sockets and Ports socket any port agreed port socket client Internet address = 138.37.94.248 message other ports server Internet address = 138.37.88.249 Client creates socket sends to addr/port Server creates socket binds to port advertises addr/port 9/10/2001 DoCS 2002 12

UDP Socket Structure host name port number Server process Client process server socket response request client socket 9/10/2001 DoCS 2002 13 C Client - create a socket #define DATA "The sea is calm tonight, the tide is full... main(argc, argv) int argc; char *argv[ ]; { int sock; struct sockaddr_in name; struct hostent *hp, *gethostbyname(); struct sockaddr_in { short sin_family; u_short sin_port; struct in_addr sin_addr; char sin_zero[8]; }; Internet socket UDP (datagram) /* Create socket on which to send. */ sock = socket(af_inet, SOCK_DGRAM, 0); if (sock < 0) { perror("opening datagram socket"); exit(1); } 9/10/2001 DoCS 2002 14

C Client - Send The Message } hp = gethostbyname(argv[1]); if (hp == 0) { fprintf(stderr, "%s: unknown host\n", argv[1]); exit(2); } bcopy(hp->h_addr, &name.sin_addr, hp->h_length); name.sin_family = AF_INET; name.sin_port = htons(atoi(argv[2])); /* Send message. */ port number if (sendto(sock, DATA, sizeof(data), 0, &name, sizeof(name)) < 0) perror("sending datagram message"); close(sock); server domain name 9/10/2001 DoCS 2002 15 C UDP Server - create socket main() { int sock, length; struct sockaddr_in name; char buf[1024]; /* Create socket from which to read. */ sock = socket(af_inet, SOCK_DGRAM, 0); if (sock < 0) { perror("opening datagram socket"); exit(1); } Internet socket UDP (datagram) 9/10/2001 DoCS 2002 16

C UDP Server - bind to port /* Create name with wildcards. */ name.sin_family = AF_INET; name.sin_addr.s_addr = INADDR_ANY; name.sin_port = 0; if (bind(sock, &name, sizeof(name))) { perror("binding datagram socket"); exit(1); } accept connections from assign default port number 9/10/2001 DoCS 2002 17 C UDP Server - Read the data /* Find assigned port value and print it out. */ length = sizeof(name); if (getsockname(sock, &name, &length)) { perror("getting socket name"); exit(1); } printf("socket has port #%d\en", ntohs(name.sin_port)); /* Read from the socket */ if (read(sock, buf, 1024) < 0) perror("receiving datagram packet"); printf("-->%s\en", buf); close(sock); } 9/10/2001 DoCS 2002 18

Remote Procedure Call Distributed Systems Fall 2002 History of RPC Birrell and Nelson - 1984 Provide communication transparency Overcome heterogeniety Firefly - Schroeder and Burrows, 1989 High performance Standardised Sun ONC, OSF DCE Object based Emerald, Choices, ANSA, Java 9/10/2001 DoCS 2002 20

Conventional Procedure Call The stack before the call to read(fd, buf, bytes) The stack while the called procedure is active 9/10/2001 DoCS 2002 21 Client and Server Stubs Principle of RPC between a client and server program. 9/10/2001 DoCS 2002 22

Implementation Components IPC IPC client stub runtime runtime stub Server invoke pack args send receive unpack args invoke work return unpack result receive send pack result return Interface Stub is proxy for other side Runtime listens for messages Must always be present Interface 9/10/2001 DoCS 2002 23 Questions How do we specify the interface? How we generate stubs? How are parameters passed? How does a client find/bind to a server? 9/10/2001 DoCS 2002 24

Steps of a Remote Procedure Call 1. Client procedure calls client stub in normal way 2. Client stub builds message, calls local OS 3. Client's OS sends message to remote OS 4. Remote OS gives message to server stub 5. Server stub unpacks parameters, calls server 6. Server does work, returns result to the stub 7. Server stub packs it in message, calls local OS 8. Server's OS sends message to client's OS 9. Client's OS gives message to client stub 10. Stub unpacks result, returns to client 9/10/2001 DoCS 2002 25 Passing Value Parameters Steps involved in doing remote computation through RPC 2-8 9/10/2001 DoCS 2002 26

Passing Value Parameters Original message on a Pentium Int val(5) String val( JILL ) The message after receipt on a SPARC The message after being inverted. The little numbers in boxes indicate the address of each byte 9/10/2001 DoCS 2002 27 Parameters and Stub Generation A procedure The corresponding message. 9/10/2001 DoCS 2002 28

Doors The principle of using doors as IPC mechanism. 9/10/2001 DoCS 2002 29 Component Generation client source interface definition IDL compiler server source client stub header server stub C compiler C compiler C compiler C compiler client object client stub object server stub object server object 9/10/2001 DoCS 2002 30

CORBA IDL Example // In file Person.idl struct Person { string name; string place; long year; } ; interface PersonList { readonly attribute string listname; void addperson(in Person p) ; void getperson(in string name, out Person p); long number(); }; 9/10/2001 DoCS 2002 31 Asynchronous RPC (1) a) The interconnection between client and server in a traditional RPC b) The interaction using asynchronous RPC 9/10/2001 DoCS 2002 32

Asynchronous RPC (2) A client and server interacting through two asynchronous RPCs 9/10/2001 DoCS 2002 33 Binding How do we locate a remote object? May be done at various times later -> more flexible earlier -> more efficient communication Usually done at run-time At initialisation - typical rpc, some object sytems At invocation - to support mobility Both can use the same paradigm locate on first contact and cache relocate if cache fails 9/10/2001 DoCS 2002 34

Remote Binding Problems Is server available? Are versions consistent? Solution - version number Reject or multiple servers Multiple Servers Load balancing First reply 9/10/2001 DoCS 2002 35 Remote Invocation Natural fit to familiar method invocation or procedure call Requires response = doop(request) Interface definition Inter-process communication Network Protocols request = receive() response = do(request) send(response) 9/10/2001 DoCS 2002 36

Linking the Client and Server Server exports an interface IDL assigns each procedure a signature within interface Also an instance or version number Name service provides port or host address Port - direct connection to interface Host - server side dispatcher provides port 9/10/2001 DoCS 2002 37 Binding a Client to a Server Client-to-server binding in DCE. 9/10/2001 DoCS 2002 38

Server Registration IPC runtime stub server Name Service add service record in table register interface export(name) export(name) return return 9/10/2001 DoCS 2002 39 RPC Protocols: Client Binding client stub IPC runtime Name Service IPC runtime ref=import(name) ref=import(name) request service lookup bind(name) lookup return record result 9/10/2001 DoCS 2002 40

Invocation Semantics Invocation semantics Maybe At-least-once At-most-once Retry request message No Yes Yes Delivery guarantees Duplicate filtering at server Not applicable No Yes Re-execute procedure or retransmit reply Not applicable Re-execute procedure Retransmit reply 9/10/2001 DoCS 2002 41