Semaphore processing method and semaphore processing system

A processing method and processing system technology, applied in the direction of program synchronization, multi-channel program device, etc., can solve the problems of small counter value range and not meeting the requirements of large counters, achieve a large value range, meet the needs of large counting quantities, The effect of expanding the range of values

CN102609317BInactive Publication Date: 2014-05-14TELEFON AB LM ERICSSON (PUBL)
6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Publication Date
2014-05-14
Estimated Expiration
Not applicable · inactive patent

Smart Images

  • Figure 1
    Figure 1
  • Figure 2
    Figure 2
Patent Text Reader

Abstract

The invention discloses a semaphore processing method and a semaphore processing system. The semaphore processing method includes: acquiring a semaphore set; combining each two semaphores in the semaphore set to be a semaphore group; converting all the semaphore groups to be a counter; setting one semaphore in each semaphore group as a counting position and setting the other semaphore as a switching position; starting the switching position when the counting position of one semaphore group is up to the limit; and closing the switching position when the counting position of one semaphore group is not up to the limit. One semaphore in each semaphore group in the counter, the other semaphore in each semaphore group is set as the switching position, so that each semaphore group can count equally, whether the counting positions are up to the limit or not in each semaphore group is identified by one switch, and value range of the semaphores is extended. Accordingly, the requirement of high counting capacity can be met by larger value ranges.
Need to check novelty before this filing date? Find Prior Art

Description

technical field

[0001] The present invention relates to the technical field of semaphore counting, and more specifically, to a processing method and system for semaphore. Background technique

[0002] The best choice for the producer-consumer model to be established on the current Unix system is to use SystemV semaphores as counters.

[0003] Semaphore, also known as semaphore, is a mechanism used to solve the problem of process synchronization and mutual exclusion. In the system, each process is given a semaphore, which represents the current state of each process, so as to ensure that no collision occurs when the process accesses shared data. SystemV semaphores are two sets of interface standards in Unix. SystemV's semaphore interface can execute multiple semaphore operations at the same time and maintain atomicity in one execution.

[0004] However, the value range of the SystemV semaphore is very limited, and the value range of each SystemV semaphore is 0 to 32767. T...

Examples

Embodiment Construction

[0031] 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. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

[0032] An embodiment of the present invention provides a semaphore processing method, comprising: acquiring a semaphore set; forming a semaphore group with every two semaphore in the semaphore set, and converting all semaphore groups into a counter; One semaphore in each semaphore group in the counter is used as a count bit, and another semaphore is used as a switch bit; when the switch bit of the semaphore group is turned on, the counting of the count bit of t...