/Race Conditions – IV

Race Conditions – IV

None of both Semaphore and Mutex provide a way to pass information between processes, and because of that Message Passing came along. Message Passing is the base of the IPC(Interprocess Communication), It uses two system calls to exchange messages between processes lets call them send and recv.

A message is sent to a process and the process should be waiting for the message to be received. If no message was available the receiver is blocked until a message is available. However, with message passing there’s few problems that rise since message passing require data exchange.

Suppose message passing is provided on a distributed system, If two processes are on distinct machines messages are exchanged over the network. the typical problem of data loss over network here arise, of course a solution to this is data marshaling over network. another problem is that the hosting OS should support process naming to be able to exchange messages between specific processes.

Producer Consumer – Message Passing :-

Message passingis mainly used in IPC rather than mere synchronization. there’s several APIs that support message passing like MPI(Message Passing Interface). also UNIX IPC implements message passing through pipes and FIFOs, POSIX message queues, System V message queues.

Here, we’ve reached the end of the Race Conditions series. I hope it helped 🙂