Linux Process + inter-process communication IPC

Source: Internet
Author: User
Article Title: Linux Process + inter-process communication IPC. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

A Linux Process

1) memory image of the process

2) Explanation

BSS segments: In a segmented memory management architecture, BSS segments (bss segments) are generally a memory area used to store uninitialized global variables in the program. BSS is short for Block Started by Symbol. BSS segments belong to static memory allocation.

Data segment: In a segmented memory management architecture, data segments (data segments) are generally a memory area used to store initialized global variables in the program. The data segment belongs to the static memory allocation.

Code segment: In a segmented memory management architecture, code segments (code segment/text segment) usually refer to a memory area used to store program code execution. The size of this area is determined before the program runs, and the memory area is usually read-only. Some architectures also allow code segments to be writable, that is, allow self-modified programs. In the code segment, it may also contain some read-only constant variables, such as string constants.

Stack is a special data structure in the form of linked lists in computer science. It is only allowed at one end of the linked list (called the top stack, top in English) to add or delete an ECS instance. In addition, the implementation of the stack data structure can also be completed through arrays. Stack stack is the memory area that stores local variables in the program. In addition, Stack stack is used to save the function call field. Stack stacks are automatically allocated by the system, and users do not need to worry about their distribution and release.

Heap refers to a piece of memory that is at the control of programmers when the program is running. It is used to dynamically allocate memory when a process is running. The heap size is not fixed and can be dynamically changed according to the program running. Controlled by new/delete in the program.

2. Linux Inter-process communication (IPC)

1) Linux IPC

2) Explanation

MPs queue: MPS queues can be divided into common MPs queues and named MPs queues. A common pipeline is used for communication between kinship processes (Parent and Child processes. A named pipe is used to name a Pipe Based on the functions provided by a common pipe to convert it into an MPS file in the file system, this allows unrelated processes to communicate through access to MPs queue files.

Signal: a message similar to a message in windows is used to notify a process of an event. As long as you know the process number, you can send a signal to the process. The process can customize the signal processing method.

Message Queue: a message queue is a linked list of messages. A process can send messages of a certain type to a message queue or read messages of a certain type from the message queue. The message memory can be customized as needed, so that the message queue can overcome the disadvantages of too little information carried by the signal and is widely used in actual programming.

Shared Memory: the shared memory is a buffer allocated in the system kernel. Multiple processes can access the buffer. Because the process can directly read and write the memory, avoiding switching between the kernel space and the user space, the shared memory read and write efficiency is very high. Shared Memory is similar to memory image files in windows programming. In Linux, most applications are used to store configuration information.

Semaphores: it also becomes a traffic signal and is mainly used for inter-process synchronization.

Set interface: it is also a socket that can be used for communication across host boundaries. The set of interfaces was initially implemented on the bsd unix system. Because of its powerful functions and friendly interfaces, they have been implemented in most operating systems and become actually network programming interfaces.

Related Article

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.