Interprocess Communication An Overview of Shared Memory and















- Slides: 15

Inter-process Communication An Overview of Shared Memory and Messaging

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

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

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

Traditional Linear Problem Master Process Problem Solver Processor

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

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

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

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

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

Linux OS: Semaphore Commands (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.

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

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

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.

Summary of Concepts • • Inter-process Communication Shared Memory Messaging Customized Operating Systems – Messaging Commands – Semaphore – ? ? ? • Limits of IPC
Interprocess communication shared memory
Symmetric shared memory architecture
Interprocess communication in linux
Print.sc/au1234
Interprocess communication in os
Race condition in interprocess communication
What is multicast communication in distributed system
Android interprocess communication
Producer-consumer problem
Special relativity vs general relativity
Shared memory in unix
Pthread_yield example
Distributed shared memory architecture tutorialspoint
Java shared memory between threads
Share a single centralized memory
Symmetric shared memory architecture