Detailed Description
The technical solution provided by the present application is further described below by referring to the accompanying drawings and embodiments. It should be understood that the system structure and the service scenario provided in the embodiments of the present application are mainly for illustrating possible embodiments of the technical solutions of the present application, and should not be interpreted as the only limitations of the technical solutions of the present application. As can be known to those skilled in the art, with the evolution of the system structure and the appearance of new service scenarios, the technical solution provided in the present application is also applicable to similar technical problems.
It should be understood that the hardware resource dynamic allocation scheme provided in the embodiments of the present application includes a hardware resource dynamic allocation method, a system, a computing device, a computer-readable storage medium, and the like. Since the principles of solving the problems of these solutions are the same or similar, some of the repeated parts may not be described again in the following description of the embodiments, but it should be understood that these embodiments are referred to and combined with each other.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. In the case of inconsistency, the meaning described in the present specification or the meaning derived from the content described in the present specification shall control. In addition, the terminology used herein is for the purpose of describing particular embodiments of the present application only and is not intended to be limiting of the present application. To accurately describe the technical content in the present application and to accurately understand the present application, terms used in the present specification are given the following explanation or definition before describing the specific embodiments:
intewell: an operating system which can be operated on various types of terminal equipment in an industrial field and realizes the intelligent modification of the terminal equipment.
Intewell RTRE: the operating system is environment software which is operated by an Intewell system in real time, has the function of a real-time operating system kernel, has strong real-time performance, and can operate a real-time operating system (namely can be regarded as a real-time operating system kernel which is operated on a non-real-time operating system) based on an Intewell RTRE.
Intewell developer: the method is a user tool provided by an Intewell system, can statically allocate Intewell real-time and non-real-time system hardware resources by a user, and provides a development tool of RTOS (real-time operating system) driving and application of the Intewell.
Fig. 1 shows a framework of an Intewell Operating System, which allows a non-Real-Time Operating System (GPOS) and a Real-Time Operating System (RTOS) to run simultaneously on the same target machine. As shown in fig. 1, the component includes a bottom hardware layer, which provides hardware resources, such as a Core unit (Core, which may be a processor), a Display card unit (Display), an Audio card unit (Audio), a network card unit, a bus unit (e.g., USB or CAN), and the like, where hardware corresponding to the unit may be a chip or a board card. The hardware layer is provided with an Intewell RTRE, and the hardware layer is provided with a non-real-time operating system and a real-time operating system, so that non-real-time applications such as human-machine interface (HMI) applications and the like can run in the running environment of the non-real-time operating system, and real-time applications such as real-time acquisition of information of a certain sensor and the like run in the running environment of the real-time operating system.
After the Intewell operating system is started, the non-real-time operating system is started first, and then the real-time operating system is guided to be started through the Intewell RTRE. Intewell realizes that the non-real-time system and the real-time system run on the same equipment through Intewell RTRE, and ensures that the non-real-time system and the real-time system are isolated from each other. The non-real-time operating system and the real-time operating system can exchange and communicate data through a virtual network card, a shared memory and the like. In some embodiments of the present application, the non-real-time operating system is a Linux system or a Windows system. In yet other embodiments, the non-real-time operating system has a macro kernel such as Unix, linux, etc., and in other embodiments, a non-real-time operating system such as Window, minix, macOS, etc. When the non-real-time operating system is Linux, it may be any Linux distribution system, such as an ubuntu system or a debian system, for example. And the real-time system can be mu Clinux, freeRTOS, mbed OS, vxworks and the like.
When a non-real-time operating system and a real-time operating system run simultaneously on the same physical hardware, the problem of allocation of hardware resources is involved. The existing hardware resource allocation method for the non-real-time operating system and the real-time operating system allocates hardware resources in a static mode, namely, a user allocates resource allocation of the non-real-time operating system and the real-time operating system at one time according to the requirement of the real-time operating system, and once the resource allocation is allocated, the resource allocation cannot be changed. When the hardware resources are not abundant, for example, when the method is applied to an embedded ARM SoC, the limitation on the low utilization rate of the hardware resources due to static allocation of the hardware resources is particularly obvious, and the way of statically allocating the hardware resources obviously cannot meet the requirement.
Based on the defects in the prior art, the application provides a method, a device and a computing device for dynamically allocating hardware resources of a system, so as to realize the dynamic allocation of the hardware resources of a non-real-time operating system and a real-time operating system, and improve the utilization rate and the operating efficiency of the hardware resources. In an embodiment of the present application, the device for dynamically allocating hardware resources of a system as shown in fig. 5 is disposed in an Intewell RTRE, so as to receive a resource allocation request or a configuration file in real time, and release the hardware resources after dynamically allocating the hardware resources.
The technical scheme provided by the application belongs to the field of integrated circuit design technology and computer operating systems, and is used for dynamically partitioning hardware resources on a microkernel operating system. The hardware resource allocation method provided by the embodiment of the application can realize dynamic allocation of hardware resources and efficient reuse of the resources, and is particularly suitable for hardware or system scenes with insufficient embedded hardware resources. Meanwhile, the requirement on hardware for real-time expansion of the Intewell operating system is not high, and different types of application programs can still be merged to the same machine to run on an embedded ARM SoC or some machine types with lower performance. Under the condition that hardware does not have the characteristic of hardware virtualization, the coexistence of a non-real-time operating system and a real-time operating system can be realized.
Fig. 2 is a flowchart illustrating a method for dynamically allocating hardware resources to a system according to an embodiment of the present application. As shown in fig. 2, the method for dynamically allocating hardware resources according to this embodiment includes the following steps:
s101: a configuration request for a target hardware resource is received.
Since the non-real-time operating system and the real-time operating system run on the same physical hardware at the same time, which may involve the problem of allocating hardware resources, when the hardware resources are not sufficient, the hardware resources need to be reallocated. For example, in some cases, when the real-time operating system needs more hardware resources, the hardware resources occupied by the non-real-time operating system need to be released and reallocated to the real-time operating system during allocation. Similarly, when the real-time system is in an idle state and the non-real-time system needs more resources, the hardware resources occupied by the real-time operating system are released and allocated to the non-real-time operating system.
In some embodiments, the configuration request of the hardware resource may be a configuration request received from a user, a hardware resource configuration request received from a non-real-time operating system or some application therein, or a hardware resource configuration request received from a real-time operating system or some application therein.
In some embodiments, when dynamic allocation of hardware resources between the non-real-time operating system and the real-time operating system on the system is required, the receiving user may send a hardware resource configuration request in a network communication manner or the like through a user tool such as intewell device. For example, when an application of a user is prompted to be triggered and started in a manner of text or image and the like to require a certain hardware resource, the user may configure the corresponding hardware resource through a user tool such as an Intewell developer and send the configuration request to the configuration server, and the Intewell RTRE receives the configuration request for the target hardware resource.
In some embodiments, a configuration request of a hardware resource from an application running in the real-time operating system may also be received, so as to dynamically apply for or release the hardware resource on the non-real-time operating system. For example, when an application of the real-time operating system is triggered and started and needs a hardware resource, a corresponding configuration request is directly generated, the Intewell RTRE obtains the configuration request for the target hardware resource, an application for the corresponding target hardware resource is made to the non-real-time operating system, and the non-real-time operating system releases the corresponding target hardware resource to be allocated to the real-time system for use. The same applies to the non-real-time operating system, for example, when a certain application of the non-real-time operating system needs a certain target hardware resource, and when the target hardware resource is occupied by the real-time system, a corresponding configuration request is generated, the configuration request for the target hardware resource is obtained by the Intewell RTRE, the real-time operating system is requested to release the corresponding target hardware resource, and the real-time operating system releases the corresponding target hardware resource to be reallocated to the non-real-time system for use. In some embodiments, the target hardware resource may be actively released after the target hardware resource is used up.
In some embodiments, the request for configuration of the target hardware resource includes a request to allocate use of the target resource, a request to release the target resource, and the like.
In some embodiments, the configuration request for the target hardware resource may be presented in a file. For example, the requested hardware resource may be described using a resource application file, such as an API _ configtable. Cfg file, or the requested hardware resource may be described using a resource release file, such as an API _ freetable. Cfg file.
S102: and acquiring the occupation information of the non-real-time operating system and the real-time operating system to the hardware resources.
In some embodiments, the occupation information of the hardware resources by the non-real-time operating system and the real-time operating system may be recorded in one or more configuration files, and the occupation information of the hardware resources by the non-real-time operating system and the real-time operating system is obtained by reading the configuration files.
In some embodiments, the configuration file may include: based on a configuration file formed by a user through configuration of the IntewellDeveloper, for example, a formed configtable. In this embodiment, the hardware resources recorded in the configtable.cfg are the same as those recorded in the IDE _ configtable.cfg, and the difference is that the recording mode is different to match different use stages.
In some embodiments, the configuration file may include a configuration file (or configuration table) generated in a process of configuring the real-time operating system, for example, rtosw _ record _ table.
S103: when the configuration request does not conflict with the occupation information, dynamically allocating the target hardware resource between the non-real-time operating system and the real-time operating system based on the configuration request.
In some embodiments, the determination of whether there is a conflict may be made by comparing the contents of the file documenting the configuration request and the occupancy information. For example, whether the target hardware requested to be allocated or released by the API _ configtable.cfg or the API _ freetable.cfg conflicts is determined based on the hardware information recorded in the IDE _ configtable.cfg and/or the rtosw _ record _ table.cfg.
The allocated resources or the released resources of the real-time operating system are recorded through the RTOSHW _ record _ Table.cfg table, and the main purpose is to prevent the real-time operating system from repeatedly allocating the same hardware resources for the RTOS or repeatedly releasing the same hardware resources by the real-time operating system. The conflict indicates that the same hardware resource is repeatedly allocated or released.
And when no resource conflict exists, executing the allocation of the target hardware resource so as to realize the dynamic allocation of the hardware resource between the non-real-time operating system and the real-time operating system and release the hardware resource. Here, the allocation of the target hardware resource includes allocation or release of use of the target resource.
In some embodiments, the configuration request in step S101 includes allocating a target hardware resource to the real-time operating system; in the step S102, the occupation information includes information that the target hardware resource is occupied by the non-real-time operating system; correspondingly, in step S103, when the configuration request does not conflict with the occupation information, the performing allocation of the target hardware resource based on the configuration request includes: and when the target hardware resource of the configuration request is occupied by the non-real-time operating system and is not allocated to the real-time operating system, releasing the target hardware resource from the non-real-time operating system based on the configuration request so as to be allocated to the real-time operating system.
By the method, the resources required by the real-time operating system are dynamically divided from the non-real-time operating system and are provided for the real-time operating system to use.
In some embodiments, the configuration request in step S101 includes releasing a target hardware resource already occupied by the real-time operating system; in the step S102, the occupation information includes information that the target hardware resource is occupied by the real-time operating system; correspondingly, in step S103, when the configuration request does not conflict with the occupation information, the performing allocation of the target hardware resource based on the configuration request includes: and when the target hardware resource of the configuration request is occupied by the real-time operating system, releasing the target hardware resource from the real-time operating system based on the configuration request so as to be distributed to the non-real-time operating system.
By the method, the resources are released to be dynamically recycled for the non-real-time operating system when the real-time operating system does not need occupied hardware resources.
In the above embodiments, the reallocation of hardware resources may be achieved using both the Intewell RTRE and the Intewell developer. After the Intewell RTRE is started to complete scanning of system hardware resources, a hardware resource acquisition service is provided for the Intewell developer, wherein items that can be acquired by the Intewell developer include a hardware resource list, a hardware resource allocation table, and hardware resources that are correspondingly allocated in the hardware resource allocation table.
In other embodiments, a hardware resource threshold value or a reserved free resource threshold value may be set for the real-time operating system and the non-real-time system to use and allocate. The allocable resource threshold may be stored in (a system file of) a non-real-time operating system, may be stored in (a system file of) a real-time operating system, and may be integrated with a hardware resource list and a hardware resource allocation table generated by the Intewell RTRE and a corresponding configuration table generated by the Intewell RTRE. The reserved hardware resources can ensure the stable operation of the real-time system and the non-real-time system, avoid the blockage, and can also be tasks allocated to emergency online and the like.
In other embodiments, dedicated hardware resources of real-time system or non-real-time system may be provided, for example, because the real-time operating system provided by the above embodiments of the present application has strong real-time performance, it allows the application to be divided into a plurality of small tasks which are executed autonomously, and these small tasks are independent of other tasks or scheduler, so as to maximize the system performance. Therefore, in the embodiment, the dedicated hardware resource is preferentially set for the real-time operating system.
In some embodiments, after the hardware resources occupied by the real-time operating system are released, the hardware resources may be reallocated to the non-real-time operating system for multiplexing, and the hardware resources released by the real-time operating system may be reinitialized on the non-real-time operating system. The driver module of the specific hardware device can be reloaded through the insmod command, and at the moment, the hardware resource can return to the non-real-time operating system to be used by the non-real-time operating system again, so that the utilization efficiency of the hardware resource is effectively improved.
In some other embodiments of the present application, after receiving the hardware resource configuration request, the target hardware resource allocation policy that can be allocated and used by different operating systems may be further obtained by processing according to the hardware resource configuration request and the obtained occupation information of the hardware resource.
For example, after receiving the hardware resource allocation request, the hardware resources required by the real-time operating system and the non-real-time operating system are evaluated, a target hardware resource allocation policy of the size of the hardware resources required by and capable of being allocated by the real-time operating system and the non-real-time operating system is given, and the hardware resources can be reallocated according to the target hardware resource allocation policy. The target hardware resource allocation policy may be given based on a related policy configuration module, the policy configuration module may also be configured to receive a user request, and the policy configuration module may be an independent computing unit or a software program based on a host operating system; in addition, since in some embodiments, the real-time operating system is installed in the non-real-time operating system, the policy configuration module may be the system software in the non-real-time operating system that is responsible for managing the hardware resources.
In this embodiment, when the policy configuration module makes a new target hardware resource allocation policy, a certain amount of idle hardware resources may be reserved, so as to facilitate an emergency online task, or avoid a system jam caused by a full hardware resource such as a CPU.
The target hardware resource allocation strategy which can be allocated and used by different operating systems is obtained by the embodiment and mainly based on a relevant strategy configuration module, and is realized by IntewellDeplorer and other development tools.
In the above embodiment, the user may read a corresponding resource occupation configuration file (e.g., configtable. Xml file) from the intewell device through network communication, analyze the file to obtain hardware resources respectively allocated by the non-real-time operating system and the real-time operating system, form a configuration file (e.g., configtable. Cfg), and obtain a target hardware resource allocation policy according to the analyzed resource occupation information.
In some other embodiments of the present application, for a case where hot plug may occur, the policy configuration module may provide real-time CPU core number scanning for the IntewellDeveloper by calling scan _ CPU. Py service can be called to perform real-time PCIE device scanning; py service may also be invoked for real-time USB device scanning, etc. That is, the present embodiment may query the occupation status of the hardware resources on the non-real-time operating system in real time through the IntewellDeveloper, and provide a basis and a policy for the hardware resource allocation.
In addition, based on steps S102 to S103, after the target hardware resource is allocated according to the hardware resource allocation request, a command set or a configuration file may also be configured for an exclusive hardware resource, so that when the real-time operating system is stopped, the real-time operating environment system may release the exclusive hardware resource of the real-time operating system to the non-real-time operating system.
The command set of the dedicated hardware resource can be added to a hardware resource list or a hardware resource allocation table generated by running environment software, a user tool or a development tool and the like, and a form integrated by the hardware resource list and the hardware resource allocation table.
The command set comprises a system stop command, a resource release command and the like, the real-time operating system can stop the real-time operating system through the system stop command, the real-time operating system can release the hardware resource exclusive to the real-time operating system to the non-real-time operating system through the resource release command, and the non-real-time operating system can reinitialize the hardware resource for use.
In some other embodiments of the present application, a user may apply for releasing the interface module to configure the hardware resources through a preset hardware resource. The preset hardware resource application release interface module is an externally provided interface for dynamically applying and releasing hardware resources, so that a user of an Intewell operating system can dynamically configure the hardware resources through the interface. For example, a user may access the Intewell system through the interface to perform hardware resource allocation using a laptop, PAD, etc. running a user mode program.
In the method for dynamically allocating hardware resources provided by the above embodiments of the present application, by designing the Intewell RTRE, the Intewell system uses the Intewell RTRE and the Intewell developer to jointly implement the partition of hardware resources. The dynamic allocation function of Intewell hardware resources is realized, hardware resources such as SoC (system on chip) and the like can be dynamically allocated, efficient multiplexing of the resources is realized, the utilization efficiency of the hardware resources is improved, and smooth completion of tasks and services is ensured.
The following further describes an embodiment of the method for dynamically allocating hardware resources provided by the present application with reference to a specific implementation manner. In this embodiment, in order to dynamically allocate the hardware resource occupied by the GPOS to the RTOS according to the running requirement of a task on the RTOS and release the hardware resource to the GPOS after the application is ended, as shown in fig. 3, the embodiment includes the following steps S210 to S300, where S210 is a process of first allocating the hardware resource, S220 to S260 is a process of dynamically allocating the resource to the RTOS, and S270 to S300 is a process of releasing the resource to the GPOS:
s210: generating a hardware resource configuration table configtable. The present embodiment may include the following steps:
firstly, a user allocates hardware resources to the RTOS according to the running requirements of tasks on the RTOS, and can send operations such as requests or commands for allocating the hardware resources to the RTOS, and the RTOS scans the hardware resources through a hardware resource allocation service module. After the Intewell RTRE is started, soC hardware resources including CPU core number, memory, and IO (serial port, network card, GPIO, SPI, I2C, CAN, etc.) are scanned, and hardware resource acquisition service is provided to the Intewell developer.
Specifically, for example, CPU core number scanning is performed by scan _ cpu.py; py through scan _ pci.py to scan the PCIE device; py through scan _ USB.
And then, the Intewell RTRE sends the result of the hardware resource scanning to the Intewell device through the SSH protocol, and can be displayed to the user in a visual manner, and the Intewell device generates a corresponding configuration file configtable.
And then, obtaining the configTable.xml by the Intewell RTRE, analyzing to obtain the hardware resources respectively allocated and used by the GPOS and the RTOS, and forming a configTable.cfg configuration file.
Cfg profile an example of a configtable is shown in the following table:
| resource name identification | Number and size of | System for use |
| CPU core | 2 | GPOS:1,RTOS:1 |
| Display card | 2 | GPOS:1,RTOS:1 |
| Memory device | 1024MB | GPOS:300MB,RTOS:100MB |
| Sound card | 2 | GPOS:1,RTOS:0 |
| …… | …… | …… |
S220: in the operation process, a user can call an Intewell user mode program such as Intewell developer and the like to allocate corresponding hardware resources to the RTOS through a hardware resource application release interface module, and then output a resource release file API _ freetable.
The user can call the following instructions to realize corresponding functions through the hardware resource application release interface module, such as:
select _ resource () -query the current state of a particular hardware resource.
free _ resource () -releasing the specified hardware resource, which is in an unallocated state.
alloc _ resource () -allocating hardware resources.
S230: according to IDE _ ConfigTable.cfg output by the hardware resource configuration service module and API _ ConfigTable.cfg output by the hardware resource application release interface module, the release and application of the hardware resources are ensured to have no conflict through the processing of the hardware resource mutual exclusion processing module. The IDE _ ConfigTable.cfg is generated through the ConfigTable.cfg, and the recorded hardware resource allocation conditions are the same.
The resource mutex processing module firstly queries the API _ configtable.cfg and the IDE _ configtable.cfg to determine whether the hardware resources are allocated or not. In step S210, the hardware resource allocated to the RTOS cannot be allocated any more, so that when the resource mutual exclusion processing module determines that the resource is not allocated, that is, the application of the hardware does not conflict, the RTOS will execute the application for allocating the corresponding hardware resource.
Then, the hardware resource mutual exclusion processing module also queries a hardware resource usage Record table (rtosw _ Record _ table.cfg), determines whether the applied resource has been applied by the RTOS according to the table, and when the applied resource has been applied by the RTOS, it indicates that a hardware resource conflict exists in the application (that is, the same hardware resource is repeatedly called by the RTOS). When a conflict occurs, corresponding prompt information can be returned so that the program re-requests other hardware resources or terminates the hardware resource calling; and when the applied resource is not applied by the RTOS, continuing to the next step.
Cfg records allocated resources and released resources of the RTOS, and an example of the table is shown as follows, wherein, when a resource is allocated by the RTOS, the corresponding flag is 1, and when the resource is not allocated or released, the resource is regarded as idle, the corresponding flag is 0.
| Resource name identification | Idle or not mark |
| CPU1 | 1 |
| CPU2 | 0 |
| Memory addresses A1-A2 | 1 |
| Memory addresses A2-A3 | 1 |
| Sound card | 0 |
| …… | …… |
S240: and taking the applied hardware resource off the GPOS.
In this step, the rmmod command (the mmod command is used to remove a specified kernel module from a currently running kernel in the Linux operating system), and the driver module of the requested hardware device is removed in each module manner, so that the hardware resource can be offline in the GPOS.
S250: and operating the hardware resource according to the address of the hardware resource by the RTOS.
This step is the process of transitioning hardware resources from GPOS to RTOS usage. The hardware address is derived from a hardware manual and is written in the user code according to the hardware manual. The hardware resources can be directly operated by using a script program when the RTOS is on line.
S260: and updating the RTOSHW _ Record _ Table.cfg table, and identifying the resource corresponding to the applied hardware resource as 1.
S270: after the application in the RTOS is finished running, an operation interface provided by the hardware resource application release interface module is called, for example, by free _ resource (), to request to release the specified hardware resource, and a resource release file API _ freetable. Specifically, refer to step S220, which is not described in detail.
S280: and (3) judging whether the hardware resources conflict (mainly preventing RTOS from being released repeatedly) according to API _ FreeTable.cfg and RTOSHW _ Record _ Table.cfg by a hardware resource mutual exclusion processing module.
The hardware resource mutual exclusion processing module maintains the above-mentioned hardware resource usage Record table rtosw _ Record _ table.cfg, which records the resources allocated by RTOS and the resources released, when Intewell allocates or releases the resources through a hardware resource dynamic allocator, the hardware resource mutual exclusion processing module needs to be called to query the rtosw _ Record _ table.cfg table first, and then the allocation and release of the resources are performed, so as to prevent the conflict. When the specified hardware resource is released and the resource release file API _ free table.cfg is generated, the Record of the released resource included in the API _ free table.cfg in the rtosw _ Record _ table.cfg table needs to be queried first, and if the identifier recorded in the rtosw _ Record _ table.cfg table is 1 (i.e., not released), it is determined that the hardware resource is not in conflict (repeatedly released), and the resource can be released.
S290: and the resource released by the RTOS is brought on line to the GPOS.
The hardware resources are reinitialized on the GPOS (mainly using the insmod command to reload the driver module of the specific hardware device), and at this time, the hardware resources can return to the GPOS to be used by the GPOS again.
S300: and updating the RTOSHW _ Record _ Table.cfg table, and identifying the corresponding resource of the applied hardware resource as 0.
According to the embodiment, based on the hardware resource configuration request of the user, the target hardware resource is scanned through the real-time running environment software, the service program and the like, the target hardware resource is applied or released and marked as idle, and finally the hardware resource in the idle state is allocated according to the hardware resource configuration request of the user, so that the dynamic allocation of the hardware resources of a real-time operating system and a non-real-time operating system is realized, the operating efficiency is improved, and the problem that the hardware resource can only be allocated statically once before the operation is started in the prior art is solved. In addition, after the real-time operating system completes the operation, the non-real-time operating system of the resource allocation can be reused, and the high-efficiency multiplexing of hardware resources is realized.
Based on an inventive concept, the present application further provides an apparatus 200 for dynamically allocating hardware resources to a system, which can be disposed in the Intewell RTRE of fig. 1. As shown in fig. 4, fig. 4 is a schematic structural diagram of a device 200 for dynamically allocating hardware resources to a system according to an embodiment of the present invention. The apparatus 200 for dynamically allocating hardware resources to a system according to this embodiment is specifically configured to perform the above-mentioned step S101 to step S103 and any optional example thereof. Reference may be made in detail to the method examples, which are briefly described herein as follows:
the apparatus 200 for dynamically allocating hardware resources of a system includes:
a communication module 210 configured to receive a configuration request for a target hardware resource, where the module is specifically configured to execute the step S101 and any optional example thereof.
An information obtaining module 220, configured to obtain occupation information of hardware resources by the non-real-time operating system and the real-time operating system, where the module is specifically configured to execute step S102 and any optional example thereof.
A hardwareresource allocation module 230, configured to dynamically allocate the target hardware resource between the non-real-time operating system and the real-time operating system based on the configuration request when the configuration request does not conflict with the occupancy information, where the module is specifically configured to execute step S103 and any optional example thereof.
In some embodiments, the configuration request received by the communication module 210 includes allocating a target hardware resource for the real-time operating system, and this module is specifically configured to execute the step S101 and any optional example thereof.
The occupation information acquired by the information acquiring module 220 includes information that the target hardware resource is occupied by the non-real-time operating system, and the module is specifically configured to execute the step S102 and any optional example thereof.
The hardwareresource allocating module 230 is configured to, when the configuration request does not conflict with the occupation information, perform allocation of the target hardware resource based on the configuration request, including: when the target hardware resource of the configuration request is occupied by the non-real-time operating system and is not allocated to the real-time operating system, the target hardware resource is released from the non-real-time operating system based on the configuration request to be allocated to the real-time operating system, and the module is specifically configured to execute the step S103 and any optional example thereof.
In some embodiments, the configuration request received by the communication module 210 includes releasing the target hardware resource already occupied by the real-time operating system, and the module is specifically configured to execute step S101 and any optional example thereof.
The occupation information acquired by the information acquiring module 220 includes information that the target hardware resource is occupied by the real-time operating system, and the module is specifically configured to execute the step S102 and any optional example thereof.
The hardwareresource allocation module 230 is configured to, when the configuration request does not conflict with the occupancy information, perform allocation of the target hardware resource based on the configuration request, including: when the target hardware resource of the configuration request is occupied by the real-time operating system, based on the configuration request, the target hardware resource is released from the real-time operating system to be allocated to the non-real-time operating system, and this module is specifically configured to execute step S103 and any optional example thereof.
In some embodiments, the information obtaining module 220 obtains the occupancy information, including: and acquiring the occupancy information by reading at least one configuration table.
The device for dynamically allocating hardware resources of a system provided in the foregoing embodiment allocates a target hardware resource pointed in a hardware resource configuration request by acquiring occupation information of resources occupied by a real-time operating system and a non-real-time operating system based on a received hardware resource configuration request; meanwhile, by calling and reading the hardware resource occupation information and the related hardware resource list, the conflicts of repeated allocation, repeated release and the like are avoided, and the dynamic allocation of the hardware resources between the real-time operating system and the non-real-time operating system is realized.
Based on an inventive concept, the present application further provides an apparatus 300 for dynamically allocating hardware resources to a system, which can be disposed in the Intewell RTRE of fig. 1. Fig. 5 is a schematic structural diagram of an apparatus 300 for dynamically allocating hardware resources to a system according to this embodiment, and fig. 5 is a specific implementation example of the embodiment of fig. 4. The apparatus 300 for dynamically allocating hardware resources to a system according to this embodiment is specifically configured to perform the above-mentioned step S101 to step S103 and any optional example thereof. Reference may be made in detail to the method examples, which are briefly summarized here as follows:
the apparatus 300 for dynamically allocating hardware resources to a system includes:
a hardware resource application release interface unit 310, configured to receive a configuration request for a target hardware resource through the interface; or, the hardware resource configuration service unit 320 is configured to receive the configuration file of the target hardware resource and parse the configuration request. The hardware resource application release interface unit 310 can provide Intewell user mode programs, and call the corresponding API operation interface provided by the hardware resource application release interface unit 310 to provide an externally provided interface for dynamically applying and releasing the hardware resources, so as to dynamically allocate the hardware resources to the real-time operating system. The hardware resource application release interface module unit 310 and the hardware resource configuration service unit 320 may be an embodiment of the communication module 210 in the apparatus 200 for dynamically allocating hardware resources to a system.
A hardware resource mutual exclusion processing unit 330, configured to obtain hardware resource occupation information of the non-real-time operating system and the real-time operating system, and determine whether the configuration request conflicts with the occupation information. The main function of the hardware resource mutex processing unit 330 is to maintain and manage a hardware resource usage Record table (e.g., rtosw _ Record _ table. Cfg), where the hardware resource usage Record table records allocated resources and released resources of the real-time operating system, and when a hardware resource is dynamically allocated, the hardware resource mutex processing unit 330 first queries the rtosw _ Record _ table. Cfg table, and then allocates and releases the resources, so as to prevent conflicts of repeated allocation or release of the resources by the real-time operating system. The hardware resource mutual exclusion processing unit 330 may be an embodiment of the information obtaining module 220 in the apparatus 200 for dynamically allocating hardware resources of a system.
A hardwareresource allocation unit 340, configured to release the target hardware resource from the non-real-time operating system to allocate to the real-time operating system when the configuration request does not conflict with the occupancy information; or, the hardware resource application releasing unit 350 is configured to release the target hardware resource from the real-time operating system to allocate to the non-real-time operating system when the configuration request does not conflict with the occupation information. The hardwareresource allocation unit 340 and the hardware resource application release unit 350 may be an embodiment of a hardware resource allocation module in the apparatus 200 for dynamically allocating hardware resources to a system.
For example, a user mode program or device accesses through the hardware resource application release interface unit 310, receives a configuration request for a target hardware resource, calls a select _ resource () service to query a current state of the target hardware resource, obtains occupation information of the hardware resource on the real-time operating system and the non-real-time operating system at that time by the hardware resource exclusive processing unit pair 330, when it is determined that the configuration request does not conflict with the occupation information of the hardware resource, calls a free _ resource () service through the hardwareresource allocation unit 340 to release the target hardware resource, and finally calls an alloc _ resource () service through the hardwareresource allocation unit 340 to allocate the hardware resource if the target hardware resource is in an unallocated state at that time.
In some other embodiments of the present application, the apparatus 300 for dynamically allocating hardware resources of a system further includes: and the strategy configuration module is configured to process and obtain the target hardware resource allocation strategy for different operating systems to allocate and use according to the configuration request of the user.
After the strategy configuration module receives a configuration request of a user for hardware resources, hardware resources required by the real-time operating system and the non-real-time operating system are evaluated, target hardware resource allocation strategies of the resource sizes required by the real-time operating system and the non-real-time operating system are given, and the hardware resources are reallocated according to the target hardware resource allocation strategies. In this embodiment, when the policy configuration module makes a new target hardware resource allocation policy, a certain amount of idle hardware resources may be reserved, so as to facilitate an emergency online task, or avoid a system jam caused by a full hardware resource such as a CPU.
With regard to the apparatus 300 for dynamically allocating hardware resources of a system in the above-described embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment related to the method, and will not be described in detail here.
The technical scheme provided by the application can dynamically allocate hardware resources of each system in Intewell, namely, the dynamic allocation of the hardware resources is realized, the high-efficiency multiplexing of the resources can be realized, and the smooth operation of services can be ensured on the operating system level.
Fig. 6 is a schematic structural diagram of a computing device 900 provided in an embodiment of the present application. The computing device may execute each optional implementation manner in the above method for dynamically allocating hardware resources, and the computing device may be a terminal, and may also be a chip or a chip system inside the terminal. As shown in fig. 6, the computing device 900 includes: a processor 910, a memory 920, and a communication interface 930.
It is to be appreciated that the communication interface 930 in the computing device 900 shown in fig. 6 may be used for communicating with other devices, and may in particular comprise one or more transceiver circuits or interface circuits.
The processor 910 may be connected to the memory 920. The memory 920 may be used to store the program codes and data. Therefore, the memory 920 may be a storage unit inside the processor 910, an external storage unit independent of the processor 910, or a component including a storage unit inside the processor 910 and an external storage unit independent of the processor 910.
Optionally, computing device 900 may also include a bus. The memory 920 and the communication interface 930 may be connected to the processor 910 through a bus. The bus may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, a line without arrows is used in FIG. 6, but does not indicate that there is only one bus or one type of bus.
It should be understood that, in the embodiment of the present application, the processor 910 may employ a Central Processing Unit (CPU). The processor may also be other general purpose processors, digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. Or the processor 910 may employ one or more integrated circuits for executing related programs to implement the technical solutions provided in the embodiments of the present application.
The memory 920 may include a read-only memory and a random access memory, and provides instructions and data to the processor 910. A portion of the processor 910 may also include non-volatile random access memory. For example, the processor 910 may also store information of the device type.
When the computing device 900 is running, the processor 910 executes the computer-executable instructions in the memory 920 to perform any of the operational steps of the methods described above and any optional implementation thereof.
It should be understood that the computing device 900 according to the embodiments of the present application may correspond to a corresponding main body for executing the method according to the embodiments of the present application, and the above and other operations and/or functions of the respective modules in the computing device 900 are respectively for implementing the corresponding flows of the methods according to the embodiments, and are not described herein again for brevity.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is merely a logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
The present embodiments also provide a computer-readable storage medium, on which a computer program is stored, the computer program being used for executing the method described above when executed by a processor, and the method including at least one of the aspects described in the above embodiments.
The computer storage media of the embodiments of the present application may take any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present application may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C + +, and conventional procedural programming languages, such as the "for example" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider). Additionally, the terms first, second, third and the like in the description and in the claims, or module a, module B, module C and the like are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order, it being understood that specific orders or sequences may be interchanged where permissible to effect embodiments of the application described herein in other than the order illustrated or described herein.
In the above description, reference to reference numerals indicating steps, such as the description of S110, S120, etc., does not necessarily indicate that the steps are performed, and the order of the steps before and after may be interchanged or performed simultaneously, where permitted.
The term "comprising" as used in the specification and claims should not be construed as being limited to the contents listed thereafter; it does not exclude other elements or steps. It should therefore be interpreted as specifying the presence of the stated features, integers, steps or components as referred to, but does not preclude the presence or addition of one or more other features, integers, steps or components, and groups thereof. Thus, the expression "an apparatus comprising the devices a and B" should not be limited to an apparatus consisting of only the components a and B.
Reference in the specification to "one embodiment" or "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. Thus, appearances of the phrases "in one embodiment" or "in an embodiment" in various places throughout this specification are not necessarily all referring to the same embodiment, but may. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments, as would be apparent to one of ordinary skill in the art from this disclosure.
It should be noted that the foregoing is only illustrative of the preferred embodiments of the present application and the technical principles employed. It will be understood by those skilled in the art that the present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the application. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and all such equivalent embodiments are within the scope of the present application.