A POSIX message queue has mq_msgsize = 128 bytes. The following four sends succeed in the listed sequence before a receiver starts. No additional messages arrive. The graph supplies each message's priority.
Successful send sequence
Message
Message length (bytes)
1
Atlas
36
2
Boreal
80
3
Cedar
24
4
Delta
60
The receiver makes four successful mq_receive() calls using 256-byte buffers. All other arguments are valid. Complete the table with each returned message name and the number of bytes returned. The final row asks for the smallest receive-buffer size permitted by this queue's configuration, even when the next message is shorter. Enter byte counts as exact integers.
Unlock full course notes by signing up
Kernel copy time for a pipe transfer
A camera process sends a 750 MB video segment to a transcoder process through an anonymous pipe, using ordinary write() and read() calls. The memory-copy bandwidth is 12 GB/s, with 1 MB = 106 bytes and 1 GB = 109 bytes. Assume each byte is copied into and out of the kernel. Ignoring system-call overhead, how long does the kernel spend copying this data? Give your answer in milliseconds, to the nearest millisecond.
Large writes from several producers on one pipe
Three producer processes on Linux write 6,000-byte records to the same pipe, one record per blocking write() call. The pipe capacity is 65,536 bytes and PIPE_BUF is 4,096 bytes. A consumer reads 6,000 bytes at a time. Which statement correctly describes what the consumer can receive?
Effect of chunk size on pipe system-call overhead
A single producer sends 512 MiB to a consumer through a pipe. The producer writes, and the consumer reads, in equal fixed-size chunks, and every call transfers one full chunk. Each system call costs 1.5 µs. Counting every write() and every read() call, find the total number of system calls with 4 KiB chunks, the total number with 64 KiB chunks, and the system-call time saved by switching to 64 KiB chunks, in milliseconds to one decimal place.