CN109933435A - Control method, device and computer equipment - Google Patents

Control method, device and computer equipment Download PDF

Info

Publication number
CN109933435A
CN109933435A CN201910228643.4A CN201910228643A CN109933435A CN 109933435 A CN109933435 A CN 109933435A CN 201910228643 A CN201910228643 A CN 201910228643A CN 109933435 A CN109933435 A CN 109933435A
Authority
CN
China
Prior art keywords
external equipment
equipment
application
virtual unit
container
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
Application number
CN201910228643.4A
Other languages
Chinese (zh)
Other versions
CN109933435B (en
Inventor
高云伟
杨立中
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CN201910228643.4A priority Critical patent/CN109933435B/en
Publication of CN109933435A publication Critical patent/CN109933435A/en
Application granted granted Critical
Publication of CN109933435B publication Critical patent/CN109933435B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

This application provides a kind of control methods, device and computer equipment, at least one container is deployed in the operating system of the computer equipment, in the case where running any application in container, if the application currently needs to use certain external equipment, the device file of corresponding virtual unit will be operated, during this period, device drives can determine the virtual unit mapped external equipment, and the state saving/restoring logic based on the external equipment, realize the switching to the equipment operation context of the external equipment, so that the application is able to access that the external equipment, current application is met to the use demand of external equipment, and it will not influence use of the other application to the external equipment, it realizes and external equipment is shared, or the exclusive use to the external equipment.

Description

Control method, device and computer equipment
Technical field
Present application relates generally to fields of communication technology, more particularly to a kind of control method, device and computer Equipment.
Background technique
In recent years, container technique has become a kind of virtualization technology being widely recognized as by everybody, can be used to realize service Device resource-sharing.Relative to virtual machine, container is directly deployed on host operating system, when certain application run-time in container Between, using the external equipment that can be connect with the Application share host in other containers, can also monopolize some or it is multiple External equipment.
However, in practical applications, some external equipments are can not be by the Application share in multiple containers;Some equipment Although holding equipment virtualizes, realizes the shared of multiple logical device, can not be shared under containerization scene, even if some set It is standby also to be shared under containerization scene, equipment component resource often can only be also used, is unable to satisfy certain applications to whole The exclusive requirement of device resource.As it can be seen that these equipment how to be allowed efficiently to be shared under containerization scene as urgent need to resolve Problem.
Summary of the invention
In view of this, being realized outer under containerization scene this application provides a control method, device and computer equipment The efficient of portion's equipment is shared.
In order to achieve the above-mentioned object of the invention, this application provides following technical schemes:
This application provides a kind of control methods, which comprises
Between application run-time in a reservoir, obtain it is described using virtual unit device file, and determine institute State virtual unit mapped external equipment;
Based on the state saving/restoring logic in the external equipment, realizes and the equipment of the external equipment is run up and down The switching of text, so that the application is able to access that or discharges the external equipment.
Optionally, the state saving/restoring logic based in the external equipment is realized to the external equipment The switching of equipment operation context, comprising:
In the case where the application is needed using the external equipment, the equipment of the external equipment is run into context The external equipment is written, and sends state to the external equipment and restores order, so as to be set described in the external-device response Received shipment row context realizes the data interaction with the application;
If the external equipment is not within a preset period of time by the application access, Xiang Suoshu external equipment sends state and protects Order is deposited, so that the external equipment saves current device and runs context;
The current device operation context for synchronizing the external equipment, discharges the external equipment and the virtual unit Mapping relations, and the current state of the external equipment is adjusted to idle state.
Optionally, the determination virtual unit mapped external equipment, comprising:
Inquire whether the virtual unit is mapped with external equipment;
If so, based on the state saving/restoring logic in the external equipment described in executing, realization sets the outside The switch step of standby equipment operation context;
If not, obtaining the external equipment for being currently at idle state, and establish the virtual unit and the current place Mapping relations between the external equipment of idle state.
Optionally, in the case where container engine creates the container, the method also includes:
For the container, configures virtual unit identifier and create equipment operation context;
Creation runs the corresponding virtual unit of context and the void with the virtual unit identifier and the equipment Propose standby device file;
The attribute information of the device file is obtained, and the attribute information is fed back into the container engine, so that institute It states using obtaining the attribute information of the device file by the container engine, based on the attribute information of the device file, Obtain the device file;
Wherein, the attribute information of the device file includes path and/or the document number of the device file.
Optionally, the method also includes:
Receive the container for the container that the container engine is sent and destroy order, the container destroy order be What each application in the container generated in the case where being removed;
It responds the container and destroys order, discharge the corresponding virtual unit identifier of the container and equipment operation up and down Text;
Remove the virtual unit for container creation.
Optionally, the external equipment includes: that the interface for restoring order and state save command for reception state is deposited Device, and the device memory for storing equipment operation context, the equipment operation context includes the external equipment Configuration information and status information.
Present invention also provides a kind of control device, described device includes:
Obtain module, between application run-time in a reservoir, obtain it is described using virtual unit equipment File, and determine the virtual unit mapped external equipment;
Control module, for realizing to the external equipment based on the state saving/restoring logic in the external equipment Equipment operation context switching so that the application is able to access that or discharges the external equipment.
Optionally, the control module includes:
Writing unit, in the case where the application is needed using the external equipment, by the external equipment Equipment runs context and the external equipment is written;
State restores command sending unit, restores order for sending state to the external equipment, so that the outside Equipment responds the equipment and runs context, realizes the data interaction with the application;
State save command transmission unit, for the external equipment within a preset period of time not by the application access In the case of, Xiang Suoshu external equipment sends state save command, so that the external equipment saves current device and runs context;
Data synchronisation unit, the current device for synchronizing the external equipment run context;
Equipment releasing unit, for discharging the mapping relations of the external equipment Yu the virtual unit, and will be described outer The current state of portion's equipment is adjusted to idle state.
Optionally, the acquisition module includes:
Query unit, for inquiring whether the virtual unit is mapped with external equipment, the case where query result, which is, is Under, it triggers described in the control module execution based on the state saving/restoring logic in the external equipment, realizes to described outer The switch step of the equipment operation context of portion's equipment;
Mapping relations establish unit, for obtaining current place in the case where the query result of the query unit is no In the external equipment of idle state, and establish between the virtual unit and the external equipment for being currently at idle state Mapping relations.
Present invention also provides a kind of computer equipment, the computer equipment includes:
Communication interface, the communication interface configure stateful saving/restoring for connecting external equipment, the external equipment Logic;
Memory, for storing the program for realizing control method as described above;
Processor, for loading and executing the program of the memory storage, described program is used for:
Between application run-time in a reservoir, obtain it is described using virtual unit device file, and determine institute State virtual unit mapped external equipment;
Based on the state saving/restoring logic in the external equipment, realizes and the equipment of the external equipment is run up and down The switching of text, so that the application is able to access that or discharges the external equipment.
It can be seen that compared with prior art, this application provides a kind of control method, device and computer equipments, it should At least one container is deployed in the operating system of computer equipment, in the case where running any application in container, if should Using currently needing to use certain external equipment, it will operate the device file of corresponding virtual unit, during this period, device drives can To determine the virtual unit mapped external equipment, and the state saving/restoring logic based on the external equipment, realize to this The switching of the equipment operation context of external equipment meets current application so that the application is able to access that the external equipment It to the use demand of external equipment, and will not influence use of the other application to the external equipment, that is, realize to external equipment Shared, or the exclusive use to the external equipment.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of application for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 shows the flow diagram of an embodiment of the control method of the application proposition;
Fig. 2 shows the flow diagrams of another embodiment of the control method of the application proposition;
Fig. 3 shows the flow diagram of the another embodiment of the control method of the application proposition;
Fig. 4 shows the signaling process schematic diagram of an embodiment of the control method of the application proposition;
Fig. 5 shows the signaling process schematic diagram of another embodiment of the control method of the application proposition;
Fig. 6 shows the structural schematic diagram of an embodiment of the control device of the application proposition;
Fig. 7 shows the structural schematic diagram of another embodiment of the control device of the application proposition;
Fig. 8 shows the structural schematic diagram of another embodiment of the control device of the application proposition;
Fig. 9 shows the structural schematic diagram of the another embodiment of the control device of the application proposition;
Figure 10 shows the hardware structural diagram of an embodiment of the computer equipment of the application proposition.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall in the protection scope of this application.
Currently, the external equipment connected to realize multiple applications to computer equipment is shared, usually using virtual Change technology, to create multiple virtual units (i.e. logical device) of same external equipment, for it is multiple using.Specifically, can To use software virtualization method, i.e., by way of software model, to construct multiple virtual units of external equipment, but it is this Virtualization overhead is big, and strong with hypervisor (virtual machine monitor) coupling, is not available under containerization scene.
It is existing to additionally provide a kind of hardware virtualization method, i.e., using technologies such as SR-IOV, so that an external equipment pair Multiple virtual units are showed outside, but this virtual unit can only use the part resource of external equipment, such as GPU (Graphics Processing Unit, graphics processor) etc. leads to certain application nothings for needing exclusive external equipment resource Method uses, moreover, this implementation is extremely complex, many external equipments are simultaneously not suitable for.
In addition, also also proposed a kind of hot-plug method, i.e., by analog machine hot plug events, realize equipment more Time-division switching between a virtual machine, still, in this implementation method, all containers in computer equipment are shared in one Core can not carry out equipment hot swap for some container, be also therefore, under containerization scene not applicable.And using can perceive External equipment addition with leave, to application be it is opaque, can also be related to ACPI (Advanced Configuration And Power Management Interface, advanced configuration and power-management interface) relevant operation, cause expense big, prolongs Also big late.
In order to improve several prior arts listed above, the application proposes to increase state saving/restoring in external equipment Logic so that the driving of computer equipment can be based on the state saving/restoring logic, be responsible for device context switching, External equipment and virtual unit are safeguarded, and dynamic updates mapping relations between the two, so that device drives can pass through Virtual unit pellucidly provides service for containerization application, and it is external to guarantee that existing application can efficiently be shared without change Equipment.
In order to make the above objects, features, and advantages of the present application more apparent, with reference to the accompanying drawing and it is specific real Applying mode, the present application will be further described in detail.
It referring to Fig.1, is a kind of flow diagram of control method provided by the embodiments of the present application, this method can be applied to Computer equipment, the application to the product type of the computer equipment without limitation, as shown in Figure 1, this method may include but It is not limited to following steps:
Step S11, between application run-time in a reservoir, obtain this using virtual unit device file;
Wherein, device file can be the program file using virtual unit, and using that can pass through, execution equipment is literary Part, realizes use to virtual unit, the application to the content of the device file of virtual unit without limitation, in practical application In, virtual unit and its device file are usually to create during creating corresponding container, and detailed process is referred to hereafter corresponding The description of embodiment.
In the present embodiment, in the application operation of deployment in a reservoir, during needing to use external equipment, usually operation is set Standby file, be by virtual unit using the external equipment mapped with it, so, for any container in computer equipment In any application operational process in, need using external equipment, the virtual units of available container mappings where with it Device file, specific acquisition methods are without limitation.
Step S12 determines the virtual unit mapped external equipment;
After creating each virtual unit, device file usually can be all created for it, device drives pass through the equipment File realizes the use to virtual unit, and then realizes the use to the virtual unit mapped external equipment.So It is deployed between any application run-time in container, device drives can first determine the application device file to be operated, i.e., After determining virtual unit belonging to the device file, the true external equipment of virtual unit mapped is determined.
Wherein, the mapping relations between virtual unit and external equipment can be dynamically, not be fixed and invariable, tool Body can dynamically adjust the dynamic mapping relationship between virtual unit and external equipment according to the actual situation, and the application is to the mapping The dynamic adjusting method of relationship is without limitation.
In the application, external equipment can refer to the hardware device other than main frame, to data and information play transmission, The effect for transferring and storing, is the important component in computer system, can be divided into input equipment, display equipment, printing The types such as equipment, External memory equipment and the network equipment, however, it is not limited to this.
Step S13 is realized and is run to the equipment of the external equipment based on the state saving/restoring logic in the external equipment The switching of context, so that the application is able to access that or discharges the external equipment.
In the present embodiment, equipment operation context may include the status number of the configuration of counterpart external device, some keys According to etc., it may indicate that the operating condition of the external equipment, in practical applications, the device context data correspondence of peripheral hardware is used to Say to be often opaque, so that using the switching control that can not be directly realized by equipment operation context, i.e., it cannot be direct State preservation/recovery order is sent to peripheral hardware, cannot also realize the flexible use to external equipment, flexible choice is exclusive outer The resource of portion's equipment, or the resource of external equipment is shared with other application, and also reduce computer to a certain extent and set Standby working performance.
In order to improve the above problem, the application proposes the logic for increasing its state saving/restoring in direct external equipment, such as Configuration status preservation/recovery order interface register, and the device memory for storing equipment operation context data, with External equipment is directly controlled so that device drives can be realized, realizes the interaction between external equipment and application.
Thus, the device drives in computer equipment can be realized based on the state saving/restoring logic of external equipment Switching to the equipment operation context of the external equipment, so that using that can be provided according to the current operation phase to external equipment The requirement in source accesses external equipment, such as exclusive external equipment resource or the resource that the external equipment is shared with other application, Or the external equipment is discharged, so that other application can monopolize the resource of the external equipment, that is, realize containerization scene Under, same external equipment is shared in multiple applications or a certain application is in the specific run stage makes the exclusive of external equipment With
In conjunction with the description of the part above step S11, below by the wound to the contents such as virtual unit and equipment operation context It builds and is illustrated, in the application, these contents are usually to realize in the creation container stage, are specifically referred to shown in Fig. 2 The flow diagram of another control method, this method are upper inferior to virtual unit, equipment operation mainly to container establishing stage The creation process of content is illustrated, the description as described in its use is referred to foregoing embodiments, as shown in Fig. 2, this method can To include but is not limited to following steps:
Step S21 for the container, configures virtual unit identifier, and create in the case where container engine creates container Build received shipment row context;
In practical applications, container engine docker can be used or container composer realizes container creation, thus, step The container engine of rapid S21 can refer to that container engine docker or container composer, the present embodiment do not do the creation process of container It is described in detail.
In addition, one group of container can be known as pod by the present embodiment, and the operating system of the computer equipment of the present embodiment is past It is past to dispose multiple containers, so, in the case where container engine creates container, the control method that the present embodiment proposes is executed, It is also assumed that being to execute the control method that the present embodiment proposes in the case where creating pod.
In the present embodiment, when creating container/pod, container engine can notify device drives to create corresponding virtual unit, It specifically can be with the virtual unit identifier that device drives can be globally unique for the container allocation, at the same time it can also create portion Equipment runs context, the equipment of creation can be run to context at this time as equipment default data, for the virtual unit The external equipment of mapping uses.
Step S22, creation virtual unit corresponding with institute's virtual unit identifier and equipment operation context, and should The device file of virtual unit;
Wherein, for any container in computer equipment, the virtual unit of creation is identified with unique virtual unit Symbol, so as to the virtual unit for other containers creation specifically divided into computer equipment.After creating virtual unit, it will be It creates device file, will pass through operation device file, realizes the use to the virtual unit, the application to virtual unit and The specific creation process of its device file is not detailed.
Step S23 obtains the attribute information of the device file, and the attribute information is fed back to the container engine, so that Using the attribute information for obtaining the device file by container engine, the attribute information based on the device file obtains the equipment File.
Wherein, the attribute information of device file may include the information such as path and/or the document number of device file, this implementation In example, which is primarily used to how instruction application accurately obtains required device file, that is to say, that the attribute information It can guide using from the multiple equipment file that device drives create, accurate to obtain required device file, the application is to the category The particular content that property information includes is without limitation.
In the present embodiment practical application, device drives are directed to any container, complete virtual unit and its device file After creation, can by device file path and/or document number, by each application of the container engine feedback into the container, in this way, Application in this embodiment is needed using in the case where the virtual unit, that is, needing to grasp the device file of the virtual unit Make, so that it may by attribute informations such as the file path of the device file of record and/or document numbers, the device file is read, And then by operating the device file, virtual unit belonging to the device file is used.
Based on the description of the core idea above to the application control method, and combine above to virtual unit and its equipment The description of the creation process of file, present applicant proposes a kind of refinement schemes to the control method, referring to shown in Fig. 3 another The flow diagram of kind control method, this method may include but be not limited to following steps:
Step S31, between application run-time in a reservoir, obtain this using virtual unit device file;
Step S32, inquires whether the virtual unit is mapped with external equipment, if not, entering step S33;If so, holding Row step S35;
In the present embodiment, in the application of virtual unit operation, it is able to access that the external equipment of virtual unit mapping, In practical application, virtual unit is created for some container, but multiple containers can share same external equipment, institute With virtual unit usually corresponds to unique container, but can map multiple external equipments, so that operating in the virtual unit Using the multiple external equipments of the person of being able to use.
In order to improve the reliability using external equipment, the application in deployment Mr. Yu's container needs to set using outside In the case where standby, if device drives obtain the equipment access request of the application, the corresponding virtual unit of the container can be first checked Currently whether it is mapped with true external equipment.
Step S33 obtains the external equipment for being currently at idle state;
External equipment it is not mapped with currently in the virtual unit of application operation (i.e. application needs external equipment to be used) In the case of, it can detecte the state of each external equipment in computer system, determining needs external equipment type to be used with application It is identical, and it is currently at the external equipment of idle state.
Wherein, the idle state of external equipment can refer to it not by any using in this case, this is in sky The external equipment of not busy state can not establish mapping relations with any virtual unit, even if having with the external equipment foundation reflect The resource etc. of the external equipment is currently not used in the application penetrating the virtual unit of relationship, but operating in the virtual unit.
Certainly, the idle state of external equipment can also refer to the external equipment by least one using but its resource Still there is allowance, i.e., can also receive the access request of new application.In this case, which, which is usually mapped with, virtually sets Application that is standby, but being currently operating in these virtual units of mapping, and all resources of the vacant external equipment, residue money Source can also support other application to run.
It can be seen that the application can be accounted for by the mapping relations of detection external equipment and/or the resource of the external equipment With situation etc., to determine whether the external equipment is in idle condition, but it is not limited to the detection method of the present embodiment description.
Step S34 establishes the mapping relations between the virtual unit and the external equipment being currently in idle condition;
The application to the construction methods of the mapping relations between virtual unit and external equipment without limitation, usual situation Under, after the mapping relations for determining virtual unit and external equipment, which can be stored to corresponding virtual unit and In external equipment, so that the application in virtual unit can be able to carry out data interaction, but not office between the external equipment It is limited to this.
The external equipment that the virtual unit currently maps is written in equipment operation context by step S35;
In conjunction with above description, external equipment is configured with the device memory for storing equipment operation context, sets in outside For when being first used, the equipment that device drives can be created runs context, be written in the device memory of the external equipment, To complete the initial configuration to the external equipment, so that the external equipment can work normally.
Step S36 sends state to the external equipment and restores order, so that external-device response equipment operation is up and down Text realizes the data interaction with application.
In the present embodiment, the interface that external equipment restores order and state save command by being configured to reception state is posted Storage, so that state saving/restoring command interface is externally transparent, so, the device drives of computer equipment can be by calling shape State saving/restoring command interface sends state to the interface register and restores order, so that the external equipment is read in equipment Equipment in depositing runs context, and responds equipment operation context, initial configuration is completed, so that using can be normal Operate the external equipment, meet application demand, as the external equipment can receive and response application send operational order, and Feedback operation data are applied to this, that is, realize the data interaction between the external equipment and application.
Wherein, the data exchange process about application and external equipment, the application are not detailed, can specifically answer according to this It is determined with the factors such as type and its demand of current operation phase, so, for different types of application, in different operation ranks Section, may be different from the data exchange process of external equipment, and the application does not do and is described in detail one by one.
Optionally, in practical applications, for realizing application and certain external equipment according to foregoing embodiments describing mode After data interaction, after a period of time, the application may not need temporarily using the external equipment, in order to avoid setting outside this The waste of standby resource, can discharge the external equipment, so that other application is able to use the external equipment.Specifically discharged Journey is referred to the signaling process figure of the another embodiment of control method shown in Fig. 4, when this method is mainly long to certain external equipment Between be illustrated by the control flow in the case where application access, as shown in figure 4, this method may include but be not limited to Lower step:
Step S41, device drives determine that external equipment not by application access, is sent out within a preset period of time to the external equipment Send state save command;
Wherein, preset time period can be a longer continuous time period, the application to its specific value without limitation.
In practical applications, certain external equipment the case where being not used by for a long time can there are many kinds of, as set outside this Standby not map any virtual unit, no application is able to use the external equipment;Alternatively, the external equipment is mapped with virtual unit, But the application for operating in the virtual unit does not need to use outside other of virtual unit mapping using the external equipment Equipment leads to external equipment situations such as being not used by for a long time, and the application is to external equipment in the tool being not used by for a long time Body situation is without limitation.
In order to avoid the waste to external device resource, in the case where determining that certain external equipment is not used by for a long time, The external equipment can be discharged, before this, driving equipment is needed to record the current equipment operation context of the external equipment, with When just using the external equipment next time, the external equipment can be controlled and be directly returned to current state.
Based on this, the present embodiment can be by calling the state saving interface of the external equipment, to connecing for the external equipment Mouth register sends state save command, but the sending method of the state save command is not limited to a kind of this implementation.
Step S42, external-device response state save command save current device and run context;
Step S43, external equipment save prompt information to device drives feedback states;
External equipment receives device drives will be after gas saves the order of state, can be by the configuration of current device and interior Some key state data in portion, the i.e. current device of the external equipment run context, the equipment for being synchronized to the external equipment Memory saves, and the application runs context data content without limitation to the current device of external equipment, can be based on outside this The type and its working condition of equipment determine, and are key state for which status information of the external equipment that needs save Information, can also the factors setting such as type based on the external equipment and its working principle different external equipments are needed The key state data content of preservation is often different, the application to it without limitation.
In practical applications, after the determining operation context write device memory by its current device of external equipment, Ke Yigao Know device drives, if what the present embodiment proposed saves prompt information to device drives feedback states, being used to annunciator driving should External equipment is to current device operation context backup storage.The application saves the content of prompt information and its defeated to the state Form etc. is without limitation out.
Step S44, the current device that the synchronous storage external equipment of device drives saves run context;
After device drives learn that current device is run context write device memory by external equipment, can directly it be set from this Standby memory reads the current operation context of the equipment, and is synchronized to driver, in this way, device drives determine the external equipment Again by use, the above-mentioned current device saved at this time can be run context is written the external equipment, so that this is outer Portion's equipment can be directly returned to state when last terminate using the external equipment.
Step S45, device drives discharge the mapping relations of the external equipment and virtual unit, and working as the external equipment Preceding state is adjusted to idle state.
After analysis above, device drives determine that the external equipment is not used by for a long time, it is believed that respectively apply current rank Section is not needed using the external equipment, can directly discharge the mapping relations between the external equipment and virtual unit, and should The current state of external equipment is adjusted to idle state, that is to say, that can mark the external equipment being not used by for a long time For free device.
In this way, needing between application run-time from now on using the external equipment, and the virtual unit of its operation does not map together The external equipment of type can directly map the virtual unit and the free device in the way of foregoing embodiments description, And then it is able to use the free device using the application, specific operation process is referred to retouching for foregoing embodiments corresponding portion It states.
Optionally, in the case where determining that external equipment is not used by for a long time, device drives can also not have to release should The mapping relations of external equipment and virtual unit, but directly adjusting its current state is idle state, so that subsequent applications It is able to use the free device, the resource of such as exclusive external equipment being in idle condition, or it is shared in sky with other application The resource of external equipment etc. of not busy state.The application does not limit the method for releasing for the external equipment being not used by for a long time It is fixed.
To sum up, the external equipment of the application provides externally transparent state saving/restoring command interface, so that equipment Driving directly can send state save command to the external equipment or state restores order, it is outer to control this according to current demand Portion's equipment carries out state preservation or recovery, avoids causing to waste to external device resource occupancy for a long time, or meet and application Data interaction demand.
And the external equipment additionally provides the equipment operation context externally transparent, device memory saves, so that setting Standby driving directly can be written and read equipment operation context, i.e., equipment is driven according to the actual demand of operation application Kinetic energy, which enough chooses the right moment, cooperates hardware device to carry out context switching, and saves the operation context of equipment when switching, relative to Opaque preservation of the prior art to the equipment operation context recorded in real time, not only reduces the equipment state number for needing to save According to, and rate-determining steps are simplified, improve control reliability.
Wherein, the mapping relations between virtual unit and external equipment are dynamic, can not need to set using outside When standby, the external equipment is discharged in time, reduces the waste to external device resource, and do not need change application, it will be able to make It obtains multiple applications and efficiently shares external equipment.
As another alternative embodiment of the application, reference Fig. 5 is the another embodiment of control method provided by the present application Signaling process schematic diagram, this method may include but be not limited to following steps:
Step S51, container engine determine that each application in the first container is removed, generate the appearance for being directed to the first container Device destroys order;
In the present embodiment practical application, the operating system of computer equipment can dispose at least one container, each At least one application can be disposed in container.In this way, in the case where determining that all applications in any container are all removed, In order to save space, it may be considered that the container is destroyed, so the container destruction order for the container can be generated at this time.
Wherein, the first container in step S51 can be any container for the operating system for being deployed in computer equipment, this Apply for the method whether all removed to each application how detected in the first container without limitation, such as detecting each application process is It is no the methods of all to terminate.
The container is destroyed order and is sent to device drives by step S52, container engine;
Step S53, device drives respond the container and destroy order, the corresponding virtual unit identifier of release the first container and Equipment runs context;
Step S54, device drives remove the virtual unit for the first container creation.
In the present embodiment, after the determination of container engine can destroy certain container, life can will be destroyed for the container of the container Order is sent to device drives, responds the container by the device drives and destroys order, specifically can be before destroying container, Ke Yixian The corresponding virtual unit identifier of the container and equipment operation context are discharged, then removes virtually setting for container creation Standby, the present embodiment does not limit for specific sweep-out method.
It can be seen that the present embodiment can destroy the container, avoid in the case that each application in a reservoir does not use The container is other application or equipment work vacating space to the occupancy of computer device resources.
It is a kind of structural schematic diagram of embodiment of control device provided by the present application referring to Fig. 6, which can apply In computer equipment, can specifically include:
Obtain module 11, between application run-time in a reservoir, obtain it is described using virtual unit set Standby file, and determine the virtual unit mapped external equipment;
Wherein, external equipment may include: the interface register for restoring order and state save command for reception state, And the device memory for storing equipment operation context, and equipment operation context may include the external equipment Configuration information and status information.
Control module 12, for based on the state saving/restoring logic in the external equipment, realization to set the outside The switching of standby equipment operation context, so that the application is able to access that or discharges the external equipment.
Optionally, as shown in fig. 7, the control module 12 may include:
Writing unit 121, in the case where the application is needed using the external equipment, by the external equipment Equipment operation context the external equipment is written;
State restores command sending unit 122, restores order for sending state to the external equipment, so that described outer Portion's equipment responds the equipment and runs context, realizes the data interaction with the application;
State save command transmission unit 123 is not visited by the application within a preset period of time for the external equipment In the case where asking, Xiang Suoshu external equipment sends state save command, so that the external equipment saves in current device operation Hereafter;
Data synchronisation unit 124, the current device for synchronizing the external equipment run context;
Equipment releasing unit 125, for discharging the mapping relations of the external equipment Yu the virtual unit, and will be described The current state of external equipment is adjusted to idle state.
As another alternative embodiment of the application, as shown in fig. 7, above-mentioned acquisition module 11 may include:
Query unit 111, for inquiring whether the virtual unit is mapped with external equipment, in the feelings that query result is yes Under condition, trigger control module 12 executes described based on the state saving/restoring logic in the external equipment, realizes to described outer The switch step of the equipment operation context of portion's equipment;
Mapping relations establish unit 112, for obtaining current in the case where the query result of the query unit is no The external equipment being in idle condition, and establish between the virtual unit and the external equipment for being currently at idle state Mapping relations.
Optionally, referring to Fig. 8, in the case where container engine creates the container, which can also include:
First creation module 13, for being directed to the container, configuring virtual unit identifier and creating equipment operation up and down Text;
Second creation module 14, it is corresponding with the virtual unit identifier and equipment operation context for creating The device file of virtual unit and the virtual unit;
Data obtaining module 15 is fed back to for obtaining the attribute information of the device file, and by the attribute information The container engine, so that the application obtains the attribute information of the device file by the container engine, based on described The attribute information of device file obtains the device file;
Wherein, the attribute information of the device file includes path and/or the document number of the device file.
As the another embodiment of the application, as shown in figure 9, the device can also include:
Order receiver module 16 destroys order for receiving the container for the container that the container engine is sent, The container, which destroys order, to be generated in the case that each application in the above-described container is removed;
Release module 17 destroys order for responding the container, discharges the corresponding virtual unit identifier of the container And equipment runs context;
Module 18 is removed, for removing the virtual unit for being directed to container creation.
It is to be appreciated that above-mentioned module and unit can be the program module for realizing corresponding function, and each program module is realized The specific implementation process of corresponding function, is referred to the description of above method embodiment corresponding portion, this embodiment is not repeated.
Referring to Fig.1 0, it is a kind of hardware structure diagram of computer equipment provided by the embodiments of the present application, the computer equipment It can be terminal or server etc., without limitation to its product type, in the present embodiment, which can by the application To include: communication interface 21, external equipment 22, memory 23 and processor 24, in which:
Communication interface 21 may include the interface of wireless communication module and/or wire communication module, such as WIFI module, GPRS The interface of module, gsm module etc. communication module can also be that USB interface, parallel/serial mouth etc. realize number inside computer equipment According to interactive interface.
External equipment 22 can be the hardware device in computer equipment other than host, and the application is to external equipment Quantity and its type without limitation, can based on the factors such as the product type of computer equipment and its function determine, as accelerator, GPU etc..
Memory 23 is for storing the program for realizing above-mentioned control method;
In this application, memory 23 can also be used to store generated each between device file and application run-time Kind data etc..
Optionally, which can store the program code for each functional module for realizing that above-mentioned virtual bench includes, tool Body can be high speed RAM memory or nonvolatile memory (non-volatile memory), and for example, at least one Magnetic disk storage etc..
Processor 24 can be central processor CPU or be specific integrated circuit ASIC (Application Specific Integrated Circuit), or be arranged to implement the integrated electricity of one or more of the embodiment of the present application Road, the application are not construed as limiting the composed structure of the processor 44.
In the embodiment of the present application, processor 24 is used to load and execute the program of memory storage, realizes above-mentioned control Each step of method, details are not described herein by the application.
It is to be appreciated that the structure composition for the computer equipment that the application proposes, it is not limited to several parts listed above, It can be determined according to the product type of computer equipment, the application is no longer described in detail one by one.
Finally, it should be noted that about in the various embodiments described above, such as first, second or the like relational terms are only Only it is used to an operation, unit or module and another is operated, unit or module distinguish, and not necessarily requires or secretly Show that there are any actual relationship or orders between these units, operation or module.Moreover, term " includes ", " packet Containing " or any other variant thereof is intended to cover non-exclusive inclusion, so that including the process, method of a series of elements Or system not only includes those elements, but also including other elements that are not explicitly listed, or it is this for further including Process, method or the intrinsic element of system.In the absence of more restrictions, being limited by sentence "including a ..." Element, it is not excluded that include the element process, method or system in there is also other identical elements.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with other The difference of embodiment, the same or similar parts in each embodiment may refer to each other.For device disclosed in embodiment, For computer equipment, since it is corresponding with method disclosed in embodiment, so being described relatively simple, related place is referring to side Method part explanation.
The foregoing description of the disclosed embodiments makes professional and technical personnel in the field can be realized or use the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the application.Therefore, the application It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one The widest scope of cause.

Claims (10)

1. a kind of control method, which comprises
Between application run-time in a reservoir, obtain it is described using virtual unit device file, and determine the void Propose standby mapped external equipment;
Based on the state saving/restoring logic in the external equipment, realize to the equipment operation context of the external equipment Switching, so that the application is able to access that or discharges the external equipment.
2. according to the method described in claim 1, the state saving/restoring logic based in the external equipment, realization pair The switching of the equipment operation context of the external equipment, comprising:
In the case where the application is needed using the external equipment, by the equipment operation context write-in of the external equipment The external equipment, and send state to the external equipment and restore order, so that equipment described in the external-device response is transported Row context realizes the data interaction with the application;
If the external equipment is not within a preset period of time by the application access, Xiang Suoshu external equipment sends state and saves life It enables, so that the external equipment saves current device and runs context;
The current device operation context for synchronizing the external equipment, discharges the mapping of the external equipment Yu the virtual unit Relationship, and the current state of the external equipment is adjusted to idle state.
3. according to the method described in claim 2, the determination virtual unit mapped external equipment, comprising:
Inquire whether the virtual unit is mapped with external equipment;
If so, being realized based on the state saving/restoring logic in the external equipment to the external equipment described in executing The switch step of equipment operation context;
If not, obtaining the external equipment for being currently at idle state, and establishes the virtual unit and be currently at sky with described Mapping relations between the external equipment of not busy state.
4. described in any item methods according to claim 1~3, in the case where container engine creates the container, the side Method further include:
For the container, configures virtual unit identifier and create equipment operation context;
Creation and the virtual unit identifier and the equipment run the corresponding virtual unit of context and described virtually set Standby device file;
The attribute information of the device file is obtained, and the attribute information is fed back into the container engine, so that described answer It is obtained with the attribute information for obtaining the device file by the container engine based on the attribute information of the device file The device file;
Wherein, the attribute information of the device file includes path and/or the document number of the device file.
5. according to the method described in claim 4, the method also includes:
It receives the container for the container that the container engine is sent and destroys order, it is described that the container, which destroys order, What each application in container generated in the case where being removed;
It responds the container and destroys order, discharge the corresponding virtual unit identifier of the container and equipment operation context;
Remove the virtual unit for container creation.
6. described in any item methods according to claim 1~3, the external equipment includes: to restore to order for reception state With the interface register of state save command, and the device memory for storing equipment operation context, the equipment operation Context includes the configuration information and status information of the external equipment.
7. a kind of control device, described device include:
Obtain module, between application run-time in a reservoir, obtain it is described using virtual unit device file, And determine the virtual unit mapped external equipment;
Control module, for based on the state saving/restoring logic in the external equipment, realization to set the external equipment The switching of received shipment row context, so that the application is able to access that or discharges the external equipment.
8. device according to claim 7, the control module include:
Writing unit, in the case where the application is needed using the external equipment, by the equipment of the external equipment It runs context and the external equipment is written;
State restores command sending unit, restores order for sending state to the external equipment, so that the external equipment The equipment operation context is responded, realizes the data interaction with the application;
State save command transmission unit, for the external equipment within a preset period of time not by the application access the case where Under, Xiang Suoshu external equipment sends state save command, so that the external equipment saves current device and runs context;
Data synchronisation unit, the current device for synchronizing the external equipment run context;
Equipment releasing unit is set for discharging the mapping relations of the external equipment Yu the virtual unit, and by the outside Standby current state is adjusted to idle state.
9. device according to claim 8, the acquisition module include:
Query unit, for inquiring whether the virtual unit is mapped with external equipment, in the case where query result, which is, is, touching It sends out control module described and executes described based on the state saving/restoring logic in the external equipment, realize to the external equipment Equipment operation context switch step;
Mapping relations establish unit, in the case where the query result of the query unit is no, acquisition to be currently at sky The external equipment of not busy state, and establish the mapping between the virtual unit and the external equipment for being currently at idle state Relationship.
10. a kind of computer equipment, the computer equipment include:
Communication interface, the communication interface configure stateful saving/restoring logic for connecting external equipment, the external equipment;
Memory, for storing the program for realizing the control method as described in claim 1~6 any one;
Processor, for loading and executing the program of the memory storage, described program is used for:
Between application run-time in a reservoir, obtain it is described using virtual unit device file, and determine the void Propose standby mapped external equipment;
Based on the state saving/restoring logic in the external equipment, realize to the equipment operation context of the external equipment Switching, so that the application is able to access that or discharges the external equipment.
CN201910228643.4A 2019-03-25 2019-03-25 Control method and device and computer equipment Active CN109933435B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910228643.4A CN109933435B (en) 2019-03-25 2019-03-25 Control method and device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910228643.4A CN109933435B (en) 2019-03-25 2019-03-25 Control method and device and computer equipment

Publications (2)

Publication Number Publication Date
CN109933435A true CN109933435A (en) 2019-06-25
CN109933435B CN109933435B (en) 2022-03-25

Family

ID=66988103

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910228643.4A Active CN109933435B (en) 2019-03-25 2019-03-25 Control method and device and computer equipment

Country Status (1)

Country Link
CN (1) CN109933435B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021114854A1 (en) * 2019-12-11 2021-06-17 腾讯科技(深圳)有限公司 Engine isolation method and related apparatus
CN113296872A (en) * 2020-04-13 2021-08-24 阿里巴巴集团控股有限公司 Container state query method, device, equipment, storage medium and system

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1936845A (en) * 2005-09-19 2007-03-28 联想(北京)有限公司 Method and apparatus for dynamic distribution of virtual machine system input-output apparatus
US7454756B2 (en) * 2004-03-05 2008-11-18 Intel Corporation Method, apparatus and system for seamlessly sharing devices amongst virtual machines
US20110289501A1 (en) * 2009-02-27 2011-11-24 Fujitsu Limited Information processing device, information processing method, and storage medium storing computer program
CN102576322A (en) * 2009-08-21 2012-07-11 赛门铁克公司 Proxy backup of virtual disk image files on NAS devices
CN105190558A (en) * 2013-10-15 2015-12-23 思科技术公司 Accelerated instantiation of cloud resource
CN105354090A (en) * 2015-10-16 2016-02-24 安一恒通(北京)科技有限公司 Management method and device of virtual equipment
CN107179955A (en) * 2017-05-08 2017-09-19 北京海杭通讯科技有限公司 Equipment blocking method and its terminal based on Android containers
CN109155743A (en) * 2016-06-01 2019-01-04 思科技术公司 Meet the system and method for SLA requirement using machine learning algorithm

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7454756B2 (en) * 2004-03-05 2008-11-18 Intel Corporation Method, apparatus and system for seamlessly sharing devices amongst virtual machines
CN1936845A (en) * 2005-09-19 2007-03-28 联想(北京)有限公司 Method and apparatus for dynamic distribution of virtual machine system input-output apparatus
US20110289501A1 (en) * 2009-02-27 2011-11-24 Fujitsu Limited Information processing device, information processing method, and storage medium storing computer program
CN102576322A (en) * 2009-08-21 2012-07-11 赛门铁克公司 Proxy backup of virtual disk image files on NAS devices
CN105190558A (en) * 2013-10-15 2015-12-23 思科技术公司 Accelerated instantiation of cloud resource
CN105354090A (en) * 2015-10-16 2016-02-24 安一恒通(北京)科技有限公司 Management method and device of virtual equipment
CN109155743A (en) * 2016-06-01 2019-01-04 思科技术公司 Meet the system and method for SLA requirement using machine learning algorithm
CN107179955A (en) * 2017-05-08 2017-09-19 北京海杭通讯科技有限公司 Equipment blocking method and its terminal based on Android containers

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
周念念: "对嵌入式系统中内存保护的研究及其设计", 《万方平台》 *
陈勇,杨战民,丁龙刚: "《龙芯嵌入式系统开发及应用实战》", 31 December 2016, 东南大学出版社 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021114854A1 (en) * 2019-12-11 2021-06-17 腾讯科技(深圳)有限公司 Engine isolation method and related apparatus
CN113296872A (en) * 2020-04-13 2021-08-24 阿里巴巴集团控股有限公司 Container state query method, device, equipment, storage medium and system
CN113296872B (en) * 2020-04-13 2022-05-06 阿里巴巴集团控股有限公司 Container state query method, device, equipment, storage medium and system

Also Published As

Publication number Publication date
CN109933435B (en) 2022-03-25

Similar Documents

Publication Publication Date Title
CN100426238C (en) VEX - virtual extension framework
CN112422453B (en) Message processing method, device, medium and equipment
CN108763099A (en) Startup method, apparatus, electronic equipment and the storage medium of system
CN109376011B (en) Method and device for managing resources in virtualization system
CN104965757A (en) Virtual machine live migration method, virtual machine migration management apparatus, and virtual machine live migration system
CN104424122B (en) A kind of electronic equipment and memory division methods
CN105874428B (en) Technology for the operating system transformation in multiple operating system environments
CN109992352B (en) Data transmission method and device, electronic equipment and readable storage medium
CN109766199A (en) Node communication method and device in a kind of robot operating system
CN103412822A (en) Operation method of non-volatile RAM, data operation method and relevant device
CN100568180C (en) A kind of dummy machine system and graphics card access method thereof
CN108064377A (en) A kind of management method and device of multisystem shared drive
CN108880898A (en) Active and standby containment system switching method and device
CN109933435A (en) Control method, device and computer equipment
CN107220102A (en) The dormancy of virtual machine and awakening method and system
CN108287647A (en) A kind of application operation method and device
CN109408222A (en) Intelligent terminal and its space management, the device with store function
CN111078587A (en) Memory allocation method and device, storage medium and electronic equipment
CN105262796A (en) Cloud platform storage resource management system and disposition framework thereof
CN115408108A (en) I/O unloading method, device, system and storage medium in cloud environment
CN114860380A (en) Data synchronization method and device, electronic equipment and computer readable storage medium
CN107861887A (en) A kind of control method of serial volatile memory
CN105511947B (en) Method and device for processing event information in multiple systems
CN108021375A (en) The management method and computer-readable recording medium of data in cloud computing system
CN111813574A (en) Picture compression method and device, storage medium and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant