Task Scheduling Queues for Foreground Responsiveness
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
When background applications are being downloaded or installed, a large number of background tasks are queued on the Native Command Queue (NCQ), causing foreground tasks generated by user interaction to be delayed excessively, leading to system freezing.
Innovation Solution
A task scheduling method that involves creating multiple task scheduling queues for different task types, determining a queue scheduling order based on execution priority, and selectively adding tasks to a task execution queue to prioritize foreground tasks, thereby reducing delay and improving system fluency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Quantity of substance
If background tasks are queued on NCQ for processing, then background applications can be downloaded or installed, but foreground tasks generated by user interaction are delayed excessively causing system freezing
Solution Approach 1:
The patent divides the single NCQ queue into multiple task scheduling queues (foreground queue and background queue) with different priorities. Foreground tasks generated by user interaction are separated from background tasks such as downloads and installations. The system processes tasks from the foreground queue first, ensuring that user-facing operations are not delayed by background processing, thereby resolving the contradiction between processing background tasks and maintaining foreground task responsiveness.
2Loss of time
If multiple task scheduling queues are created with different priorities, then foreground tasks can be processed with lower delay, but the device complexity increases
Solution Approach 1:
The patent introduces an IO scheduler as an intermediary layer between the application layer and the NCQ hardware queue. This IO scheduler manages multiple virtual queues (foreground queue, background queue) and translates them into a single physical NCQ queue. The intermediary abstracts the complexity of priority-based scheduling from the underlying hardware interface, allowing priority-based task processing while maintaining compatibility with the existing NCQ structure and minimizing system complexity.
3Ease of operation
If foreground tasks are prioritized over background tasks, then system fluency is improved, but background task processing efficiency may be reduced
Solution Approach 1:
The patent implements a periodic scheduling mechanism where the system alternates between servicing the foreground queue and the background queue. When the foreground queue contains tasks, the system processes them with high priority to maintain system fluency. When the foreground queue is empty or contains fewer tasks than a threshold, the system switches to process background tasks efficiently. This periodic switching ensures that foreground tasks receive timely attention while background tasks are processed without excessive delay, balancing system fluency with background task productivity.
Data Source
AI summary
Disclosed in the present application are a task scheduling method and apparatus, and a terminal device and a storage medium. When tasks to be executed are generated, said tasks are firstly stored in task scheduling queues; a terminal determines a queue scheduling sequence for the task scheduling queues according to the execution priority levels of the task types of said tasks; and an arrangement sequence of said tasks is determined according to the queue scheduling sequence. In this way, the terminal can preferentially process a task to be executed in the foreground, thereby effectively controlling a processing time delay of the task to be executed in the foreground.


