1. LPU MCA Semester 1
  2. CAP366
  3. Unit 3

CAP366 · Unit 3: Process management

Inter-process communication

10 practice questions · in the MTE and ETE syllabus

Key points

  • Two models: shared memory and message passing
  • Shared memory needs its own synchronization
  • Blocking send and receive = rendezvous
  • Ordinary pipe is one-way between related processes

Cooperating processes communicate by shared memory or message passing.

ModelStrengthCost
Shared memoryFast; kernel needed only to set up the regionProcesses must synchronize their own access
Message passingEasy, good for small data and distributed systemsKernel call for each message

Message passing can be direct (name the process) or indirect (mailbox/port), and send/receive can be blocking or non-blocking; blocking send plus blocking receive is a rendezvous. A circular bounded buffer using only in/out indices holds at most N - 1 items (10 slots hold 9).

An ordinary pipe is unidirectional and connects related processes (parent and child); named pipes (FIFOs) can connect unrelated ones.

Exam pitfall: a pipe reader sees end-of-file only when every write end is closed, so an unclosed duplicate write end can make the reader block forever.

Try two questions

Question 1 · Tier 1, Recall

Which two fundamental models are used for inter-process communication?

  1. Polling and interrupt-driven I/O
  2. Paging and demand segmentation
  3. Spooling and double buffering of I/O
  4. Shared memory and message passing
Show the answer

D. Shared memory is fast (kernel not involved after setup); message passing is easier for distributed systems.

Question 2 · Tier 2, Understand

Which statement about shared-memory IPC is TRUE?

  1. Processes must synchronize their own access to the shared region
  2. It works between processes on separate machines linked over a network
  3. It uses send() and receive() calls handled by the kernel
  4. The kernel serialises every access to the region for the processes
Show the answer

A. After the region is set up, accesses are ordinary memory operations; synchronization is the programmers' job.