it540 operating system inter-process communication (ipc) · inter-process communication (ipc) ......

19
Hussein Omar Hussein ID:163104047 Inter - Process Communication (IPC) IT540 Operating system

Upload: phamthu

Post on 27-Jun-2018

230 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

Hussein Omar Hussein ID:163104047

Inter-Process Communication(IPC)

IT540 Operating system

Page 2: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

Introduction.

What is IPC?

Types of IPC.

IPC Mechanisms.

Why IPC?.

Potential IPC problems.

Outline

Page 3: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

Introduction

• Processes within a system could be independent or cooperating.

• Cooperating: can affect or affected by other process

• Reasons for cooperating:

oInformation sharing.

oComputation speedup.

oModularity.

oConvenience .

• OS provides facilities for IPC.

Page 4: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

IPC

Process 1 Process 2

data

sender receiver

Page 5: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

What is IPC?

Inter-process Communication is a set of mechanisms or techniques for exchanging Data between two processes or applications.

Page 6: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

Types IPC

Inter-process communication can be:-Unicast:

When communication is from one process to a single other process. e.g. Socket communication.

Multicast:When communication is from one process to a group of processes. e.g. Publish/Subscribe Message model.

Page 7: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

P2

P1 P1

P2 P3 P4...

unicast multicast

mm m m

Page 8: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

• Shared Memory

• Message Passing

• Pipe

• Semaphores

IPC Mechanisms

Page 9: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

■ Shared Memory is an efficient means of passing data between

processes. One will create a memory portion which other processes

(if permitted) can access.

■ This shared memory section is used by communicating processes

simultaneously.

■ Also we have to synchronize the processes so they can alter shared

memory simultaneously.

Shared Memory

Page 10: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating
Page 11: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

• Operating system establishes a communication Channel.

• One Process is a sender and the other is Receiver.

• Each process puts the data in the channel.

• IPC messaging lets processes send and receive messages, and queue messages for processing in an arbitrary order.

Message passing

Page 12: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

Message passing

Page 13: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

•Pipe allow transfer data between processes in First in-First-out manner.

•A pipe is usually realized in memory.

•Pipe operations are memory operations.

pip

Page 14: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

Creating pipeline

Page 15: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

•They are often used to monitor and control the availability of system resources such as shared memory segments.

•Semaphores are used to synchronize the processes so that they can’t access critical section simultaneously.

Semaphores

Page 16: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

•Information sharing.

•Resource sharing.

•Performance speedup.

•Flexibility.

•Maintain protection & isolation.

Why IPC?

Page 17: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

• Starvation

Occur when multiple processes or threads compete for access to a shared resource. One process may monopolize the resource while others are denied access.

• Deadlock

Occur when two processes need multiple shared resources at the same time in order to continue.

• Data Inconsistency

Shared resources are modified at the same time by multiple resources.

Potential IPC problems.

Page 18: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating

• http://faculty.salina.k-state.edu/tim/ossg/IPC

• https://en.wikipedia.org/wiki/Inter-process_communication.

• https://www.slideshare.net/search/slideshow?searchfrom=header&q=inter-process+communication+&ud=any&ft=all&lang=en&sort=.

• https://www.infor.uva.es/~jjalvarez/asignaturas/SD/lectures/chapter2.pdf

• Understanding Operating Systems, Seventh Edition, Ann McIver McHoes & Ida M. Flynn.

• Operating Systems Design and Implementation, Third Edition,

References

Page 19: IT540 Operating system Inter-Process Communication (IPC) · Inter-Process Communication (IPC) ... • Understanding Operating Systems, ... Ann McIver McHoes & Ida M. Flynn. • Operating