SlideShare a Scribd company logo
Operating System 19
Interacting Processes and IPC
Prof Neeraj Bhargava
Vaibhav Khanna
Department of Computer Science
School of Engineering and Systems Sciences
Maharshi Dayanand Saraswati University Ajmer
Multiprocess Architecture – Chrome Browser
• Many web browsers ran as single process (some still
do)
– If one web site causes trouble, entire browser can hang or
crash
• Google Chrome Browser is multiprocess with 3
different types of processes:
– Browser process manages user interface, disk and
network I/O
– Renderer process renders web pages, deals with HTML,
Javascript. A new renderer created for each website
opened
• Runs in sandbox restricting disk and network I/O, minimizing
effect of security exploits
– Plug-in process for each type of plug-in
Interprocess Communication
• Processes within a system may be independent or
cooperating
• Cooperating process can affect or be affected by other
processes, including sharing data
• Reasons for cooperating processes:
– Information sharing
– Computation speedup
– Modularity
– Convenience
• Cooperating processes need interprocess communication
(IPC)
• Two models of IPC
– Shared memory
– Message passing
Communications Models
(a) Message passing. (b) shared memory.
Cooperating Processes
• Independent process cannot affect or be
affected by the execution of another process
• Cooperating process can affect or be
affected by the execution of another process
• Advantages of process cooperation
– Information sharing
– Computation speed-up
– Modularity
– Convenience
Producer-Consumer Problem
• Paradigm for cooperating processes, producer
process produces information that is
consumed by a consumer process
– unbounded-buffer places no practical limit on the
size of the buffer
– bounded-buffer assumes that there is a fixed
buffer size
Bounded-Buffer –
Shared-Memory Solution
• Shared data
#define BUFFER_SIZE 10
typedef struct {
. . .
} item;
item buffer[BUFFER_SIZE];
int in = 0;
int out = 0;
• Solution is correct, but can only use BUFFER_SIZE-1 elements
Bounded-Buffer – Producer
item next_produced;
while (true) {
/* produce an item in next produced */
while (((in + 1) % BUFFER_SIZE) == out)
; /* do nothing */
buffer[in] = next_produced;
in = (in + 1) % BUFFER_SIZE;
}
Bounded Buffer – Consumer
item next_consumed;
while (true) {
while (in == out)
; /* do nothing */
next_consumed = buffer[out];
out = (out + 1) % BUFFER_SIZE;
/* consume the item in next consumed */
}
Interprocess Communication –
Shared Memory
• An area of memory shared among the
processes that wish to communicate
• The communication is under the control of the
users processes not the operating system.
• Major issues is to provide mechanism that will
allow the user processes to synchronize their
actions when they access shared memory.
• Synchronization is discussed in great details in
Chapter 5.
Interprocess Communication –
Message Passing
• Mechanism for processes to communicate and
to synchronize their actions
• Message system – processes communicate
with each other without resorting to shared
variables
• IPC facility provides two operations:
– send(message)
– receive(message)
• The message size is either fixed or variable
Message Passing (Cont.)
• If processes P and Q wish to communicate, they need
to:
– Establish a communication link between them
– Exchange messages via send/receive
• Implementation issues:
– How are links established?
– Can a link be associated with more than two processes?
– How many links can there be between every pair of
communicating processes?
– What is the capacity of a link?
– Is the size of a message that the link can accommodate
fixed or variable?
– Is a link unidirectional or bi-directional?
Message Passing (Cont.)
• Implementation of communication link
– Physical:
• Shared memory
• Hardware bus
• Network
– Logical:
• Direct or indirect
• Synchronous or asynchronous
• Automatic or explicit buffering
Direct Communication
• Processes must name each other explicitly:
– send (P, message) – send a message to process P
– receive(Q, message) – receive a message from
process Q
• Properties of communication link
– Links are established automatically
– A link is associated with exactly one pair of
communicating processes
– Between each pair there exists exactly one link
– The link may be unidirectional, but is usually bi-
directional
Indirect Communication
• Messages are directed and received from mailboxes
(also referred to as ports)
– Each mailbox has a unique id
– Processes can communicate only if they share a mailbox
• Properties of communication link
– Link established only if processes share a common
mailbox
– A link may be associated with many processes
– Each pair of processes may share several communication
links
– Link may be unidirectional or bi-directional
Indirect Communication
• Operations
– create a new mailbox (port)
– send and receive messages through mailbox
– destroy a mailbox
• Primitives are defined as:
send(A, message) – send a message to
mailbox A
receive(A, message) – receive a message
from mailbox A
Indirect Communication
• Mailbox sharing
– P1, P2, and P3 share mailbox A
– P1, sends; P2 and P3 receive
– Who gets the message?
• Solutions
– Allow a link to be associated with at most two
processes
– Allow only one process at a time to execute a
receive operation
– Allow the system to select arbitrarily the
receiver. Sender is notified who the receiver
was.
Synchronization
• Message passing may be either blocking or non-blocking
• Blocking is considered synchronous
– Blocking send -- the sender is blocked until the message is
received
– Blocking receive -- the receiver is blocked until a message is
available
• Non-blocking is considered asynchronous
– Non-blocking send -- the sender sends the message and
continue
– Non-blocking receive -- the receiver receives:
 A valid message, or
 Null message
 Different combinations possible
 If both send and receive are blocking, we have a rendezvous
Synchronization (Cont.)
 Producer-consumer becomes trivial
message next_produced;
while (true) {
/* produce an item in next produced */
send(next_produced);
}
message next_consumed;
while (true) {
receive(next_consumed);
/* consume the item in next consumed */
}
Buffering
• Queue of messages attached to the link.
• implemented in one of three ways
1.Zero capacity – no messages are queued on a link.
Sender must wait for receiver (rendezvous)
2.Bounded capacity – finite length of n messages
Sender must wait if link full
3.Unbounded capacity – infinite length
Sender never waits
Assignment
• Explain the concept of IPC for Interacting
Processes.

More Related Content

PPTX
3 processes
PPT
Process
PPT
Ch4 OS
 
PDF
ITFT_Inter process communication
PPT
PPT
Inter process communication
3 processes
Process
Ch4 OS
 
ITFT_Inter process communication
Inter process communication

What's hot (7)

PPT
Lecture 7, 8, 9 and 10 Inter Process Communication (IPC) in Operating Systems
PPT
PPTX
Inter Process Communication
PDF
Towards Improved Data Dissemination of Publish-Subscribe Systems
PPT
Design and analysis of a mobile file sharing system for opportunistic networks
PPTX
Message Passing, Remote Procedure Calls and Distributed Shared Memory as Com...
Lecture 7, 8, 9 and 10 Inter Process Communication (IPC) in Operating Systems
Inter Process Communication
Towards Improved Data Dissemination of Publish-Subscribe Systems
Design and analysis of a mobile file sharing system for opportunistic networks
Message Passing, Remote Procedure Calls and Distributed Shared Memory as Com...
Ad

Similar to Operating system 19 interacting processes and ipc (20)

PDF
interprocess-communication.pdf
PDF
Lecture-4_Process Management.pdf
PPT
Inter-Process communication in Operating System.ppt
PPTX
Chapter 3b- Process Communication (1) (1)(1) (1).pptx
PPTX
5_Interprocess Communication.pptx
PPT
PPT
Chapter 3 - Processes
PDF
Lecture 3_Processes in Operating Systems.pdf
PPT
Ch03 processes
PPTX
Chapter 3 - InterProcess Communication.pptx
PPTX
Operating system
PPT
41_P17CSC104_20201209054563635172951.ppt
PPT
UNIT I Process management main concept.ppt
PPTX
Lecture 3 Inter Process Communication.pptx
PPT
LEC_3.ppt jef,fdds,fn,befhj efbhjfrgeukevbhwj
PPTX
CSC 2205 OS Lecture 07 IPC on 7-10-2024 New.pptx
PPT
Process Management.ppt
PPTX
Inter Process Communication-R.D.Sivakumar
PPTX
PPTX
interprocess-communication.pdf
Lecture-4_Process Management.pdf
Inter-Process communication in Operating System.ppt
Chapter 3b- Process Communication (1) (1)(1) (1).pptx
5_Interprocess Communication.pptx
Chapter 3 - Processes
Lecture 3_Processes in Operating Systems.pdf
Ch03 processes
Chapter 3 - InterProcess Communication.pptx
Operating system
41_P17CSC104_20201209054563635172951.ppt
UNIT I Process management main concept.ppt
Lecture 3 Inter Process Communication.pptx
LEC_3.ppt jef,fdds,fn,befhj efbhjfrgeukevbhwj
CSC 2205 OS Lecture 07 IPC on 7-10-2024 New.pptx
Process Management.ppt
Inter Process Communication-R.D.Sivakumar
Ad

More from Vaibhav Khanna (20)

PPTX
Information and network security 47 authentication applications
PPTX
Information and network security 46 digital signature algorithm
PPTX
Information and network security 45 digital signature standard
PPTX
Information and network security 44 direct digital signatures
PPTX
Information and network security 43 digital signatures
PPTX
Information and network security 42 security of message authentication code
PPTX
Information and network security 41 message authentication code
PPTX
Information and network security 40 sha3 secure hash algorithm
PPTX
Information and network security 39 secure hash algorithm
PPTX
Information and network security 38 birthday attacks and security of hash fun...
PPTX
Information and network security 37 hash functions and message authentication
PPTX
Information and network security 35 the chinese remainder theorem
PPTX
Information and network security 34 primality
PPTX
Information and network security 33 rsa algorithm
PPTX
Information and network security 32 principles of public key cryptosystems
PPTX
Information and network security 31 public key cryptography
PPTX
Information and network security 30 random numbers
PPTX
Information and network security 29 international data encryption algorithm
PPTX
Information and network security 28 blowfish
PPTX
Information and network security 27 triple des
Information and network security 47 authentication applications
Information and network security 46 digital signature algorithm
Information and network security 45 digital signature standard
Information and network security 44 direct digital signatures
Information and network security 43 digital signatures
Information and network security 42 security of message authentication code
Information and network security 41 message authentication code
Information and network security 40 sha3 secure hash algorithm
Information and network security 39 secure hash algorithm
Information and network security 38 birthday attacks and security of hash fun...
Information and network security 37 hash functions and message authentication
Information and network security 35 the chinese remainder theorem
Information and network security 34 primality
Information and network security 33 rsa algorithm
Information and network security 32 principles of public key cryptosystems
Information and network security 31 public key cryptography
Information and network security 30 random numbers
Information and network security 29 international data encryption algorithm
Information and network security 28 blowfish
Information and network security 27 triple des

Recently uploaded (20)

PPTX
Odoo POS Development Services by CandidRoot Solutions
PPTX
ManageIQ - Sprint 268 Review - Slide Deck
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Understanding Forklifts - TECH EHS Solution
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PDF
medical staffing services at VALiNTRY
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PPTX
history of c programming in notes for students .pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
AI in Product Development-omnex systems
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Introduction to Artificial Intelligence
PPTX
Transform Your Business with a Software ERP System
PPTX
Online Work Permit System for Fast Permit Processing
PDF
Design an Analysis of Algorithms I-SECS-1021-03
Odoo POS Development Services by CandidRoot Solutions
ManageIQ - Sprint 268 Review - Slide Deck
Upgrade and Innovation Strategies for SAP ERP Customers
Understanding Forklifts - TECH EHS Solution
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
medical staffing services at VALiNTRY
VVF-Customer-Presentation2025-Ver1.9.pptx
PTS Company Brochure 2025 (1).pdf.......
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
history of c programming in notes for students .pptx
Operating system designcfffgfgggggggvggggggggg
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
AI in Product Development-omnex systems
ISO 45001 Occupational Health and Safety Management System
How to Choose the Right IT Partner for Your Business in Malaysia
Introduction to Artificial Intelligence
Transform Your Business with a Software ERP System
Online Work Permit System for Fast Permit Processing
Design an Analysis of Algorithms I-SECS-1021-03

Operating system 19 interacting processes and ipc

  • 1. Operating System 19 Interacting Processes and IPC Prof Neeraj Bhargava Vaibhav Khanna Department of Computer Science School of Engineering and Systems Sciences Maharshi Dayanand Saraswati University Ajmer
  • 2. Multiprocess Architecture – Chrome Browser • Many web browsers ran as single process (some still do) – If one web site causes trouble, entire browser can hang or crash • Google Chrome Browser is multiprocess with 3 different types of processes: – Browser process manages user interface, disk and network I/O – Renderer process renders web pages, deals with HTML, Javascript. A new renderer created for each website opened • Runs in sandbox restricting disk and network I/O, minimizing effect of security exploits – Plug-in process for each type of plug-in
  • 3. Interprocess Communication • Processes within a system may be independent or cooperating • Cooperating process can affect or be affected by other processes, including sharing data • Reasons for cooperating processes: – Information sharing – Computation speedup – Modularity – Convenience • Cooperating processes need interprocess communication (IPC) • Two models of IPC – Shared memory – Message passing
  • 4. Communications Models (a) Message passing. (b) shared memory.
  • 5. Cooperating Processes • Independent process cannot affect or be affected by the execution of another process • Cooperating process can affect or be affected by the execution of another process • Advantages of process cooperation – Information sharing – Computation speed-up – Modularity – Convenience
  • 6. Producer-Consumer Problem • Paradigm for cooperating processes, producer process produces information that is consumed by a consumer process – unbounded-buffer places no practical limit on the size of the buffer – bounded-buffer assumes that there is a fixed buffer size
  • 7. Bounded-Buffer – Shared-Memory Solution • Shared data #define BUFFER_SIZE 10 typedef struct { . . . } item; item buffer[BUFFER_SIZE]; int in = 0; int out = 0; • Solution is correct, but can only use BUFFER_SIZE-1 elements
  • 8. Bounded-Buffer – Producer item next_produced; while (true) { /* produce an item in next produced */ while (((in + 1) % BUFFER_SIZE) == out) ; /* do nothing */ buffer[in] = next_produced; in = (in + 1) % BUFFER_SIZE; }
  • 9. Bounded Buffer – Consumer item next_consumed; while (true) { while (in == out) ; /* do nothing */ next_consumed = buffer[out]; out = (out + 1) % BUFFER_SIZE; /* consume the item in next consumed */ }
  • 10. Interprocess Communication – Shared Memory • An area of memory shared among the processes that wish to communicate • The communication is under the control of the users processes not the operating system. • Major issues is to provide mechanism that will allow the user processes to synchronize their actions when they access shared memory. • Synchronization is discussed in great details in Chapter 5.
  • 11. Interprocess Communication – Message Passing • Mechanism for processes to communicate and to synchronize their actions • Message system – processes communicate with each other without resorting to shared variables • IPC facility provides two operations: – send(message) – receive(message) • The message size is either fixed or variable
  • 12. Message Passing (Cont.) • If processes P and Q wish to communicate, they need to: – Establish a communication link between them – Exchange messages via send/receive • Implementation issues: – How are links established? – Can a link be associated with more than two processes? – How many links can there be between every pair of communicating processes? – What is the capacity of a link? – Is the size of a message that the link can accommodate fixed or variable? – Is a link unidirectional or bi-directional?
  • 13. Message Passing (Cont.) • Implementation of communication link – Physical: • Shared memory • Hardware bus • Network – Logical: • Direct or indirect • Synchronous or asynchronous • Automatic or explicit buffering
  • 14. Direct Communication • Processes must name each other explicitly: – send (P, message) – send a message to process P – receive(Q, message) – receive a message from process Q • Properties of communication link – Links are established automatically – A link is associated with exactly one pair of communicating processes – Between each pair there exists exactly one link – The link may be unidirectional, but is usually bi- directional
  • 15. Indirect Communication • Messages are directed and received from mailboxes (also referred to as ports) – Each mailbox has a unique id – Processes can communicate only if they share a mailbox • Properties of communication link – Link established only if processes share a common mailbox – A link may be associated with many processes – Each pair of processes may share several communication links – Link may be unidirectional or bi-directional
  • 16. Indirect Communication • Operations – create a new mailbox (port) – send and receive messages through mailbox – destroy a mailbox • Primitives are defined as: send(A, message) – send a message to mailbox A receive(A, message) – receive a message from mailbox A
  • 17. Indirect Communication • Mailbox sharing – P1, P2, and P3 share mailbox A – P1, sends; P2 and P3 receive – Who gets the message? • Solutions – Allow a link to be associated with at most two processes – Allow only one process at a time to execute a receive operation – Allow the system to select arbitrarily the receiver. Sender is notified who the receiver was.
  • 18. Synchronization • Message passing may be either blocking or non-blocking • Blocking is considered synchronous – Blocking send -- the sender is blocked until the message is received – Blocking receive -- the receiver is blocked until a message is available • Non-blocking is considered asynchronous – Non-blocking send -- the sender sends the message and continue – Non-blocking receive -- the receiver receives:  A valid message, or  Null message  Different combinations possible  If both send and receive are blocking, we have a rendezvous
  • 19. Synchronization (Cont.)  Producer-consumer becomes trivial message next_produced; while (true) { /* produce an item in next produced */ send(next_produced); } message next_consumed; while (true) { receive(next_consumed); /* consume the item in next consumed */ }
  • 20. Buffering • Queue of messages attached to the link. • implemented in one of three ways 1.Zero capacity – no messages are queued on a link. Sender must wait for receiver (rendezvous) 2.Bounded capacity – finite length of n messages Sender must wait if link full 3.Unbounded capacity – infinite length Sender never waits
  • 21. Assignment • Explain the concept of IPC for Interacting Processes.