1 Outline Objective: –Message Passing Administrative details: –Sign up for demo slots on Demo Scheduler –Check for demo location with grader –Submit details.

Slides:



Advertisements
Similar presentations
Processes Management.
Advertisements

Operating Systems Lecture 7.
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
CSCC69: Operating Systems
Deadlocks, Message Passing Brief refresh from last week Tore Larsen Oct
Remote Procedure Call (RPC)
Remote Procedure Call Design issues Implementation RPC programming
©2009 Operačné systémy Procesy. 3.2 ©2009 Operačné systémy Process in Memory.
Tam Vu Remote Procedure Call CISC 879 – Spring 03 Tam Vu March 06, 03.
Lightweight Remote Procedure Call Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy Presented by Alana Sweat.
Lecture 3 Page 1 CS 239, Spring 2001 Interprocess Communications in Distributed Operating Systems CS 239 Distributed Operating Systems April 9, 2001.
Avishai Wool lecture Introduction to Systems Programming Lecture 4 Inter-Process / Inter-Thread Communication.
A CHAT CLIENT-SERVER MODULE IN JAVA BY MAHTAB M HUSSAIN MAYANK MOHAN ISE 582 FALL 2003 PROJECT.
CS 582 / CMPE 481 Distributed Systems Communications (cont.)
Computer Science Lecture 2, page 1 CS677: Distributed OS Last Class: Introduction Distributed Systems – A collection of independent computers that appears.
RPC Project Using either sockets or TLI, implement Remote Procedure Calls between two distinct machines that are communicating over an Ethernet network.
Networks 1 CS502 Spring 2006 Network Input & Output CS-502 Operating Systems Spring 2006.
Communication in Distributed Systems –Part 2
02/01/2010CSCI 315 Operating Systems Design1 Interprocess Communication Notice: The slides for this lecture have been largely based on those accompanying.
CS-3013 & CS-502, Summer 2006 Network Input & Output1 CS-3013 & CS-502, Summer 2006.
Remote Procedure Calls. 2 Client/Server Paradigm Common model for structuring distributed computations A server is a program (or collection of programs)
Chapter 4.1 Interprocess Communication And Coordination By Shruti Poundarik.
Interprocess Communication. Process Concepts Last class.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 12 Communicating over.
Inter-Process Communication Mechanisms CSE331 Operating Systems Design.
Chap 3 Processes-Concept. Process Concept Process – a program in execution; process execution must progress in sequential fashion A process includes:
Distributed Systems. Interprocess Communication (IPC) Processes are either independent or cooperating – Threads provide a gray area – Cooperating processes.
COSC 3407: Operating Systems
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Problems with Send and Receive Low level –programmer is engaged in I/O –server often not modular –takes 2 calls to get what you want (send, followed by.
Review COMPSCI 210 Recitation 7th Dec 2012 Vamsi Thummala.
CS307 Operating Systems Project 2: Inter-Process Communication and Synchronization Fan Wu Department of Computer Science and Engineering Shanghai Jiao.
Chapter 2 Applications and Layered Architectures Sockets.
The Socket Interface Chapter 21. Application Program Interface (API) Interface used between application programs and TCP/IP protocols Interface used between.
1 Lecture 5 (part2) : “Interprocess communication” n reasons for process cooperation n types of message passing n direct and indirect message passing n.
Review Questions on Chapter IV—IPC COSC 4330/6310 Summer 2013.
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
Processes. Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication.
CE Operating Systems Lecture 13 Linux/Unix interprocess communication.
Unix Process Model Simple and powerful primitives for process creation and initialization. fork syscall creates a child process as (initially) a clone.
Processes CSCI 4534 Chapter 4. Introduction Early computer systems allowed one program to be executed at a time –The program had complete control of the.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-4 Process Communication Department of Computer Science and Software.
Remote Procedure Call Andy Wang Operating Systems COP 4610 / CGS 5765.
1 Outline for Today Objective: –5 Dining Philosophers –Reader-writer problem –Message Passing Administrative details: –Check for demo location with grader.
Brian N. Bershad, Thomas E. Anderson, Edward D. Lazowska, and Henry M. Levy. Presented by: Tim Fleck.
Mark Stanovich Operating Systems COP Primitives to Build Distributed Applications send and receive Used to synchronize cooperating processes running.
Operating Systems Lecture Notes Processes Matthew Dailey Some material © Silberschatz, Galvin, and Gagne, 2002.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
InterProcess Communication. Interprocess Communication Processes within a system may be independent or cooperating Cooperating process can affect or be.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
Inter-Process Communication 9.1 Unix Sockets You may regard a socket as being a communication endpoint. –For two processes to communicate, both must create.
RPC Model, Stubs and Skeletons Divya Nampalli
Implementing Remote Procedure Call Landon Cox February 12, 2016.
Distributed Computing & Embedded Systems Chapter 4: Remote Method Invocation Dr. Umair Ali Khan.
1 Outline for Today Objective: –Continue with message-passing style interprocess communication (IPC) –Get specific with UNIX system calls Administrative.
Communication in Distributed Systems. . The single most important difference between a distributed system and a uniprocessor system is the interprocess.
03 – Remote invoaction Request-reply RPC RMI Coulouris 5
Outline Objective: Administrative details: Message Passing
Processes Overview: Process Concept Process Scheduling
Last Class: RPCs and RMI
2-Dining Puppies Mutex Failure.
IPC and RPC.
Chapter 4: Processes Process Concept Process Scheduling
Sarah Diesburg Operating Systems COP 4610
EECE.4810/EECE.5730 Operating Systems
Remote Procedure Call Hank Levy 1.
Remote Procedure Call Hank Levy 1.
Remote Procedure Call Hank Levy 1.
Message Passing Systems Version 2
Presentation transcript:

1 Outline Objective: –Message Passing Administrative details: –Sign up for demo slots on Demo Scheduler –Check for demo location with grader –Submit details will be posted on the newsgroup –“Freeze” your code at midnight in a subdir you won’t touch until the demo (same as submitted) –Check for changes on the website (in schedule, problem sets, etc)

2 Interprocess Communication – Messages (API-level) Assume no explicit sharing of data elements in the address spaces of processes wishing to cooperate/communicate. Essence of message-passing is copying (although implementations may avoid actual copies whenever possible). Problem-solving with messages - has a feel of more active involvement by participants.

3 Issues System calls for sending and receiving messages with the OS(s) acting as courier. –Variations on exact semantics of primitives and in the definition of what comprises a message. Naming - direct (to/from pids), indirect (to distinct objects - e.g., mailboxes, ports, sockets) –How do unrelated processes “find” each other? Buffering - capacity and blocking semantics. Guarantees - in-order delivery? no lost messages?

4 Send and Receive Messaging combines

5 5 DP – Direct Send/Receive Message Passing Between Philosophers Philosopher 0 (thinking) Philosopher 1 Philosopher 2 Philosopher 3 (eating) Philosopher 4 Fork please?

6 Philosopher 0 (thinking) Philosopher 1 Philosopher 2 Philosopher 3 (eating) Philosopher 4 Umm. Oh yeah.

7 Philosopher 0 (thinking) Philosopher 1 Philosopher 2 Philosopher 3 (eating) Philosopher 4 Fork please?

8 Philosopher 0 (thinking) Philosopher 1 Philosopher 2 Philosopher 3 (eating) Philosopher 4 Fork please? I’ll ignore that request until I’m done

9 Philosopher 0 (thinking) Philosopher 1 Philosopher 2 Philosopher 3 (eating) Philosopher 4 Fork please?

10 Client / Server server-> send(request)

11 Example: Time Service (kernel-based)

12 Example: Time Service (via Messages)

13 Client / Server with Threads

14 Hiding Message-Passing: RPC

15 Remote Procedure Call - RPC Looks like a nice familiar procedure call P0P0 result = foo(param); P1P1 Receive

16 Remote Procedure Call - RPC Looks like a nice familiar procedure call P0P0 result = foo(param); please do foo for P 0 with param P1P1 Receive blocked here

17 Remote Procedure Call - RPC Looks like a nice familiar procedure call P0P0 result = foo(param); please do foo for P 0 with param P1P1 Receive r = foo(param); // actual call blocked here

18 Remote Procedure Call - RPC Looks like a nice familiar procedure call P0P0 result = foo(param); P1P1 Receive r = foo(param); // actual call Reply returning r to P 0 blocked here

19 Remote Procedure Call - RPC Looks like a nice familiar procedure call P0P0 result = foo(param); P1P1 Receive r = foo(param); // actual call Reply returning r to P 0

20 Remote Procedure Call - RPC Looks like a nice familiar procedure call P0P0 result = foo(param); P1P1 Receive r = foo(param); // actual call Reply

21 5DP via RPC with Fork Manager Looks like a nice familiar procedure call Philosopher 0 result = PickupForks (0); Fork Server Receive r = proc(param); // explicit queuing when necessary Reply

22 Example: Time Service via RPC

23 What’s Really Going On

24 RPC Issues

25 Practice Break Larry, Moe, and Curly are planting seeds. Larry digs the holes. Moe then places a seed in each hole. Curly then fills the hole up. There are several synchronization constraints: –Moe cannot plant a seed unless at least one empty hole exists, but Moe does not care how far Larry gets ahead of Moe. –Curly cannot fill a hole unless at least one hole exists in which Moe has planted a seed, but the hole has not yet been filled. Curly does not care how far Moe gets ahead of Curly. –Curly does care that Larry does not get more than MAX holes ahead of Curly. Thus, if there are MAX unfilled holes, Larry has to wait. –There is only one shovel with which both Larry and Curly need to dig and fill the holes, respectively. Sketch out the pseudocode for the 3 threads which represent Larry, Curly, and Moe using whatever synchronization/communication method you like.

26 Larry () {while (TRUE) { P(holes); P(shovel); dig; V(shovel); V(empty); } Moe () {while(TRUE){ P(empty); seed empty hole; V(seeded); } semaphore holes = MAX; semaphore shovel = 1; semaphore empty, seeded = 0; Curly () {while(TRUE){ P(seeded); P(shovel); fill hole; V(shovel); V(holes); }

27 Larry () {while (TRUE) { garden->allowdigging(); dig; garden->donedigging(); } Moe () {while(TRUE){ garden->allowseeding(); seed empty hole; garden->doneseeding(); } Curly () {while(TRUE){ garden->allowfilling(); fill hole; garden->donefilling(); }

28 Garden Monitor Lock garden_gate; Condition shovel_free, empty_holes, filled_holes, not_too_far_ahead; Void allowdigging() { garden_gate.Acquire(); while (holes >= MAX) not_too_far_ahead.Wait(garden_gate); while (!shovel) shovel_free.Wait(garden_gate); holes ++; shovel = FALSE; garden_gate.Release();} Void donedigging() { garden_gate.Acquire(); empty++; shovel=TRUE; empty_holes.Signal(garden_gate); shovel_free.Signal(garden_gate); garden_gate.Release();} Void allowseeding() { garden_gate.Acquire(); while (empty == 0) empty_holes.Wait(garden_gate); garden_gate.Release();} Void doneseeding() { garden_gate.Acquire(); empty--; filled++; filled_holes.Signal(garden_gate); garden_gate.Release();}

29 Void allowfilling() { garden_gate.Acquire(); while (filled==0) filled_holes.Wait(garden_gate); while (!shovel) shovel_free.Wait(garden_gate); filled --; shovel = FALSE; garden_gate.Release();} Void donefilling() { garden_gate.Acquire(); holes--; shovel=TRUE; not_too_far_ahead.Signal(garden_gate); shovel_free.Signal(garden_gate); garden_gate.Release();}

30 Garden Server (using threads and monitor) While (1){ ReceiveRequest(msg); thread->fork(handler, msg); } Void handler (msg){ garden->msg.function(); SendReply(msg.requester); exit(); }

31 Larry () {while (TRUE) { garden_server->RPC(allowdigging); dig; garden_server-> RPC(donedigging); } Moe () {while(TRUE){ garden_server-> RPC(allowseeding); seed empty hole; garden_server-> RPC(doneseeding); } Curly () {while(TRUE){ garden_server-> RPC(allowfilling); fill hole; garden_server-> RPC(donefilling); }

32 Outline for 9/17 Objective: –Message Passing Administrative details: –ACM Meeting this Wed. D106 LSRC 6pm Replaced by lecture 5

33 Naming Destinations for Messages: Ports replyport-> replyport->receive(response);

34 Advantages of Ports

35 Port Issues

36 Examples of Ports in Real Systems

37 Sockets for Client-Server Message Passing Server 1. Create a named socket syscalls: sfd = socket(…) bind (sfd, ptr,…) 2. Listen for clients listen(sfd, …) 4. Connection made and continue listening cfd=accept(sfd, …) 5. Exchange data write(cfd, …) 6. Done: close(cfd); close(sfd); Client 3. Create unnamed socket & ask for connection syscalls: cfd=socket(…) err=connect(cfd, ptr, …) 5. Exchange data read(cfd, …) 6. Done: close(cfd); name

38 Notification of Pending Messages

39 Polling: Select

40 Immediate Notification: Upcalls

41 Advantages of Server “Isolation” Afforded by Message Passing

42 Reconsidering the Kernel Interface and OS Structure

43 Servers and Microkernels

44 Microkernel with “User-Level” OS Server Processes fork open

45 End-to-End Argument Application-level correctness requires checking at the endpoints to ensure that the message exchange accomplished its purpose –Application semantics involved –Notification of successful delivery (UPS tracking) is not as good as a direct response (thank you note) from the other end. Reliability guarantees in the message-passing subsystem provide performance benefits (short- circuiting corrective measures). –Re-transmitting packet may save re-transferring whole file.