CN103744726A - Two-stage scheduling method of real-time extension of Windows system - Google Patents
Two-stage scheduling method of real-time extension of Windows system Download PDFInfo
- Publication number
- CN103744726A CN103744726A CN201410001033.8A CN201410001033A CN103744726A CN 103744726 A CN103744726 A CN 103744726A CN 201410001033 A CN201410001033 A CN 201410001033A CN 103744726 A CN103744726 A CN 103744726A
- Authority
- CN
- China
- Prior art keywords
- real
- time
- task
- thread
- kernel
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The invention relates to a two-stage scheduling method of real-time extension of the Windows system. According to the method, by means of affinity settings of the Windows system, reallocating the CPU (Central Processing Unit) resources of the system, and specifying a running core of real-time tasks in order to ensure resources needed by the real-time tasks; setting an IOAPIC(I/O Advanced Programmable Interrupt Controller) redirection table to enable external interrupt to point to specific core processing and to not affect the operation of real-time kernel; meanwhile, using a clock interrupt counter of Local APIC (Advanced Programmable Interrupt Controller) to provide task scheduling with high-precision clock signals; using WinDbg to obtain operation function entry addresses of the process and the thread of Windows from NTDLL to be packaged as DLL, and forming a basic interface of task control; locking and mapping kernel task control blocks and task queues to enable the writing and debugging of a scheduling algorithm can be performed in a user mode, and finally linking into the interrupt handling routine of the high-precision clock of the Local APIC so as to complete the real-time kernel scheduling algorithm.
Description
Technical field
The invention belongs to Computer Applied Technology field, relate to a kind of two-level scheduler method of Windows system real-time extension.
Background technology
Along with the develop rapidly of embedded real-time technique and virtual experiment technology, in industrial circle and in l-G simulation test, Windows operating system is also more and more used as the system platform of application in real time.In order to meet the requirement of real-time, the real-time capacity that increases Windows system itself is very necessary.Mostly existing real time operating system patent, be about the theoretical relevant innovation of real time operating system is as scheduling, resource management etc., basic not about the corresponding scheme in real time of windows platform.Existing Windows real-time scheme is business solutions as Windows RTX, INtime.They take over HAL(hardware abstraction layer) mode provide a set of and the system of Windows own parallel system.Although they have solved the problem of the real-time capacity deficiency of Windows own, retrofit work cost is very high, and some conventional drivings need to be rewritten again, and system flexibility reduces.Its nature of business, causes user's use cost greatly to increase especially, and is difficult for customization.Domestic have the real-time system > > of patent < < based on Windows driver to utilize external interface card that high precision timing is provided, and completes real-time task switch by direct control CPU register.Although substantially met requirement of real time, direct control register has high risk, and is mainly Embedded processing on real-time.The present invention mainly utilizes the task of Windows scheduling itself to switch, and provides a kind of thread controlled two-level scheduler technology, thereby real-time basis is provided.Can expand easily on this basis or self-defined Real-Time Scheduling scheme, complete writing of real-time user program.
Summary of the invention
The technical matters solving
For fear of the deficiencies in the prior art part, the present invention proposes a kind of two-level scheduler method of Windows system real-time extension, has mainly solved in art methods in Windows system the large and low problem of timing accuracy of the switching cost of task.
Technical scheme
A two-level scheduler method for Windows system real-time extension, is characterized in that step is as follows:
Step 1: utilize process and thread CPU affinity zone bit in Windows system, system resource is redistributed, all processes and thread in system are all pointed to non real-time kernel, vacate the core cpu of operation real-time task, for real-time task provides enough operation resources;
Step 2: operation-interface encapsulation, interrupt management and EMS memory locked and these three parts of mapping realize the operation of real-time task simultaneously:
A) the system service descriptor table SSDT providing by means of Microsoft, utilize known Windows interface characteristics code, the instruction of search system internal memory, obtain establishment, hang-up, the recovery of process and thread, the function entrance address of four basic operations of termination, and according to system function prototype, utilize embedding compilation to call, complete the encapsulation of specific operation interface;
B) use the programming of IOAPIC programmable interrupt controller that external interrupt is divided and tasked each non real-time kernel, avoid the interference of external interrupt to real-time kernel, by setting the count value on the initial count register in real-time kernel, produce the timing signal of 10-100 microsecond, for Real-Time Scheduling program provides scheduling signals;
C) the pre-continuous physical page of first to file under kernel state, it is locked, prevent the swapping in and out of this page, utilize MDL mechanism, this physical page is carried out to the mapping of user's state, make user's state and kernel state can operate same physical space, the data copy causing while avoiding operational mode to switch, thread control block TCB and process control block (PCB) PCB are mapped as to user's available address, under user's state, carry out writing and debugging of dispatching algorithm;
Step 3: system, when carrying out specific tasks, according to different task types, adopts different processing kernel dispatching strategies, and common task, Windows system task and external interrupt are used non real-time kernel processes, adopts the scheduling strategy of Window system self; The special interruption of real-time task, appointment will, by real-time kernel resume module, adopt Real-Time Scheduling mechanism, thereby realizes the two-level scheduler of Windows real-time extension.
The step of setting the count value on initial count register in described step 2 is as follows:
Step a: obtain specified dominant frequency and original outer frequency that CPU dispatches from the factory, calculate frequency multiplication by these two values, the pass between three is: dominant frequency equals outer frequency and is multiplied by frequency multiplication;
Step b: inquire about registration table or utilize rdtsc assembly instruction to calculate the current true dominant frequency of CPU, the frequency multiplication of calculating according to step a, inverse draws real frequently outer, the effective bus frequency of the system that obtains;
Step c: the numerical value that initial count register is filled is: dispatching cycle/bus frequency.
In described step 3, the step of Real-Time Scheduling mechanism is as follows:
Step a: thread TCB is inserted to READY_LIST according to thread implicit precedence level;
Step b: thread TCB Direct Transform chained list state being changed according to thread operation result;
Step c: utilize soft interruption to be absorbed in kernel and carry out task switching, when scheduling first need by the start time in DELAY_LIST to thread insert in READY_LIST;
Steps d: current scheduling situation is made a decision, check whether limit priority task changes: directly finish clock if do not change and interrupt processing, task is operation then; If change, enter the scheduling of being correlated with of DPC routine, select the thread that READY_LIST medium priority is the highest and state is READY, recover its operation.
Beneficial effect
The two-level scheduler method of a kind of Windows system real-time extension that the present invention proposes, solved the problem of the switching of Windows task and timing real-time deficiency, adopt the strategy of two-level scheduler to carry out the real-time extension of Windows, dispatching cycle is stable and support the switching of seizing at any time, and scheduling meets real-time task requirement.The relevant interface that utilizes DLL to provide, user can carry out easily self-defining scheduling strategy or dispatching sequence when writing application.
The present invention is conducive to the debugging exploitation of user program.Owing to not changing and taking over hardware abstraction layer HAL, so real-time task can be rewritten a series of driver, and real-time task is exactly directly Win32 application program.Only need load driver and DLL, utilize existing IDE instrument just can write easily debugging, alleviated real-time application and development difficulty.Utilize to greatest extent Windows system itself to make system there is good stability.
Accompanying drawing explanation
The two-level scheduler method flow diagram of Fig. 1 Windows system real-time extension
Fig. 2 affinity is set figure
Fig. 3 Windows system process thread graph of a relation
Fig. 4 kernel operations port addressing process
Fig. 5 external interrupt management schematic diagram
Fig. 6 count value setting process figure
Fig. 7 MDL structural representation
Fig. 8 user's state and kernel state shared drive mapping structure figure
Fig. 9 Real-Time Scheduling mechanism process flow diagram
Figure 10 example operation result
Embodiment
Now in conjunction with the embodiments, the invention will be further described for accompanying drawing:
The present invention utilizes Windows type of drive, affinity set, interrupt management, EMS memory locked be embedded in system kernel with mapping and task blocked operation, make it to become the module of an independent operating, complete the two-level scheduler of real-time extension, its process flow diagram as shown in Figure 1.
Concrete implementation step is:
Step 1: utilize the CPU affinity zone bit of process and thread in Windows system, system resource is redistributed.Processes all in system and thread are pointed to non real-time kernel, vacate the core cpu of operation real-time task, for real-time task provides enough operation resources, as shown in Figure 2.
It is mainly by the controll block of process and thread is operated that affinity is set, and finds its affinity territory, corresponding affinity mask is set, thereby specifies the operation kernel of this process or thread.In Windows system, as shown in Figure 3, the ActiveProcessLinks active process chain list area of all process control block (PCB)s is all with the form association of doubly linked list, therefore can be convenient for all process control block (PCB)s by any one process.In each process control block (PCB), Affinity field is that the affinity of this process arranges territory, and ThreadListHead thread chain list area is the linked list head of all threads of this process, by this zone bit can convenient this process under all threads.The Affinity field of each thread control block is that the affinity of this process arranges territory.Therefore, by the hierarchical relationship of process and thread, can carry out affinity setting to whole system task.
In each operating system version, the incomplete same difference of the corresponding flags-offset amount of process threads can utilize dt order to obtain the side-play amount of each zone bit in WinDbg.Under Windows xp SP3 system environments, in process control block (PCB), ThreadListHead fields offset amount is 0x50, and Affinity fields offset amount is 0x5C, and ActiveProcessLinks fields offset amount is 0x88; In thread control block, ListEntry chained list pointer field fields offset amount is 0x1B0, and Affinity fields offset amount is 0x124.Affinity field is arranged to the affinity setting that corresponding kernel mask is completion system task, as is arranged to 0x0E, represent that this task can carry out on No. 1, No. 2 and No. 3 kernels, can not on No. 0 kernel, carry out.
Step 2: set by affinity, guaranteed the hardware resource of real-time task operation, operation-interface encapsulation, interrupt management and EMS memory locked and these three parts of mapping realize the operation of real-time task simultaneously:
Operation-interface encapsulation: the expansion of Windows system real time, the two-level scheduler under kernel state, must relate to establishment, termination, hang-up and the recovery operation of real-time task process and thread.Windows system itself does not externally provide these operation-interfaces under kernel state, but they are present in kernel really, is therefore necessary to utilize some method to obtain the function address of process threads operation, for Real-Time Scheduling device.
The system service descriptor table SSDT providing by means of Microsoft, utilizes known Windows interface characteristics code, and the instruction of search system internal memory, obtains system handling function entry address.Obtain behind this entry address, according to system function prototype, utilize embedding compilation to call, complete the encapsulation of specific operation interface.
System service descriptor table SSDT, connects the core A PI of the Win32API of ring3 rank and ring0 rank, is an address reference table.The corresponding fixing service number of each user API, this service number is exactly the side-play amount of the corresponding core A PI of this user API with respect to allocation index base address.Its effect is equivalent to the directional beacon of internal system API, indicates the kernel address of the API that need to call.
Kernel operations port addressing process as shown in Figure 4, utilize the base address of the corresponding service of operation-interface number and SSDT table, can obtain the kernel address of the corresponding NT function of operation-interface, in Windows system, Nt interface function is primary function, has a large amount of abnormal judgements and wrong processing to operate, and execution efficiency is not high, for the bookkeeping of real-time task, can select the more Ke interface function of bottom.In Nt interface function porch, utilize known Ke interface characteristics code, the instruction of search system internal memory, obtains system Ke handling function entry address.Find behind Ke handling function entry address, according to system function prototype, utilize embedding compilation to call, complete the encapsulation of kernel operations interface.
Under Windows xp SP3 system environments, the service number of establishment, hang-up, recovery and the termination of thread is respectively 0x35,0xFE, 0xCE and 0x102, the condition code of hanging up function is followed successively by 0x89,0x45 and 0xFC, and the condition code of reconstruction is followed successively by 0xFF, 0x75 and 0x08.
Interrupt management: other that interrupt except clock on shielding real-time core interrupt, and provide high precision scheduling signals for Real-Time Scheduling.The interrupt system overwhelming majority of multinuclear PC uses Advanced Programmable Interrupt Controllers APICs APIC to realize, and each core cpu has the Local APIC of oneself, and is subject to IOAPIC on mainboard to carry out unified management.External unit is connected to IOAPIC, and IOAPIC is distributed to external interrupt the Local APIC processing of each CPU again.Utilize the programming of IOAPIC controller to make to interrupt redirecting, directed external interrupt, process to non real-time kernel, avoided the impact of external interrupt on real-time kernel.Utilize the programming of Local APIC controller can set clock interrupt cycle, enable to produce the timing signal of 10-100 microsecond, for Real-Time Scheduling program provides scheduling signals.
1. use IOAPIC controller shielding external interrupt
When an IRQ occurs, IOAPIC controller is responsible for determining IRQ is sent to which core cpu, and with which kind of form transmission etc., IOAPIC can describe the mapping of IRQ and interrupt vector number, Windows can transfer to corresponding interrupt handling routine according to interrupt vector number.
By Intel handbook, learnt, IOAPIC unit comprises one group of bus-in singal, the interrupt redirection table of 24 64, programmable controller and transmission, receives the register of APIC information in APIC bus.I/O equipment is by applying for that in IOAPIC a look-at-me line comes to send and interrupt to operating system.Then IOAPIC in re-direction table, select corresponding and use in information form an interrupt request information exchange and cross APIC bus and send to corresponding CPU to process.Each in re-direction table can be programmed individually, and can specify it is look-at-me, interrupt vector and priority, the target processor of edge/level sensitivity, and the selecteed mode of processor (static or dynamic).
In the present invention, only used 24 re-direction table in IOAPIC, APIC is exactly " route " function that has realized interruption by these 24 re-direction table.By to re-direction table reprogramming, make external interrupt only issue the processing of non real-time CPU core, do not issue real-time CPU core, thereby the load that alleviates real-time CPU reduces the delay of real-time task.
The re-direction table of 24 64 in IOAPIC, each all can connect external interrupt, and wherein which CPU processing 56-63 bit representation mails to this interruption.This eight-digit binary number position represents respectively 8 CPU cores from low to high, corresponding bits position, is 1, represents that this interruption need to issue this CPU core processing; This interrupts not issuing this CPU processing to be set to 0 expression.In Windows, the address of IOAPIC is 0xFEC00000, by reading and writing its a series of register, realize programming Control, access IOAPIC, can not directly use its internal register, but will visit by 2 memory-mapped registers, one is IOREGSEL, one is IOWIN, and their address is respectively 0xFEC00000 and 0xFEC00010.24 re-direction table of register traversal of utilizing 2 mappings, are revised as corresponding value the 56-63 position of each vector.Its principle as shown in Figure 5.
In the present invention, the 57th position of being redirected in list item, be 1, the 56th and 58-63 position, be 0, can realize external interrupt and all issue non real-time core CPU1, and CPU0 can not receive external interrupt.By this setting, can complete the heavily distribution of interrupt resources, now in real time CPU0 no longer receives external interrupt, and all outside interruptions are all by the processing of non real-time CPU1 core, thus the delay that can eliminate real-time task and cause because interrupt processing.
2. use Local APIC to produce high precision scheduling signals
Local APIC timer in multinuclear PC is idle state, can utilize it to realize high-precision clock signal, for scheduling provides trigger pulse.In Local APIC, there are initial count register and vector registor, what initial count register was filled is timing space-number (time-count cycle is divided by frequency), and what vector registor was filled is to reach after timing space-number, break in service person's program entry address of processing.
In the present invention, according to dispatching cycle, initial count register is set, points to independently interrupt vector and process address, and write corresponding interrupt service routine, in interrupt service routine, realize scheduling strategy.Thereby having realized two separate clocks in PC interrupts: one is that original Windows system clock interrupts, and one is that the new real-time clock adding interrupts, and two clocks interrupt being independent of each other.
The reference frequency of Local APIC controller is system bus frequency, namely frequently outer, by wmic instruction, can directly obtain outer frequency value.But in actual applications, there will be the phenomenons such as overclocking, and the value that this instruction is obtained is specified Default Value, also needs further perfect.According to outer frequency, there is fixing multiple relation with dominant frequency: dominant frequency=outer X frequency multiplication frequently.Obtain after the specified dominant frequency that CPU dispatches from the factory, with the original outer frequency one of above-mentioned acquisition, at first calculate frequency multiplication.After determining frequency multiplication, again inquire about registration table or utilize rdtsc assembly instruction to calculate current true dominant frequency, real frequently outer thereby inverse draws, the effective bus frequency of the system that is only now obtaining.The numerical value that initial count register is filled is: dispatching cycle/bus frequency.Concrete operation step as shown in Figure 6.
Obtain after timing space-number, in initial count register corresponding to Local APIC controller 0xFEE00380 place, fill in this numerical value, complete the setting in scheduling timing cycle.At 0xFEE00320 place, corresponding arranging in register, arranges its interrupt vector, makes it to point to Real-Time Scheduling entrance.Like this, often reach after dispatching cycle, Local APIC controller will produce clock and interrupt, and triggers Real-Time Scheduling.
EMS memory locked and mapping: Windows memory management adopts virtual memory technology, it exchanges away the page temporarily not using from internal memory, and the page that needs are used changes in internal memory.For real-time task, the brought time overhead that skips of skipping leaf is flagrant.Meanwhile, Windows task often operates in user's state, and user's state program and kernel state program acquiescence can not direct communications.When having data to transmit and to process, system needs constantly between user's state and kernel state, to switch, and constantly copy data, has so just increased the task deadline, likely causes overtime.
Windows kernel and application program are used virtual address to visit internal memory, one section of continuous virtual address space may be corresponding many physical pages, these pages are likely discontinuous.Windows utilizes descriptor memory symbol chained list MDL (Memory Descriptor List, descriptor memory table) to describe the mapping relations between physical memory and virtual memory.
The data structure of MDL is as shown in Figure 7: one section of continuous virtual address space correspondence 3 physical pages, and these 3 pages are also discontinuous.MDL can connect into a chained list, Next points to next MDL, Size represents the memory size that store M DL is used, MdlFlags represents the mark of MDL, when being mapped to user's state address from kernel state address, address after mapping is the user state virtual address relevant to process context, Process points to this process, when being mapped to kernel state from user's state, MappedSystemVa represents the kernel state virtual address after mapping, the size of virtual memory is ByteCount, the address of first page is StartVa, the first address of virtual memory is ByteOffset with respect to the side-play amount of first page address.
When kernel state memory-mapped is arrived to user's state, first call IoAllocateMdl interface and distribute a MDL, for the internal memory distributing in nonpaged pool, carry out initialization page number array with MmBuidlMdlForNonpagedPool interface, the internal memory of recycling MmProbeAndLockPages interface locks MDL, and indicate the authority to it, finally call MmMapLockedPagesSpecifyCache interface kernel state Buffer mapping is arrived to user's state address space, return to the start address of user's state address space.
In the present invention, as shown in Figure 8, dispatching office is needed to data structure, mainly that the scheduling queue that comprises thread control block TCB and process control block (PCB) PCB is mapped as to user's available address, scheduling queue in scheduling queue in user's state real-time task and kernel state Real-Time Scheduling device points to identical physical memory, and the scheduling queue in operation user state real-time task is equal to the scheduling queue in operation kernel state Real-Time Scheduling device.
Make like this writing and debugging and can carry out in user's state of dispatching algorithm, undesired mode switches, and the information of scheduling queue in user's state just can be revised kernel state, facilitates exploitation and the replacement of scheduler program.After scheduling strategy determines, scheduling mechanism is hung in the interrupt handling program of Local APIC high precision clock, thereby periodically carried out switching and the scheduling of task.
5) task is switched.In two-level scheduler, real-time task will be by real-time kernel resume module, utilizes the DPC routine that Local APIC high precision clock interrupts to carry out operation dispatching strategy.The most frequently used scheduling strategy based on priority is only provided in the present invention at present.Priority level initializing is not limit (be greater than 0, the less priority of numeral is higher), and first priority high person move, and can deprive and can seize.
Real-Time Scheduling Police in the present invention: have task to arrive, first according to thread implicit precedence level, its TCB is inserted to READY_LIST.When program is carried out, thread TCB Direct Transform chained list state being changed according to thread operation result.As the thread recovering in SUSPEND_LIST and WAITING_LIST (being that state is READY) inserts in READY_LIST, or insert and block or hang-up queue after direct change state itself that need to hang up or wait for.Utilize soft interruption to be absorbed in kernel and carry out task switching, when scheduling first need by the start time in DELAY_LIST to thread insert in READY_LIST.In READY_LIST, be to insert with priority size ascending order.Namely first node is the task that priority is the highest.So far, can make a decision current scheduling situation, check whether whether limit priority task changes, hang up etc.If do not change, directly finish clock and interrupt processing, then operation.If changed, enter the scheduling of being correlated with of DPC routine, select READY_LIST medium priority the highest and have the thread of operation qualification (state is READY), recover its operation.The user program of writing can also improve response thread priority dynamically in thread operational process, or directly changes thread place chained list.Process flow diagram represents as Fig. 9.
Writing of application program is mainly that the user interface that calls DLL and provide is write.Be below an application program operation result as shown in figure 10.This program is moved altogether 3 threads, in strict accordance with priority operation, and supports to seize and thread synchronization.Can find out that two-level scheduler can meet requirement of real time for the scheduling controlling of thread.The user interface that DLL provides simultaneously can make user change easily the association attributeses such as thread priority, and we provide a set of complete synchronization mechanism to add simulation Windows itself.This provides good spread foundation for customization particular schedule or execution sequence.In example, 3 thread information are as shown in table 1.Execution result as shown in figure 10.Can find out that user can realize the control completely of thread by operations such as priority level initializings.System requirement of real time, effectively control task operation.
Table 1 thread attribute is set table
Thread sequence number | Priority | Task is switched |
Thread_1 | 30 | Circulation is printed 5 times, recovers Thread_3 |
Thread_2 | 20 | Circulate 5 times, recover Thread_3, end of run |
Thread_3 | 10 | 3 hang-up that circulate, repeat twice end of run |
The present invention utilizes type of drive to carry out real time implementation expansion to Windows system, system resource is redistributed, to distinguish real-time and non real-time operation core.For real-time task, adopted Real-Time Scheduling Police, due to the exclusivity of real-time core, improved real-time performance.Shielded the major part on real-time core simultaneously and interrupted, utilizing clock to interrupt is dispatching cycle, for software real-time task in test provides higher execution efficiency.For common task, Windows system task and external interrupt, all can use non real-time kernel processes, adopt the scheduling strategy of Windows system self to process.Like this, this two-level scheduler scheme is both compatible the task processing of Windows system itself, the execution efficiency and the accuracy that have improved again real-time task.
Claims (3)
1. a two-level scheduler method for Windows system real-time extension, is characterized in that step is as follows:
Step 1: utilize process and thread CPU affinity zone bit in Windows system, system resource is redistributed, all processes and thread in system are all pointed to non real-time kernel, vacate the core cpu of operation real-time task, for real-time task provides enough operation resources;
Step 2: operation-interface encapsulation, interrupt management and EMS memory locked and these three parts of mapping realize the operation of real-time task simultaneously:
A) the system service descriptor table SSDT providing by means of Microsoft, utilize known Windows interface characteristics code, the instruction of search system internal memory, obtain establishment, hang-up, the recovery of process and thread, the function entrance address of four basic operations of termination, and according to system function prototype, utilize embedding compilation to call, complete the encapsulation of specific operation interface;
B) use the programming of IOAPIC programmable interrupt controller that external interrupt is divided and tasked each non real-time kernel, avoid the interference of external interrupt to real-time kernel, by setting the count value on the initial count register in real-time kernel, produce the timing signal of 10-100 microsecond, for Real-Time Scheduling program provides scheduling signals;
C) the pre-continuous physical page of first to file under kernel state, it is locked, prevent the swapping in and out of this page, utilize MDL mechanism, this physical page is carried out to the mapping of user's state, make user's state and kernel state can operate same physical space, the data copy causing while avoiding operational mode to switch, thread control block TCB and process control block (PCB) PCB are mapped as to user's available address, under user's state, carry out writing and debugging of dispatching algorithm;
Step 3: system, when carrying out specific tasks, according to different task types, adopts different processing kernel dispatching strategies, and common task, Windows system task and external interrupt are used non real-time kernel processes, adopts the scheduling strategy of Window system self; The special interruption of real-time task, appointment will, by real-time kernel resume module, adopt Real-Time Scheduling mechanism, thereby realizes the two-level scheduler of Windows real-time extension.
2. a kind of two-level scheduler method of Windows system real-time extension according to claim 1, is characterized in that institute
State that in step 2, to set the step of the count value on initial count register as follows:
Step a: obtain specified dominant frequency and original outer frequency that CPU dispatches from the factory, calculate frequency multiplication by these two values, the pass between three is: dominant frequency equals outer frequency and is multiplied by frequency multiplication;
Step b: inquire about registration table or utilize rdtsc assembly instruction to calculate the current true dominant frequency of CPU, the frequency multiplication of calculating according to step a, inverse draws real frequently outer, the effective bus frequency of the system that obtains;
Step c: the numerical value that initial count register is filled is: dispatching cycle/bus frequency.
3. a kind of two-level scheduler method of Windows system real-time extension according to claim 1, is characterized in that institute
The step of stating Real-Time Scheduling mechanism in step 3 is as follows:
Step a: thread TCB is inserted to READY_LIST according to thread implicit precedence level;
Step b: thread TCB Direct Transform chained list state being changed according to thread operation result;
Step c: utilize soft interruption to be absorbed in kernel and carry out task switching, when scheduling first need by the start time in DELAY_LIST to thread insert in READY_LIST;
Steps d: current scheduling situation is made a decision, check whether limit priority task changes: directly finish clock if do not change and interrupt processing, task is operation then; If change, enter the scheduling of being correlated with of DPC routine, select the thread that READY_LIST medium priority is the highest and state is READY, recover its operation.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410001033.8A CN103744726B (en) | 2014-01-02 | 2014-01-02 | A kind of two-level scheduler method of Windows system real-time extension |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410001033.8A CN103744726B (en) | 2014-01-02 | 2014-01-02 | A kind of two-level scheduler method of Windows system real-time extension |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103744726A true CN103744726A (en) | 2014-04-23 |
CN103744726B CN103744726B (en) | 2017-01-04 |
Family
ID=50501746
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410001033.8A Active CN103744726B (en) | 2014-01-02 | 2014-01-02 | A kind of two-level scheduler method of Windows system real-time extension |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103744726B (en) |
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104572281A (en) * | 2014-12-29 | 2015-04-29 | 联合汽车电子有限公司 | Clock interrupt periodical task occupation achieving method and embedded system |
CN105045666A (en) * | 2015-07-09 | 2015-11-11 | 西北工业大学 | Method for partition scheduling in Windows operating system environment |
CN105955807A (en) * | 2016-04-20 | 2016-09-21 | 上海瀚银信息技术有限公司 | System and method for processing task |
WO2017020572A1 (en) * | 2015-08-05 | 2017-02-09 | 华为技术有限公司 | Interrupt processing method, ioapic and computer system |
CN109190217A (en) * | 2018-08-21 | 2019-01-11 | 东方电子股份有限公司 | A kind of message mask emulation test system of elastically regulating and controlling platform |
CN110620712A (en) * | 2019-09-03 | 2019-12-27 | 武汉久同智能科技有限公司 | Method for realizing real-time EtherCAT master station of Window platform |
CN111143072A (en) * | 2019-12-29 | 2020-05-12 | 浪潮(北京)电子信息产业有限公司 | User mode program memory allocation method, system and related components |
CN111198828A (en) * | 2019-12-25 | 2020-05-26 | 晶晨半导体(深圳)有限公司 | Configuration method, device and system for coexistence of multiple storage media |
CN113110108A (en) * | 2021-04-28 | 2021-07-13 | 北京星途探索科技有限公司 | Implementation method for guaranteeing real-time performance of semi-physical simulation by three-layer structure |
CN113806035A (en) * | 2021-03-09 | 2021-12-17 | 京东科技控股股份有限公司 | Distributed scheduling method and service server |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5515538A (en) * | 1992-05-29 | 1996-05-07 | Sun Microsystems, Inc. | Apparatus and method for interrupt handling in a multi-threaded operating system kernel |
US5528513A (en) * | 1993-11-04 | 1996-06-18 | Digital Equipment Corp. | Scheduling and admission control policy for a continuous media server |
CN101478549A (en) * | 2009-01-20 | 2009-07-08 | 电子科技大学 | Operation method for memory sharing media server and functional module construction |
CN102346687A (en) * | 2011-09-21 | 2012-02-08 | 南京航空航天大学 | Real-time system based on Windows driver |
CN103440173A (en) * | 2013-08-23 | 2013-12-11 | 华为技术有限公司 | Scheduling method and related devices of multi-core processors |
-
2014
- 2014-01-02 CN CN201410001033.8A patent/CN103744726B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5515538A (en) * | 1992-05-29 | 1996-05-07 | Sun Microsystems, Inc. | Apparatus and method for interrupt handling in a multi-threaded operating system kernel |
US5528513A (en) * | 1993-11-04 | 1996-06-18 | Digital Equipment Corp. | Scheduling and admission control policy for a continuous media server |
CN101478549A (en) * | 2009-01-20 | 2009-07-08 | 电子科技大学 | Operation method for memory sharing media server and functional module construction |
CN102346687A (en) * | 2011-09-21 | 2012-02-08 | 南京航空航天大学 | Real-time system based on Windows driver |
CN103440173A (en) * | 2013-08-23 | 2013-12-11 | 华为技术有限公司 | Scheduling method and related devices of multi-core processors |
Non-Patent Citations (2)
Title |
---|
杜旭东等: "基于资源重分配的Windows实时性改造", 《微电子学与计算机》 * |
蒋善锋等: "Windows时钟机制的实时扩展研究", 《微电子学与计算机》 * |
Cited By (15)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104572281A (en) * | 2014-12-29 | 2015-04-29 | 联合汽车电子有限公司 | Clock interrupt periodical task occupation achieving method and embedded system |
CN105045666A (en) * | 2015-07-09 | 2015-11-11 | 西北工业大学 | Method for partition scheduling in Windows operating system environment |
CN105045666B (en) * | 2015-07-09 | 2018-06-01 | 西北工业大学 | Subregion dispatching method under Windows operating system environment |
WO2017020572A1 (en) * | 2015-08-05 | 2017-02-09 | 华为技术有限公司 | Interrupt processing method, ioapic and computer system |
CN105955807A (en) * | 2016-04-20 | 2016-09-21 | 上海瀚银信息技术有限公司 | System and method for processing task |
CN105955807B (en) * | 2016-04-20 | 2023-10-31 | 上海瀚银信息技术有限公司 | Task processing system and method |
CN109190217B (en) * | 2018-08-21 | 2023-02-14 | 东方电子股份有限公司 | Message mask simulation test system of elastic regulation and control platform |
CN109190217A (en) * | 2018-08-21 | 2019-01-11 | 东方电子股份有限公司 | A kind of message mask emulation test system of elastically regulating and controlling platform |
CN110620712A (en) * | 2019-09-03 | 2019-12-27 | 武汉久同智能科技有限公司 | Method for realizing real-time EtherCAT master station of Window platform |
CN110620712B (en) * | 2019-09-03 | 2021-08-20 | 武汉久同智能科技有限公司 | Method for realizing real-time EtherCAT master station of Window platform |
CN111198828A (en) * | 2019-12-25 | 2020-05-26 | 晶晨半导体(深圳)有限公司 | Configuration method, device and system for coexistence of multiple storage media |
CN111143072B (en) * | 2019-12-29 | 2023-09-08 | 浪潮(北京)电子信息产业有限公司 | User mode program memory allocation method, system and related components |
CN111143072A (en) * | 2019-12-29 | 2020-05-12 | 浪潮(北京)电子信息产业有限公司 | User mode program memory allocation method, system and related components |
CN113806035A (en) * | 2021-03-09 | 2021-12-17 | 京东科技控股股份有限公司 | Distributed scheduling method and service server |
CN113110108A (en) * | 2021-04-28 | 2021-07-13 | 北京星途探索科技有限公司 | Implementation method for guaranteeing real-time performance of semi-physical simulation by three-layer structure |
Also Published As
Publication number | Publication date |
---|---|
CN103744726B (en) | 2017-01-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103744726A (en) | Two-stage scheduling method of real-time extension of Windows system | |
US9354944B2 (en) | Mapping processing logic having data-parallel threads across processors | |
CN102023844B (en) | Parallel processor and thread processing method thereof | |
CN100511151C (en) | Multiple-path multiple-core server and CPU virtualization processing method thereof | |
JP5357972B2 (en) | Interrupt communication technology in computer system | |
CN102375761A (en) | Business management method, device and equipment | |
RU2013125719A (en) | ARCHITECTURE OF DISTRIBUTED COMPUTATIONS | |
WO2011130406A1 (en) | Runspace method, system and apparatus | |
US10248456B2 (en) | Method and system for providing stack memory management in real-time operating systems | |
US8769543B2 (en) | System and method for maximizing data processing throughput via application load adaptive scheduling and context switching | |
CN103793255A (en) | Configurable multi-main-mode multi-OS-inner-core real-time operating system structure and starting method | |
CN104461970B (en) | Dma controller, mobile terminal and data method for carrying | |
CN112199173A (en) | Data processing method for dual-core CPU real-time operating system | |
US20060015876A1 (en) | Light weight context switching technique | |
Bi et al. | Research of key technologies for embedded Linux based on ARM | |
CN102117224B (en) | Multi-core processor-oriented operating system noise control method | |
Casini et al. | Addressing analysis and partitioning issues for the Waters 2019 challenge | |
US7516311B2 (en) | Deterministic microcontroller context arrangement | |
US20130111152A1 (en) | Method for optimizing memory access in a microprocessor including several logic cores upon resumption of executing an application, and computer program implementing such a method | |
US7562207B2 (en) | Deterministic microcontroller with context manager | |
US10503557B2 (en) | Method of processing OpenCL kernel and computing device therefor | |
WO2006081094A2 (en) | Deterministic microcontroller | |
US11593159B2 (en) | External exception handling | |
CN117667223B (en) | Data adventure solving method, computing engine, processor and electronic equipment | |
US6711655B1 (en) | Finding available memory space by finding its associated memory transfer controller |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |