Inter-process communication (IPC) is the generic term of how processes exchange data. Purposes: • Data transfer - data can be between a byte and several megabytes • Sharing data - multiple processes can operate on the same data • Event notification - processes can tell each other or events occurring • Resource sharing - a set of cooperating processes can define their own protocol for accessing shared resources, but cannot use the kernel's resource allocation • Process control - can assume complete control over the execution of another process IPC's used by UNIX: • Signals • Shared files (pipes) • Message queues • Shared memory • Semaphores • Sockets IPC's used by Windows: • DDE - Dynamic Data Exchange • OLE - Object Linking and Embedding • COM - Common Object Model • ActiveX Message Passing: • msgsnd() - Send message to the queue • msgrcv() - Read message from the queue • msgctl() - Used to control and obtain parameters of the queue • msgget() - Used with the queue key name, used to access the queue Shared Memory: • shmget() - Created shared segment in physical memory, returning the segment ID • shmat() - Attaches segment to the address space of the calling process • shmdt() - Detaches an attached segment from address space of calling process • shmctl() - Used to modify attributes associated with the shared memory segment Semaphores: No actual data is sent, a Semaphore is a counter that checks availability of resources, if the value returned is 0 then the resource is available, else the process will sleep until the resource is available • semget() - Creates set/array of semaphores • semop() - Manipulate semaphore set • semctl() - Modify attribute of a semaphore set