Communication between processes

Source: Internet
Author: User

A process is a running activity that can be executed concurrently by a program with independent functions. It is a computer program in the active state.

Process status: User status/kernel status/in-memory readiness/in-memory sleep/ready and swapped out/preemptive/created/frozen.

Fork, exec, wait, exit

Process Communication Methods in Linux:

1. pipe-used for inter-process communication, half-duplex. Two pipelines are required for communication between the two parties. An unknown pipeline can only be used between parent and child processes and brother processes to form an independent file system, and only exists in the memory. data can be read and written. write Data to the end of the buffer and read data from the buffer header.

Only non-formatted byte streams can be transferred, and the buffer size is limited.

2. signal-a simulation of the interrupt mechanism at the software level. signals are the only asynchronous communication mechanism in the program communication mechanism. reliable and unreliable, real-time and non-real-time signals. phase Signal Generation --- register in process --- cancel in process --- signal processing function execution completed

Traffic signal lamp-provides a mechanism to control the access to shared resources among processes, which is equivalent to a memory flag. A process can determine whether it can access some shared resources, and the process can also change the flag. used for Process Synchronization and access control.

3. Message Queue-a message can be regarded as a record with a specific format and priority. A message queue is a linked list of messages and is sustained with the kernel.

4. Shared Memory-the most useful method for inter-process communication, the fastest IPC form, and the process shared memory, which is achieved through synchronization mechanisms such as mutex locks and semaphores.

5. semaphore-as a means of synchronization between processes and different threads of the same process.

6. socket-used for communication between different computers.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.