Linux system semaphore multi-thread communication protection method

A system signal and semaphore technology, applied in the field of operating systems, can solve the problems affecting the effectiveness and reliability of threads, no solutions, false permissions, etc., to solve synchronization problems and false permissions problems, and ensure the reliability of effectiveness and execution. sexual effect

Pending Publication Date: 2022-03-25
TONG FANG ELECTRONICS SCI & TECH
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

However, the P operation of the externally triggered thread is random. When the thread function corresponding to the V operation of the semaphore sem is not completely executed once, a new P operation of more than one time is triggered, and the thread corresponding to the V operation will miss the

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Linux system semaphore multi-thread communication protection method

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0025] The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments of the present invention belong to the protection scope of the present invention.

[0026] Such as figure 1 As shown, according to the communication protection method between a kind of Linux system semaphore multi-thread described in the embodiment of the present invention, comprises the following steps:

[0027] S1 After the Linux system starts, execute the application program and create the semaphore S 1 ~S n , create thread T 1 ~T 2n , create an inter-thread semaphore protection flag F 1 ~F n , n is a positive integer;

[0028] S2 uses the sem_init function provide...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a Linux system semaphore multi-thread communication protection method, which comprises the following steps that after a Linux system is started, semaphores S1-Sn, threads T1-T2n and inter-thread semaphore protection identifiers F1-Fn are created, and n is a positive integer; a semaphore S1-Sn is initialized by using a semi-init function provided by a system, threads T1-T2n are initialized by using a pthread create function provided by the system, and an inter-thread semaphore protection identifier F1-Fn is initialized to be 0 by using an assignment operator provided by the system. According to the method and the device, the inter-thread semaphore protection identifier is added, and the inter-thread semaphore protection identifier value is judged, so that whether the thread of the communication object needs to be activated or not is further judged, the synchronization problem and the false permission problem of inter-thread communication are effectively solved, and the inter-thread effectiveness and the execution reliability are guaranteed.

Description

technical field [0001] The invention relates to the technical field of operating systems, in particular to a communication protection method among multiple threads of semaphore in a Linux system. Background technique [0002] The Linux operating system is an embedded system with a wide range of applications, such as: medical equipment, automobiles, industrial control, aviation, aerospace and other military fields. Embedded systems are application-centric, and tailoring is an important feature of embedded systems, usually composed of specific functional modules and computer control modules. Embedded Linux system has the advantages of low cost, multiple hardware platform support, excellent performance and good network support. [0003] A thread is the smallest unit handled by the operating system. Often a process contains multiple threads, and multiple threads in the process share resources, address space, and data segments. Therefore, resource access synchronization and mu...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F9/52
CPCG06F9/52G06F2209/522
Inventor 张盼华吕辉杰张伟涛陈华强樊浩王庆寰
Owner TONG FANG ELECTRONICS SCI & TECH
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products