Embedded system resource management method based on multi-core DSP
Technical Field
The invention relates to a resource management technology in an embedded system, in particular to a method and a system for managing various resources of the embedded system of a complex multi-processing node based on a multi-core DSP.
Background
In the field of digital signal processing, a signal processing unit usually adopts a DSP (digital signal processor) and FPGA (field programmable gate array) architecture, in an embedded signal processing unit of a traditional single-core DSP processing chip, because the DSP processing capacity is limited, single task processing is usually carried out, even if multiple tasks are operated, because the number of various types of resources on a board is small, the resources can be fixedly distributed in a single mapping mode, and various processes provided by an operating system, such as process scheduling and the like, can be used for management among the tasks.
With the development of chip technology and the continuous improvement of application requirements, at present, a DSP chip is also developed from a single core to multiple cores, sometimes even multiple DSPs are integrated on a single board card, an FPGA can also realize more and more various processing resources, and processable tasks are also changed from a single task mode to multiple tasks. The traditional simple resource management method is not suitable any more, and the various resources on the board which are increased rapidly need more advanced resource management methods and means to carry out effective management, so that a plurality of tasks reasonably use the resources on the board.
Disclosure of Invention
In view of the above, the main objective of the present invention is to provide a resource management method for an embedded system based on a multi-core DSP, which can solve the technical problem of allocation management of on-board hardware resources and software resources in the multi-core DSP embedded system, and to achieve the above technical objectives, the present invention adopts the following technical solutions:
an embedded system resource management method based on multi-core DSP at least comprises the following steps:
(1) classifying and sorting various allocable resources, determining attribute information of various resources and creating a resource pool; the method specifically comprises the following steps:
(1a) defining DSP kernel processing resources and resource attributes and memory resources and resource attributes, wherein the resource attributes comprise: the method comprises the following steps of (1) identifying resources, the number of the resources, resource occupation attributes and shared resource occupancy rate, wherein the resource occupation attributes comprise private occupation and shared occupation;
(1b) defining the resource type, quantity and resource attribute of a processing module supported by the FPGA;
(1c) forming a system resource list;
(2) performing resource occupation evaluation on various tasks supported by the system to form a task resource occupation list; the method specifically comprises the following steps:
(2a) defining the task type and the task execution number;
(2b) system resources occupied by each task are determined, wherein the system resources comprise kernel resources, FPGA processing resources, memory resources and resource attributes of various resources;
(2c) forming a task resource occupation list;
(3) allocating resources required by task execution according to the task execution request; the method specifically comprises the following steps:
(3a) inquiring a task resource occupation list according to a specific task, and determining various resources required by the task;
(3b) inquiring available resources in a system resource list according to resources required by the task and applying for the available resources;
(3c) marking the applied system resources with state information to mark that the resources are occupied; the occupied private resources cannot be repeatedly applied for use, the resource availability of the common resources is evaluated, and the occupied rate of the resources is marked;
(3d) sending the task parameters and the applied resource information to a task processing kernel to execute the task;
(4) when the task parameters are changed, judging whether resources are reallocated or not according to the task parameter change request; the method specifically comprises the following steps:
(4a) when the task parameters are changed, the resource occupation list is obtained again according to the changed task parameters, and various resources required by the task are determined;
(4b) comparing the resources required by the task after the parameter is changed with the resources already applied by the task before the parameter is changed, judging whether various resources need to be applied again, if not, executing the step (5), if so, releasing the previous resources, and reapplying the system resources;
(4c) marking the applied system resources with state information to mark that the resources are occupied; the occupied private resources cannot be repeatedly applied for use, the resource availability of the common resources is evaluated, and the occupied rate of the resources is marked;
the shared resource needs to identify the occupied rate, and resource availability evaluation is carried out when other tasks apply for the resource;
(4d) sending the changed task parameters and resource information to a task processing kernel to execute the task;
(5) releasing the distributed system resources after the task is finished; the method specifically comprises the following steps:
(5a) receiving a task ending request, inquiring and acquiring all system resources occupied by the task;
(5b) releasing all system resources occupied by the task, marking state information, updating resource state information, marking the resources in an idle state for private resources, marking the resource available amount after releasing for shared resources, and evaluating the resource availability when other tasks apply for the resources;
(5c) and informing the task processing kernel to stop the task.
Wherein, the resource occupancy rate of part of tasks is determined according to the working parameters of the current tasks.
And (4) when the shared resources are allocated in the step (3), the occupied shared resources are preferentially used, and when no occupied shared resources are available, the idle shared resources are reallocated.
Compared with the prior art, the invention has the following advantages:
1. the invention manages the system resource uniformly by standardizing the on-board system resource classification method and the resource allocation strategy, thereby improving the safety of resource use.
2. The method breaks through the limitation that fixed resources are occupied by tasks in the traditional embedded system, and realizes flexible and efficient resource management of the complex embedded system.
Drawings
FIG. 1 is a flow chart of an implementation of the present invention.
Detailed Description
The invention is described in further detail below with reference to the figures and specific examples.
Referring to fig. 1, an embodiment of an embedded system resource management method based on a multi-core DSP, where an embedded system board is an 8-core DSP plus a single-chip FPGA, and a digital demodulation task is taken as an example, includes the following steps:
step 1) classifying and sorting various allocable resources on the board, defining attribute information of various resources and creating a resource pool:
step 1a) the number of DSP cores is 8, wherein, core 0 is responsible for system task and resource management, other 7 cores are abstracted into 7 core processing resources, the resource attribute can be private resources or common resources, the shared storage space on the DSP chip is 4 Mbytes, and the resource attribute is common resources;
step 1b), 8-path narrow-band down-conversion resources can be used in the FPGA, and the resource attribute is private resources;
step 1c), three resources of 7 kernel resources, 4 Mbyte memories and 8-path narrow-band down-conversion are counted into a system resource list, and the attribute and the current application state of each resource are recorded to form a final system resource pool;
step 2) performing resource occupation evaluation on the digital demodulation task to form a task resource occupation list:
step 2a), the types of system tasks are 1, and the number of executed tasks is 8;
step 2b), the number of cores required to be occupied by one path of digital demodulation task is 1, the resource attribute is set to be shared, the resource usage is determined according to parameters, the number of resources occupying narrow-band down-conversion is 1, the resource attribute is private, the memory resource is occupied by 10%, and the resource attribute is shared;
step 2c), recording three resources of 1 kernel resource, a memory resource and 1-path narrow-band down-conversion into a digital demodulation task resource occupation list;
step 3) receiving a digital demodulation task execution request, and allocating resources required by task execution:
step 3a) inquiring a digital demodulation task resource occupation list to obtain various resources required by the task;
step 3b) determining various required resources and usage according to the digital demodulation task parameters, inquiring and applying in a system resource list one by one, wherein the number of cores is 1, the resource attribute is shared, the 1M symbol rate demodulation occupies 30% of the core processing resources, the number of the narrow-band down-conversion resources is 1, the memory resources are 10%, and the resource attribute is shared;
step 3c) marking the state information of the applied system resource, wherein if the kernel is core 1, the narrowband down-conversion channel 1 and the memory index is 1, the resource state is identified in the corresponding system resource state;
step 3d) sending the task parameters and the applied resource information to a task processing kernel to execute the task;
step 4) receiving a digital demodulation parameter change request, and judging whether to reallocate resources:
step 4a) according to the changed task parameters, re-inquiring and calculating the required resources, if the 1M symbol rate is changed into the 2M symbol rate, the number of the parameters causes that the occupied kernel processing resources are changed into 60%, and the use amount of other resources is not changed;
step 4b) comparing with the previously applied resource, if the kernel processing resource is changed from 30% to 60%, releasing the previously applied 30% kernel resource, and re-applying 60% kernel resource;
step 4c), carrying out state marking on the changed system resource;
step 4d) sending the modified digital demodulation task parameters and the resource information to a task processing kernel to execute the task;
step 5) receiving a digital demodulation task ending request, and releasing the distributed system resources:
step 5a) receiving a task ending request, inquiring and acquiring system resources occupied by the task;
step 5b) releasing all system resources occupied by the task, carrying out state marking, and updating resource state information;
step 5c) informing the task processing kernel to stop the task;
it will be appreciated by those of ordinary skill in the art that the embodiments described herein are intended to assist the reader in understanding the principles of the invention and are to be understood that the scope of the invention is not to be limited to such specific statements and embodiments. Those skilled in the art can make various other specific changes and combinations based on the teachings of the present invention without departing from the spirit of the invention, and these changes and combinations are within the scope of the invention.