Processes, Threads, and Interprocess Communication – Signals

signal Signal mechanism The signal is a simulation of the interrupt mechanism at the software level, and it is an asynchronous communication method. The Linux kernel notifies the user process through the signal, and different signal types represent different events. Linux extends the early unix signal mechanism Signal generation: 1 keystroke spawns 2 System call […]

Processes, Threads, and Interprocess Communication – Thread Mutex

Thread Communication – Mutual Exclusion critical resource A shared resource that only one task (process, thread) can access at a time Critical section Code that accesses critical resources Mutual exclusion mechanism mutex mutual exclusion lock Tasks apply for locks before accessing critical resources, and release locks after accessing Mutex initialization – pthread_mutex_init #include <pthread.h> int […]

LinuxC interprocess communication — pipe

nameless pipe 1. The kernel will open up a “pipe”, and the communication process will realize communication by sharing this pipe. code show as below: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> int fd[2]; void read_msg(int sig) { char buffer[1024] = {0}; read(fd[0], buffer, sizeof(buffer)); printf(“buffer […]

Processes, Threads, and Interprocess Communication – Interprocess Communication

Interprocess Communication (IPC, InterProcess Communication) Concept: It is the exchange of information between processes. Common communication methods Unnamed pipe (pipe) Famous pipes (fifo) signal shared memory (mmap) socket Outdated IPC communication method System V IPC shared memory message queue Semaphore set Anonymous pipe Anonymous pipeline features Anonymous pipes have the following characteristics: Can only be […]

IO entry, thread – IPC object for interprocess communication (shared memory, message queue and semaphore set)

Inter-process communication IPC object Inter-Process Communication (IPC, Inter-Process Communication) refers to a mechanism for information exchange and data sharing between different processes. In multi-process programming, inter-process communication is very important, which allows coordination and cooperation between different processes to achieve more complex tasks. In the Linux/Unix operating system, various IPC objects are provided, including shared […]

Linux source code analysis – interprocess communication – shared memory

In the Linux system, each process has an independent virtual memory space, that is to say, the data obtained by different processes accessing the same virtual memory address is different, because the same virtual memory address of different processes will be mapped to at different physical memory addresses. But sometimes, in order to communicate between […]

Python single inheritance, multiple inheritance, @property, exception, file operation, thread and process, interprocess communication, TCP framework 7.24

Single inheritance class luban: def __init__(self, name): self.name = name self.skill = “Fishing Missile” self. damageLevel = 20 def attack(self): print(“{} used the skill {}, causing great trouble to the enemy\ ” “And has a {}% chance to cause a one-hit kill effect”.format(self.name, self.skill, self.damageLevel)) class luban7(luban): pass # __name__ : Magic method: similar to […]

Linux interprocess communication (fifo famous pipe)

Article directory foreword 1. Explanation of the concept of famous pipelines 2. Create fifo from the command line 3. Create fifo without command line Four, fifo and pipeline comparison Summarize Foreword In the last article, we explained the unnamed pipeline. In this article, we will explain the famous pipeline. 1. Explanation of the concept of […]