1 / 8

Unix Inter-Process Communication

Multiprocessing. Most common program-modularization technique in Unix paradigm is to split up large programs into multiple cooperating processesUnix OS's encourage breaking programs into simpler small applications by:making process-spawning cheapproviding methods (shellouts, I/O redirection, pipe

acton
Télécharger la présentation

Unix Inter-Process Communication

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. Unix Inter-Process Communication Art of Unix Programming: Ch #7

    2. Multiprocessing Most common program-modularization technique in Unix paradigm is to split up large programs into multiple cooperating processes Unix OS's encourage breaking programs into simpler small applications by: making process-spawning cheap providing methods (shellouts, I/O redirection, pipes, message-passing, and sockets) that make it relatively easy for processes to communciate encouraging the use of simple, transparent, textual data formats that can be passed through pipes and sockets

    3. Taxonomy of Unix IPC Methods Hand off tasks to specialist programs program runs another to accomplish a specialized task called shelling out to the called program Caller and calee do not communicate while running, so protocol design not an issue except caller may pass in command-line arguments, and callee might pass back data by, for example, writing or modifying a file that the caller then uses

    4. Taxonomy of Unix IPC Methods Pipes, Redirection and Filters Depend on convention that every program has initially available to it (at least) two I/O data streams: standard input and standard output numeric file descriptors 0 and 1 respectively Many programs can be written as filters, which read sequentially from standard input and write only to standard output All stages in a pipeline run concurrently, each stage waits for input on the output of the previous one, but no stage has to exit before the next can run Unidirectional, all data flows one way

    5. Taxonomy of Unix IPC Methods Slave Processes Send data back and forth between master and slaves, while both are running at the same time Requires some sort of protocol and internal-state machines to handle communication between them When becomes to complex, time to separate into client-server

    6. Taxonomy of Unix IPC Methods Peer-to-Peer IPC All previous have a hierarchy, with one process effectively controlling or driving another In communications and networking we frequently need channels that are peer-to-peer, usually with data flowing freely in both directions

    7. Peer-to-Peer IPC Methods Tempfiles oldest IPC method files act as drops between cooperating programs Signals two processes on the same machine can communicate by sending signals a form of soft interrupt processes declare signal handlers

    8. Peer-to-Peer IPC Methods Sockets Developed in BSD lineage of unix as a way to encapsulate bi-directional stream communication Byte streams are sequenced and reliable Of course, sockets can be used for communication of processes on different machines Shared Memory shared memory requires that the processes to communicate live on the same machine Used instead of sockets when performance is critical issue (and processes can be run on the same machine).

More Related