Semaphore mechanism based on [mu] C/OS-II system

A semaphore and mechanism technology, applied in the field of embedded real-time operating systems, can solve the problem of high overhead of suspended tasks, and achieve the effect of speeding up communication and improving real-time performance.

Pending Publication Date: 2021-06-01
HARBIN UNIV OF SCI & TECH
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] The purpose of the present invention is to provide a kind of semaphore mechanism for protecting shared resources to protect shared resources when using mutual exclusion semaphore mechanism in the real-time operating system kernel μC / OS-II to protect shared resources. Improving the real-time performance of μC / OS-II system

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
  • Semaphore mechanism based on [mu] C/OS-II system
  • Semaphore mechanism based on [mu] C/OS-II system
  • Semaphore mechanism based on [mu] C/OS-II system

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0015] Add three members to the event control block, including the number of read request tasks OSReadCnt, the read request task table OSReadGrp and OSReadTbl[OS_READ_PRIO_SIZE] with the same structure as the continuing table; add two new states in the OSEventType of the event control block, read request The task occupies the state ROS_EVENT_TYPE_MUTEX and the write request task occupies the state WOS_EVENT_TYPE_MUTEX; add two new states in the OSTCBStatPend of the task control block, the read request pending state ROS_STAT_PEND_OK and the write request pending state ROS_STAT_PEND_OK.

[0016] The original kernel uses the lower 8 bits of OSEventCnt to judge whether the mutex semaphore is occupied, and it is impossible to determine whether it is occupied by a read task or a write task. Therefore, in order to achieve the purpose of multiple read tasks occupying the semaphore at the same time, the present invention uses the state OSEventType of the mutex semaphore as the judgment ...

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 semaphore mechanism based on a [mu] C/OS-II system, and the semaphore mechanism protects shared resources, and divides semaphores into a reading mechanism and a writing mechanism. When semaphores are created, attributes such as a read task table, an event waiting table and a semaphore state are distributed to the semaphores. When one read task occupies the semaphore, the priority of the task is stored in the read task table, the occupied state of the semaphore is changed, other tasks which want to read the shared resources still can apply for the read semaphore, and tasks which want to write the shared resources do not apply for the semaphore, so that reading and reading sharing, read-write mutual exclusion and write-write mutual exclusion are realized. And the priority of the tasks in the read task table can be improved to avoid the condition of priority inversion, so that the problems that the overhead is relatively high due to the fact that the tasks are frequently suspended in a mutual exclusion semaphore mechanism in a mu C/OS-II system and a writer waits for a long time in a read/write semaphore mechanism are solved, and the execution efficiency of communication between the tasks is further improved.

Description

technical field [0001] The invention belongs to the technical field of embedded real-time operating systems, and relates to a semaphore mechanism based on μC / OS-II system. Background technique [0002] μC / OS-II is a priority-based preemptive hard real-time kernel, which provides the most basic system services, such as semaphore, mailbox, message queue, memory management, interrupt management, etc. In the real-time kernel, there are often multiple tasks accessing the same shared resource at the same time. In order to prevent the shared resource from being destroyed, μC / OS-II uses a mutual exclusion semaphore to protect it, but for a real-time kernel, the mutual exclusion semaphore The overhead of the implementation mechanism is relatively large, that is, operations such as suspending other tasks. There are two ways for a task to access global variables / competing resources - read / write. If the task is only reading the global variable and does not change the value of the globa...

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
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/48G06F9/50G06F9/52G06F9/54
CPCG06F9/4881G06F9/5038G06F9/526G06F9/542G06F2209/484G06F2209/5021
Inventor 丁宇涛徐江李纯锋
Owner HARBIN UNIV OF 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