Multi-Core Request Handling with FIFO Queues and Priority Yielding
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing multi-core systems face challenges in managing globally shared resources due to the lack of ordering guarantees in spinlocks, leading to issues like starvation and deadlock, and the inability to derive non-trivial bounds on worst-case blocking times.
Innovation Solution
A method and computer program code that implement a FIFO queue for globally shared resources, allowing higher-priority tasks to yield the processing core to lower-priority tasks, and raise the priority of tasks acquiring resources to the ceiling priority of the processing core to ensure atomicity and maintain strict FIFO ordering.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If a FIFO queue is associated with a globally shared resource to guarantee ordering, then the worst-case blocking time can be bounded, but problems of starvation and deadlock are introduced
Solution Approach 1:
The patent applies dynamics by making the spinlock behavior adaptive rather than static. The spinlock can switch between FIFO-based ordered access and unordered access modes depending on the situation. When a task is preempted, the spinlock transitions to unordered mode to prevent starvation, while maintaining FIFO ordering when possible to provide blocking time bounds. This dynamic adjustment resolves the contradiction between ordering guarantees and starvation prevention.
Solution Approach 2:
The patent changes the parameter of lock acquisition order from always-FIFO to conditionally-FIFO. By introducing a flag or state variable that tracks whether the spinlock should maintain ordering, the system can adjust its behavior based on preemption events. When preemption occurs, the ordering parameter is relaxed, allowing later arrivals to acquire the lock before earlier preempted tasks, thus preventing starvation while maintaining FIFO bounds during normal operation.
2Productivity
If unordered spinlocks are used to allow preemption, then higher-priority tasks can preempt spinning tasks, but the lack of ordering guarantees makes it challenging to derive non-trivial bounds on worst-case blocking time
Solution Approach 1:
The patent segments the spinlock operation into distinct phases: ordered phase and unordered phase. During the ordered phase, FIFO ordering is maintained for blocking time analysis. When preemption is detected, the system transitions to the unordered phase where preemption is allowed but ordering guarantees are temporarily suspended. This segmentation allows the system to enjoy both FIFO bounds during normal operation and preemption capability when needed, resolving the contradiction between productivity and measurement precision.
3Measurement precision
If strict FIFO ordering is maintained for globally shared resources, then worst-case blocking time can be bounded, but higher-priority tasks cannot preempt lower-priority spinning tasks
Solution Approach 1:
The patent makes the FIFO ordering dynamic rather than static. The system maintains strict FIFO ordering only when no preemption is needed, but dynamically relaxes this ordering when preemption occurs. This is achieved by tracking preemption events and adjusting the lock acquisition order accordingly. The dynamic nature of the ordering allows the system to maintain blocking time bounds during normal operation while enabling preemption when higher-priority tasks are released, thus resolving the contradiction between measurement precision and productivity.
Data Source
Figure 1
Figure 2~4
AI summary
The present invention is related to a method and a computer program code for handling requests in a multi-core system. In a first step, a request for a globally shared resource is received (S1) from a task belonging to a processing core. In case a FIFO queue associated with the globally shared resource is empty, the request is satisfied (S2). In case the FIFO queue associated with the globally shared resource is not empty, the request is queued (S4) in the FIFO queue. When the queued request reaches the head of the FIFO queue, the task is treated (S6) as eligible to enter the respective critical section. The invention is further directed towards a multi-core system using such a method.