Interprocess Communication Flashcards
What are the difference between named and ordinary pipes?
Ordinary pipes are unidirectional. They can only exist between parent and child process. They can only be used by two processes (one on each end). Named pipes do not have these restrictions.
Why is a wait() not a good idea when using ordinary pipes to communicate between processes?
Because read() and write() are blocking calls and can be used as a sync point. Calling wait() may result in deadlock.
What happens when a process reads from a pipe that has no writer?
It receives an EOF
What happens to a process writing to pipe that has no reader?
It is signalled (to terminate)
What are the two ways that processes communicate?
Message passing, and shared memory
What is message passing?
Messages are passed between processes. Requires system calls (kernel intervention).
What is shared memory?
Both processes have access to shared section of memory, allowing them to communicate.
What are co-operating processes?
They are processes that can affect each other (communication) while independent processes do not.
What is a rendezvous?
Both send and receive calls are blocking.
What is a rendezvous?
Both send and receive calls are blocking, creating a synchronisation point.
Things to consider when storing a sent message…
We want to minimise copying.
Why is direct communication not a great message passing solution?
We are directly sending messages to processes (explicitly stating sender pid, or name). This makes changing names of processes difficult. Changing one program might lead to changing multiple.
What is indirect communication?
Processes communicate through mailboxes (both must have reference to mailbox to communicate). Sender doesn’t need to know which process it is sending to.
How is synchronisation handled with shared memory?
Explicitly by the programmer, at the user level (i.e. locks)
Why are pipes and shared memory initialised before fork()?
So that both processes have a reference to them