Presentation is loading. Please wait.

Presentation is loading. Please wait.

Inter-process Communication An Overview of Shared Memory and Messaging.

Similar presentations


Presentation on theme: "Inter-process Communication An Overview of Shared Memory and Messaging."— Presentation transcript:

1 Inter-process Communication An Overview of Shared Memory and Messaging

2 Overview Inter-process Communication (IPC) Shared Memory – Concept – Associated Linux Commands Messaging – Concept – Associated Linux Commands Summary of Concepts

3 Scope of Presentation Impart General Concepts Assumption Audience has General Programming Knowledge Present Two of Many IPC Strategies Recognition of Other IPC Methodologies

4 Overview of IPC Definition – Ability for processes to share information and resources, as well as provide critical notices of process status to other processes. Coordination of Processes – Integrity of Data – Protection of Order of Operations Complex problem solving – Non-linear Problems – Linear Problems

5 Traditional Linear Problem Master Process Problem Solver Process Processor

6 Linear Problem with Answer Caching (using IPC and multiple processors) Master Process Problem Solver Process Processor 1 Processor 2 Processor 3 Potential Problem Answer Cache Message Queue Cache Problem Solver Processes

7 Management of IPC Process Level Operating System Level Two Common Techniques – Shared Memory – Messaging

8 Shared Memory Allow two or more processes access to the same address space for reading and writing. What could go wrong! Process Level Management of Access Protecting Access with a Semaphore

9 Semaphore A semaphore is a global memory variable that processes use to manage access to memory and resources. Analogy: Classroom Speaking Permission Card – No speaking unless card is in Student’s Possession – Student Must Get the Card and Return the Card Simple Semaphore – Reading and Writing Complex Semaphore – Bank of Printers

10 Shared Memory Pros and Cons Pros – Good speed once access is granted. – Simple implementation Cons – Performance degradation as user access requests increase – Limited scalability and applicability to purpose

11 Linux OS: Semaphore Com mands (not inclusive) semget() – Initializes or gains access to a semaphore. semop() - Performs operations on a semaphore set. semctl() - Changes permissions and other characteristics of existing semaphore sets.

12 Messaging Allow processes to communicate via messages that are managed by the OS. – Data Requests – Processing Requests – Process Control Through Message Forwarding Direct Messaging – Synchronous (ex. Requesting data) – Asynchronous (ex. Print job) Indirect Messaging – Mailbox Concept – OS Controlled Queue

13 Messaging Pros and Cons Pros – Strong ability to scale solutions and retain performance – Ability to queue requests and allow processes to continue – Flexibility to create complex dependent operations through message redirection Cons – Complex implementation

14 Linux OS: Messaging Commands (not inclusive) msgget() - Initializes a new message queue. msgsnd() – Used to send messages to a message queue. msgrcv() – Used to receive messages from a message queue.

15 Summary of Concepts Inter-process Communication Shared Memory Messaging Customized Operating Systems – Messaging Commands – Semaphore – ??? Limits of IPC


Download ppt "Inter-process Communication An Overview of Shared Memory and Messaging."

Similar presentations


Ads by Google