Questions: Shared Memory Inter-Process Communication

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

Process A writes a 1000-element array into shared memory and then signals Process B to start reading. Without any additional synchronization, what is most likely to happen?

AProcess B will read the array correctly because memory writes are always completed before signaling
BProcess B may observe a partially-written or stale array due to CPU/compiler reordering and cache effects — explicit synchronization is required
CThe operating system automatically serializes shared-memory access when a signal is sent
DProcess B will block until Process A has finished all writes, since shared memory has built-in ordering guarantees
Question 2 Multiple Choice

Why is shared memory faster than pipe-based or message-queue IPC for large, high-frequency data transfers?

AShared memory uses special hardware-level memory that is physically faster than normal RAM
BShared memory eliminates kernel copies — both processes access the same physical memory through their virtual address spaces, with no data copied through the kernel
CShared memory bypasses the CPU cache, so reads always see the most current value without stale-cache delays
DThe OS schedules shared-memory processes at higher priority to minimize inter-process wait time
Question 3 True / False

Shared memory provides automatic mutual exclusion — the OS ensures that mainly one process can write to the shared region at a time.

TTrue
FFalse
Question 4 True / False

A bug in one process that corrupts a shared memory region can damage data visible to all other processes attached to that same region.

TTrue
FFalse
Question 5 Short Answer

In a producer-consumer ring buffer implemented in shared memory, why must the producer and consumer use semaphores to track the number of full and empty slots, even when only one process reads and one writes?

Think about your answer, then reveal below.