CN107015843A - All-purpose computer handles the method and a kind of virtual timing equipment of external event in real time - Google Patents
All-purpose computer handles the method and a kind of virtual timing equipment of external event in real time Download PDFInfo
- Publication number
- CN107015843A CN107015843A CN201610064154.6A CN201610064154A CN107015843A CN 107015843 A CN107015843 A CN 107015843A CN 201610064154 A CN201610064154 A CN 201610064154A CN 107015843 A CN107015843 A CN 107015843A
- Authority
- CN
- China
- Prior art keywords
- virtual
- timing equipment
- processor
- code
- virtual timing
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
Present invention proposition is a kind of to realize the method for the real-time processing of external event using computing resource is had more than needed on all-purpose computer, this method isolates hardware resource used in real-time event processing on a general-purpose computer first, it is set no longer to be managed by common computer operations system, then using the related driver programs in common computer operations system, by with it is separate in common computer operations systemic-function, processing related software bag is loaded into segregate hardware resource operation in real time, so as to prevent the various operations of common computer operations system to cause real-time to influence real-time event processing, and turn avoid the high cost for using specialized hardware board and dumb.Based on method proposed by the present invention, the invention also provides the virtual timing equipment that the hardware communication devices such as computing resource, storage resource, the serial ports/network interface card being had more than needed on a kind of utilization all-purpose computer are realized.
Description
Problem domain:
The invention belongs to real-time I O process field, more particularly to one kind is by a part of computing resource of all-purpose computer and all purpose communication
The when system card that board is realized.
Correlation technique:
In engineering, generally there are two methods to the real-time processing of physical event:
Method one:Using special hardware board, there is processing unit and storage resource on board, board can be utilized thereon
These hardware resources complete the real-time processing to event.The advantage of this implementation is to be easier to ensure the real-time of event handling
Property;Have the disadvantage that the cost of hardware is higher and after hardware board is dispatched from the factory, user is difficult to change this board to patrol for the processing of event
Volume.
Method two is that event is received using common hardware, and by the real-time task in all-purpose computer to the event that receives
Handled in real time.The advantage of such a implementation be flexibly, cost it is low, have the disadvantage event handling real-time easily by general
The influence of other tasks on computer.
The content of the invention:
For the advantage and disadvantage of both the above implementation method, the present invention proposes a kind of using segregate hardware resource on all-purpose computer
The method for carrying out real-time event processing, its essence is:Event is handled using the processor and memory of all-purpose computer, but it is logical
Cross the hardware resource that is managed of operating system on limitation all-purpose computer so that the process of real-time event processing logically with it is general
Computer operating system is separate, so as to prevent the various operations of common computer operations system to cause real-time event processing
Real-time influences, and turn avoid the high cost for using specialized hardware board and dumb.
Specifically, the present invention proposes a kind of method that utilization all-purpose computer resource handles external event in real time, including general meter
The processor dynamically operating system of offline function, the driver operated in the operating system, virtual unit are supported on calculation machine
Realize bag and the hardware module for knowing or producing event, it is characterised in that:
(1) virtual unit, which is realized, includes initialization module, outside interactive module and internal interactive module, wherein described initial
Change module is responsible for outside interactive module and running environment is set up in the normal operation of internal interactive module, and outside interactive module is responsible for logical
The outside for crossing the hardware module and the general-purpose computing system is interacted, and internal interactive module is responsible for and the general-purpose computations
Machine operating system and software thereon are communicated, and outside interactive module, the normal operation of internal interactive module are independently from institute
State common computer operations system;
(2) driver performs the flow comprised the following steps, and the place for external event is installed on the all-purpose computer
Manage logic:
Step one:The function of being provided using the operating system, by needed for real-time event processing including described hardware module, processing
Hardware resource including device, the physical memory page, is isolated from current operation system;
Step 2:The function of being provided using the operating system, obtains the management information for the hardware resource for being isolated out in step one;
Step 3:The information that bag and step 2 are obtained is realized according to virtual unit, the hardware resource isolated to step one carries out necessary
Initialization;
Step 4:Processor used in isolated to step one, real-time event processing sends initialization command, so as to cause to connect
The processor for receiving initialization command starts to perform the included logic function of virtual unit realization bag;
(3) processor can comprise the following steps when performing the logic function that the virtual unit realization is included:
Running environment required for step one initialization real-time event processing;
Step 2 performs the internal interactive module and outside interactive module parallel, as described in (1), in normal operation, this
The operation of two modules is independently of the common computer operations system.
It should be noted that:
1. method proposed by the present invention only define " virtual unit realize bag outside interactive module and outside interactive module it is normal
Operation is independently of common computer operations system ", do not limit virtual unit and realize bag realizes its normal work using which kind of mode
Function outside logic.For the related hardware environment initialization before normal work (such as:The initialization of associated internal memory, hardware
The initialization of module, route, the foundation of page table interrupted etc.), the abnormality that occurs in course of normal operation (such as occurs in that
Some software and hardware failures are, it is necessary to be reset) situations such as, relevant technical staff in the field can be according to the characteristics of hardware module
With the factor such as software development workload estimate, autonomously deciding on is realized by driver program, or realizes that bag is realized by virtual unit,
Or bag cooperative achievement is realized by driver and virtual unit.
2. the inventive method does not limit the parallel execution side that virtual unit realizes internal interactive module and outside interactive module in bag
Formula.When virtual unit realizes that bag only completes whole logic functions using a CPU, if more emphasizing logical with outside in real time
Letter, then can make outside interactive module be run in the way of external interrupt processor, and internal interactive module is run with polling mode;
If more emphasizing to handle the request from common computer operations system in real time, internal interactive module can be embodied as interprocessor
The processing routine of interruption, and outside interactive module is run with polling mode.When virtual unit realizes that bag uses enough CPU
When completing its logic function, then outside interactive module and internal interactive module can be selected alone in interrupt handling routine form, also
It is to be run in poll form.In the implementation having, virtual unit is realized in bag even can have task scheduling comprising one
The real time operating system of function.
3. the inventive method does not limit internal interactive module and outside interactive module is only single task pattern.This area is related
Technical staff can freely complete the logic function of these modules using multitask cooperation, such as:Outside interactive module can be with
Including interface module and processing module, interface module is only responsible for real-time reception external event, and will play the friendship of the event after timestamp
Asynchronous process is carried out to processing module (such as:The local clock frequency of adjustment, update local zone time etc.), so as to ensure " to
The information that reaches, which carries out beating timestamp, to be operated " real-time.
Based on the above method, the present invention proposes a kind of void realized on the all-purpose computer with multiple logic processors by software
Intend timing equipment, including when system event acquisition board, one or more logic processors on the all-purpose computer, it is virtual when
The software of the driver for equipment of uniting and virtual timing equipment realizes bag, it is characterized in that:
(1) it is offline that the logic processor on current computer is entered Mobile state by the operating system support installed on the all-purpose computer;
(2) software realizes that including processor starts code, virtual timing equipment setup code and the work of virtual timing equipment
Code, wherein:1. processor starts code and is used to initialize the processor for being in down status so that corresponding place
Manage the state that device enters " can normally perform virtual timing equipment setup code ";2. system is set when processor starts code and be virtual
Standby setup code is continuous in logic, so that processor carries out virtual timing equipment after processor startup code has been performed
Setup code;3. virtual timing equipment setup code is the ring that virtual timing equipment operation code creates a normal work
Border, goes to virtual timing equipment operation code afterwards;4. system event acquisition board is received when virtual timing equipment operation code is responsible for pair
To when system message and on all-purpose computer software the acquisition time request handled;
(3) driver is run in the operating system of the all-purpose computer, and it is to receive the loading that user sends virtual
The flow comprised the following steps is performed after the request of timing equipment:
Step 1: the request operating system logic processor to be used virtual timing equipment is offline;
Step 2: obtaining information during management required for system event acquisition board;
Step 3: distribution starts and run the physical memory needed for virtual timing equipment, it is empty that this physical memory is logically divided into work
Between and auxiliary space two parts, wherein working space storage content include:1. the software realizes each several part generation included
Code, 2. virtual timing equipment operation code data required in normal operation;The content of auxiliary space storage includes:Management
Information, virtual timing equipment when described required for system event acquisition board are used to supply common computer operations system when normally running
The temporal information of reading;
Step 4: realizing the working space in the code in bag, physical memory described in initialization step three according to the software;
Step 5: the auxiliary space in the information obtained according to step 2, physical memory described in initialization step three;
Step 6: notifying the processor in the offline logic processor of step one performs working space described in step 3 to start code;
(4) the virtual timing equipment setup code comprises the following steps:
Step 1: obtaining information when managing described needed for system event acquisition board from the auxiliary space;
Step 2: the information according to this process step one, to it is described when system event acquisition board and processor carry out Initialize installation;
Step 3: the porch for operation code of being united when jumping to described virtual is continued executing with;
(5) information variable when the virtual timing equipment operation code includes Jiao Shi version numbers variable, nearest school, when unite event acquisition
Board interrupt handling routine and request processing cycle, wherein, Jiao Shi version numbers are used to indicate that how many times school currently has been carried out
When, during nearest school information be used to recording be most recently received when system message situation (including included in message of being united when nearest temporal information,
Receive the time for message of now uniting);
(6) event acquisition board interrupt handling routine of being united when includes following flow:
Step 1: from it is described when system event acquisition board receive when unite event;
Step 2: obtaining the current time of processor;
Step 3: processing receive when unite message, and information when updating nearest school
Step 4:Version number's variable increases 1 during high-ranking officers;
Step 5: interrupt processing is returned;
(7) request processing cycle includes following flow:
Step one:Current Jiao Shi version numbers are cached to local temporary variable cached;
Step 2:According to information during newest school and the current time of processor, calculating should return to the current time of requestor;
Step 3:If current Jiao Shi version numbers are not equal to cached, step one is gone to, is otherwise continued executing with;
Step 4:The storage region that the current time that step 2 is obtained is put into auxiliary space, arranged with the general-purpose operating system.
Based on the above method, the present invention also proposes a kind of to be realized by software on the all-purpose computer with multiple logic processors
Virtual timing equipment, including when system event acquisition board, multiple logic processors on the all-purpose computer, it is virtual when system set
Standby driver and the software of virtual timing equipment realize bag, it is characterized in that:
(1) operating system installed on the all-purpose computer supports the logic processor on current computer enters Mobile state offline;
(2) software realizes that including processor starts code, virtual timing equipment setup code and the work of virtual timing equipment
Code, wherein:1. processor starts code and is used to initialize the processor for being in down status so that corresponding place
Manage the state that device enters " can normally perform virtual timing equipment setup code ";2. system is set when processor starts code and be virtual
Standby setup code is continuous in logic, so that processor carries out virtual timing equipment after processor startup code has been performed
Setup code;3. virtual timing equipment setup code is the ring that virtual timing equipment operation code creates a normal work
Border, goes to virtual timing equipment operation code afterwards;4. system event acquisition board is received when virtual timing equipment operation code is responsible for pair
To when system message and on all-purpose computer software the acquisition time request handled;
(3) driver is run in the operating system of the all-purpose computer, and it is to receive the loading that user sends virtual
The flow comprised the following steps is performed after the request of timing equipment:
Step 1: the request operating system logic processor to be used virtual timing equipment is offline;
Step 2: obtaining information during management required for system event acquisition board;
Step 3: distribution starts and run the physical memory needed for virtual timing equipment, it is empty that this physical memory is logically divided into work
Between and auxiliary space two parts, wherein working space storage content include:1. the software realizes each several part generation included
Code, 2. virtual timing equipment operation code data required in normal operation;The content of auxiliary space storage includes:Management
Information, virtual timing equipment when described required for system event acquisition board are used to supply common computer operations system when normally running
The temporal information of reading;
Step 4: realizing the working space in the code in bag, physical memory described in initialization step three according to the software;
Step 5: the auxiliary space in the information obtained according to step 2, physical memory described in initialization step three;
Step 6: notifying the processor in the offline logic processor of step one performs working space described in step 3 to start code;
(4) the virtual timing equipment setup code comprises the following steps:
Step 1: obtaining information when managing described needed for system event acquisition board from the auxiliary space;
Step 2: the information according to this process step one, to it is described when system event acquisition board and processor carry out Initialize installation;
Step 3: the porch for operation code of being united when jumping to described virtual is continued executing with;
(5) information variable when the virtual timing equipment operation code includes Jiao Shi version numbers variable, nearest school, when unite event handling
Circulation and request processing cycle, wherein, when Jiao Shi version numbers are used to indicate that how many times school currently has been carried out, believe during nearest school
Cease for record be most recently received when system message situation (including included in message of being united when nearest temporal information, receive now system report
The time of text);
(6) loop body that event handling of being united when is circulated comprises the following steps:
Step one:The state of system event acquisition board when described in poll, thing of being united when system event acquisition board have received when detecting
Part;
Step 2:From it is described when system event acquisition board obtain newest when unite message;
Step 3:Version number is cached to local variable last during high-ranking officers, and then version number is set to " transitory state " during high-ranking officers;
Step 4:Obtain the current time of processor;
Step 5:Handle receive when unite message, and information when updating nearest school;
Step 6:Version number is set to last+1 during high-ranking officers;
(7) request processing cycle comprises the following steps:
Step one:Polling request buffering area, obtains pending time inquiring event;
Step 2:Current Jiao Shi version numbers are cached to local temporary variable cached;
Step 3:If cached is " transitory state ", step 2 is gone to, otherwise according to the current of information during newest school and processor
Time, calculating should return to the current time of requestor;
Step 4:If current Jiao Shi version numbers are not equal to cached, step 2 is gone to, is otherwise continued executing with;
Step 5:The storage region that the current time that step 3 is obtained is put into auxiliary space, arranged with the general-purpose operating system.
It should be noted that:When system message it is very frequent when (such as:The all-purpose computer for having run this virtual timing equipment undertakes
The role of ntp server), can be further by " pair when unite the processing of event " point for the virtual timing equipment of both the above
Solve as " message of being united during reception " and " message of being united during processing ", united when making above-mentioned event acquisition board interrupt handling routine and when unite
Event handling circulation is merely responsible for " message of being united during reception ", had both been responsible for " message of being united during processing " by request processing cycle, and also had been responsible for place
Manage the time inquiring request from common computer operations system.
Figure of description explanation:
Fig. 1 is the schematic diagram for starting, running virtual unit described in the inventive method.In this figure, realized by virtual unit soft in bag
Part is responsible for initializing hardware resource used in virtual unit.
Fig. 2 is another mode for starting, running virtual unit described in the inventive method.In the manner, by virtual equipment driver
Program is responsible for initializing the hardware resource used in virtual unit, outside CPU.
The software that Fig. 3 is included by virtual unit of the present invention.Wherein virtual unit realizes that the code in bag is only used in virtual unit
Processor on run, driver runs only on the processor that common computer operations system is managed.
Fig. 4 is shown when realizing virtual unit on x86 computers, and 1. virtual unit realizes the basic structure of bag;2. driver will
When virtual unit loads startup optimization, service condition (with hypographous part illustrated) of the virtual unit to physical memory.Note:
Now only have bootMem to be limited to below 1M position, virtual unit can not be done to the physical location of other internal memories
Any restriction is (such as:In practice, page table internal memory is located at before peripheral hardware setup code).
When Fig. 5 shows that two computers for having used virtual timing equipment are calibrated by communication link, every computer has
Which part is the part of virtual timing equipment.In the example shown, computer in time server role it is virtual when unite
Equipment is run virtual timing equipment using two logic processors and realizes bag.
Fig. 6 is in embodiment 1, the virtual timing equipment driver of the general-purpose operating system starts the flow of virtual timing equipment.
During Fig. 7 is embodiment 1, the virtual timing equipment driver of the general-purpose operating system or other tasks by it is virtual when system set
The standby flow for obtaining the standard time.
Fig. 8 is in embodiment 1, the virtual timing equipment driver control of the general-purpose operating system sends patrolling for correcting time in network message
Volume.
Fig. 9 be embodiment 1 in, initialization flow of the virtual timing equipment before normal work.
Figure 10 is in embodiment 2, message receives the handling process interrupted outside virtual timing equipment.
Figure 11 is in embodiment 1, virtual timing equipment is for the handling process from common computer operations system request.
Embodiment:
Illustrate first:
Although * virtual timing equipment is used as the client of correcting time in network, this area correlation technique in the following embodiments
Personnel under the enlightenment of the present invention, it is voluntarily drawing, for correcting time in network service end virtual timing equipment it is same the present invention's
Within protection domain, virtual timing equipment now can be as " being determined in embodiment 1 using common computer operations system
When have a high regard for the virtual timing equipment of business timing request to send correcting time in network message " like that, will not there is no real-time will in virtual timing equipment
The function of asking is transferred to operate in the driver in common computer operations system and realized, to reduce the soft of virtual timing equipment
Part development difficulty and hardware resource requirements.
Although * in implementation below, being united when determining when virtual timing equipment externally exports by virtual timing equipment driver
Message, but relevant technical staff in the field is under the enlightenment of the present invention, it is voluntarily drawing, itself supported by virtual timing equipment
The scheme of system message when timer is to determine when to export, still within protection scope of the present invention.
* the present invention is not limiting as relevant technical staff in the field and realizes that virtual timing equipment is realized based on certain real time operating system
Bag.In fact, using real time operating system, relevant technical staff in the field can develop void with better function with easier
Intend timing equipment.
1. the exemplary embodiment one of virtual timing equipment of the present invention
On a general x86 computer with serial ports and multiple logic processors, using in the part on all-purpose computer
Deposit, a logic processor on computer and serial ports are used as virtual timing equipment, so that the application on this computer
Operation can be calibrated by the serial ports and other computers of this virtual timing equipment.This two software of virtual timing equipment correspondence
Bag a, software kit is operate in the driver in common computer operations, and user can be realized to void by this driver
Intend peace loading, unloading and control of timing equipment etc.;Another software kit is that virtual timing equipment realizes bag, and the realization bag includes
Processor start code, virtual timing equipment setup code and when unite card working software.The virtual timing equipment will be distributed to
Its a part of physical memory is used as information exchange area, the operating system on all-purpose computer can by accessing this information exchange area,
Realize the communication with virtual timing equipment.Virtual timing equipment utilizes this information exchange area, is exported to common computer operations system
Temporal information;When system card working software unite when knowing that serial ports have received new using interrupt mode message, by interrupting (if uncommon
Virtual timing equipment is hoped to save) or poll (being asked if virtual timing equipment is designed to receive by aforementioned information exchange area)
Mode knows that other tasks have issued time inquiring request on all-purpose computer.
The workflow of 1.1 virtual timing equipment drivers:
Virtual timing equipment driver performs the virtual timing equipment of flow startup comprised the following steps:
STEP1 (utilizing the function of computer operating system) is offline by some logic processor, and it is dcpu by offline processor to remember this;
STEP2 (by computer operating system or on startup static reservations) allocated physical address is less than in 1M low side physics
Deposit, remember and bootMem is saved as in this;
STEP3 (by computer operating system) distribute for store virtual timing equipment setup code and when unite card working software
Physical memory space;
Physical memory space used in STEP4 (by computer operating system) distribution information exchange area;
STEP5 (by computer operating system) distributes physics memory pages, and these pages are used to deposit virtual timing equipment startup
Used page table during with normal work;
STEP6 from disk read virtual timing equipment realize virtual timing equipment setup code in bag and when unite card working software,
In the memory headroom that their executable form is put into STEP3 distribution;
Physical memory space that STEP7 is distributed according to STEP2~STEP4, virtual timing equipment setup code and when unite card work
The used virtual address of software, is that dcpu creates execution virtual timing equipment initialization generation in the space that STEP5 is distributed
Code and when system card working software when used page table;
STEP8 reads virtual timing equipment from disk and realizes that the processor of bag starts code, and necessary reorientation (ratio is being carried out to it
Such as:The page table page distributed according to STEP5, updates page table address) after, the code after reorientation is put into STEP2 distribution
BootMem in;
STEP9 obtains virtual timing equipment and uses I O access address (such as I/O port or PCI of the physical serial interface on current computer
Bus address) and corresponding I APIC reference address, and these reference address charged into the information that STEP4 distributed exchanged
Qu Zhong;
STEP10 sends the IPI interruptions for startup to dcpu so that dcpu is after this interruption is received, from bootMem bags
The porch that the processor contained starts code starts to perform;
STEP11 sets inquiry timer;
After handling process and correcting time in network timers trigger after virtual timing equipment driver trade mark enquiries timers trigger
Handling process, wherein after inquiry timers trigger, driver performs the flow comprised the following steps:
If there is the time of new " next time sends correcting time in network message " CFIRE1 information exchange area, step CFIRE2 is performed, it is no
Then go to CFIRE3;
CFIRE2 sets correcting time in network timer according to the time of " next time sends correcting time in network message ";
CFIRE3 sets the time of inquiry next time timers trigger;
After correcting time in network timers trigger, driver performs the flow for including operating as follows:
Configuration information exchange area, makes it be indicated " need to send correcting time in network message " to virtual timing equipment.
Other tasks of driver or common computer operations system are current to obtain by performing the flow comprised the following steps
Standard time:
GET1:Configuration information exchange area, makes it indicate:" current pending processing time inquiring request ";
GET2:If information exchange area indicates " message of being united when need to send ", step GET2 is gone to, GET3 is otherwise continued executing with;
GET3:Close responding ability of the current processor to interruption;
GET4:If information exchange area indicates " current pending processing time inquiring request ", step GET4 is gone to, is otherwise continued
Perform GET5;
GET5:Current time is obtained from information exchange area;
GET6:Open responding ability of the current processor for interruption
1.2 virtual timing equipments realize the workflow of bag:
Virtual timing equipment realizes that the processor of bag starts code and comprised the following steps:
DPINIT1:Processor is made to enter protected mode;
DPINIT2:The page table that load driver program is created in its STEP7, and enter paging protected mode;
DPINIT3:Jump to and continued executing with virtual timing equipment setup code;
Virtual timing equipment realizes that the virtual timing equipment setup code of bag comprises the following steps:
WINIT1:Interrupt vector number is distributed for serial equipment, corresponding interrupt processing flow is installed;
WINIT2:The IOAPIC reference address and serial equipment reference address recorded according to driver in information exchange area, it is right
IOAPIC and serial equipment are initialized so that after serial equipment receives and sent data, dcpu can receive interruption,
And perform the interrupt processing flow that this flow WINIT1 is installed;
WINIT3:Buffering area will be received and buffering area is received and be disposed as sky;
WINIT4:Start serial ports, and allow it to send interruption after message is received;
When system card working software include information variable, setup code when Jiao Shi version numbers variable, nearest school are installed, " serial ports
Finish receiving " interrupt handling routine, this interrupt handling routine comprises the following steps:
Step one:The data of reception are put into reception buffering area,
Step 2:If receive the content in buffering area not yet constitute completion when unite message, processing terminates, otherwise continued executing with;
Step 3:Obtain the current timestamp of processor;
Step 4:Handle receive when unite message, information variable when updating nearest school;
Step 5:Version number's variable increases 1 during high-ranking officers;
Step 6:Empty reception buffering area;
This interrupt handling routine the step of four messages when containing virtual timing equipment for school processing protocol, such as may bag
Containing the step that " time that ' next time sends correcting time in network message ' is set in information exchange area " is such.Virtual timing equipment can be with
Use interrupt mode, it would however also be possible to employ polling mode, message of being united when externally sending.When being sent using interrupt mode during system message,
When system card working software include setup code is installed, " serial ports is sent completely " interrupt handling routine, and allow serial ports complete
Backward CPU reports are sent into data to interrupt.Comprise the following steps for the processing that " serial ports is sent completely " interrupts:
Step one:If it is sky to send buffering area, processing terminates, otherwise continued executing with;
Step 2:Initial character is taken away from buffering area is sent;
Step 3:The character for notifying serial ports forwarding step two to take away;
When using polling mode externally send when system message when, when system message transmission need not be by " during serial ports be sent completely
It is disconnected ", but completely by when system card working software in request processing module realize in the lump.
Request processing module, which can be known using polling mode or interrupt mode and handle task on computer, have issued time acquisition
Request and when system message send request.
For polling mode, the circulation that request processing module comprises the following steps:
SVC1:If information exchange area indicates " message of being united when need to send ", step SVC2 is performed, SVC5 is otherwise performed;
SVC2:Generation is united message when to be sent;
SVC3:Notify serial ports forwarding step SVC2 generation when unite message;
SVC4:" message of being united when need to send " for removing information exchange area is indicated;
SVC5:If information exchange area indicates " current pending processing time inquiring request ", SVC6 is performed, SVC1 is otherwise gone to;
SVC6:Current Jiao Shi version numbers are cached to local variable cached;
SVC7:According to information, the current time of processor during nearest school, calculating should return to the current time of requestor;
SVC8:If current Jiao Shi version numbers are not equal to cached, step SVC6 is gone to;
SVC9:The step SVC7 current times obtained are put into the storage region arranged with common computer operations system;
SVC10:Information exchange area is made no longer to indicate " current pending processing time inquiring request ";
SVC11:Go to step SVC1;
For interrupt mode, request processing module can interrupt to obtain the time that task on computer is sent by an interprocessor
Obtain request, now, should prevent request processing module hinder for outside reach when system message reception (such as in processing procedure
Middle closing interrupt response), virtual timing equipment setup code should be this interprocessor and interrupt the interruption that registration comprises the following steps
Handling process:
Step one:According to information when processor current time and nearest school, current actual time is calculated;
Step 2:The actual time write-in information exchange area that step one is obtained, and externally instruction time acquisition request processing terminates.
In the realization having, system message and internal time are obtained when can respectively be realized to external network using two logic processors
The processing of request, now, virtual timing equipment can be known using polling mode from serial ports has new when system message to reach.
2. the exemplary embodiment two of virtual timing equipment of the present invention
Another exemplary embodiment of virtual timing equipment of the present invention is:United special common network interface card when having for one
On the general x86 computers of multiple logic processors, patrolled using one on the partial memory on all-purpose computer, computer
Volume processor and this special network adapter as virtual timing equipment so that application on this computer can by this it is virtual when
The network interface card for equipment of uniting sets time operation with other computers.This virtual timing equipment corresponds to two software kits, and a software kit is
The driver run in common computer operations, user can by this driver, realize to the installation of virtual timing equipment,
Unloading and control etc.;Another software kit is that virtual timing equipment realizes bag, and the software kit includes processor and starts code, void
Intend timing equipment setup code and when unite card working software.The virtual timing equipment will distribute to its a part of physical memory
As information exchange area, the operating system on all-purpose computer can be realized and virtual timing equipment by accessing this information exchange area
Communication.Virtual timing equipment utilizes this information exchange area to common computer operations system output time information;When unite card work
Software is united message when knowing that network interface card have received new using interrupt mode, is passed through and is interrupted (virtual timing equipment is saved if wishing)
Or poll (asks) mode to be known on all-purpose computer if virtual timing equipment is designed to receive by aforementioned information exchange area
Other tasks have issued time inquiring request.
Relevant technical staff in the field under the enlightenment of above exemplary embodiment one, can voluntarily obtain the reality of exemplary embodiment two
Existing details.The main distinction of exemplary embodiment two and exemplary embodiment one is:
● the initialization operation of communication card is more complicated
In general, network interface card is more complicated than serial ports a lot, potentially include the setting of DMA request buffering area, MAC Address setting,
IOMMU setting, setting of MSI interrupt etc., relevant technical staff in the field be free to determine to be entered by which software
The initialization of row network interface card.
● the processing protocol of communication message is more complicated
When run Network Time Protocol when, when system message using UDP messages encapsulation, now needed inside virtual timing equipment operation code
Contain the processing logic of associated the Internet protocol.Relevant technical staff in the field can use unikernel/libOS or real-time operation
System etc. realizes the reception for network message and the processing of basic network agreement, is grasped in real time by operating in unikernel/libOS/
Make the NTP softwares in system to realize message and the time acquisition request of task on all-purpose computer during for network pair
Processing.
● without will when unite message fragment, you can sent
Can only be compared with byte-by-byte send with serial ports, network interface card system message can be sent when disposably will be whole, so that system is reported when simplifying
The transmission logic of text.
Claims (2)
1. handling the method for external event when a kind of utilization all-purpose computer resource is real-time, including processor dynamic is supported on all-purpose computer
The operating system of offline function, the driver operated in the operating system, virtual unit realize bag and for knowing or
The hardware module of generation event, it is characterised in that:
(1) virtual unit, which is realized, includes initialization module, outside interactive module and internal interactive module, wherein described initial
Change module is responsible for outside interactive module and running environment is set up in the normal operation of internal interactive module, and outside interactive module is responsible for logical
The outside for crossing the hardware module and the general-purpose computing system is interacted, and internal interactive module is responsible for and the general-purpose computations
Machine operating system and software thereon are communicated, and outside interactive module, the normal operation of internal interactive module are independently from institute
State common computer operations system;
(2) driver performs the flow comprised the following steps, and the place for external event is installed on the all-purpose computer
Manage logic:
Step one:The function of being provided using the operating system, by needed for real-time event processing including described hardware module, processing
Hardware resource including device, the physical memory page, is isolated from current operation system;
Step 2:The function of being provided using the operating system, obtains the management information for the hardware resource for being isolated out in step one;
Step 3:The information that bag and step 2 are obtained is realized according to virtual unit, the hardware resource isolated to step one carries out necessary
Initialization;
Step 4:Processor used in isolated to step one, real-time event processing sends initialization command, so as to cause to connect
The processor for receiving initialization command starts to perform the included logic function of virtual unit realization bag;
(3) processor can comprise the following steps when performing the logic function that the virtual unit realization is included:
Running environment required for step one initialization real-time event processing;
Step 2 performs the internal interactive module and outside interactive module parallel, as described in (1), in normal operation, this
The operation of two modules is independently of the common computer operations system.
2. the virtual timing equipment that a kind of utilization all-purpose computer resource is realized, including when system event acquisition board, the general-purpose computations
The software of one or more logic processors, the driver of virtual timing equipment and virtual timing equipment on machine realizes bag,
It is characterized in that:
(1) it is offline that the logic processor on current computer is entered Mobile state by the operating system support installed on the all-purpose computer;
(2) software realizes that including processor starts code, virtual timing equipment setup code and the work of virtual timing equipment
Code, wherein:1. processor starts code and is used to initialize the processor for being in down status so that corresponding place
Manage the state that device enters " can normally perform virtual timing equipment setup code ";2. system is set when processor starts code and be virtual
Standby setup code is continuous in logic, so that processor carries out virtual timing equipment after processor startup code has been performed
Setup code;3. virtual timing equipment setup code is the environment that virtual timing equipment operation code creates a normal work,
Virtual timing equipment operation code is gone to afterwards;4. system event acquisition board is received when virtual timing equipment operation code is responsible for pair
When system message and on all-purpose computer software the acquisition time request handled;
(3) driver is run in the operating system of the all-purpose computer, and it is to receive the loading that user sends virtual
The flow comprised the following steps is performed after the request of timing equipment:
Step 1: the request operating system logic processor to be used virtual timing equipment is offline;
Step 2: obtaining information during management required for system event acquisition board;
Step 3: distribution starts and run the physical memory needed for virtual timing equipment, it is empty that this physical memory is logically divided into work
Between and auxiliary space two parts, wherein working space storage content include:1. the software realizes each several part generation included
Code, 2. virtual timing equipment operation code data required in normal operation;The content of auxiliary space storage includes:Management
Information, virtual timing equipment when described required for system event acquisition board are used to supply common computer operations system when normally running
The temporal information of reading;
Step 4: realizing the working space in the code in bag, physical memory described in initialization step three according to the software;
Step 5: the auxiliary space in the information obtained according to step 2, physical memory described in initialization step three;
Step 6: notifying the processor in the offline logic processor of step one performs working space described in step 3 to start code;
(4) the virtual timing equipment setup code comprises the following steps:
Step 1: obtaining information when managing described needed for system event acquisition board from the auxiliary space;
Step 2: the information according to this process step one, to it is described when system event acquisition board and processor carry out Initialize installation;
Step 3: the porch for operation code of being united when jumping to described virtual is continued executing with;
(5) information variable when the virtual timing equipment operation code includes Jiao Shi version numbers variable, nearest school, when unite event acquisition
Board interrupt handling routine and request processing cycle, wherein, Jiao Shi version numbers are used to indicate that how many times school currently has been carried out
When, during nearest school information be used to recording be most recently received when system message situation (including included in message of being united when nearest temporal information,
Receive the time for message of now uniting);
(6) event acquisition board interrupt handling routine of being united when includes following flow:
Step 1: from it is described when system event acquisition board receive when unite event;
Step 2: obtaining the current time of processor;
Step 3: processing receive when unite message, and information when updating nearest school
Step 4:Version number's variable increases 1 during high-ranking officers;
Step 5: interrupt processing is returned;
(7) request processing cycle includes following flow:
Step one:Current Jiao Shi version numbers are cached to local temporary variable cached;
Step 2:According to information during newest school and the current time of processor, calculating should return to the current time of requestor;
Step 3:If current Jiao Shi version numbers are not equal to cached, step one is gone to, is otherwise continued executing with;
Step 4:The storage region that the current time that step 2 is obtained is put into auxiliary space, arranged with the general-purpose operating system.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610064154.6A CN107015843A (en) | 2016-01-28 | 2016-01-28 | All-purpose computer handles the method and a kind of virtual timing equipment of external event in real time |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610064154.6A CN107015843A (en) | 2016-01-28 | 2016-01-28 | All-purpose computer handles the method and a kind of virtual timing equipment of external event in real time |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107015843A true CN107015843A (en) | 2017-08-04 |
Family
ID=59439384
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610064154.6A Pending CN107015843A (en) | 2016-01-28 | 2016-01-28 | All-purpose computer handles the method and a kind of virtual timing equipment of external event in real time |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107015843A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108737007A (en) * | 2018-08-24 | 2018-11-02 | 新华三技术有限公司 | A kind of method for synchronizing time, device and equipment |
CN112904932A (en) * | 2021-05-08 | 2021-06-04 | 鹏城实验室 | Clock synchronization method, board card, computer storage medium and terminal equipment |
CN113190331A (en) * | 2021-07-01 | 2021-07-30 | 飞腾信息技术有限公司 | Interrupt delay optimization method for time system card on virtual machine |
-
2016
- 2016-01-28 CN CN201610064154.6A patent/CN107015843A/en active Pending
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108737007A (en) * | 2018-08-24 | 2018-11-02 | 新华三技术有限公司 | A kind of method for synchronizing time, device and equipment |
CN112904932A (en) * | 2021-05-08 | 2021-06-04 | 鹏城实验室 | Clock synchronization method, board card, computer storage medium and terminal equipment |
CN113190331A (en) * | 2021-07-01 | 2021-07-30 | 飞腾信息技术有限公司 | Interrupt delay optimization method for time system card on virtual machine |
CN113190331B (en) * | 2021-07-01 | 2021-09-21 | 飞腾信息技术有限公司 | Interrupt delay optimization method for time system card on virtual machine |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11799952B2 (en) | Computing resource discovery and allocation | |
CN102341783B (en) | Guest Interrupt Controllers for Each Processor to Aid Interrupt Virtualization | |
CN100570565C (en) | Operating system service method and system based on strategy are provided in supervisory routine | |
CN101344860B (en) | Virtual machine environment for interfacing a real time operating system environment with a native host operating system | |
CN103064796B (en) | virtual machine memory sharing method and computer system | |
CN101751284A (en) | I/O resource scheduling method for distributed virtual machine monitor | |
US20210117244A1 (en) | Resource manager access control | |
CN104321749A (en) | Architecture and method for managing interrupts in a virtualized environment | |
CN103034524A (en) | Paravirtualized virtual GPU | |
CN107491354B (en) | Shared memory-based communication method and device between virtual machines | |
GB2418753A (en) | Emulating shared memory in a distributed-memory computing system using memory windows | |
CN105830026A (en) | Apparatus and method for scheduling graphics processing unit workloads from virtual machines | |
CN101452406A (en) | Cluster load balance method transparent for operating system | |
CN101206623A (en) | System and method for migration of a virtual endpoint from one virtual plane to another | |
CN104468803A (en) | Virtual data center resource mapping method and equipment | |
RU2012127580A (en) | A MULTI-STAGE PLANNING APPROACH AT THE LEVEL OF SOURCE CODES FOR THE DEVELOPMENT AND TESTING OF SOFTWARE FOR MULTIProcessor environments | |
CN105359100A (en) | Utilizing client resources during mobility operations | |
CN107436798A (en) | A kind of process access method and device based on NUMA node | |
CN105264506A (en) | Assigning processors to memory mapped configuration | |
CN103744716A (en) | Dynamic interrupt balanced mapping method based on current virtual central processing unit (VCPU) scheduling state | |
CN104050043A (en) | Share cache perception-based virtual machine scheduling method and device | |
CN101876954B (en) | Virtual machine control system and working method thereof | |
US20210326221A1 (en) | Network interface device management of service execution failover | |
CN107015843A (en) | All-purpose computer handles the method and a kind of virtual timing equipment of external event in real time | |
CN103793255A (en) | Configurable multi-main-mode multi-OS-inner-core real-time operating system structure and starting method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20170804 |