The process is usually defined as an instance of a running program, which consists of two parts:
One is the operating system used to manage the kernel objects of the process. The kernel object is also a system that is used to store statistics about the process.
The other is the address space, which contains all the code and data of the executable module or DLL module. It also contains dynamic allocation space. Such as thread stacks and allocation spaces. Each process is given its own virtual address space. When a thread in the process is running, the thread can access the memory that belongs to its process. Memory belonging to other processes is hidden and cannot be accessed by running threads.
In order to communicate between two processes, reference is available for reference:
0. Clipboard Clipboard: Ways in the 16-bit era, support in CWND
1. Windows messages for window messages and dedicated WM_COPYDATA Messages SendMessage () receiver must have a window
2. Use of shared memory (Shared Memory) a. A set of shared memory area HANDLE CreateFileMapping (HANDLE, LPSECURITY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCSTR) generates a file-mapping the core object LPVOID MapViewOfFile (HANDLE hFileMappingObject, DWORD dwDesiredAcess, DWORD dwFileOffsetHigh, DWORD DWFILEOFFSETLOW, DWORD DWNUMBEROFBYTOSTOMAP; get a pointer to shared memory B. Finding that shared memory determines that this memory must have the same ability to present each process in the form of peer to peer, generate the same capabilities, generate shared memory and initialize it . CreateFileMapping () should be called, and then call getLastError (). If the error code is Error_alReady_exists, then the process can assume that this shared memory area has been opened and initialized by other processes, otherwise the process It is reasonable to think that you are in the first one, and then you will initialize the shared memory. Also use only the Server process in the Client / Server architecture should be generated and initialized shared memory. All processes should be used
HANDLE OpenFileMapping (DWORD dwDesiredAccess, BOOL bInheritHandle, LPCTSTR lpName); then call MapViewOfFile (), to obtain a pointer to the shared memory c synchronization (Mutex) d clean up (Cleaning up) BOOL UnmapViewOfFile (LPCVOID lpBaseAddress);.. CloseHandle ()
3. Dynamic Data Exchange (DDE) By maintaining the application between the global allocation, it is possible to make a large amount of data that can be manually placed in the global memory, and then use the window message to pass the memory pointer. This is the way to use the 16-bit WIN era Because there is no global and local memory under Win32, the current memory is only a virtual memory.
4. Message PIPE is used to set a permanent communication channel between applications, and read and write data like this channel to access a flat file. Anonymous pipes are one-way flow, and can only flow between the processes on the same computer. Named Pipes two-way, cross-network, any process can easily grasp, put into the data of the pipe with a fixed format, and use readFile () can only read the size of the size. It can be used in the I / O Completion Ports5 Mail Slot (Mailslots) broadcast communication, and the new method provided in the 32 system can exchange data between different hosts, only support the mail slot customer under Win9X.
6. Windows Sockets (Windows Socket) It has all the functions of the message pipeline, but complies with a set of communication standards to communicate with each other's applications on different operating systems.
7. Internet communication makes the app upload or download file from the Internet address
8. RPC: Remote process call, rarely used, because it is incompatible with Unix's RPC.
9. Serial / Parallel Communication It allows applications to communicate with other applications via serial or parallel ports.
10. COM / DCOM exchanges data exchange data exchange through the agent stub mode of the COM system, but can only be used to transmit data when the call function is called, and data can be transmitted between different hosts through the DCOM.