WorksheetsLec3_ Part3 (Interprocess Communication Quiz)
Total questions: 22
Worksheet time: 11hrs 0mins
What is the main reason for using Interprocess Communication (IPC)?
To reduce memory usage
To allow processes to communicate and coordinate actions
To avoid system calls
To enable direct file access
In a cooperating process system, which of the following is NOT a reason for cooperation?
Information sharing
Computation speedup
Deadlock creation
Modularity
Which IPC method uses a common memory region for communication?
Message passing
Shared memory
Signals
Ports
Which system call is used in POSIX to create or open a shared memory segment?
open()
fork()
shm_open()
mmap()
What does mmap() do in the context of shared memory?
Deletes memory
Writes directly to disk
Maps shared memory into the process address space
Encrypts shared data
What is a mailbox in message passing?
A physical address
A logical channel with a unique ID
A shared disk partition
A CPU register
Which type of link in IPC allows only one direction of communication?
Unidirectional
Bidirectional
Symmetrical
Multiplexed
In POSIX shared memory, what does ftruncate() do?
Truncates a file
Maps memory
Sets the size of the shared memory object
Unlinks the shared memory
What does a 'handle' represent in Windows IPC?
The actual data
A reference to a port or resource
A user password
A thread ID
What is the first step in a Local Procedure Call (LPC) in Windows?
Client sends a connection request
Server creates a shared object
Client writes to shared memory
Server sends a signal
What is the correct solution to a race condition?
Delete one process
Use synchronization techniques like semaphores or mutexes
Increase memory size
Assign processes to different CPUs
In direct communication, what must be true?
Processes must know each other’s IDs
All communication goes through a server
Shared memory must be mapped
Communication is always one-way
Which of the following is true about shared memory?
It works best over a network
It requires processes to coordinate access manually
It is slower than message passing
It uses sockets for communication
In POSIX, which function maps shared memory into a process's address space?
shm_read()
mmap()
ptr_map()
shm_link()
What best defines a race condition?
When a process monopolizes the CPU
When processes communicate too quickly
When multiple processes access shared data and the final result depends on timing
When processes use different ports
What is a key advantage of shared memory over message passing?
It’s faster because it avoids kernel involvement
It supports remote processes
It uses less memory
It uses file descriptors
Which scenario is most likely to lead to a race condition?
Processes using mailboxes
Two threads incrementing a shared variable without synchronization
Independent processes printing to screen
Processes accessing separate files
Why are race conditions dangerous?
They waste memory
They lead to unpredictable or incorrect results
They improve process speed
They are needed for message passing
In message passing IPC, which component ensures messages are sent to the right recipient?
Mailbox (or port)
CPU
Cache
Socket buffer
Why must synchronization be used in shared memory IPC?
To protect the system from power loss
To prevent race conditions and ensure data consistency
To delay message transmission
To allow mailbox usage
Which of the following is NOT a property of a communication link?
Unidirectional or bidirectional
Always encrypted
May be established only if a shared mailbox exists
Can be between many processes
What is an advantage of message passing over shared memory?
It’s always faster
It automatically synchronizes communication
It doesn’t support bidirectional links
It avoids using system calls
