1 / 23

INTER-PROCESS COMMUNICATION AND SYNCHRONISATION : Lesson-7: Pipe, socket and RPC

INTER-PROCESS COMMUNICATION AND SYNCHRONISATION : Lesson-7: Pipe, socket and RPC. 1. Pipe. 1. Pipe is a device with the functions create, connect and delete and functions similar to a device driver (open, write, read, close) and include.

Download Presentation

INTER-PROCESS COMMUNICATION AND SYNCHRONISATION : Lesson-7: Pipe, socket and RPC

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. INTER-PROCESS COMMUNICATION AND SYNCHRONISATION: Lesson-7: Pipe, socket and RPC Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  2. 1. Pipe 1. Pipe is a device with the functions create, connect and delete and functions similar to a device driver (open, write, read, close) and include. - A message-pipe is an IPC queue of messages between two given inter-connected tasks or two sets of tasks. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  3. Pipe-device Functions Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  4. 2. An OS can handle a pipe IPC as a virtual device when writing and reading from the pipe. The C command are similar to fwrite with a pipe name to write into a named file, and C command fread with name to read from a named pipe. An OS handles stream of bytes into the pipes similar to Java PipedInputOutputStreams. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  5. Task A Pipe Device p Task A sending messages into a pipe and task D receiving that Task D Task C m1 m1 m2 read m1 write m1 read m2 Pipe Device functions create, connect, open, write, read, close, delete write m2 read m3 write m3 Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  6. 3. One task in a set of tasks can write through an OS scheduler to a pipe at the back pointer address, *pBACK. 4. Other task in a set of tasks can read through an OS scheduler from a pipe at the front pointer address, *pFRONT. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  7. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  8. 5. In a pipe, there may be no fixed number of bytes per message with an initial pointer for the back and front and there may be no limiting final back pointers. A pipe can therefore be unlimited and have a variable number of bytes between the initial and final pointers.   Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  9. Pipe Functions Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  10. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  11. 2. Socket 1. Two processes (or sections of a task) at two sets of ports interconnect (perform inter process communication) through a socket at each. [These are virtual (logical), and not physical sockets.] Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  12. 2. A socket is a stream between two specified sections (ports) at the specified sets (addresses) sent with a port-specific protocol. Each socket may have the process address (similar to a network or IP address) and section (similar to a port) specification. The sections (or ports or tasks) and sets of processes (addresses) may be on the same computer or on a network. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  13. Process_i Port_j Socket Device S1 Process i port j socket for the messages that socket at process m port n receives Process_m Port_n Task C Socket Device S2 write S, m1 m1 m1 m2 read S read S read S write S, m2 Device functions of Sockets create, socketS1 (port_j, address_i), socketS2 (port_ n, address_m), open, write, read, close, delete write S, m3 Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  14. 3. There has to be a specific protocol in which the messages at the socket interconnect between (i, j) and (m, n). [i and m are process addresses, and j and n are port or section specifications] A pipe does not have protocol based inter-processor communication, while socket provides that. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  15. 4. A socket can be a client-server socket. Client Socket and server socket functions are different. A socket can be a peer-to-peer socket IPC. At source and destination sockets have similar functions. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  16. 3. Remote Procedure Call (RPC) 1. Provides the inter task communication when a task is at system 1 and another task is at system 2. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  17. 2. Both systems work in the peer-to-peer communication mode. Each system in peer-to-peer mode can make an RPC. • 3. An RPC permits remote invocation of the processes in the distributed systems. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  18. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  19. Summary Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  20. We learnt the following IPC functions at an OS • Pipe, Sockets and Remote procedure calls (RPCs) Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  21. Pipe is a queue or stream of messages that connects the two tasks and the pipe functions are similar to the device functions and IO stream functions. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  22. AnOS provides the sockets for the inter task communication like in a network or client server architecture. Socket has the protocol based IPC functions while pipe functions are simple without the protocol functions. • The RPCs are used for distributed tasks. Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

  23. End of Lesson-7: Pipe, socket and RPC Chapter-8 L7: "Embedded Systems - Architecture, Programming and Design" , Raj Kamal, Publs.: McGraw-Hill, Inc.

More Related