EECS 482 Introduction to Operating Systems

Similar documents
Networks and distributed computing

Networks and distributed computing

416 Distributed Systems. RPC Day 2 Jan 12, 2018

Lecture 5: Object Interaction: RMI and RPC

COMMUNICATION PROTOCOLS: REMOTE PROCEDURE CALL (RPC)

416 Distributed Systems. RPC Day 2 Jan 11, 2017

Last Class: RPCs. Today:

Lecture 06: Distributed Object

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

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

Chapter 3: Client-Server Paradigm and Middleware

Remote Procedure Call

CHAPTER - 4 REMOTE COMMUNICATION

Contents. Java RMI. Java RMI. Java RMI system elements. Example application processes/machines Client machine Process/Application A

5 Distributed Objects: The Java Approach

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

Distributed Technologies - overview & GIPSY Communication Procedure

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

Chapter 4 Communication

RMI: Design & Implementation

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

Lecture 15: Network File Systems

RPC Paradigm. Lenuta Alboaie Andrei Panu

Distributed Systems 8. Remote Procedure Calls

EECS 482 Introduction to Operating Systems

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

Remote Procedure Calls

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

Remote Procedure Call (RPC) and Transparency

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

EECS 482 Introduction to Operating Systems

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

Network Object in C++

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

CS153: Communication. Chengyu Song. Slides modified from Harsha Madhyvasta, Nael Abu-Ghazaleh, and Zhiyun Qian

Structured communication (Remote invocation)

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

Process Concept: views of a process Process Scheduling CSCI 6730/ 4730 Operating Systems

EECS 482 Introduction to Operating Systems

Slides on cross- domain call and Remote Procedure Call (RPC)

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

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

Process. Program Vs. process. During execution, the process may be in one of the following states

Message Passing vs. Distributed Objects. 5/15/2009 Distributed Computing, M. L. Liu 1

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

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

Communication. Distributed Systems Santa Clara University 2016

Remote Invocation Vladimir Vlassov and Johan Montelius

IBD Intergiciels et Bases de Données

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

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

Last Class: Network Overview. Today: Distributed Systems

Lecture 8: February 19

Chapter 3: Processes: Outline. Operating Systems. Remote Procedure Calls (RPC) Client-Server Remote Machine Communication Mechanisms

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

CSCI-1680 RPC and Data Representation John Jannotti

RMI & RPC. CS 475, Spring 2019 Concurrent & Distributed Systems

CSCE 455/855 Distributed Operating Systems

Today: Distributed Objects. Distributed Objects

Distributed Systems. 5. Remote Method Invocation

Interprocess Communication

Object-Oriented Systems Design RMI

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

EECS 482 Introduction to Operating Systems

COMP/ELEC 429/556 Introduction to Computer Networks

Operating System Support

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

Outlook. Process Concept Process Scheduling Operations on Processes. IPC Examples

SAI/ST course Distributed Systems

External Data Representation (XDR)

3. Remote Procedure Call

Distributed Systems Principles and Paradigms. Distributed Object-Based Systems. Remote distributed objects. Remote distributed objects

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

EECS 482 Introduction to Operating Systems

The UNIVERSITY of EDINBURGH. SCHOOL of INFORMATICS. CS4/MSc. Distributed Systems. Björn Franke. Room 2414

Introduction & RMI Basics. CS3524 Distributed Systems Lecture 01

Processes. Operating System Concepts with Java. 4.1 Sana a University, Dr aimen

Distributed Environments. CORBA, JavaRMI and DCOM

Networked Systems and Services, Fall 2018 Chapter 4. Jussi Kangasharju Markku Kojo Lea Kutvonen

The Big Picture So Far. Chapter 4: Processes

DISTRIBUTED COMPUTER SYSTEMS

Chapter 4: Processes. Process Concept

Collaboration of Tasks

Communication. Outline

REMOTE PROCEDURE CALLS EE324

Chapter 4: Processes

CHAPTER 3 - PROCESS CONCEPT

DS 2009: middleware. David Evans

Verteilte Systeme (Distributed Systems)

Lecture 17 Java Remote Method Invoca/on

Q.1. (a) [4 marks] List and briefly explain four reasons why resource sharing is beneficial.

Evolution of Service Oriented Architectures

E&CE 454/750-5: Spring 2010 Programming Assignment 1 Due: 11:59 PM Friday 11 th June 2010

Remote Procedure Call

Chapter 4: Processes

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

Chapter 3 Parallel Software

The Big Picture So Far. Chapter 4: Processes

CORBA (Common Object Request Broker Architecture)

JAVA RMI. Remote Method Invocation

Transcription:

EECS 482 Introduction to Operating Systems Fall 2017 Manos Kapritsos Slides by: Harsha V. Madhyastha

Recap: Socket abstraction Machine 1 Machine 2 Process A Process B Process C socket 1 socket 2 socket 3 socket 1 socket 2 Operating system Operating system Network interface card Network interface card November 28, 2017 EECS 482 Lecture 23 2

Client-server Common way to structure a distributed application: Server provides some centralized service Client makes request to server, then waits for response Example: Web server Server stores and returns web pages Clients run web browsers, which make GET/POST requests Example: Producer-consumer Server manages state associated with coke machine Clients call client_produce() or client_consume(), which send request to the server and return when done Client requests block at the server until they are satisfied November 28, 2017 EECS 482 Lecture 23 3

Producer-consumer in clientserver paradigm client_produce() { send produce request to server wait for response server() { receive request if (produce request) { add coke to machine else { take coke out of machine send response Problems? How to fix? November 28, 2017 EECS 482 Lecture 23 4

Producer-consumer in clientserver paradigm client_produce() { send produce request to server wait for response server() { receive request if (produce request) { while(machine is full) { wait add coke to machine else { take coke out of machine send response November 28, 2017 EECS 482 Lecture 23 5

Producer-consumer in clientserver paradigm server() { receive request if (produce request) { create thread that calls server_produce() else { create thread that calls server_consume() server_produce() { lock while (machine is full) { wait put coke in machine unlock send response November 28, 2017 EECS 482 Lecture 23 6

Producer-consumer in clientserver paradigm How to lower overhead of creating threads? Maintain pool of worker threads There are other ways to structure the server Basic goal: Account for slow operations Two approaches: Polling (via select) Threads + signals November 28, 2017 EECS 482 Lecture 23 7

Project 4 Use assertions to catch errors early No. of free disk blocks matches file system contents? Are you unlocking a lock that you hold? Verify initial file system is not malformed Use showfs to verify that contents of file system match your expectations There are no boundaries in TCP byte streams A char* is not a string! November 28, 2017 EECS 482 Lecture 23 8

Producer-consumer in clientserver paradigm client_produce() { send produce request to server server() { wait for response receive request if (produce request) { thread(server_produce()) else { thread(server_consume()) send response November 28, 2017 EECS 482 Lecture 23 9

Remote Procedure Call Hide complexity of message-based communication from developers Procedure calls more natural for inter-process communication Goals of RPC: Client sending request à function call Client receiving response à returning from function Server receiving request à function invocation Server sending response à returning to caller November 28, 2017 EECS 482 Lecture 23 10

RPC abstraction via stub functions on client and server Client machine client call return receive client stub send server return call send server stub receive Server machine November 28, 2017 EECS 482 Lecture 23 11

RPC stubs Client stub: Constructs message with function name and parameters Sends request message to server Receives response from server Returns response to client Server stub: Receives request message Invokes correct function with specified parameterss Constructs response message with return value Sends response to client stub November 28, 2017 EECS 482 Lecture 23 12

RPC abstraction via stub functions on client and server Client machine client call return receive client stub send server return call send server stub receive Server machine November 28, 2017 EECS 482 Lecture 23 13

Producer-consumer using RPC Client stub int produce (int n) { int status; send (sock, &n, sizeof(n)); recv (sock, &status, sizeof(status)); return(status); Server stub void produce_stub () { int n; int status; recv (sock, &n, sizeof(n)); status = produce(n); send (sock, &status, sizeof(status)); November 28, 2017 EECS 482 Lecture 23 14

Generation of stubs Stubs can be generated automatically What do we need to know to do this? Interface description: Types of arguments and return value e.g. rpcgen on Linux November 28, 2017 EECS 482 Lecture 23 15

RPC Transparency RPC makes remote communication look like local procedure calls Basis of CORBA, Thrift, SOAP, Java RMI, Examples in this class? What factors break illusion? Failures remote nodes/networks can fail Performance remote communication is inherently slower Service discovery client stub needs to bind to server stub on appropriate machine November 28, 2017 EECS 482 Lecture 23 16

RPC Arguments Can I have pointers as arguments? How to pass a pointer as argument? Client stub transfers data at the pointer Server stub stores received data and passes pointer Challenge: Data representation should be same on either end Example: I want to send a 4-byte integer:» 0xDE AD BE EF» Send byte 0, then byte 1, byte 2, byte 3» What is byte 0? November 28, 2017 EECS 482 Lecture 23 17

Endianness int x = 0xDE AD BE EF Little endian: Byte 0 is 0xEF Big endian: Byte 0 is 0xDE If a little endian machine sends to a big endian: 0xDE AD BE EF will become 0xEF BE AD DE November 28, 2017 EECS 482 Lecture 23 18

Making a distributed system look like a local system RPC: make request/response look like function call/return Distributed Shared Memory: make multiple memories look like a single memory Distributed File System: make disks on multiple computers look like a single file system Parallelizing compilers: make multiple CPUs look like one CPU Process migration (and RPC): allow users to easily use remote processors November 28, 2017 EECS 482 Lecture 23 19

Building distributed systems Why build distributed systems? Performance Aggregate performance of many computers can be faster than that of (even a fast) single computer Reliability Try to provide continuous service, even if some computers fail Try to preserve data, even if some storage fails November 28, 2017 EECS 482 Lecture 23 20

What is a distributed system? November 28, 2017 EECS 482 Lecture 23 21

What is a distributed system? A collection of distinct processes that: are spatially separated communicate with each other by exchanging messages have non-negligible communication delay do not share fate November 28, 2017 EECS 482 Lecture 23 22

A distributed system is a concurrent system One multi-threaded process on one computer Several multi-threaded processes on several computers send receive November 28, 2017 EECS 482 Lecture 23 23