Memory allocation method and device for target computing system and automatic driving vehicle

By pre-applying and automatic recycling of memory for external devices, the problem of inability to recycle memory after the connection of external devices is interrupted, improving resource utilization and avoiding resource waste.

CN119806812AActive Publication Date: 2025-04-11BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 13 Cites 0 Cited by

Patent Information

Application Number
CN202411846202.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-04-11
Estimated Expiration
2044-12-13

AI Technical Summary

Technical Problem

In the prior art, after the connection between the external device and the target computing system is interrupted, the allocated memory cannot be automatically recycled, resulting in waste of resources.

Method used

By pre-requesting memory for external devices connected to the target computing system, the memory blocks corresponding to the external device are obtained, and when the external device makes a memory request, the free sub-memory blocks are allocated to the external device. When the external device is interrupted from the connection between the target computing system, the status of the allocated sub-memory block is reset to the idle state to achieve automatic memory recovery.

Benefits of technology

It realizes automatic recycling of allocated memory, improves resource utilization, and avoids resource waste caused by the inability to use allocated memory after the external device is restored.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119806812A_ABST
    Figure CN119806812A_ABST
Patent Text Reader

Abstract

The invention provides a memory allocation method and device for a target computing system and an automatic driving vehicle, and relates to the technical field of computers, in particular to the technical field of automatic driving and resource scheduling. According to the implementation scheme, memory pre-application is carried out on external equipment connected with a target computing system, a memory block corresponding to the external equipment is obtained, and the memory block comprises a plurality of sub-memory blocks; in response to a received memory request of the external device, allocating a first sub-memory block in an idle state in the memory block to the external device; and resetting the state of the sub-memory block allocated to the external equipment to be an idle state in response to a received signal indicating that the connection between the external equipment and the target computing system is interrupted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, in particular to the field of autonomous driving and resource scheduling technology, and specifically to a memory allocation method, apparatus, electronic device, computer-readable storage medium, computer program product, autonomous driving vehicle and edge computing device for a target computing system. Background Art

[0002] Graphics Processing Unit (GPU) has a wide range of applications, covering graphics and image processing, scientific computing, artificial intelligence, big data analysis, cloud computing and other fields. Its powerful parallel processing capabilities provide support for various complex computing tasks and promote scientific and technological progress. At present, the GPU market is developing rapidly, and with the continuous innovation of technology, GPU will play an important role in more fields and become the core force to promote the continuous progress of the computing era.

[0003] The methods described in this section are not necessarily methods that have been previously conceived or employed. Unless otherwise indicated, it should not be assumed that any method described in this section is considered to be prior art simply because it is included in this section. Similarly, unless otherwise indicated, the issues mentioned in this section should not be considered to have been recognized in any prior art. Summary of the invention

[0004] The present disclosure provides a memory allocation method, apparatus, electronic device, computer-readable storage medium, computer program product, autonomous driving vehicle, and edge computing device for a target computing system.

[0005] According to one aspect of the present disclosure, a memory allocation method for a target computing system is provided, comprising: obtaining a memory block corresponding to an external device connected to the target computing system by pre-applying for memory for the external device, the memory block comprising a plurality of sub-memory blocks; in response to receiving a memory request from the external device, allocating a first sub-memory block in an idle state in the memory block to the external device; and in response to receiving a signal indicating that the connection between the external device and the target computing system is interrupted, resetting the state of the sub-memory block allocated to the external device to an idle state.

[0006] According to another aspect of the present disclosure, a memory allocation device for a target computing system is provided, comprising: an acquisition unit, configured to acquire a memory block corresponding to an external device connected to the target computing system by pre-applying for memory for the external device, the memory block comprising a plurality of sub-memory blocks; an allocation unit, configured to allocate a first sub-memory block in an idle state in the memory block to the external device in response to receiving a memory request from the external device; and a reset unit, configured to reset the state of the sub-memory block allocated to the external device to an idle state in response to receiving a signal indicating that the connection between the external device and the target computing system is interrupted.

[0007] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the memory allocation method for a target computing system of the present disclosure.

[0008] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable a computer to execute the memory allocation method for a target computing system of the present disclosure.

[0009] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, wherein the computer program implements the memory allocation method for a target computing system of the present disclosure when executed by a processor.

[0010] According to another aspect of the present disclosure, there is provided an autonomous driving vehicle, comprising: at least one camera device; and the electronic device of the present disclosure.

[0011] According to another aspect of the present disclosure, an edge computing device is provided, including: at least one camera device; and the electronic device of the present disclosure.

[0012] According to one or more embodiments of the present disclosure, it is possible to automatically recycle the allocated memory, improve resource utilization, and avoid resource waste caused by the inability to use the allocated memory after the external device is restored.

[0013] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0014] The accompanying drawings exemplarily illustrate the embodiments and constitute a part of the specification, and together with the text description of the specification, are used to explain the exemplary implementation of the embodiments. The embodiments shown are for illustrative purposes only and do not limit the scope of the claims. In all drawings, the same reference numerals refer to similar but not necessarily identical elements.

[0015] Figure 1 A schematic diagram showing an exemplary system in which the various methods described herein may be implemented according to an embodiment of the present disclosure;

[0016] Figure 2 A flowchart of a memory allocation method for a target computing system according to an embodiment of the present disclosure is shown;

[0017] Figure 3 A flow chart of allocating sub-memory blocks to external devices according to an embodiment of the present disclosure is shown;

[0018] Figure 4 An architectural diagram showing a first driver and a second driver according to an exemplary embodiment of the present disclosure;

[0019] Figure 5 A flowchart of memory pre-application according to an exemplary embodiment of the present disclosure is shown;

[0020] Figure 6 A flowchart of allocating sub-memory blocks to an imaging device according to an exemplary embodiment of the present disclosure is shown;

[0021] Figure 7 A flowchart of releasing a sub-memory block according to an exemplary embodiment of the present disclosure is shown;

[0022] Figure 8 A flowchart of releasing a memory block according to an exemplary embodiment of the present disclosure is shown;

[0023] Fig. 9 A structural block diagram of a memory allocation device for a target computing system according to an embodiment of the present disclosure is shown;

[0024] Fig.10 A structural block diagram of an exemplary electronic device that can be used to implement the embodiments of the present disclosure is shown. DETAILED DESCRIPTION

[0025] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope of the present disclosure. Similarly, for the sake of clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0026] In the present disclosure, unless otherwise specified, the use of the terms "first", "second", etc. to describe various elements is not intended to limit the positional relationship, temporal relationship, or importance relationship of these elements, and such terms are only used to distinguish one element from another element. In some examples, the first element and the second element may refer to the same instance of the element, and in some cases, based on the description of the context, they may also refer to different instances.

[0027] The terms used in the description of various examples in this disclosure are only for the purpose of describing specific examples and are not intended to be limiting. Unless the context clearly indicates otherwise, if the number of elements is not specifically limited, the element can be one or more. In addition, the term "and / or" used in this disclosure covers any one of the listed items and all possible combinations.

[0028] In the related art, in application scenarios where video memory is dynamically allocated and released, some versions of graphics card drivers (such as CUDA 535) have a problem in which the allocated memory cannot be automatically reclaimed when the process is forcibly terminated, resulting in a waste of memory resources.

[0029] An embodiment of the present disclosure provides a memory allocation method for a target computing system, which pre-applies for memory for each external device, obtains an available memory block corresponding to the external device, and allocates an idle sub-memory block therein to the external device when the external device makes a memory request; when the process of the external device is forcibly terminated due to the interruption of the connection between the external device and the target computing system, all allocated sub-memory blocks corresponding to the external device are reset to an idle state to achieve automatic recovery of the allocated memory, improve resource utilization, and avoid resource waste caused by the inability to use the allocated memory after the external device is subsequently restored.

[0030] The embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.

[0031] Figure 1 FIG. 1 is a schematic diagram of an exemplary system 100 in which various methods and apparatuses described herein may be implemented according to an embodiment of the present disclosure. Figure 1 , the system 100 includes a motor vehicle 110 , a server 120 , and one or more communication networks 130 coupling the motor vehicle 110 to the server 120 .

[0032] In an embodiment of the present disclosure, the motor vehicle 110 may include a computing device according to an embodiment of the present disclosure and / or be configured to perform a method according to an embodiment of the present disclosure.

[0033] The server 120 may run one or more services or software applications that enable methods for allocating memory. In some embodiments, the server 120 may also provide other services or software applications that may include non-virtualized environments and virtualized environments. Figure 1 In the configuration shown, the server 120 may include one or more components that implement the functions performed by the server 120. These components may include software components, hardware components, or a combination thereof that can be executed by one or more processors. A user of the motor vehicle 110 may in turn utilize one or more client applications to interact with the server 120 to utilize the services provided by these components. It should be understood that a variety of different system configurations are possible, which may differ from the system 100. Therefore, Figure 1 is one example of a system for implementing the various methods described herein and is not intended to be limiting.

[0034] Server 120 may include one or more general purpose computers, dedicated server computers (e.g., PC (personal computer) servers, UNIX servers, mid-range servers), blade servers, mainframe computers, server clusters, or any other suitable arrangement and / or combination. Server 120 may include one or more virtual machines running virtual operating systems, or other computing architectures involving virtualization (e.g., one or more flexible pools of logical storage devices that may be virtualized to maintain a server's virtual storage device). In various embodiments, server 120 may run one or more services or software applications that provide the functionality described below.

[0035] The computing units in the server 120 may run one or more operating systems including any of the above operating systems and any commercially available server operating systems. The server 120 may also run any of a variety of additional server applications and / or middle-tier applications, including HTTP servers, FTP servers, CGI servers, JAVA servers, database servers, etc.

[0036] In some embodiments, server 120 may include one or more applications to analyze and consolidate data feeds and / or event updates received from motor vehicle 110. Server 120 may also include one or more applications to display data feeds and / or real-time events via one or more display devices of motor vehicle 110.

[0037] The network 130 may be any type of network known to those skilled in the art that may support data communications using any of a variety of available protocols, including, but not limited to, TCP / IP, SNA, IPX, etc. By way of example only, the one or more networks 110 may be a satellite communications network, a local area network (LAN), an Ethernet-based network, a token ring, a wide area network (WAN), the Internet, a virtual network, a virtual private network (VPN), an intranet, an extranet, a blockchain network, a public switched telephone network (PSTN), an infrared network, a wireless network (including, for example, Bluetooth, WiFi), and / or any combination of these and other networks.

[0038] The system 100 may also include one or more databases 150. In some embodiments, these databases may be used to store data and other information. For example, one or more of the databases 150 may be used to store information such as audio files and video files. The data repository 150 may reside in various locations. For example, the data repository used by the server 120 may be local to the server 120, or may be remote from the server 120 and may communicate with the server 120 via a network-based or dedicated connection. The data repository 150 may be of different types. In some embodiments, the data repository used by the server 120 may be a database, such as a relational database. One or more of these databases may store, update, and retrieve data to and from the database in response to a command.

[0039] In some embodiments, one or more of the databases 150 may also be used by an application to store application data. The databases used by the application may be different types of databases, such as a key-value store, an object store, or a conventional store backed by a file system.

[0040] The motor vehicle 110 may include a sensor 111 for sensing the surrounding environment. The sensor 111 may include one or more of the following sensors: a visual camera, an infrared camera, an ultrasonic sensor, a millimeter wave radar, and a laser radar (LiDAR). Different sensors may provide different detection accuracy and range. The camera may be installed at the front, rear, or other location of the vehicle. The visual camera may capture the situation inside and outside the vehicle in real time and present it to the driver and / or passengers. In addition, by analyzing the images captured by the visual camera, information such as traffic light indications, intersection conditions, and the operating status of other vehicles may be obtained. The infrared camera may capture objects under night vision conditions. Ultrasonic sensors may be installed around the vehicle to measure the distance of objects outside the vehicle from the vehicle using the characteristics of strong ultrasonic directionality. Millimeter wave radars may be installed at the front, rear, or other location of the vehicle to measure the distance of objects outside the vehicle from the vehicle using the characteristics of electromagnetic waves. Laser radars may be installed at the front, rear, or other location of the vehicle to detect object edges and shape information, thereby identifying and tracking objects. Due to the Doppler effect, the radar device may also measure the speed change of the vehicle and the moving object.

[0041] The motor vehicle 110 may also include a communication device 112. The communication device 112 may include a satellite positioning module capable of receiving satellite positioning signals (e.g., Beidou, GPS, GLONASS, and GALILEO) from satellites 141 and generating coordinates based on these signals. The communication device 112 may also include a module for communicating with a mobile communication base station 142, and the mobile communication network may implement any suitable communication technology, such as GSM / GPRS, CDMA, LTE, and other current or evolving wireless communication technologies (e.g., 5G technology). The communication device 112 may also have a vehicle-to-vehicle or vehicle-to-everything (V2X) module, which is configured to implement, for example, vehicle-to-vehicle (V2V) communication with other vehicles 143 and vehicle-to-infrastructure (V2I) communication with infrastructure 144. In addition, the communication device 112 may also have a module configured to communicate with a user terminal 145 (including but not limited to a smartphone, a tablet computer, or a wearable device such as a watch) by, for example, using a wireless LAN or Bluetooth of the IEEE802.11 standard. Using the communication device 112, the motor vehicle 110 may also access the server 120 via the network 130.

[0042] The motor vehicle 110 may also include a control device 113. The control device 113 may include a processor that communicates with various types of computer-readable storage devices or media, such as a central processing unit (CPU) or a graphics processing unit (GPU), or other dedicated processors. The control device 113 may include an automatic driving system for automatically controlling various actuators in the vehicle. The automatic driving system is configured to control the powertrain, steering system, and braking system of the motor vehicle 110 (not shown) via multiple actuators in response to inputs from multiple sensors 111 or other input devices to control acceleration, steering, and braking, respectively, without human intervention or limited human intervention. Some processing functions of the control device 113 can be implemented through cloud computing. For example, some processing can be performed using an on-board processor, while other processing can be performed using computing resources in the cloud. The control device 113 can be configured to perform a method according to the present disclosure. In addition, the control device 113 can be implemented as an example of a computing device on the motor vehicle side (client) according to the present disclosure.

[0043] Figure 1 The system 100 may be configured and operated in various ways to enable the application of various methods and apparatuses described in the present disclosure.

[0044] According to the embodiments of the present disclosure, Figure 2 As shown, a memory allocation method for a target computing system is provided, including: step S201, by pre-applying for memory for an external device connected to the target computing system, obtaining a memory block corresponding to the external device, the memory block including multiple sub-memory blocks; step S202, in response to receiving a memory request from the external device, allocating a first sub-memory block in an idle state in the memory block to the external device; and step S203, in response to receiving a signal that the connection between the external device and the target computing system is interrupted, resetting the state of the sub-memory block allocated to the external device to an idle state.

[0045] Therefore, firstly, memory pre-application is performed for each external device to obtain an available memory block corresponding to the external device, and when the external device makes a memory request, the free sub-memory block is allocated to the external device; when the process of the external device is forcibly terminated due to the interruption of the connection between the external device and the target computing system, all allocated sub-memory blocks corresponding to the external device are reset to the free state to realize automatic recovery of the allocated memory, improve resource utilization, and avoid resource waste caused by the inability to use the allocated memory after the external device is restored.

[0046] In some embodiments, the target computing system may be a computing system based on one or more of a computer, a mobile phone, and a vehicle-mounted computer. The external device may be at least one of a voice device, a camera device, and a sensor device that is communicatively connected to the target computing system.

[0047] In some embodiments, pre-applying for memory for an external device connected to the target computing system may be pre-applying for memory of a computing unit in the target computing system, where the computing unit may be, for example, a graphics processor.

[0048] In some embodiments, the external device may be one or more. When pre-applying for memory, an independent memory area may be applied for each external device as a memory block corresponding to the external device, wherein each memory block may include multiple sub-memory blocks. It is understandable that the memory size of each sub-memory block and the number of sub-memory blocks may be determined according to actual needs and are not limited here.

[0049] In some embodiments, the target computing system may be activated in response to executing a memory pre-application operation for an external device connected to the target computing system, thereby further improving the efficiency of memory allocation.

[0050] After obtaining the corresponding memory block for each external device, a sub-memory block in an idle state can be obtained from the corresponding memory block in response to a memory request sent by the external device, and the sub-memory block can be allocated to the external device; in response to receiving a signal indicating that the connection between the external device and the target computing system is interrupted, the state of each allocated sub-memory block in the memory block corresponding to the external device is reset to an idle state, so that memory can be reallocated for the external device after the external device is restored.

[0051] Among them, the reasons for the interruption of the connection between the external device and the target computing system may include but are not limited to the interruption of the connection due to the crash or shutdown of the external device due to hardware failure or power problem, the interruption of the connection due to communication link failure, etc. These failures will cause the process being executed by the external device to be forced to terminate.

[0052] In some embodiments, the external device may include a camera device, and pre-applying for memory for the external device connected to the target computing system to obtain a memory block corresponding to the external device may include: obtaining pixels of the camera device; and obtaining a memory block corresponding to the camera device based on the pixels of the camera device, wherein the memory size of each sub-memory block in the memory block is determined based on the pixels of the camera device.

[0053] In some embodiments, the external device may be a camera device, and the target computing system may be an on-board computer or an edge computing device in a roadside device.

[0054] In some embodiments, the target computing system may be connected to multiple camera devices (e.g., 12), and the pixels of each camera device may be different. By determining the memory size of the corresponding sub-memory block according to the pixels of the camera device, it is possible to avoid resource waste caused by an overly large sub-memory block and improve resource utilization.

[0055] In some embodiments, the memory size of each sub-memory block in the memory block may be the memory size required for one frame of image captured by the camera device.

[0056] In some exemplary embodiments, the vehicle-mounted computer can be connected to 12 cameras, which can include 8 cameras with 8MP pixels and 4 cameras with 3MP pixels, wherein the required memory size for a frame of image taken by the 8MP pixel camera is approximately 7.8125MB, and the required memory size for a frame of image taken by the 3MP pixel camera is approximately 2.93MB. When pre-allocating memory for each camera, the memory size of the sub-memory block corresponding to the 8MP pixel camera can be determined to be 7.8125MB, and the memory size of the sub-memory block corresponding to the 3MP pixel camera can be determined to be 2.93MB. Thus, while improving resource utilization, the efficiency of image data processing can be further improved.

[0057] In some embodiments, the preset memory size may be increased based on the memory size required for the above-mentioned one frame of image to determine the memory size of the sub-memory block to prevent possible memory overflow.

[0058] In some embodiments, the target computing system may include a first driver and a second driver.

[0059] like Figure 3 As shown, in response to receiving a memory request from an external device, allocating a first sub-memory block in an idle state in a memory block to the external device may include: step S301, in response to receiving the memory request, the second driver sends a memory block allocation request to the first driver, the memory block allocation request includes a first identifier of the external device; step S302, in response to receiving the memory block allocation request, the first driver performs the following operations: step S3021, according to the first identifier, obtaining a first sub-memory block in the memory block corresponding to the external device; step S3022, sending the second identifier of the first sub-memory block to the second driver; and step S3023, updating the state of the first sub-memory block to an allocated state; and step S303, in response to receiving the second identifier, the second driver sends the second identifier to the external device to allocate the first sub-memory block to the external device.

[0060] Therefore, the memory allocation method of the embodiment of the present disclosure is implemented by modifying the existing driver, thereby reducing development costs, improving development efficiency, and improving the stability of the operation of the memory allocation solution.

[0061] In some embodiments, the first driver may be a driver for hardware initialization and resource allocation. The second driver may be a driver for managing and controlling external devices. It is understandable that relevant technicians may determine the first driver and the second driver according to actual needs, and no limitation is made here.

[0062] In some embodiments, the acquisition and management of the memory block may be performed by the first driver.

[0063] In some embodiments, pre-application of graphics card memory for an external device connected to a target computing system to obtain a memory block corresponding to the external device may include: in response to the start-up of the target computing system, completing registration of each camera device through a first driver program to obtain device identification information and pixels of each camera device; and applying for a corresponding memory block in the graphics memory for each camera device according to the pixels of each camera device through the first driver program.

[0064] The memory allocation method of the present disclosure will be further described below by taking an on-board computer and an on-board camera device as examples.

[0065] In some exemplary embodiments, the first driver may be a PCIE (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus) driver for implementing hardware initialization and resource allocation. The second driver may be a V4L2 (Video for Linux 2, a kernel driver for video devices in the Linux kernel) driver for implementing video or image data processing and camera device management and control.

[0066] Figure 4 An architectural diagram of a first driver and a second driver according to an exemplary embodiment of the present disclosure is shown.

[0067] In some exemplary embodiments, Figure 4 As shown, the external device (eg, vehicle-mounted camera device) can interact with the second driver program through the external device driver program (eg, camera device driver program). The second driver program and the first driver program can interact with each other through a preset interface.

[0068] In some exemplary embodiments, see Figure 4The first driver is used to manage the memory blocks V0 to V11 pre-applied when the system starts. The flowchart of memory pre-application can be found in Figure 5 In response to the memory pre-application process starting, the first driver pre-applies for a corresponding memory block for each camera device according to information such as pixels of each camera device.

[0069] In some exemplary embodiments, the first driver may implement memory pre-application for each camera device through a dma_alloc_attrs function.

[0070] Continue to see Figure 4 , memory blocks V0 to memory blocks V11 correspond to 12 camera devices (camera device v0 to camera device v11) respectively, and each memory block includes n memory blocks, which can be identified as buffer 1, buffer 2, ..., buffer n respectively.

[0071] In response to the second driver receiving a memory request from a camera device, the second driver obtains a free sub-memory block (the first sub-memory block mentioned above) from the memory block corresponding to the camera device managed by the first driver, and allocates the sub-memory block to the camera device.

[0072] In response to the second driver receiving a signal that a camera device is shutting down (for example, in response to a camera device being shut down, the second driver closes the file descriptor corresponding to the camera device), a first release instruction can be sent to the first driver to reset the status of each allocated sub-memory block corresponding to the camera device to an idle state.

[0073] Figure 6 A flowchart of allocating sub-memory blocks to an imaging device according to an exemplary embodiment of the present disclosure is shown.

[0074] In some exemplary embodiments, Figure 6 As shown, in response to the second driver receiving a memory request from a camera device, a memory allocation process is triggered, and a memory block allocation request is sent to the first driver by calling a memory allocation function (e.g., get_dma_attrs), wherein the memory block allocation request includes a first identifier of the camera device (e.g., the above-mentioned device identifier v1). After receiving the above-mentioned request, the first driver can determine the memory block corresponding to the camera device according to the first identifier, and perform status detection on multiple sub-memory blocks in the memory block in sequence, and in response to detecting a sub-memory block in an idle state, return the address of the sub-memory block to the second driver, so that the second driver can allocate the sub-memory block to the camera device, and at the same time, the first driver can set the state of the sub-memory block to an allocated state.

[0075] In some embodiments, the above-mentioned memory allocation method for the target computing system may also include: in response to receiving a memory release signal of the first sub-memory block sent by an external device, the second driver sends a second release request to the first driver, the second release request includes a first identifier of the external device and a second identifier of the first sub-memory block; and in response to receiving the second release request, the first driver updates the state of the first sub-memory block to an idle state according to the first identifier and the second identifier.

[0076] In some embodiments, in response to the completion of a process of a certain camera device, the sub-memory block occupied by the process can be released. In some embodiments, the camera device can send a memory release signal of the corresponding sub-memory block to the second driver, and after receiving the signal, the second driver can send a second release request to the first driver (for example, it can be implemented by the put_dma_attrs function), wherein the request carries the first identification of the camera device (the above-mentioned device identification v1) and the second identification of the sub-memory block (for example, the identification buffer 2 of the above-mentioned sub-memory block).

[0077] After receiving the request, the first driver can find the corresponding sub-memory block in the corresponding memory block (for example, find the sub-memory block buffer 2 in the memory block V1) according to the above identifier, and reset the state of the sub-memory block to an idle state.

[0078] As a result, the sub-memory blocks of the terminated processes can be recovered in time, thereby further improving the utilization rate of memory resources.

[0079] In some embodiments, in response to receiving a signal indicating that a connection between an external device and a target computing system is interrupted, resetting the state of a sub-memory block allocated to the external device to an idle state may include: in response to receiving the signal, a second driver sending a first release request to a first driver, the first release request including a first identifier of the external device; and in response to receiving the first release request, the first driver resetting the state of each sub-memory block in an allocated state in a memory block corresponding to the external device to an idle state based on the first identifier.

[0080] Therefore, the memory allocation method of the embodiment of the present disclosure is implemented by modifying the existing driver, thereby reducing development costs, improving development efficiency, and improving the stability of the operation of the memory allocation solution.

[0081] Figure 7 A flowchart of releasing a sub-memory block according to an exemplary embodiment of the present disclosure is shown.

[0082] In some exemplary embodiments, in response to a camera device being shut down during operation, after the second driver receives a signal indicating that the camera device is shut down (for example, in response to a camera device being shut down, the second driver closes the file descriptor corresponding to the camera device), a memory release process may be triggered, and the state of all sub-memory blocks allocated to the camera device may be reset to an idle state by calling a memory release function (for example, put_dma_attrs). After the camera device is turned on again, these memory blocks may be reallocated to the camera device according to a memory request.

[0083] In some embodiments, the above-mentioned memory allocation method for a target computing system may further include: in response to the target computing system being shut down, the first driver program releases the memory block.

[0084] Figure 8 A flowchart of releasing a memory block according to an exemplary embodiment of the present disclosure is shown.

[0085] In some exemplary embodiments, Figure 8 As shown, in response to the vehicle-mounted computer shutting down, the first driver can release the memory blocks corresponding to the applied camera devices by calling the memory release function (e.g., dma_free_attrs). Thus, when the target computing system is shut down, all the applied memory blocks are released in time, thereby avoiding the waste of resources caused by the memory resources still being occupied after the system is shut down.

[0086] In some embodiments, Fig. 9 As shown, a memory allocation device 900 for a target computing system is provided, comprising: an acquisition unit 910, configured to acquire a memory block corresponding to an external device connected to the target computing system by pre-applying for memory for the external device, the memory block comprising a plurality of sub-memory blocks; an allocation unit 920, configured to allocate a first sub-memory block in an idle state in the memory block to the external device in response to receiving a memory request from the external device; and a reset unit 930, configured to reset the state of the sub-memory block allocated to the external device to an idle state in response to receiving a signal indicating that the connection between the external device and the target computing system is interrupted.

[0087] The operations performed by units 910 to 930 in the memory allocation device 900 for the target computing system and the effects achieved are similar to steps S201 to S203 in the memory allocation method for the target computing system, and are not described in detail again.

[0088] In some embodiments, the target computing system may include a first driver and a second driver, and the allocation unit may include: a first sending sub-unit, configured to, in response to receiving a memory request, cause the second driver to send a memory block allocation request to the first driver, wherein the memory block allocation request includes a first identifier of an external device; a first execution sub-unit, configured to, in response to receiving the memory block allocation request, cause the first driver to perform the following operations: obtain a first sub-memory block in a memory block corresponding to the external device according to the first identifier; send a second identifier of the first sub-memory block to the second driver; and update the status of the first sub-memory block to an allocated status; and a second sending sub-unit, configured to, in response to receiving the second identifier, cause the second driver to send the second identifier to the external device to allocate the first sub-memory block to the external device.

[0089] In some embodiments, the reset unit may include: a third sending sub-unit, configured to, in response to receiving a signal, cause the second driver to send a first release request to the first driver, the first release request including a first identifier of the external device; and a first reset sub-unit, configured to, in response to receiving the first release request, cause the first driver to reset the state of each allocated sub-memory block in the memory block corresponding to the external device to an idle state based on the first identifier.

[0090] In some embodiments, the above-mentioned memory allocation device for the target computing system may also include: a sending unit, configured to respond to receiving a memory release signal of the first sub-memory block sent by an external device, by which the second driver sends a second release request to the first driver, the second release request including a first identifier of the external device and a second identifier of the first sub-memory block; and an updating unit, configured to respond to receiving the second release request, by which the first driver updates the state of the first sub-memory block to an idle state according to the first identifier and the second identifier.

[0091] In some embodiments, the memory allocation device for the target computing system may further include: a releasing unit configured to release the memory block by the first driver in response to the target computing system being shut down.

[0092] In some embodiments, the external device may include a camera device, and the acquisition unit may include: a first acquisition sub-unit, configured to acquire pixels of the camera device; and a second acquisition sub-unit, configured to acquire a memory block corresponding to the camera device based on the pixels of the camera device, wherein the memory size of each sub-memory block in the memory block is determined based on the pixels of the camera device.

[0093] In some embodiments, the memory size of each sub-memory block in the memory block may be the memory size required for one frame of image captured by the camera device.

[0094] According to an embodiment of the present disclosure, an electronic device, a readable storage medium and a computer program product are also provided.

[0095] According to another aspect of the present disclosure, an edge computing device is also provided. Optionally, the edge computing device may include not only electronic devices but also communication components, and the electronic devices and communication components may be integrated or separately provided. The electronic devices may obtain data from roadside sensing devices (such as roadside cameras), such as pictures and videos, to perform image and video processing and data calculation, and then transmit the processing and calculation results to the cloud control platform via the communication components.

[0096] Optionally, the edge computing device may also be a road side computing unit (RSCU). Optionally, the electronic device itself may also have the perception data acquisition function and communication function, such as an AI camera. The electronic device can directly perform image and video processing and data calculation based on the acquired perception data, and then transmit the processing and calculation results to the cloud control platform.

[0097] Optionally, the cloud control platform performs processing in the cloud to perform image and video processing and data calculation. The cloud control platform can also be called a vehicle-road collaborative management platform, V2X platform, cloud computing platform, central system, cloud server, etc.

[0098] refer to Fig.10 , a block diagram of an electronic device 1000 that can be used as a server or client of the present disclosure will now be described, which is an example of a hardware device that can be applied to various aspects of the present disclosure. The electronic device is intended to represent various forms of digital electronic computer devices, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.

[0099] like Fig.10As shown, the electronic device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 can also be stored. The computing unit 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.

[0100] Multiple components in the electronic device 1000 are connected to the I / O interface 1005, including: an input unit 1006, an output unit 1007, a storage unit 1008, and a communication unit 1009. The input unit 1006 can be any type of device that can input information to the electronic device 1000. The input unit 1006 can receive input digital or character information, and generate key signal input related to user settings and / or function control of the electronic device, and can include but is not limited to a mouse, a keyboard, a touch screen, a track pad, a track ball, a joystick, a microphone, and / or a remote controller. The output unit 1007 can be any type of device that can present information, and can include but is not limited to a display, a speaker, a video / audio output terminal, a vibrator, and / or a printer. The storage unit 1008 can include but is not limited to a disk and an optical disk. The communication unit 1009 allows the electronic device 1000 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks, and may include but is not limited to a modem, a network card, an infrared communication device, a wireless communication transceiver and / or a chipset, such as a Bluetooth device, an 802.11 device, a WiFi device, a WiMax device, a cellular communication device and / or the like.

[0101] The computing unit 1001 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 1001 performs the various methods and processes described above, such as the memory allocation method for the target computing system disclosed in the present invention. For example, in some embodiments, the memory allocation method for the target computing system disclosed in the present invention may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 1008. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded into the RAM 1003 and executed by the computing unit 1001, one or more steps of the memory allocation method for the target computing system described above may be performed. Alternatively, in other embodiments, the computing unit 1001 may be configured to execute the memory allocation method for the target computing system of the present disclosure in any other appropriate manner (for example, by means of firmware).

[0102] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0103] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.

[0104] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0105] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0106] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0107] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.

[0108] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.

[0109] Although the embodiments or examples of the present disclosure have been described with reference to the accompanying drawings, it should be understood that the above-mentioned methods, systems and devices are merely exemplary embodiments or examples, and the scope of the present invention is not limited by these embodiments or examples, but only by the claims after authorization and their equivalent scope. Various elements in the embodiments or examples can be omitted or replaced by their equivalent elements. In addition, each step can be performed in an order different from that described in the present disclosure. Further, the various elements in the embodiments or examples can be combined in various ways. It is important that with the evolution of technology, many elements described herein can be replaced by equivalent elements that appear after the present disclosure.

Claims

1. A memory allocation method for a target computing system, comprising: By performing a memory pre-application for an external device connected to the target computing system, a memory block corresponding to the external device is obtained, wherein the memory block includes a plurality of sub-memory blocks; In response to receiving a memory request from the external device, allocating a first sub-memory block in the memory block that is in an idle state to the external device; as well as In response to receiving a signal indicating that the connection between the external device and the target computing system is interrupted, the state of the sub-memory block allocated to the external device is reset to an idle state.

2. The method according to claim 1, wherein: The target computing system includes a first driver and a second driver, and in response to receiving a memory request from the external device, allocating a first sub-memory block in the memory block that is in an idle state to the external device includes: In response to receiving the memory request, the second driver sends a memory block allocation request to the first driver, wherein the memory block allocation request includes a first identifier of the external device; In response to receiving the memory block allocation request, the first driver performs the following operations: According to the first identifier, obtaining the first sub-memory block in the memory block corresponding to the external device; sending a second identifier of the first sub-memory block to the second driver; and Updating the state of the first sub-memory block to an allocated state; and In response to receiving the second identifier, the second driver sends the second identifier to the external device to allocate the first sub-memory block to the external device.

3. The method according to claim 2, wherein: In response to receiving a signal indicating that the connection between the external device and the target computing system is interrupted, resetting the state of the sub-memory block allocated to the external device to an idle state comprises: In response to receiving the signal, the second driver sends a first release request to the first driver, wherein the first release request includes a first identifier of the external device; and In response to receiving the first release request, the first driver program resets the state of each allocated sub-memory block in the memory block corresponding to the external device to an idle state according to the first identifier.

4. The method according to claim 2 or 3, further comprising: In response to receiving a memory release signal of the first sub-memory block sent by the external device, the second driver sends a second release request to the first driver, where the second release request includes a first identifier of the external device and a second identifier of the first sub-memory block; as well as In response to receiving the second release request, the first driver updates the state of the first sub-memory block to an idle state according to the first identifier and the second identifier.

5. The method according to any one of claims 2 to 4, further comprising: In response to the target computing system shutting down, the memory block is released by the first driver.

6. The method according to any one of claims 1 to 5, wherein: The external device includes a camera device, and the pre-application for memory of the external device connected to the target computing system to obtain a memory block corresponding to the external device includes: Acquiring pixels of the camera device; and The memory block corresponding to the camera device is acquired according to the pixels of the camera device, wherein the memory size of each sub-memory block in the memory block is determined based on the pixels of the camera device.

7. The method according to claim 6, wherein: The memory size of each sub-memory block in the memory block is the required memory size for one frame of image captured by the camera device.

8. A memory allocation device for a target computing system, comprising: An acquisition unit is configured to acquire a memory block corresponding to the external device connected to the target computing system by performing a memory pre-application for the external device, wherein the memory block includes a plurality of sub-memory blocks; an allocating unit, configured to allocate a first sub-memory block in the memory block that is in an idle state to the external device in response to receiving a memory request from the external device; as well as The reset unit is configured to reset the state of the sub-memory block allocated to the external device to an idle state in response to receiving a signal indicating that the connection between the external device and the target computing system is interrupted.

9. The device according to claim 8, wherein: The target computing system includes a first driver and a second driver, and the allocation unit includes: A first sending subunit is configured to, in response to receiving the memory request, send a memory block allocation request from the second driver to the first driver, wherein the memory block allocation request includes a first identifier of the external device; The first execution subunit is configured to, in response to receiving the memory block allocation request, cause the first driver to perform the following operations: According to the first identifier, obtaining the first sub-memory block in the memory block corresponding to the external device; sending a second identifier of the first sub-memory block to the second driver; and Updating the state of the first sub-memory block to an allocated state; and The second sending subunit is configured to, in response to receiving the second identifier, have the second driver program send the second identifier to the external device so as to allocate the first sub-memory block to the external device.

10. The device according to claim 9, wherein: The reset unit comprises: a third sending subunit, configured to, in response to receiving the signal, send a first release request from the second driver to the first driver, wherein the first release request includes a first identifier of the external device; and The first resetting sub-unit is configured to, in response to receiving the first release request, reset the state of each allocated sub-memory block in the memory block corresponding to the external device to an idle state according to the first identifier by the first driver.

11. The device according to claim 9 or 10, further comprising: a sending unit, configured to, in response to receiving a memory release signal of the first sub-memory block sent by the external device, send a second release request from the second driver to the first driver, wherein the second release request includes a first identifier of the external device and a second identifier of the first sub-memory block; as well as The updating unit is configured to, in response to receiving the second release request, update the state of the first sub-memory block to an idle state by the first driver according to the first identifier and the second identifier.

12. The device according to any one of claims 9 to 11, further comprising: A release unit is configured to release the memory block by the first driver in response to the target computing system being shut down.

13. The device according to any one of claims 8 to 12, wherein: The external device includes a camera device, and the acquisition unit includes: A first acquisition subunit is configured to acquire pixels of the camera device; and The second acquisition subunit is configured to acquire the memory block corresponding to the camera device according to the pixels of the camera device, wherein the memory size of each sub-memory block in the memory block is determined based on the pixels of the camera device.

14. The device according to claim 13, wherein: The memory size of each sub-memory block in the memory block is the required memory size for one frame of image captured by the camera device.

15. An electronic device, comprising: at least one processor; as well as a memory communicatively coupled to the at least one processor; in The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.

16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to make a computer execute the method according to any one of claims 1-7.

17. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

18. An autonomous driving vehicle comprising: at least one video camera; as well as The electronic device as claimed in claim 15.

19. An edge computing device, comprising: at least one video camera; as well as The electronic device as claimed in claim 15.

Citation Information

Patent Citations

  • Communication method and device for user domain and equipment, and automobile

    CN115396478A

  • Model deployment data storage management method and device based on memory pool

    CN117271112A

  • DToF device initialization method and electronic equipment

    CN117707627A

  • Signal lamp detection method, device and system and automatic driving vehicle

    CN117710939A

  • PCIe equipment hot insertion method and device, electronic equipment and medium

    CN117873937A