Talk C together (83rd back: C language instance-inter-process communication overview)
Hello, everyone. We are talking about the process stop in the first two times. The example here is:Inter-process communication. When you leave the rest of your time, your words will go right. Let's talk C chestnuts together!
Each process has its own resources. If resources need to be shared between different processes, communication between processes is required.IPC indicates inter-process communication). Here is an actual example:
The code for process A is as follows:
int main(){ int a = 3; printf("%d \n",a); return 0;}
The code for process B is as follows:
Int main () {int B = 3; printf ("% d \ n", B); printf ("% d \ n", ); // If process B wants to use resource A in process a, it needs to communicate with process A and return 0 ;}
From the code above, you can see that a process has its own resources and can use its own resources at will. However, if you want to use resources in other processes, you need to communicate between processes.
Communication between processes, There are three problems to solve:
1. How to communicate between processes; 2. How to Use critical resources between processes; 3. How to execute a task in an orderly manner between processes;
For question 1, we will explain it in the following chapter. We will not detail it here.
Regarding question 2 and question 3, we introduced a simple method of mutual exclusion when processes are mutually exclusive in the previous chapter. We will introduce other methods in the subsequent chapter. These two problems are actually the same as the process synchronization and mutex, which can solve the problem of Process Synchronization and mutex.
The Process Communication Between processes is a very important part of the process knowledge system. Today we are just an overview to give you a holistic grasp of these contents, in order to lay a good foundation for further learning. In the subsequent chapter, we will detail the content of inter-process communication. Let's look forward to it together, haha.
Let's talk about the example of inter-process communication. I want to know what examples will be provided later, and I will try again.