0
0
Operating Systemsknowledge~20 mins

Inter-process communication (pipes, shared memory) in Operating Systems - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
IPC Mastery Badge
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Pipes in IPC

Which statement best describes the behavior of a pipe used for inter-process communication?

AA pipe provides a unidirectional communication channel where data written by one process can be read by another in a FIFO order.
BA pipe allows two unrelated processes to communicate by sharing a common memory space.
CA pipe enables multiple processes to access the same data simultaneously without synchronization.
DA pipe stores data permanently until explicitly deleted by the operating system.
Attempts:
2 left
💡 Hint

Think about how data flows between processes using pipes and the order in which data is received.

📋 Factual
intermediate
2:00remaining
Shared Memory Characteristics

Which of the following is true about shared memory as a method of inter-process communication?

AShared memory allows multiple processes to access the same memory region directly, requiring synchronization mechanisms to avoid conflicts.
BShared memory requires data to be copied between processes to communicate.
CShared memory communication is always slower than pipes due to overhead.
DShared memory automatically manages access control without programmer intervention.
Attempts:
2 left
💡 Hint

Consider how processes access data in shared memory and what is needed to prevent errors.

🔍 Analysis
advanced
2:00remaining
Analyzing Pipe Communication Behavior

Consider two processes communicating via a pipe. Process A writes 100 bytes, then Process B reads 50 bytes, then Process A writes another 30 bytes. What is the total number of bytes available for Process B to read after these operations?

A30 bytes
B130 bytes
C50 bytes
D80 bytes
Attempts:
2 left
💡 Hint

Remember that reading from a pipe removes data from the buffer.

Comparison
advanced
2:00remaining
Comparing Pipes and Shared Memory

Which of the following correctly compares pipes and shared memory for inter-process communication?

ABoth pipes and shared memory require the processes to be related (parent-child) to communicate.
BShared memory is unidirectional, while pipes allow bidirectional communication.
CShared memory requires explicit synchronization, while pipes handle synchronization internally by design.
DPipes are faster than shared memory because they avoid synchronization overhead.
Attempts:
2 left
💡 Hint

Think about how synchronization is managed in each IPC method.

Reasoning
expert
2:00remaining
Diagnosing IPC Deadlock Scenario

Two processes use a pipe for communication. Process A writes data and waits for a response from Process B. Process B waits to read data before sending a response. Both processes are now stuck waiting indefinitely. What is the most likely cause of this deadlock?

AProcess A is writing more data than the pipe buffer can hold, causing it to block indefinitely.
BBoth processes are waiting for each other to perform an action first, causing a circular wait deadlock.
CThe pipe was not created correctly, so no data can be transferred.
DProcess B is reading from the pipe before Process A writes any data, causing a race condition.
Attempts:
2 left
💡 Hint

Consider what happens when two processes wait on each other to proceed.