Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, 2005 4.1 Operating System Concepts Operating Systems Lecture 12 Communicating over.

Slides:



Advertisements
Similar presentations
Processes Management.
Advertisements

©2009 Operačné systémy Procesy. 3.2 ©2009 Operačné systémy Process in Memory.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Remote Procedure CallCS-4513, D-Term Remote Procedure Call CS-4513 Distributed Computing Systems (Slides include materials from Operating System.
Remote Method Invocation
Abhinav Kamra Computer Science, Columbia University 4.1 Operating System Concepts Silberschatz, Galvin and Gagne  2002 Chapter 4: Processes Process Concept.
FONG CHAN SING (143334) WONG YEW JOON (143388). JAVA RMI is a distributive system programming interface introduced in JDK 1.1. A library that allows an.
Chapter 3.2: Processes modified by your instructor
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Chapter 3: Processes.
CS490T Advanced Tablet Platform Applications Network Programming Evolution.
Sockets  Defined as an “endpoint for communication.”  Concatenation of IP address + port.  Used for server-client communication.  Server waits for.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Chapter 3: Processes.
CS3771 Today: network programming with sockets  Previous class: network structures, protocols  Next: network programming Sockets (low-level API) TODAY!
Introduction to Remote Method Invocation (RMI)
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 3: Processes Modified from the text book Slides. TY, Sept 2010.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
CHAPTER 4 PROCESSES Operating Systems CHAPTER FOUR, OPERATING SYSTEMS 2 Processes Current-day computer systems allow multiple programs to be loaded into.
RPC Project Using either sockets or TLI, implement Remote Procedure Calls between two distinct machines that are communicating over an Ethernet network.
1/30/2004CSCI 315 Operating Systems Design1 Processes Notice: The slides for this lecture have been largely based on those accompanying the textbook Operating.
Chapter 3: Processes. Process Concept Process Scheduling Operations on Processes Cooperating Processes Interprocess Communication Communication in Client-Server.
02/02/2004CSCI 315 Operating Systems Design1 Interprocesses Communication Notice: The slides for this lecture have been largely based on those accompanying.
Communication in Distributed Systems –Part 2
Client-Server Communication Sockets Remote Procedure Calls Remote Method Invocation (Java)
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 3: Processes Modified from the text book Slides. TY, Sept 2011.
02/01/2010CSCI 315 Operating Systems Design1 Interprocess Communication Notice: The slides for this lecture have been largely based on those accompanying.
Remote Procedure Calls. 2 Client/Server Paradigm Common model for structuring distributed computations A server is a program (or collection of programs)
Processes Operating System Concepts chapter 3 CS 355 Operating Systems
Interprocess Communication. Process Concepts Last class.
Inter-process communication
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 3 Inter-process Communication.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 3: Processes 170 UCSB T. Yang Some of slides are from the Chapter.
COSC 3407: Operating Systems
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
1. I NTRODUCTION TO N ETWORKS Network programming is surprisingly easy in Java ◦ Most of the classes relevant to network programming are in the java.net.
Silberschatz, Galvin, and Gagne  1999 Applied Operating System Concepts Chapter 15: Distributed Communication Sockets Remote Procedure Calls (RPCs) Remote.
1 Lecture 5 (part2) : “Interprocess communication” n reasons for process cooperation n types of message passing n direct and indirect message passing n.
3.1 Silberschatz, Galvin and Gagne ©2009Operating System Concepts with Java – 8 th Edition Chapter 3: Processes.
AE4B33OSS Chapter 3: Processes. 3.2Silberschatz, Galvin and Gagne ©2005AE4B33OSS Chapter 3: Processes Process Concept Process Scheduling Operations on.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Outline n Process Concept n Process.
Web Design & Development 1 Lec - 21 Umair Javed. Web Design & Development 2 Socket Programming.
Chapter 3: Processes (6 th edition chap 4). 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Distributed Computing A Programmer’s Perspective.
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Chapter 3: Processes Adapted to COP4610 by Robert van Engelen.
Eric Tryon Brian Clark Christopher McKeowen. System Architecture The architecture can be broken down to three different basic layers Stub/skeleton layer.
3.1 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Overview: Process Concept Process Scheduling Operations on Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Jan 19, 2005 Chapter 3: Processes Process Concept.
Chapter 3: Processes-Concept. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes-Concept Overview Process Scheduling.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
UNIT-6. Basics of Networking TCP/IP Sockets Simple Client Server program Multiple clients Sending file from Server to Client Parallel search server.
 Process Concept  Process Scheduling  Operations on Processes  Cooperating Processes  Interprocess Communication  Communication in Client-Server.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Remote Method Invocation RMI architecture stubs and skeletons for remote services RMI server and client in Java Creating an RMI Application step-by- step.
Communications in Client-Server Systems the details…
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Chapter 3: Process-Concept. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Principles Chapter 3: Process-Concept Process Concept Process Scheduling.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
H.-H. S. Lee 1 ECE3055 Computer Architecture and Operating Systems Lecture 11 Processes Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering.
Client-Server Communication
MCA – 405 Elective –I (A) Java Programming & Technology
Processes Overview: Process Concept Process Scheduling
Socket Programming Cal Poly Pomona Young CS380.
Operating System Concepts
Presentation transcript:

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 12 Communicating over a Network Read Ch 4.6

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Recall IPC Interprocess communication (IPC) accomplished by message passing. Direct Communication: Processes identify each other by name. Indirect communication: Processes use a mailbox or a port.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Communication over a network Communication between processes over a network is accomplished with sockets. A socket is defined as an endpoint for communication. Communication consists between a pair of sockets. A socket is the concatenation of IP address and port number. The socket :1625 refers to port 1625 on host

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Client-Server Architecture The server "listens" to a specified port for incoming client requests. When a request is received, the server accepts the connection from the client socket. "Well known" port numbers:  telnet: 23  ftp: 21  http: 80 All ports numbers below 1024 are considered well known. They are used for standard services.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Example Suppose there is a client process on host machine, X, with IP address, The client contacts a web server at IP address, Question: What is the port number for the server? Host, X, assigns the client a port, e.g Result: Connection between 2 sockets: Client on host XWeb Server: :1625Q: What is this socket? Packets of information travel between the hosts and are delivered to the appropriate process by way of the port.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Socket Communication

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Implementation in Java Java provides a Socket class for establishing communication. (This makes is easier to implement than in C/C++) Example: Implementation of a time-of-day server  Clients request the time of day from the server  The server listens to port 5155 (could choose any port number above 1024).

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Server Side Application public class Server { public static void main( String [ ] args) { Socket client = null;//will hold socket for client PrintWriter pout = null;//allows easy communication ServerSocket sock = null;//Holds server socket... sock = new ServerSocket(5155); //Port for server socket while (true) { //Listen for requests client = sock.accept( ); //Waits for client to contact (blocked) //accept( ) returns socket from client //PrintWriter allows easy communication through socket pout = new PrintWriter(client.getOutputStream( ), true); pout.println(new java.util.Date().toString()); //write time of day to //client pout.close(); client.close();... } }

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Client Side Application public class Client { public static void main(String[ ] args) { InputStream in = null; //for input stream from socket BufferedReader bin = null; //for reading in from socket Socket sock = null; //socket for contact with server... sock = new Socket(" ", 5155); //server socket in = sock.getInputStream( ); //Set up for reading bin = new BufferedReader(new inputStreamReader(in)); String line; // Holds input line while ((line = bin.readln( )) != null) //read to end System.out.println(line); //print out line... } } //(Note: IP address indicates the local host)

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Remote Procedure Calls Remote procedure call (RPC) abstracts procedure calls between processes on networked systems. Messages are well structured (not just data packets).  Addressed to RPC daemon listening to a port on the remote system.  Contain identifier of function to be executed.  Contain parameters to pass to that function. The port is identified by a number at the start of the message packet.  A system has one network address, but may have many ports.  To request a specific service, must address message to the proper port.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Invoking an RPC Invoking a procedure on a remote host is the same as invoking one locally (The details are hidden). Stubs – client-side proxy for the actual procedure on the server. Procedure for executing a remote procedure call:  The client invokes the remote procedure  The RPC system calls the stub, passing it the parameters provided in the procedure call.  The client-side stub locates the port on the server.  The stub marshalls the parameters. (Packages them into a form that can be sent over the network).  The stub transmits a message to the server using message passing.  The server-side stub receives this message, unpacks the marshalled parameters, and performs the procedure on the server.  If necessary, return values are passed back to the client.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Which Port to Use? With ordinary procedure calls there is a binding between the name of the procedure and the address of the procedure. With an RPC, there is binding between the client and server ports. How does the client know which port to use? Predetermined binding: RPC has fixed port address. Dynamic binding: O.S. provides a matchmaker daemon (rendezvous daemon) on a fixed RPC port.  The client sends a message to the matchmaker and requests the port address of the RPC.  The matchmaker returns the port number.  The RPC call is sent to that port.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Execution of RPC

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Remote Method Invocation Remote Method Invocation (RMI) is a Java mechanism similar to RPCs. RMI allows a Java program on one machine to invoke a method on a remote object. RMI works between Java Virtual Machines. Could be two JVM's on the same machine or on different machines.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts RPC vs. RMI Difference between an RPC and an RMI: RPC Procedural: Only allows procedures or functions to be called. Parameters: Ordinary data structures RMI Object Based: Can invoke a method on a remote object. Parameters: Can pass objects as parameters. Allows for distributed Java applications

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Process for RMI 1. A stub on the client machine is invoked. 2. The stub sends a parcel with the name of the method and the marshalled parameters. 3. A skeleton on the server unmarshall's the parameters and invokes the method. 4. The skeleton marshall's the return value into a parcel and returns it to the client. 5. The stub on the client unmarshall's the return value and passes it to the client.

Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Marshalling Parameters Example: Client invokes someMethod(A, B) on a Server object. The method returns a boolean object.