Presentation is loading. Please wait.

Presentation is loading. Please wait.

Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki IPC1.PPT/001 Inter-Process.

Similar presentations


Presentation on theme: "Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki IPC1.PPT/001 Inter-Process."— Presentation transcript:

1 Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki E-mail: hfujino@siue.edu IPC1.PPT/001 Inter-Process Communication (IPC) CS 547/490 Network Programming

2 Inter Process Communication: What is “IPC”? Computer Process A Process B Address Space for A Address Space for B IPC IPC1.PPT/002 IPC is a mechanism for two processes to communicate

3 CS 547/490 Network Programming Five Methods for IPC: 1. Pipes (Named Pipes) 2. Message Queue 3. Shared memory 4. Semaphore IPC1.PPT/003 5. Monitor

4 CS 547/490 Network Programming  A pipe is essentially a FIFO data structure (queue) created by OS. What is “pipe”?  A pipe provides a communication channel between two independent processes.  A pipe provides a unidirectional communication channel.  A pipe is a communication channel through OS. IPC1.PPT/004  Pipe is a shared memory (or shared file) We can use it through “system calls”

5  Pipe is created by OS CS 547/490 Network Programming FIFO Queue  Pipe is a FIFO queue Process 1 Process 2  Between two processes  Unidirectional channel Concept of pipe visualized IPC1.PPT/005

6 CS 547/490 Network Programming FIFO Queue Process 1 Process 2        IPC1.PPT/006  - The order is preserved by OS Detailed work is taken care of by OS - Race condition will not happen - FIFO enforced by OS (Abstraction of “queue”)

7 CS 547/490 Network Programming Five application models for pipe 1. Single Process Model 2. Parallel Multi-Process Model 3. Sequential Multi-Process Model 4. Chain Multi-Process Model IPC1.PPT/007 5. Circular Multi-Process Model:

8 OS CS 547/490 Network Programming (1) Single-Process Model: FIFO Queue Process pd = pipe; write (pd); read (pd); External FIFO buffer Indirect access to FIFO IPC1.PPT/008

9 CS 547/490 Network Programming (1) Single-Process Model (continued): Process write (FIFO); read (FIFO); OS FIFO Queue FIFO Queue (Pipe) Internal FIFO buffer Direct access to FIFO IPC1.PPT/009

10 DISK CS 547/490 Network Programming (1) Single-Process Model (continued): File Server write (fd); read (fd); OS FIFO Queue Thread 1 Thread 2 Request File Application Example IPC1.PPT/010

11 CS 547/490 Network Programming Advantages Disadvantages OS takes care of “race condition” problem (some operating systems) High level of abstraction - “Create FIFO”, “Delete FIFO”, “Remove an element”, … etc. - Operations as system calls High overhead (each operation requires system call) Program becomes “OS dependent” - Can not run on an OS which does not support pipe. (1) Single-Process Model (continued): IPC1.PPT/011 - “Fail-safe”: data will be in pipe even after a user process crashes

12 CS 547/490 Network Programming Process 1 write (pd); read (pd); OS (2) Parallel Multi-Process Model: IPC1.PPT/012 Process 2 write (pd); read (pd); folk FIFO Queue (Pipe)

13 CS 547/490 Network Programming (2) Parallel Multi-Process Model (continued): Process 1 Process 2 Process n      Pipe General Parallel Multi-Process Model IPC1.PPT/013

14 CS 547/490 Network Programming (2) Parallel Multi-Process Model (continued): Server n Server 2 Disk Server 1 Disk Pipe  When a request arrives, put the request in the pipe.  Transmit the requested file  Remove the first job from the pipe. Application Example IPC1.PPT/014

15 CS 547/490 Network Programming Process 1 write (pd); read (pd); OS (3) Sequential Multi-Process Model: close IPC1.PPT/016 Process 1’ write (pd); read (pd); folk FIFO Queue (Pipe)

16 CS 547/490 Network Programming Process 1 write (pd); read (pd); OS FIFO Queue (Pipe) Process 1’ write (pd); read (pd); (3) Sequential Multi-Process Model (continued): IPC1.PPT/017

17 File Server DISK CS 547/490 Network Programming (3) Sequential Multi-Process Model (continued): OS FIFO Queue (Pipe) Incoming Request Transmit Requested File Application Example IPC1.PPT/018 Authenticator read (pd); write (pd);

18 CS 547/490 Network Programming (3) Sequential Multi-Process Model (continued): Server 2 Disk Server 1 Disk Server n Disk Pipe Authorizer 1 Authorizer 2 Authorizer n           Application Example IPC1.PPT/019

19 CS 547/490 Network Programming Advantages Disadvantages Better response time - “convoy effect” High running cost - Hardware/Software Cost (3) Sequential Multi-Process Model (continued): FIFO DISK J1J1 File Server - Maintenance Cost - Disk Mirroring J2J2 J3J3 J4J4 J5J5 J6J6 Small jobs stack after a big one IPC1.PPT/020

20 CS 547/490 Network Programming (4) Chain Multi-Process Model: Pipe 1Pipe 2 Process 1 Process 2 Process 3 IPC1.PPT/021

21 CS 547/490 Network Programming Application Example (4) Chain Multi-Process Model (continued): IPC1.PPT/022 Possible applications? 1. Compiler, assembler, Linker 2. Any processes that contain “steps” 3. Multimedia Stream Decorder/Encorder (File access, encoding, file transmission, etc)

22 CS 547/490 Network Programming OS Process 1 write (pd); read (pd); Process 2 write (pd); read (pd); (5) Circular Multi-Process Model: IPC1.PPT/023

23 CS 547/490 Network Programming Computer Client 1 Server Client 2Client n Pipe 1 Pipe 2 (5) Circular Multi-Process Model (continued): Application Example IPC1.PPT/024

24 CS 547/490 Network Programming Advantages Disadvantages Better security Flexibility (Modularity) - Server can be modified (upgraded) without changing client - Users (requestors) can not directly access server High cost (hardware) Pipe may be a performance bottleneck (5) Circular Multi-Process Model (continued): IPC1.PPT/025

25 CS 547/490 Network Programming (2) Parallel Multi-Process Model (continued): Server 2 Disk Server 1 Disk Server n Disk Pipe Job Dispatcher Application Example IPC_1.PPT/001


Download ppt "Department of Computer Science Southern Illinois University Edwardsville Spring, 2010 Dr. Hiroshi Fujinoki IPC1.PPT/001 Inter-Process."

Similar presentations


Ads by Google