The synthesization dispatching algorithm of division operation system
The technical field subregion
The present invention is a kind of synthesization dispatching algorithm for the division operation system.
Background is described
At present, dissimilar division operation system call algorithms is variant again general character, be necessary to study wherein difference and common technology, reduce research and development and maintenance cost, and need to guarantee the highly reliable and real-time of scheduling, so this just need to provide a kind of synthesization dispatching algorithm for the division operation system.
Summary of the invention
The present invention comprises concrete feature content to be had:
Subregion is categorized as core subregion and common subregion
Classification of task is task in idle task and the subregion
Manage ready task in ready priority scheduling subregion and core subregion and the common subregion with four ready chained lists
Adopt the ready priority scheduling subregion of bitmap management of 8x32 and the priority of ready task 0-255
Highly reliable real-time multi-stage scheduling
Embodiment
1. subregion is categorized as core subregion and common subregion
Subregion is the supvr of resource, and subregion is categorized as unique core subregion and the time scheduling table of user's attitude operation and the common subregion of priority scheduling of kernel mode operation.The priority of priority scheduling subregion is 0-255.The kernel mode subregion be mainly used in monitoring and administrative time dispatch list and priority scheduling subregion.Common subregion is owing to the monitoring of core subregion, and reliability is improved.
2. classification of task is task in idle task and the subregion
Have unique idle task in the system, it does not belong to any subregion, operates in kernel mode.Task is by partition creating and startup in the subregion, and it is the performance element in the subregion, and priority is 0-255.When only task was not moved in core subregion and common subregion, idle task was just moved.
3. adopt four ready chained lists to manage ready task in ready priority scheduling subregion and core subregion and the common subregion
System uses a ready chained list management priority to be all ready priority scheduling subregions of 0-255.It is all ready tasks of 0-255 that core subregion, time scheduling table subregion and priority subregion are managed the interior priority of this subregion with a ready chained list respectively.A ready chained list is comprised of 256 ready chains, ready subregion or the task of a priority of every ready chain management.Idle task is not on any ready chain.
4. adopt the ready priority scheduling subregion of bitmap management of 8x32 and the priority of ready task 0-255
In the bitmap management of 8x32, task priority is 0-255 in priority scheduling subregion or the subregion, priority moves to right value 0-7 after 5 as priority main rope quotation marks, low effective 5 the value 0-31 of priority is as priority secondary index number, use 8 bitmaps as priority main rope quotation marks bitmap, use 8 group of 32 bitmap as secondary index bitmap corresponding to 8 main rope quotation marks of priority, priority secondary index bitmap is 32 bitmaps corresponding to main rope quotation marks group, and the call number of corresponding position is the main rope quotation marks of priority or secondary index number in the bitmap.
When priority scheduling subregion or task become ready attitude, position, position that priority main rope quotation marks are corresponding in priority main rope quotation marks bitmap, in priority secondary index bitmap, with the position, position of priority secondary index correspondence, and ready subregion or task be added on the corresponding priority ready chain.
When ready priority scheduling subregion or ready task become non-ready attitude, non-ready subregion or task are extractd from corresponding priority ready chain.If do not have subregion or task on the corresponding priority ready chain of non-ready subregion or task, then in priority secondary index bitmap with the bit clear of priority secondary index correspondence.If the every place value in the priority secondary index bitmap all is 0, then in priority main rope quotation marks bitmap with bit clear corresponding to priority main rope quotation marks.
During the limit priority ready task, if the every place value in the priority main rope quotation marks bitmap all is 0, then subregion is abandoned scheduling under all priority scheduling subregions or the task in the ready subregion of the limit priority that obtains the priority scheduling subregion or subregion.Otherwise, in priority main rope quotation marks bitmap, obtain place value and be 1 lowest order call number as limit priority main rope quotation marks, obtain place value and be 1 lowest order call number in limit priority secondary index bitmap as limit priority secondary index number, limit priority is that move to left value after 5 of limit priority main rope quotation marks adds limit priority secondary index number.First subregion on the limit priority subregion ready chain is the ready subregion of limit priority that participates in the scheduling of priority subregion, and first task on the limit priority task ready chain is the limit priority ready task that participates in task scheduling in the subregion.When obtaining the limit priority of ready subregion and task, no matter how many limit priorities is, the time of obtaining all is the same, and the algorithm that obtains limit priority is highly reliable and fast.
5. highly reliable real-time multi-stage scheduling
Time scheduling table, priority and three kinds of scheduling modes of timeslice are supported in the subregion scheduling.Allowed a plurality of time scheduling tables in the system, can when operation, change the time scheduling table, but any moment there is a time scheduling table to participate in scheduling at the most.Time scheduling list scheduling subregion must be in the time scheduling table setup time window, and when system has used this time scheduling table to dispatch, could participate in scheduling.The time scheduling list scheduling is that time window subregion and core subregion are moving when busy time window.The priority scheduling subregion is merely able at the free time of time scheduling list scheduling window and free time of time window subregion operation, and the subregion that priority is identical is supported time slice scheduling.
During task scheduling, there is the attribute that whether is preempted in task, and when task does not allow to seize, only has when task and initiatively abandons processor, and other task just can be scheduled and obtain processor; When task allowed to seize, the same priority task was dispatched according to the round-robin mode in the subregion.High-priority task need to guarantee that it is preferentially carried out by designated high priority.
When scheduling, the task that is scheduled is selected by system from following three ready chained lists: the current ready chained list of time window subregion that carries out the time scheduling list scheduling (if free time window or the time window subregion be not normal state, task does not participate in scheduling on this chained list), the ready chained list of core subregion is not (if the core subregion is normal state, task does not participate in scheduling on this chained list), the ready chained list of limit priority subregion in the priority scheduling subregion (if limit priority scheduling subregion is not normal state, task does not participate in scheduling on this chained list).If three ready chained lists are taken up an official post be engaged in not participating in not having task on scheduling or the ready chained list, then move idle task.Whether idle window of current time window is at first judged by system, and whether the time windows scheduling subregion normal state, whether has ready task in the subregion:
The current time window is that idle window or time windows scheduling subregion are not have ready task in the time window subregion of normal state or normal state: the limit priority ready task of core subregion and the limit priority ready task of priority scheduling subregion are carried out priority ratio, get the high-priority task operation among both, the limit priority ready task of the identical operation core of priority subregion;
It is to have ready task in normal state and the subregion that the current time window exists subregion and subregion: the limit priority ready task of core subregion and the limit priority ready task of time scheduling list scheduling subregion are carried out priority ratio, get the high-priority task operation among both, the limit priority ready task of the identical run-time scheduling list scheduling of priority subregion.
Description of drawings
In the Figure of description: Fig. 1 is that priority is that 42 the ready task position in bitmap arranges example; Fig. 2 is the time window of time scheduling list scheduling subregion on the time scheduling table; Fig. 3 is the selection course of operation subregion and operation task.