Week 3b
Week 3b
OPERATING SYSTEMS
wait() & fork() Example
2
wait() & fork() Example
Process mailbox
If it is owned by a process, there is an owner ( which receives messages) and
a user (which sends messages).
Each mailbox has a unique owner – no confusion
When the process terminates, the mailbox disappears.
System mailbox
If the mailbox is owned by the operating system, it is independent and not
attached to a process.
The operating system must provide a mechanism to allow a process to:
Create a new mailbox
Send and receive messages through the mailbox
Delete a mailbox
Synchronization
Message passing may be either blocking or non-blocking
Blocking is considered synchronous
Blocking send has the sender block until the message is
received
Blocking receive has the receiver block until a message is
available
Non-blocking is considered asynchronous
Non-blocking send has the sender send the message and
continue
Non-blocking receive has the receiver receive a valid message
or null
Communications in Client-Server Systems
Sockets
Remote Procedure Calls
Pipes
Remote Method Invocation (Java)
Operating System Concepts – 9th Edition 3.6 Silberschatz, Galvin and Gagne ©2013
Examples of IPC Systems – Windows
Message-passing centric via advanced local procedure call (LPC)
facility
Operating System Concepts – 9th Edition 3.8 Silberschatz, Galvin and Gagne ©2013
Socket Communication
Operating System Concepts – 9th Edition 3.9 Silberschatz, Galvin and Gagne ©2013
Remote Procedure Calls
Remote procedure call (RPC) abstracts procedure calls
between processes on networked systems
Again uses ports for service differentiation
Stubs – client-side proxy for the actual procedure on the
server
Remote communication has more failure scenarios than
local
Messages can be delivered exactly once rather than
at most once
Operating System Concepts – 9th Edition 3.10 Silberschatz, Galvin and Gagne ©2013
Execution of RPC
Operating System Concepts – 9th Edition 3.11 Silberschatz, Galvin and Gagne ©2013
Pipes
Pipes are a type of IPC (Inter-Process Communication)
technique that allows two or more processes to communicate
with each other by creating a unidirectional or bidirectional
channel between them.
A pipe is a virtual communication channel that allows data to be
transferred between processes, either one-way or two-way.
Pipes can be implemented using system calls in most modern
operating systems, including Linux, macOS, and Windows
Operating System Concepts – 9th Edition 3.12 Silberschatz, Galvin and Gagne ©2013
Ordinary Pipes
Ordinary Pipes allow communication in standard producer-consumer
style
Producer writes to one end (the write-end of the pipe)
Consumer reads from the other end (the read-end of the pipe)
Ordinary pipes are therefore unidirectional
Require parent-child relationship between communicating processes
Operating System Concepts – 9th Edition 3.13 Silberschatz, Galvin and Gagne ©2013