operating systems
play

Operating Systems RPC: Processes Maria Hybinette, UGA Maria - PDF document

Operating Systems RPC: Processes Maria Hybinette, UGA Maria Hybinette, UGA Chapter 3: Processes: Outline Process Concept: views of a process Process Scheduling Operations on Processes Cooperating Processes Inter Process


  1. Operating Systems RPC: Processes Maria Hybinette, UGA Maria Hybinette, UGA Chapter 3: Processes: Outline • Process Concept: views of a process • Process Scheduling • Operations on Processes • Cooperating Processes • Inter Process Communication (IPC) – Local • Pipe • Shared Memory • Messages (Queues) – Remote • Lower Level: Sockets, MPI, Myrinet • Higher Level: RPC, RMI, WebServices, CORBA, Maria Hybinette, UGA Maria Hybinette, UGA

  2. Client-Server Remote Machine Communication Mechanisms • Socket communication • Remote Procedure Calls (Project due next week). • Remote Method Invocation (Briefly, on your own) Maria Hybinette, UGA Maria Hybinette, UGA Procedure Calls • [caller] wants result – Request asks someone – an C E/S expert for result Result • [callee/server/expert] – provided result and return to caller. Request • Remote Procedure Calls C E/S Result Maria Hybinette, UGA Maria Hybinette, UGA

  3. IPC vs. RPC Maria Hybinette, UGA Maria Hybinette, UGA Remote Procedure Calls (RPC) • Inter-machine process to process communication – (abstract) procedure calls across a network: – functionCall [address] [ parameters] – [address] : adds an extra layer for RPCs. • remote program number, • remote program version number (enables old ! newer), and • remote procedure number • -- ! Address – machine [& port] : routed to a portmapper instead. – rusers, rstat, rlogin, rup => daemons at ports • Registered library calls (port mapper) • Many are now disabled due to security concerns ( here ) – Hides message passing I/O from programmer • Looks (almost) like a procedure call -- but client invokes a procedure on a server. – Pass arguments – get results – Fits into high-level programming language constructs – Well understood Maria Hybinette, UGA Maria Hybinette, UGA

  4. End-to-End Addresses: IP_number-host [:Port_number] • Identifies the ultimate Secure shell/file(ssh, sftp, scp), destination 22 Mail (SMTP) • IP addresses identify hosts WWW 25 Echo – 127.0.0.1, 172.20.10.15, 128.192.101.135 80 – {ingrid:509} nslookup nike.cs.uga.edu 7 – Ifconfig – 172.16-31, 192.168.0-255 rlogin 513 • private address spaces. • Host has many applications ! ports • Ports (16-bit identifier) 1-65,535 – End to End. Well-known 1-1,023 Registered 1,024-49,151 Dynamic 49,152-65,535 https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers Maria Hybinette, UGA Maria Hybinette, UGA Details: Remote Procedure Calls • RCP one step further. – Custom RPC programs divorces the concept of the requirement that ‘specific’ well known port numbers or being tied to specific port numbers for programs by using a look-up server: portmapper (at port 111). – Programs can use ‘any’ portnumber by registering it to the portmapper. • Either TCP or UDP • Portable: Permits Communication between machines that use different representation of data (order of bits). – eXternal Data Representation ( XDR ) protocol Maria Hybinette, UGA Maria Hybinette, UGA

  5. rlogin [nike.cs.uga.edu:513] • Plain text communication over port 153 (default). • Problems: Passwords transmitted un- encrypted. • Today: talk about mechanics: • .rlogin/.rhosts files – Allow logins without a password • Login – without password can be set up using encryption keys . Future: Tools Talk – start here: Maria Hybinette, UGA Maria Hybinette, UGA https://www.jeffgeerling.com/blog/brief-history-ssh-and-remote-access RPC Calls : Portmapper Anwers: What is the Port Number. • RPC applications picks any available port then registers it with a port mapper daemon (this is for specially for remote procedure calls) • rpcinfo – p Maria Hybinette, UGA Maria Hybinette, UGA

  6. Remote Procedure Calls (RPC) time line • RPC High level view: – Calling process attempt to call a ‘remote’ routine on server – Calling process (client) is suspended – Parameters are passed across network to a process server – Server executes procedure – Return results across network – Calling process resumes Maria Hybinette, UGA Maria Hybinette, UGA Client Machine Server Machine Client Program Runs Receive Request Calls RPC Function Execute request: rlogin(), ravg() Get Appropriate 1. Program # server program 2. Version # Handle request Call that service 3. Function # Service function computes, executes. Request Completes Client Program Continues Return Results Maria Hybinette, UGA Maria Hybinette, UGA

  7. Remote Procedure Calls • Usually built on top sockets: – User Datagram, or – Transmission Control Protocols routed by the Internet Protocol (IP)). • Uses stubs – client-side and server-side proxies for the actual procedures on the server & client. – The client-side stub locates the server and marshalls the parameters. • Kernel helps with this. – The server-side stub receives this message, unpacks the ‘marshalled’ parameters, and then performs the procedure call on the server • Kernel helps with this. Maria Hybinette, UGA Maria Hybinette, UGA Association 5 tuple {protocol, local-address, local-process, foreign-address, foreign-process} Client/Server Model Using RPC XDR pack XDR unpack Each RPC parameters parameters call invocation by a call client process calls client server client server stub a client stub , stub which builds a return return unpack pack message and results results sends it to a server kernel kernel stub network • The server stub uses the message to generate a local procedure call to the server • If the local procedure call returns a value, the server stub builds a message and sends it to the client stub, which receives it and returns the result(s) to the client Maria Hybinette, UGA Maria Hybinette, UGA

  8. RPC Association Between Machines • Association between remote and local host – 5 tuple • {protocol, local-address, local-process, foreign-address, foreign- process} • Protocol : transport protocol typically TCP or UDP, needs to be common between hosts • Local/foreign address: Typically the IP address • Local/foreign process: Typically the port number (not PID) Maria Hybinette, UGA Maria Hybinette, UGA Binding Registration data flow Client Process Portmapper Procedure Call data flow Server Process • RPC application is packed into a program and is assigned an identifier (Port) • Portmap : allocates port numbers for RPC programs Maria Hybinette, UGA Maria Hybinette, UGA

  9. Details • Portmapper (daemon) listens on port 111 UDP (TCP) • Handles the mapping: – {Program #, Version #) ! Port# • Each RPC Server starts on Port# (ephemeral) and registers it with the Portmapper • Each RPC Client calls Portmapper on specified host to accept the port of target RPC Server, then once connection is established RPC Clients calls server with request, containing procedureID and parameters. Maria Hybinette, UGA Maria Hybinette, UGA Details of Connecting Remote Procedure Calls • Book version of previous slide Maria Hybinette, UGA Maria Hybinette, UGA

  10. Remote Procedure Calls Details • Machine independent representation of data: – Differ if most [or least] significant byte is in the high memory address – External data representation (XDR) • Allows more complex representation that goes beyond: – htonl() routines. • Fixed or dynamic address binding – Dynamic: Matchmaker daemon at a fixed address (given name of RPC returns port of requested daemon) Maria Hybinette, UGA Maria Hybinette, UGA Hide Complexity Program to generate code • rpcgen generates C code from a file written in ‘RPC language’ avoids programmer to worry about networking details – Stylistics – end with an X. <name>.x , e.g., avg.x – rpcgen avg.x • Leaves the programmer with 3 tasks: [avg.x, ravg.c, and avg_proc.c ] – avg.x – Create Client routine (e.g., ravg.c with main program on local host), then run it. • ravg <host> <parameters> • ravg localhost 1 2 3 4 • ravg vcf4 1 2 3 4 • ravg vcf4 $RANDOM $RANDOM – Create Server program avg_proc.c (e.g., actual code to compute something, e.g., an average), then run it: • avg_svc & // but run avg_svc • rpcinfo –p localhost https://docs.oracle.com/cd/E19683-01/816-1435/rpcgenpguide-21470/index.html http://www.linuxjournal.com/article/2204?page=0,1 Maria Hybinette, UGA Maria Hybinette, UGA

  11. Other Locations of Tutorial • Tutorial https://www.linuxjournal.com/article/2204 Maria Hybinette, UGA Maria Hybinette, UGA Tutorial ( linux journal ) generated files • rpcgen generates C code from a file written in ‘RPC language’ <name>. x , e.g., avg.x Default output rpcgen Syntax Example Header file <name>.h avg.h XDR data type translate <name>_xdr.c avg._xdr.c routines (from type in .h file) stub program for server <name>_svc.c avg_svc.c stub program for client <name>_clnt.c avg_clnt.c • (Create these) Application programmer (you) write code for: – Client routine (main program) • ravg <host> <parameters> – Server program (e.g., actual code to compute average) • avg_proc.c Maria Hybinette, UGA Maria Hybinette, UGA

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend