COMMMUNICATING COOPERATING PROCESSES



Similar documents
Mutual Exclusion using Monitors

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

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

Middleware Lou Somers

1 Operating Systems Prof. Dr. Marc H. Scholl DBIS U KN Summer Term IPC may often be used for both

A distributed system is defined as

Network Programming TDC 561

Division of Informatics, University of Edinburgh

Chapter 1 FUNDAMENTALS OF OPERATING SYSTEM

Client/Server and Distributed Computing

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

COM 440 Distributed Systems Project List Summary

Client-server Sockets

Real Time Programming: Concepts

Network Communication

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

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

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


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

Technical Overview Emif Connector

Elements of Advanced Java Programming

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

Monitors, Java, Threads and Processes

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

Chapter 11. User Datagram Protocol (UDP)

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

Agenda. Distributed System Structures. Why Distributed Systems? Motivation

A Java-based system support for distributed applications on the Internet

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.

Event-based middleware services

Client-Server Applications

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2

Chapter 3. Internet Applications and Network Programming

Report of the case study in Sistemi Distribuiti A simple Java RMI application

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

Transparent Redirection of Network Sockets 1

Design Patterns in C++

Operating Systems and Networks

Encryption and Decryption for Secure Communication

B) Using Processor-Cache Affinity Information in Shared Memory Multiprocessor Scheduling

What is Middleware? Software that functions as a conversion or translation layer. It is also a consolidator and integrator.

OPERATING SYSTEMS PROCESS SYNCHRONIZATION

MACH: AN OPEN SYSTEM OPERATING SYSTEM Aakash Damara, Vikas Damara, Aanchal Chanana Dronacharya College of Engineering, Gurgaon, India

Transparent Redirection of Network Sockets 1

Resource Utilization of Middleware Components in Embedded Systems

ActiveVOS Clustering with JBoss

Client-Server Architecture

Introduction to Computer Networks

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

Chapter 2: Remote Procedure Call (RPC)

Symmetric Multiprocessing

Chapter 2: Enterprise Applications from a Middleware Perspective

Chapter 6, The Operating System Machine Level

Distributed Systems Principles and Paradigms. Chapter 04: Communication. 4.1 Layered Protocols. Basic networking model.

Chapter 11 Distributed File Systems. Distributed File Systems

Remote Method Invocation in JAVA

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

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

NETWORKING FEATURES OF THE JAVA PROGRAMMING LANGUAGE

Network Programming with Sockets. Process Management in UNIX

µtasker Document FTP Client

Java Thin-Client Programming for a Network Computing Environment

Cornerstones of Security

Design Notes for an Efficient Password-Authenticated Key Exchange Implementation Using Human-Memorable Passwords

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

IMPLEMENTATION OF AN AGENT MONITORING SYSTEM IN A JINI ENVIRONMENT WITH RESTRICTED USER ACCESS

CORBA, DCOP and DBUS. A performance comparison.

IBM SPSS Collaboration and Deployment Services Version 6 Release 0. Single Sign-On Services Developer's Guide


CS 164 Winter 2009 Term Project Writing an SMTP server and an SMTP client (Receiver-SMTP and Sender-SMTP) Due & Demo Date (Friday, March 13th)

FF/EDM Intro Industry Goals/ Purpose Related GISB Standards (Common Codes, IETF) Definitions d 4 d 13 Principles p 6 p 13 p 14 Standards s 16 s 25

Network Technologies

Internet Information TE Services 5.0. Training Division, NIC New Delhi

Session NM059. TCP/IP Programming on VMS. Geoff Bryant Process Software

[Prof. Rupesh G Vaishnav] Page 1

1 Organization of Operating Systems

Let s Chat! (Part 1)

From Middleware to Service-Oriented Architecture (SOA)

Computer Networks UDP and TCP

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

Lesson: All About Sockets

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

Firewall Port Handling in TENA Applications

Distributed Systems. 2. Application Layer

Apache Traffic Server Extensible Host Resolution

How To Write A Mapreduce Program In Java.Io (Orchestra)

Transcription:

COMMMUNICATING COOPERATING PROCESSES The producer-consumer paradigm A buffer of items can be filled by the producer and emptied by the consumer. The producer and the consumer must be synchronized: the producer can produce one item while the consumer is consuming another item. The buffer can be unbounded or bounded. In the last case the consumer must wait if the buffer is empty and the producer must wait if the buffer is full. The buffer may either be provided by the OS through an Inter Process Communication (IPC) facility or by explicitly coded by the application programmer with the use of Shared Memory solution. G. Piscitelli Politecnico di Bari 1 of 12

Shared data #define BUFFER_SIZE 10 Typedef struct {... } item; item buffer[buffer_size]; int in = 0; int out = 0; SHARED-MEMORY SOLUTION Cooperating Processes Producer process item nextproduced; while (1) { while (((in + 1) % BUFFER_SIZE) == out); /* do nothing */ buffer[in] = nextproduced; in = (in + 1) % BUFFER_SIZE; } Consumer process item nextconsumed; while (1) { while (in == out); /* do nothing */ nextconsumed = buffer[out]; out = (out + 1) % BUFFER_SIZE; } G. Piscitelli Politecnico di Bari 2 of 12

INTERPROCESS COMMUNICATION (IPC) Mechanism for processes to communicate and to synchronize their actions. Message-Passing system: processes communicate with each other without resorting to shared variables. IPC facility provides two operations: send(message) message size fixed or variable receive(message) If P and Q wish to communicate, they need to: establish a communication link between them exchange messages via send/receive From the logical point of view, a communication link may be implemented in several ways: Φ Direct (through process name) or Indirect communication (through mailbox or port) Φ Symmetric or Asymmetric communication (the receiver knows the sender or not) Φ Synchronous or Asynchronous communication (blocking or non blocking primitives) Φ Extended or Limited rendez-vous communication (when both the send and the receive are blocking or not) Φ Unbuffering or Buffering (with bounded or unbounded capacity) communication queue. G. Piscitelli Politecnico di Bari 3 of 12

DIRECT COMMUNICATION Processes must name each other explicitly: send (P, message) send a message to process P receive(q, message) receive a message from process Q Properties of communication link Links are established automatically. A link is associated with exactly one pair of communicating processes. Between each pair there exists exactly one link. The link may be unidirectional, but is usually bi-directional. A variant employs aymmetry: send (P, message) send a message to process P receive(id, message) receive a message from any process; id is the name of the current process. G. Piscitelli Politecnico di Bari 4 of 12

INDIRECT COMMUNICATION Messages are directed and received from mailboxes (also referred to as ports). Each mailbox has a unique id. Processes can communicate only if they share a mailbox. Properties of communication link Link established only if processes share a common mailbox A link may be associated with many processes. Each pair of processes may share several communication links. Link may be unidirectional or bi-directional. Operations create a new mailbox send and receive messages through mailbox destroy a mailbox Primitives are defined as: send(a, message) send a message to mailbox A receive(a, message) receive a message from mailbox A G. Piscitelli Politecnico di Bari 5 of 12

INDIRECT COMMUNICATION Mailbox owner A process (the mailbox is part of its address space and it can only receive messages) or the OS The owner process is that creates a new mailbox When the owner process terminates, the mailbox disappears Mailbox sharing P 1, P 2, and P 3 share mailbox A. P 1, sends; either P 2 or P 3, but not both, will receive the message. Solutions Allow a link to be associated with at most two processes. Allow only one process at a time to execute a receive operation. Φ Allow the system to select arbitrarily the receiver. Sender is notified who the receiver was. G. Piscitelli Politecnico di Bari 6 of 12

COMMUNICATION SYNCHRONIZATION Message passing may be either blocking or non-blocking. Blocking is considered synchronous Non-blocking is considered asynchronous send and receive primitives may be either blocking or non-blocking. COMMUNICATION BUFFERING Queue of messages attached to the link; implemented in one of three ways. 1. Zero capacity 0 messages. Sender must wait for receiver (rendezvous). 2. Bounded capacity finite length of n messages Sender must wait if link full. 3. Unbounded capacity infinite length Sender never waits. G. Piscitelli Politecnico di Bari 7 of 12

CLIENT-SERVER COMMUNICATION Sockets Remote Procedure Calls Remote Method Invocation (Java) G. Piscitelli Politecnico di Bari 8 of 12

CLIENT-SERVER COMMUNICATION Socket A socket is defined as an endpoint for communication. A socket is made up of an IP address concatenated with a port number. The socket 161.25.19.8:1625 refers to port 1625 on host 161.25.19.8 Communication consists of a pair of sockets. The server waits for incoming client requests by listening to a specified port, accepts the connection request from the client socket and completes the connection. Servers offering specific services listen to well-known ports: port 80 for web or http, port 21 for ftp, port 23 for telnet). G. Piscitelli Politecnico di Bari 9 of 12

CLIENT-SERVER COMMUNICATION Remote Procedure Call Remote procedure call (RPC) abstracts procedure calls between processes on networked systems. Stubs client-side proxy for the actual procedure on the server. The client-side stub locates the server and marshalls the parameters. The server-side stub receives this message, unpacks the marshalled parameters, and performs the procedure on the server. Implementation Issues Cannot pass pointers call by reference becomes call by copy-restore (but might fail) Weakly typed languages client stub cannot determine size Not always possible to determine parameter types Cannot use global variables may get moved to remote machine G. Piscitelli Politecnico di Bari 10 of 12

CLIENT-SERVER COMMUNICATION Remote Procedure Call G. Piscitelli Politecnico di Bari 11 of 12

CLIENT-SERVER COMMUNICATION Remote Method Invocation (RMI) RMI is a Java mechanism similar to RPCs. RMI allows a Java program on one machine to invoke a method on a remote object. G. Piscitelli Politecnico di Bari 12 of 12