INTER PROCESS COMMUNICATION (IPC)
InterProcess Communication:
The Windows operating system provides mechanisms for facilitating communications and data sharing between applications.
The Windows operating system provides mechanisms for facilitating communications and data sharing between applications.
a) Applications can use IPC categorized as clients or servers.
b) A client is an application or a process that requests a service from some other application or process.
c) A server is an application or a process that responds to a client request.
d) Many applications act as both a client and a server, depending on the situation.
The following IPC mechanisms are supported by Windows:
1) Clipboard
2) COM
3) Data Copy
4) DDE
5) File Mapping
6) Mailslots
7) Pipes
8) RPC
9) Windows Sockets
1) Using the Clipboard for IPC:
a) The clipboard acts as a central depository for data sharing among applications.
b) When a user performs a cut or copy operation in an application, the application puts the selected data on the clipboard in one or more standard or application-defined formats.
c) Any other application can then retrieve the data from the clipboard, choosing from the available formats that it understands.
2) Using COM for IPC:
a) Applications that use OLE manage compound documents—that is, documents made up of data from a variety of different applications.
b) OLE provides services that make it easy for applications to call on other applications for data editing. For example, a word processor that uses OLE could embed a graph from a spreadsheet.
` i) The foundation of OLE is the Component Object Model (COM).
ii) A software component that uses COM can communicate with a wide variety of other components, even those that have not yet been written.
iii) The components interact as objects and clients.
iv) COM objects provide access to an object's data through one or more sets of related functions, known as interfaces.
v) Distributed COM extends the COM programming model so that it works across a network.
Refer:
3) Using Data Copy for IPC:
a) Data copy enables an application to send information to another application using the WM_COPYDATA message.
b) This method requires cooperation between the sending application and the receiving application.
c) The receiving application must know the format of the information and be able to identify the sender.
d) The sending application cannot modify the memory referenced by any pointers.
4) Using DDE for IPC:
a) DDE is a protocol that enables applications to exchange data in a variety of formats.
b) Applications can use DDE for one-time data exchanges or for ongoing exchanges in which the applications update one another as new data becomes available.
c) DDE exchanges can occur between applications running on the same computer or on different computers on a network.
5) Using a File Mapping for IPC:
a) File mapping enables a process to treat the contents of a file as if they were a block of memory in the process's address space.
b) The process can use simple pointer operations to examine and modify the contents of the file.
c) When two or more processes access the same file mapping, each process receives a pointer to memory in its own address space that it can use to read or modify the contents of the file.
d) The processes must use a synchronization object, such as a semaphore, to prevent data corruption in a multitasking environment.
6) Using a Mailslot for IPC:
a) Mailslots provide one-way communication.
b) Mailslots offer an easy way for applications to send and receive short messages.
c) Any process that creates a mailslot is a mailslot server.
d) Other processes, called mailslot clients, send messages to the mailslot server by writing a message to its mailslot.
e) Incoming messages are always appended to the mailslot.
f) The mailslot saves the messages until the mailslot server has read them.
g) A process can be both a mailslot server and a mailslot client, so two-way communication is possible using multiple mailslots.
h) They also provide the ability to broadcast messages across all computers in a network domain.
a) Mailslots provide one-way communication.
b) Mailslots offer an easy way for applications to send and receive short messages.
c) Any process that creates a mailslot is a mailslot server.
d) Other processes, called mailslot clients, send messages to the mailslot server by writing a message to its mailslot.
e) Incoming messages are always appended to the mailslot.
f) The mailslot saves the messages until the mailslot server has read them.
g) A process can be both a mailslot server and a mailslot client, so two-way communication is possible using multiple mailslots.
h) They also provide the ability to broadcast messages across all computers in a network domain.
7) Using Pipes for IPC:
a) There are two types of pipes for two-way communication: anonymous pipes and named pipes.
b) Anonymous pipes provide an efficient way to redirect standard input or output to child processes on the same computer.
c) Named pipes provide a simple programming interface for transferring data between two processes, whether they reside on the same computer or over a network.
8) Using RPC for IPC:
a) RPC provided by Windows is compliant with the Open Software Foundation (OSF) Distributed Computing Environment (DCE).
b) RPC enables applications to call functions remotely. Therefore, RPC makes IPC as easy as calling a function.
c) RPC operates between processes on a single computer or on different computers on a network.
Refer:
9) Using Windows Sockets for IPC:
a) Windows Sockets is a protocol-independent interface.
b) It takes advantage of the communication capabilities of the underlying protocols.
c) In Windows Sockets 2, a socket handle can optionally be used as a file handle with the standard file I/O functions.