Communication Motivation

Similar documents
Real Time Programming: Concepts

Chapter 2: Remote Procedure Call (RPC)

COMMMUNICATING COOPERATING PROCESSES

Network Programming TDC 561

How To Understand The Concept Of A Distributed System

Verteilte Systeme. ISO- Referenzmodell. 2. Transport Layer (Wdh) OSI- Modell = Open Systems Interconnection Referenzmodell!

How To Write A Network Operating System For A Network (Networking) System (Netware)

Middleware Lou Somers

Kap. 2. Transport - Schicht

Infrastructure that supports (distributed) componentbased application development

Chapter 6. CORBA-based Architecture. 6.1 Introduction to CORBA 6.2 CORBA-IDL 6.3 Designing CORBA Systems 6.4 Implementing CORBA Applications

Communication. Layered Protocols. Topics to be covered. PART 1 Layered Protocols Remote Procedure Call (RPC) Remote Method Invocation (RMI)

Middleware and Distributed Systems. Introduction. Dr. Martin v. Löwis

COM 440 Distributed Systems Project List Summary

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

A distributed system is defined as

Socket = an interface connection between two (dissimilar) pipes. OS provides this API to connect applications to networks. home.comcast.

Linux Kernel Architecture

Chapter 11. User Datagram Protocol (UDP)

Lehrstuhl für Informatik 4 Kommunikation und verteilte Systeme. Middleware. Chapter 8: Middleware

Mutual Exclusion using Monitors

Network Attached Storage. Jinfeng Yang Oct/19/2015

Chapter 6, The Operating System Machine Level

Chapter 2: Processes, Threads, and Agents

Objectives of Lecture. Network Architecture. Protocols. Contents

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY Operating System Engineering: Fall 2005

Interface Definition Language

Introduction CORBA Distributed COM. Sections 9.1 & 9.2. Corba & DCOM. John P. Daigle. Department of Computer Science Georgia State University

Network File System (NFS) Pradipta De

Lecture 7: Java RMI. CS178: Programming Parallel and Distributed Systems. February 14, 2001 Steven P. Reiss

TIn 1: Lecture 3: Lernziele. Lecture 3 The Belly of the Architect. Basic internal components of the Pointers and data storage in memory

Middleware: Past and Present a Comparison

It is the thinnest layer in the OSI model. At the time the model was formulated, it was not clear that a session layer was needed.

Design Patterns in C++

System Calls and Standard I/O

Distributed Systems. Security concepts; Cryptographic algorithms; Digital signatures; Authentication; Secure Sockets

REAL TIME OPERATING SYSTEMS. Lesson-10:

Upgrade-Preisliste. Upgrade Price List

Chapter 3. Internet Applications and Network Programming

Transport Layer Protocols

File Transfer And Access (FTP, TFTP, NFS) Chapter 25 By: Sang Oh Spencer Kam Atsuya Takagi

Introduction. What is an Operating System?

Introduction to CORBA. 1. Introduction 2. Distributed Systems: Notions 3. Middleware 4. CORBA Architecture

APPLICATION CODE APPLICATION CODE S ERVER PROCESS STUB STUB RPC RUNTIME LIBRARY RPC RUNTIME LIBRARY ENDPOINT MAP ENDPOINT MAP

We mean.network File System

Client/Server and Distributed Computing

Network Communication

Communication Systems Internetworking (Bridges & Co)

The OSI model has seven layers. The principles that were applied to arrive at the seven layers can be briefly summarized as follows:

Limi Kalita / (IJCSIT) International Journal of Computer Science and Information Technologies, Vol. 5 (3), 2014, Socket Programming

PERFORMANCE COMPARISON OF COMMON OBJECT REQUEST BROKER ARCHITECTURE(CORBA) VS JAVA MESSAGING SERVICE(JMS) BY TEAM SCALABLE

Understanding Android s Security Framework

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

SPICE auf der Überholspur. Vergleich von ISO (TR) und Automotive SPICE

NFS File Sharing. Peter Lo. CP582 Peter Lo

Socket Programming. Request. Reply. Figure 1. Client-Server paradigm

Socket Programming in the Data Communications Laboratory

CS161: Operating Systems

Deployment-Optionen für den optimierten Desktop. Senior Systems Engineer, Citrix Systems

How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X

Agenda. Distributed System Structures. Why Distributed Systems? Motivation

Motivation Definitions EAI Architectures Elements Integration Technologies. Part I. EAI: Foundations, Concepts, and Architectures

Tutorial on Socket Programming

Web Services. Copyright 2011 Srdjan Komazec

Computer Network. Interconnected collection of autonomous computers that are able to exchange information

Invocación remota (based on M. L. Liu Distributed Computing -- Concepts and Application

Embedded Systems. 6. Real-Time Operating Systems

System Software Winter 2015

CSC 2405: Computer Systems II

Principles and characteristics of distributed systems and environments

Overview of CORBA 11.1 I NTRODUCTION TO CORBA Object services 11.5 New features in CORBA Summary

Software design (Cont.)

Client/Server Computing Distributed Processing, Client/Server, and Clusters

Chapter 11 Distributed File Systems. Distributed File Systems

Distributed Systems LEEC (2005/06 2º Sem.)

ICOM : Computer Networks Chapter 6: The Transport Layer. By Dr Yi Qian Department of Electronic and Computer Engineering Fall 2006 UPRM

Software / FileMaker / Plug-Ins Mailit 6 for FileMaker 10-13

Outline SOA. Properties of SOA. Service 2/19/2016. Definitions. Comparison of component technologies. Definitions Component technologies

From Control Loops to Software

SOFT 437. Software Performance Analysis. Ch 5:Web Applications and Other Distributed Systems

Operating Systems and Networks

6.828 Operating System Engineering: Fall Quiz II Solutions THIS IS AN OPEN BOOK, OPEN NOTES QUIZ.

SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (I)

Named Pipes, Sockets and other IPC

Microsoft Nano Server «Tuva» Rinon Belegu

XMOS Programming Guide

COMP5426 Parallel and Distributed Computing. Distributed Systems: Client/Server and Clusters

ELEN 602: Computer Communications and Networking. Socket Programming Basics

Chapter 2: Enterprise Applications from a Middleware Perspective

Division of Informatics, University of Edinburgh

A Look through the Android Stack

SYSTEM ecos Embedded Configurable Operating System

Transcription:

Communication Motivation Synchronization and Communication Interprocess Communcation (IPC) typically comprises synchronization as well as communication issues! Synchronization A waits until a specific condition holds B fulfills this specific condition and informs A Only a single bit is the information entity! Communication True exchange of data Various communcation concepts exist (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 1

3 Classes of Communication Within a single process! A threads inside a process share the complete address space! Communication through any data structures provided by the programming language Between processes on a single machine! Explicit use of memory portions shared between different address spaces! Fast but complicated way to communicate Between processes on different machines! Distributed systems! Message passing is the primary form of communication! Some people prefer to use various kinds of distributed shared memory Sharing Memory Between Processes Multiple processes share a given number of pages explicitly Shared pages will be mapped into several virtual address spaces Communication via read and write instructions! All kind of data structures can be allocated inside shared memory! Beware of pointers! Address Space A Page Table of A Address Space B Page Table of B Main Memory (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 2

Beware of Pointers! Address Space A X Dangerous to use pointers inside shared memory Pointers within shared memory itself are okay if mapped to the same address in all processes! Therefore, the address to be mapped to can be fixed Pointers stored inside but pointing outside of shared memory! are deadly since they point to something different in other address spaces Address Space B Y Message-based Communication Anwendung Anwendung Anwendung Betriebssystem Betriebssystem Rechner Rechner Message = Sequence of bytes 2 fundamental operations! send! receive For many message-based techniques, it is easy to cross computer boundaries (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 3

Comparison Memory-based Communication Access schared memory via read and write operations Pro! Performance! Transparency (for some) Contra! Shared memory needed (requires monoprocessor or multiprocessor)! Transparency (for others)! You don t see when you communicate! Need for synchronization to preserve data consistency Message-based Communication Send and receive messages Pro! More general concept (applicable to monoprocessors, multiprocessors, and even distributed systems)! No transparency (for some) Contra! Efficiency In case sender and receiver are on the same host Networks are slow compared to memory! No transparency (for others) Synchronicity Synchronous Communication! is blocked until message received! Less buffer space required! Limits concurrency! Also called blocking send Asynchronous Communication! only blocked until message has been copied! may issue many messages in short sequence (risk of congestion)! Buffering of messages required! Also called Non-blocking Send Receiver Receiver (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 4

Communication Pattern Smallest unit of communication! Notification Single message from sender to receiver! Service Invocation Client request to server Reply back to sender Additional patterns (mostly used in distributed systems)! Multicast Send a message to a group of receivers! Broadcast Send a message to any potential receiver on the network Receiver(s) 4 Basic Ways to Communicate (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 5

Datagram and receiver are decoupled! Concurrency Operating system has to buffer messages! Complex (overflow,...)! Sometimes still need to block sender in case of resource limitations Examples! UDP (User Datagramm Protocol) Part of TCP/IP Best Effort max. 64 kbyte data! Signals Software interrupts in UNIX No data or a maximum of 4 Byte knows...! Nothing Receiver Rendezvous and receiver are coupled for the duration of message transfer! Limited concurrency No buffers required! Direct copy of data from sender to receiver! Very attractive when crossing address space boundaries! Simple to implement Examples! Ada, QNX,... knows...! that message arrived safely Receiver (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 6

Synchronous Service Invocation Even less concurrency Bi-directional communication possible Example! Remote Procedure Call (RPC) DCE, Corba, COM+, Java RMI,...! QNX knows...! Message has been received! Request has been processed! The result (Client) Receiver () reply() Asynchronous Service Invocation More concurrency again Sometimes called asynchronous RPC Examples! V-Kernel knows...! Message has been received! Request has been processed! The result get_reply() Receiver reply() get_reply() (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 7

Messages Across Address Spaces Receiver Receiver Operating System Operating System Asynchronous 2 copies! From sender to buffer! From buffer to receiver Problems! Buffer management! Overflow handling Synchronous and receiver are blocked! Direct copy from sender to receiver possible! 1 copy Problems! Limited concurrency Solved with multiple threads Using Virtual Memory Techniques Map message into address space of receiver! Mark page(s) as Copy-On-Write! No single copy possible If sender or receiver change message content, a copy must be created! Worst case 1 copy Additional problems! If message doesn t start on page boundary, we leak memory content to other applications Possible solution! Operating system manages message buffers! must request send buffer first! Receiver will get address of message upon receipt Address Space A Address Space B (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 8

Signale Übermittlung asynchroner Ereignisse zwischen Prozessen (keine zusätzliche Übertragung von Daten möglich) Ursprung! Software-Interrupts in Fehlerfällen und für Job Control Arithmetikfehler Adreß- und Busfehler Unerlaubter Zugriff Timer... Reaktion auf Signal! Blockieren: Zeitliche Empfangsbeschränkung (vgl. Disable Interrupts)! Ignorieren! Verarbeiten: Anmeldung eines Signal Handlers! Prozeß terminieren Beispiel Prozeß gibt Zustandsinformationen bei Erhalt eines Signals aus int signal_arrived = 0; void signal_handler ( int signo ) { signal_arrived = 1; int main () { signal(sigusr1,signal_handler); while (1) { // Tue etwas sinnvolles... if (signal_arrived) { // Reagiere auf Signal... signal_arrived = 0; Absenden des Signals, z.b. kill -USR1 pid (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 9

Pipes Pipes und Named Pipes (auch FIFO genannt) für Prozeßkommunikation auf einem Rechner Pipes zwischen Vater- und Kindprozessen:! Verbindung über vererbte Datei-Deskriptoren Beispiel main () { int pipe_ends[2]; pipe(pipe_ends); if (fork()!= 0) { // Vaterprozeß write(pipe_ends[1],daten,...); else { // Kindprozeß read(pipe_ends[0],daten,...); " Transportsystem" Empfänger" Exkurs: UNIX-Shell und Pipes Exemplarische Realisierung von: a b... int pfd[2]; pipe(pfd); if (fork()==0) { // Kind - Wird Prozeß a dup(pfd[1],1); /* stdout auf Pipe-Eingang */ execve( a,...); if (fork()==0) { // Kind - Wird Prozeß b dup(pfd[0],0), /* stdin auf Pipe/Ausgang */ execve( b,...); if (Vordergrund-Bearbeitung) { wait(...);... zurück zur Eingabeschleife (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 10

Realisierung " Empfänger" Puffer" Klassisches Erzeuger/Verbraucher-System! Puffer bestimmter Länge für jede Pipe! Empfänger wird blockiert, wenn keine Daten vorliegen! wird blockiert, solange Puffer voll ist Synchrones Verfahren bei zu kleinem Puffer! Gefahr der Verklemmung? Named Pipes! Pipe-Deskriptoren nur über fork vererbbar! Pipe-Namen im Dateisystem aufbauen, damit unabhängige Prozesse miteinander kommunizieren können! Kommunizierte Daten werden nicht über Dateisystem geleitet! Client/ Systems Based on synchronous service invocation Forms the platform for most distributed systems today Client! Worldwide availability of servers! Clients send requests! RPC dominant communication technique! Addresses open and heterogeneous systems But also a possible architecture for modern operating systems! Mikrokernel with minimal functionality! Lifting of operating system functionality into user-mode servers! Basis for distributed operating systems! Efficient communication among address spaces required reply() (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 11

Client/ Architecture Client Client Client Client Betriebssystem Betriebssystem Rechner 1 Rechner 2 Lokal servers! File system! Input and Output Graphics subsystem! Process management! Paging! Remote servers! Network file systems (e.g. shares or NFS)! Distributed file systems! Rlogin, Telnet,...! WWW server (IIS, apache, )! Clock synchronization (ntp) Communication Remote Procedure Call (RPC) (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 12

Remote Procedure Call Tries to resemble semantics of local procedure call! Push arguments on stack! Jump subroutine Push return address on stack! Execute procedure! Store result in well-known register! Return from procedure Local procedure are part of address space of caller Now, procedure may be remote! In some other address space! Maybe on another machine Local Procedure Call Application r := f(p); f! RPC: Course of Action stubs extracts arguments and pushes them on the stack Remote procedure is called as a local subroutine Client r := rp(p); 1 Client stub puts arguments and procedure name into message 6 Client-Stub rp Data types are converted to some network standard (Marshalling) Operating System Message is sent to server -Stub rp 3 4 Operating System rp Host 2 5 Host Result of remote procedure travels the Network other way! (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 13

Marshalling Imported for distributed systems! Encoding of basic data types may differ Little endian vs. big endian Define a generic network standard! converts data from local representation to network standard! Receiver converts data from network standard to local representation Not needed if we just want to cross address spaces not hosts RPC Compiler! Defines a set of remote procedures Service or interface description! Define signature for each method Type and sequence of arguments Name of procedure Return type Interface definition language (IDL) IDL compiler automates most functionality to call a remote procedure! Client stubs! stubs! Additional server functionality.c Stub.c Interface Description Compiler (e.g. C++) IDL Compiler Client Stub.c Client.c (c) Peter Sturm, University of Trier, D-54286 Trier, Germany 14