Linux platform application development - through inter-process mode
1. Line:
1) the named pipe and pipe unnamed difference:
Named pipes: between any process
Unnamed pipes: between parent and child
- Writing data in memory storage pipe
- Pipe is a half-duplex communication
- Core implementations
See more about my previous blog pipeline:
https://blog.csdn.net/Kobe51920/article/details/103229320
2. Semaphore:
- 1) The concept of the semaphore:
Semaphore is a counter, commonly used in the treatment process or thread synchronization issues, especially synchronize access to critical resources.
Critical resources can be simply understood as resources can only be operated by a process or thread at a time, here's resources
It can be a piece of code, a variable or some hardware resources. It represents a process for the concurrent use of the semaphore value is greater than or equal to 0
The number of resource entity; less than zero indicates a critical resource is waiting to use the number of processes.
Note: semaphore signals with here is not related.
Similar to the message queue, linux kernel semid_ds also maintains a data structure for each instance of the semaphore,
- 2) Critical Resources:
That only one process can go visit
- 3) p, v operations:
p:+1
v: -1
- 4) critical region:
Access to critical resources controlled to achieve the same time the process can go visit
- 5) process synchronization:
http://c.biancheng.net/cpp/html/2596.html
3. Shared memory:
More See my previous blog:
https://blog.csdn.net/Kobe51920/article/details/103274866
4. Message Queue:
This approach generally use less, do not go into detail
5. Socket socket:
See my previous blog post mentioned: