🎓 BookMCQ
← Back to 3. Processes in Operating System

📝 Interprocess Communication in process implementation (35 MCQs)

Communication Between Independent Process Address Spaces

Interprocess communication (IPC) provides mechanisms through which separate processes exchange information and coordinate their activities. It belongs to process management and supports cooperation between programs that execute within independently protected address spaces. Common IPC mechanisms include shared memory, message passing, pipes, signals, sockets, and synchronisation primitives. Their selection depends on communication patterns, performance requirements, data ownership, and whether processes execute on one computer or across a network.

Why Isolated Processes Require Communication Mechanisms

Process isolation prevents one process from freely accessing another process's private memory, improving protection and execution reliability. However, cooperating processes must exchange information to complete shared tasks. IPC establishes controlled communication channels without removing necessary protection boundaries. It also addresses coordination problems such as concurrent access, message ordering, resource sharing, and synchronisation between independently scheduled execution activities.

IPC Channels, Data Exchange, and Synchronisation

With message passing, processes use send and receive operations through a communication channel managed by the operating system or a communication service. Shared-memory IPC maps a common memory region into multiple address spaces. Synchronisation mechanisms such as semaphores, mutexes, and condition variables coordinate access and prevent conflicting updates to shared information.

Coordinating Two Processes Through an IPC Channel

Consider producer process P generating ten data records for consumer process C. Through a bounded message queue, P sends each record, and C receives them in sequence. If the queue becomes full, P may block until C removes an item. If the queue is empty, C may wait for the next available message.

IPC Performance, Protection, and Synchronisation Requirements

IPC enables modular applications, producer-consumer systems, databases, and cooperating services to share information. Shared memory can provide high throughput because processes access common data directly after setup, but synchronisation remains essential. Message passing offers clearer communication boundaries but may involve copying, system calls, and scheduling overhead. Network-based IPC additionally introduces latency and communication failures.

Misconceptions About IPC and Process Synchronisation

'IPC always requires processes to share memory' is incorrect because message passing uses communication channels. 'Shared memory automatically prevents race conditions' is incorrect because concurrent updates require synchronisation. 'Message passing is limited to separate computers' is incorrect because processes on the same machine can exchange messages through local IPC facilities.

Exam Focus: IPC Mechanisms and Coordination Behaviour

Compare shared memory, message passing, pipes, signals, and sockets by data-transfer method, synchronisation requirements, and communication scope. Trace producer-consumer interactions and identify blocking conditions when buffers are full or empty. Questions may examine race conditions, mutual exclusion, communication overhead, direct versus indirect communication, and the distinction between data exchange and process synchronisation.

Key Terms of Interprocess Communication

  • IPC - Communication between separate processes.
  • Message passing - Exchanging data through messages.
  • Shared memory - Memory region mapped into multiple processes.
  • Mutex - Lock providing mutual exclusion.
  • Semaphore - Synchronisation variable controlling access.
  • Race condition - Result dependent on execution timing.
5
Easy
17
Medium
13
Hard

📝 All Interprocess Communication in process implementation MCQs

Q1. Which interprocess communication model lets cooperating processes exchange data by reading and writing a common region of memory?

A.Message passing
B.Shared memory ✅
C.Signals only
D.Pipes only
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: In shared memory communication, the operating system establishes a region that several processes can map into their address spaces. Data written by one process is immediately visible to the others, so the model avoids copying messages, although it requires explicit synchronisation to prevent conflicts.

Q2. Which interprocess communication model relies on send and receive operations provided by the operating system?

A.Message passing ✅
B.Shared memory
C.Memory mapping without synchronisation
D.Global variables
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: Message passing uses send and receive primitives so that the operating system carries messages between processes. Because the kernel mediates each transfer, the model works across machines and avoids shared memory conflicts, but each message typically incurs copying and system call overhead.

Q3. In the context of interprocess communication, what is a bounded buffer?

A.A queue of fixed capacity that holds a limited number of messages at a time. ✅
B.An unlimited queue that never fills.
C.A memory map of the kernel code.
D.A stack used only for function calls.
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A bounded buffer has a fixed number of slots, so a sender must wait when it is full and a receiver must wait when it is empty. This limit protects system memory and gives a predictable structure for producer and consumer processes that exchange items.

Q4. In direct communication, how are the communicating processes identified?

A.By a file path on the disk
B.By an explicit name or identifier of the sender and receiver ✅
C.By a port number on a printer
D.Randomly chosen at each message
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: Direct communication requires each process to name the other explicitly, which establishes a link between a specific pair. This makes the relationship clear but limits flexibility, since changing one partner means changing the program that refers to it by name.

Q5. Which buffering arrangement has zero capacity, so that a sender must wait until the receiver is ready to accept the message?

A.Bounded buffer
B.Unbounded buffer
C.Zero-capacity link ✅
D.Circular buffer
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: A zero-capacity link provides no storage, so the message is passed directly from sender to receiver at the moment both are ready. This is a rendezvous that synchronises the two processes, which contrasts with buffered links where the sender can continue after depositing the message.

Q6. A student believes that shared memory requires no synchronisation because each process simply reads and writes its own data. Which correction is most accurate?

A.The student is correct because shared memory is always private.
B.Shared memory is shared by definition, so concurrent accesses to common data require synchronisation to avoid race conditions. ✅
C.Shared memory cannot be used by more than one process.
D.Synchronisation is only needed on printers.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Once the region is shared, two processes may update the same location at nearly the same time, producing lost updates or inconsistent values. Mutual exclusion or similar mechanisms must coordinate access. The student's assumption confuses private data with the shared region that defines the model.

Q7. Why is message passing often preferred when processes run on different machines?

A.Because the processes have no shared physical memory, so messages must travel across a network. ✅
B.Because message passing requires the same physical memory on both machines.
C.Because shared memory works over any network without change.
D.Because messages cannot carry data.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Processes on separate computers cannot map a common physical memory region, so communication must be carried as messages over the network. Message passing provides exactly this capability and hides the transport details, which is why it is the natural model for distributed communication.

Q8. Why does shared memory generally offer higher communication speed than message passing once it has been set up?

A.Because data can be accessed directly without the kernel copying each message between processes. ✅
B.Because shared memory has no physical location at all.
C.Because shared memory bypasses the CPU completely.
D.Because shared memory messages are smaller.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: After the shared region is established, processes read and write it directly, avoiding the kernel copies and system calls needed for each message. The saving is substantial for frequent or large exchanges, although the synchronisation overhead must still be considered.

Q9. Why does a blocking send with a zero-capacity link synchronise the sender and receiver?

A.Because the sender waits until the receiver takes the message, so both processes meet at the moment of transfer. ✅
B.Because the sender and receiver always run on the same CPU.
C.Because the sender is deleted after sending.
D.Because zero capacity means the messages are never delivered.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: With no buffer, the message can only move when both parties are present, so the sender cannot proceed until the receiver accepts it. This rendezvous forces the processes into step with each other, which is useful for coordination but can slow the sender if the receiver is busy.

Q10. Why is buffering helpful in asynchronous communication?

A.It decouples the timing of the sender and receiver, letting the sender continue while the message waits in the buffer. ✅
B.It removes the need for the operating system.
C.It forces the sender to wait forever.
D.It prevents any message from being delivered.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When messages are placed in a buffer, the sender does not need to wait for the receiver to be ready. This allows the two processes to run at different speeds, smoothing out bursts of activity. The benefit comes at the cost of storage and of possible blocking when the buffer fills.

Q11. Why can indirect communication through mailboxes simplify a system with many senders and one server?

A.Because the server can receive from a shared mailbox without knowing each sender by name, so senders can change without modifying the server. ✅
B.Because mailboxes only allow a single message ever.
C.Because mailboxes remove the need for any receiver.
D.Because the server must know every sender's password.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A mailbox decouples senders from receivers. The server listens on one known mailbox, and any client can deposit requests there. Adding or replacing clients therefore does not require changing the server, which is a practical benefit in designs with many clients and a single service.

Q12. Why must a producer-consumer solution using shared memory protect the shared buffer with mutual exclusion?

A.Because the producer and consumer might update the buffer's index variables at the same time, leading to corrupted data. ✅
B.Because the buffer contains only printer data.
C.Because mutual exclusion increases the buffer size.
D.Because the consumer never reads the buffer.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When two processes update the same index or slot concurrently, one update can overwrite another, producing wrong counts or lost items. Mutual exclusion ensures that only one process modifies the critical part at a time, which keeps the buffer consistent under concurrent access.

Q13. Why does an unbounded buffer never block the producer, and why is that not always desirable?

A.It never blocks because storage is treated as unlimited, but it can exhaust memory if the producer consistently outpaces the consumer. ✅
B.It never blocks because the consumer is always faster.
C.It is undesirable only for printers.
D.It never blocks and never stores anything.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: An unbounded buffer keeps accepting items, so the producer is never delayed. However, storage is finite in practice, and a persistent mismatch in speed can fill memory, causing failures. The choice between bounded and unbounded buffers is therefore a trade-off between blocking and memory risk.

Q14. Why is choosing between zero, bounded and unbounded buffers described as a trade-off?

A.Zero capacity forces synchronisation, bounded buffers limit memory but can block, and unbounded buffers avoid blocking at the risk of memory exhaustion. ✅
B.All three choices give identical behaviour in every system.
C.Buffer size affects only printer speed.
D.Buffers have no effect on communication.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Each buffer design favours different goals: zero capacity gives tight coordination, bounded buffers provide controlled memory use with possible blocking, and unbounded buffers maximise decoupling. Designers balance synchronisation, memory and responsiveness, so no single choice is universally best.

Q15. Two processes on the same machine must exchange 1 GB of data in many messages. Which mechanism is generally most efficient once established?

A.Shared memory, because data is accessed directly rather than copied for every message. ✅
B.Message passing with a copy for each message, because it is always faster.
C.Printing each message to the screen.
D.Storing messages on a floppy disk.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: For large volumes on one machine, shared memory avoids repeated kernel copies, so its per-transfer cost is lower. Message passing still has value for simplicity and isolation, but for heavy data exchange the direct access of shared memory is usually the more efficient choice.

Q16. A bounded buffer has room for 4 items. A producer inserts 6 items rapidly, and no consumer removes anything during that time. How many items can be inserted before the producer blocks?

A.4 ✅
B.5
C.6
D.Unlimited
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The buffer holds 4 items, so after the fourth insertion the buffer is full and the next insertion must wait. Only 4 items are placed before blocking, even though the producer wishes to send 6. This illustrates how a bounded buffer protects memory but introduces blocking when the consumer is absent.

Q17. A client runs on one machine and a server runs on another machine. Which communication approach is most appropriate?

A.Shared memory mapped between the two machines.
B.Message passing carried over a network connection. ✅
C.Writing to a global variable on the client.
D.Using a zero-capacity pipe on the same process.
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The two machines have separate physical memories, so shared memory cannot connect them directly. Message passing over a network connection carries requests and replies between the client and server, which is the standard approach for distributed client-server communication.

Q18. A bounded buffer has size 3. A producer inserts 5 items in total and a consumer removes 2 items. How many items remain in the buffer at the end?

A.1
B.2
C.3 ✅
D.5
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Each insertion adds one item and each removal takes one away, so the net count is 5−2=35 - 2 = 3 items. The buffer capacity limits when insertion must wait, but the final count depends only on total insertions minus removals, which is a useful way to check the state of such systems.

Q19. Processes need to receive requests from any client that sends them, without knowing each client in advance. Which addressing approach best meets this need?

A.Indirect communication through a mailbox or port that the server listens on. ✅
B.Direct communication requiring the server to name every client in its code.
C.Shared memory with no synchronisation.
D.A zero-capacity link that requires prior knowledge of all clients.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: A mailbox or port lets any client send to a known address, and the server receives from it without listing every client. This indirection supports open-ended client populations, whereas direct communication would require the server to know and name each sender in advance.

Q20. A message passing system spends 2 ms copying each message, while a shared memory write costs 0.001 ms. For 1000 messages, what is the ratio of message passing time to shared memory time?

A.20
B.200
C.2000 ✅
D.20000
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Message passing takes 1000×2=20001000 \times 2 = 2000 ms, while shared memory takes 1000×0.001=11000 \times 0.001 = 1 ms. The ratio is 2000/1=20002000 / 1 = 2000. The calculation highlights how per-operation costs can differ enormously, which guides the choice of mechanism for heavy communication workloads.

Q21. A student says that shared memory processes never need locks because each process has its own memory. What is the error?

A.There is no error, because shared memory is private.
B.Shared memory is common to the cooperating processes, so access must be synchronised even though each process also has private memory. ✅
C.Locks are never used in any operating system.
D.Shared memory exists only on printers.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The shared region is by definition accessible to multiple processes, so concurrent updates can conflict. Private memory does not remove the need for synchronisation of the shared part. The student mixes private and shared memory and so overlooks the race conditions that locks are designed to prevent.

Q22. A student says that message passing is always slower than shared memory, so it should never be used. Which evaluation is most accurate?

A.The claim is correct because message passing never has any advantage.
B.The claim overlooks that message passing offers isolation, works across machines and avoids shared-memory synchronisation complexity, so it is valuable despite higher per-message cost. ✅
C.The claim is correct because shared memory cannot be synchronised.
D.The claim is flawed because message passing does not exist.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Message passing typically has higher overhead per message, but it simplifies coordination, provides isolation and extends naturally to distributed systems. Choosing it can be the right decision even though it is slower for heavy local traffic, so the student's universal claim ignores these advantages.

Q23. A student says that a blocking send over a zero-capacity link returns immediately after placing the message in a buffer, even if the receiver is absent. What is the flaw?

A.There is no flaw because the sender always returns immediately.
B.A zero-capacity link has no buffer, so the sender must wait until the receiver accepts the message. ✅
C.Zero-capacity links never transfer messages.
D.Blocking sends never exist.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The defining property of a zero-capacity link is that no message is stored in between, so the sender remains blocked until the transfer occurs. Claiming the sender returns immediately contradicts the meaning of zero capacity and misunderstands the synchronisation that this design imposes.

Q24. A student says that a mailbox can have only one sender and one receiver at a time. What is the correction?

A.The claim is correct because mailboxes are always private links.
B.Mailboxes support many-to-many communication, so several senders and receivers can use the same mailbox. ✅
C.Mailboxes are used only for printing.
D.Mailboxes cannot store messages.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: A mailbox is an indirect channel that can be shared among several processes, allowing many senders to deposit messages and many receivers to take them. The student confuses mailboxes with direct one-to-one links, which is a common misunderstanding of indirect communication.

Q25. A student says that an unbounded buffer guarantees the producer can never run out of memory. What is wrong with this claim?

A.Nothing is wrong, since unbounded means unlimited memory.
B.Unbounded in design does not mean infinite memory; if the producer outpaces the consumer, storage can still be exhausted. ✅
C.Unbounded buffers never store data.
D.Unbounded buffers only apply to printers.
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: An unbounded buffer does not block the producer, but it is still limited by the physical memory available. A sustained imbalance in speed can fill memory and cause failure, so the student confuses the absence of an explicit limit with the absence of any practical limit.

Q26. A graph plots transfer time against message size for two methods. Message passing rises linearly with a large per-message constant, while shared memory stays nearly flat. What is the best inference?

A.Message passing has a significant per-message overhead, while shared memory has low cost per transfer after setup. ✅
B.Shared memory costs more for every transfer than message passing.
C.Message size has no effect on either method.
D.Both methods have identical costs at every size.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The steeper and higher line for message passing shows substantial per-message overhead, whereas the flat shared memory line indicates little dependence on message size once the region exists. The graph therefore supports the inference that message passing is costlier for frequent transfers.

Q27. A graph shows the number of items in a bounded buffer of capacity 5 over time. The count reaches 5 and remains there for a long interval while the producer waits. What does this suggest?

A.The producer is blocked because the buffer is full, which suggests the consumer is slower than the producer during that interval. ✅
B.The buffer is empty and the consumer is blocked.
C.The buffer is unlimited and never fills.
D.The producer is idle because it has finished.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: A count fixed at capacity means the buffer is full and the producer must wait for space. The consumer is therefore removing items more slowly than they arrive during that period. Reading the plateau at the capacity value correctly identifies the blocking condition and the speed mismatch behind it.

Q28. A timeline shows a sender blocked from time 2 ms until time 6 ms, when the receiver finally calls receive. Which communication design is most consistent with this behaviour?

A.A blocking synchronous send over a zero-capacity link. ✅
B.An unbounded asynchronous mailbox that never blocks.
C.A non-blocking send with a large buffer.
D.Shared memory with no waiting.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: The sender waits until the receiver takes the message, which matches a blocking synchronous send over a zero-capacity link. A non-blocking send or unbounded mailbox would let the sender continue immediately. The timeline's blocked interval is the key evidence for the synchronous design.

Q29. A table lists throughput in messages per second against buffer size: size 1 gives 100, size 4 gives 380, size 8 gives 600, size 16 gives 610, size 32 gives 612. Which conclusion is best supported?

A.Throughput rises with buffer size but levels off, so very large buffers add little benefit. ✅
B.Throughput falls steadily as buffer size grows.
C.Buffer size has no relation to throughput.
D.Throughput is highest at size 1.
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Throughput climbs substantially up to size 8 and then changes very little between 16 and 32. The data supports diminishing returns from larger buffers, which is useful when choosing a buffer size that balances memory use against performance.

Q30. Which combination describes indirect, asynchronous, bounded-buffer communication?

A.A mailbox with non-blocking sends and a finite queue of messages. ✅
B.A direct link with blocking sends and zero capacity.
C.Shared memory with no buffer and no synchronisation.
D.A zero-capacity link that stores messages permanently.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Indirect communication uses a mailbox, asynchronous sending does not force the sender to wait, and a finite queue gives bounded storage. The other options combine properties that contradict one another, such as zero capacity with permanent storage, so only the first describes the requested behaviour.

Q31. Which pairing correctly matches a shared-memory concept with its purpose?

A.A semaphore with coordinating access to shared data ✅
B.A semaphore with printing documents to a screen
C.A shared region with deleting process identifiers
D.A mailbox with mapping memory into the kernel
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A semaphore is a synchronisation tool used to coordinate access to shared data, which makes it suitable for shared-memory communication. The other pairings assign unrelated functions to these concepts, such as printing or deleting identifiers, so they do not describe the intended relationships.

Q32. A blocking receive is issued on a channel where no message has arrived. Which behaviour is correct?

A.The receiver waits until a message arrives, so the operation is synchronised with the sender. ✅
B.The receiver immediately receives an empty message and continues.
C.The receiver is terminated by the operating system.
D.The receiver moves to the printer queue.
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A blocking receive suspends the receiver until data arrives, which synchronises it with the sender's activity. Returning an empty message or terminating the process would be incorrect, since the defining feature of the blocking operation is that the caller waits for the event.

Q33. A producer creates items at 3 items per second and a consumer removes them at 2 items per second. The bounded buffer starts empty and has capacity 10. After how many seconds does the buffer become full?

A.5 seconds
B.10 seconds ✅
C.20 seconds
D.30 seconds
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: The buffer gains a net of 3−2=13 - 2 = 1 item per second. To reach capacity 10 from empty, it needs 10/1=1010 / 1 = 10 seconds. This net-rate reasoning is the key step in producer-consumer analysis, and it ignores the brief startup effects that do not change the steady accumulation.

Q34. A pipeline has four processes, each passing a message to the next through a zero-capacity link, and each hop requires 3 ms for the rendezvous. How long does a message take to travel from the first process to the last?

A.3 ms
B.9 ms ✅
C.12 ms
D.4 ms
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Four processes form three links between consecutive pairs, so the message makes three hops. Each hop takes 3 ms, giving 3×3=93 \times 3 = 9 ms in total. Counting links rather than processes is the step that avoids the common error of multiplying by four.

Q35. A web service places incoming requests into a mailbox with room for 50 requests. Requests arrive at 12 per second and are processed at 10 per second. Starting empty, how many seconds pass before the mailbox becomes full?

A.5 seconds
B.10 seconds
C.25 seconds ✅
D.50 seconds
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The mailbox gains 12−10=212 - 10 = 2 requests per second. To fill 50 slots from empty it needs 50/2=2550 / 2 = 25 seconds. The system designer can use this net-rate calculation to decide whether to add processing capacity before the backlog causes rejected or delayed requests.

🔗 Related Topics (MCQs)