Unmanned driving shared memory intelligent management method
Obtain the memory block size required by the application through hidden points, and use the clustering algorithm and dichotomy method to automatically adjust the memory block size and quantity, solving the problems of low shared memory segment allocation efficiency and memory overflow, and improving memory utilization and overflow locating speed.
Patent Information
- Application Number
- CN202411157029.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-22
- Publication Date
- 2025-01-21
AI Technical Summary
In the prior art, the allocation of shared memory segments requires users to make subjective adjustments. The adjustment is difficult and inefficient, and it is easy to lead to large granularity of memory block size and quantity, resulting in low shared memory utilization rate and memory overflow problems. Impacts system stability.
Obtain the memory block size required by the application through buried points, use the elbow rule and K-Means clustering algorithm to calculate a reasonable memory block size and quantity, combine the dichotomy method to adjust the number of memory blocks, and automatically calculate and adjust the memory block size and quantity. , avoid shared memory overflow, and reduce the impact of overflow through multi-segment physical memory organization and index linking methods.
It improves the allocation efficiency and utilization of shared memory, reduces the impact scope of shared memory overflow, increases the speed of locating overflow points, and reduces manual intervention and error rates.
Smart Images

Figure CN119336526A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of communication middleware for unmanned driving systems, and specifically relates to the technical field of local communication based on shared memory, and in particular to an intelligent management method for unmanned driving shared memory. Background Art
[0002] The implementation of unmanned driving applications usually involves modules such as perception, planning, decision-making, and control. The information transmission between these modules needs to rely on communication middleware. At present, the commonly used communication middleware in unmanned driving includes DDS, ICEORYX, APOLLO, SOME / IP, etc.
[0003] As an important part of communication middleware, local communication can be implemented by various technical means, such as pipelines, message queues, sockets and shared memory. With the increase of complexity of unmanned systems, the amount of data transmission has also increased dramatically. Therefore, the current mainstream technical means of implementation is based on shared memory, which can effectively avoid data copying and even achieve zero copy of data. The present invention is an engineering optimization of shared memory allocation based on ICEORYX, the Ice Antelope middleware.
[0004] The existing technology mainly applies for a continuous shared memory segment for storing user data. At the same time, considering that the length of user data may be different, the above continuous shared memory segment is divided into memory blocks of different sizes and numbers. The specific allocation plan of the shared memory segment needs to be determined by the user according to the complexity of data interaction between application modules.
[0005] The existing scheme similar to the present invention is as follows: Under normal circumstances, a process, usually called a daemon process, is responsible for creating and managing a shared memory segment for storing user data. The sender and the receiver are linked to the shared memory segment, and the processes of both parties can directly read and write the shared memory segment, thereby realizing data transmission between different modules. These user data include a variety of sensor raw data, target detection data, planning data, control data, etc. Considering that the sizes of different data vary greatly, in order to manage these data more effectively, the shared memory segment is organized into the form of a memory pool. A shared memory segment contains multiple memory pools, and different memory pools store memory blocks of different sizes. The same memory pool contains multiple memory blocks of the same size to meet the communication needs of data of different sizes. The size of the shared memory segment is calculated by the size and number of the memory blocks.
[0006] The allocation of the continuous shared memory segment is illustrated by an example. For example, the stable operation of the application requires 10,000 1KB memory blocks, 2,000 256KB memory blocks, and 200 1024KB memory blocks. The above memory block sizes and quantities are provided to the daemon process in the form of a configuration file. The daemon process calculates the size of the required shared memory segment based on the configuration file and divides the memory pool and memory blocks. The configuration file is as follows:
[0007]
[0008] The actual physical memory of the shared memory segment is organized as follows Figure 1 As shown, memory segments of different sizes and numbers are distributed continuously.
[0009] The shared memory segment is managed and organized in the daemon process as follows Figure 2 As shown, the shared memory segment is divided into three memory pools. Memory pool 1 contains 10000 1KB memory blocks, memory pool 2 contains 2000 256KB memory blocks, and memory pool 3 contains 200 1024KB memory blocks.
[0010] After the shared memory segment is created and organized, the sender and receiver processes can start inter-process communication. The sender and receiver can communicate in 1-to-1, 1-to-many, many-to-1, many-to-many and other modes. The detailed communication process is as follows: Figure 3 As shown:
[0011] 1) Start the daemon process, which creates a shared memory segment and organizes and divides the memory pool and memory block according to the user configuration file.
[0012] 2) The sender links to the shared memory segment created by the daemon process and applies for a memory block of the corresponding size on demand. The underlying layer will return a memory block address of a size not less than the size based on the size of the data passed in by the user and provide it to the user.
[0013] 3) After processing the user logic, for example, the image target detection task, the user can write the detected target result into the memory block and push the memory block address into the data sending buffer, where the data sending buffer is a table storing memory addresses. The buffer size, i.e., the size of the table, represents the number of tasks that can be queued for processing, and notifies interested recipients to receive the tasks.
[0014] 4) Upon receiving notification from the sender, the bottom layer will automatically push the memory block address storing the image target detection result data to the data receiving buffer, where the data receiving buffer is a table storing memory addresses, and the buffer size, i.e., the size of the table, represents the number of tasks that can be queued for processing.
[0015] 5) The receiver periodically polls the receiving buffer, obtains the data of interest from the buffer, and executes the receiving user logic. Of course, it can also be set to trigger the receiver to perform corresponding operations when new data arrives in the receiving buffer.
[0016] 6) When the user no longer needs to access the corresponding memory block, the memory block release operation is executed, that is, the reference count corresponding to the memory block is reduced by 1, and the memory block is returned to the memory pool, thus completing a sending and receiving link.
[0017] Unmanned driving applications rely on multiple senders and receivers between modules to complete the flow of upstream and downstream data and realize related functions.
[0018] The configuration file for shared memory segment allocation needs to be initialized based on the user's understanding of the application, that is, the number of memory pools and the size and number of memory blocks stored in them must be estimated to form a preliminary configuration file, and then it must be adjusted repeatedly based on the application's operating conditions. For example, the log of the communication middleware layer will indicate that the number of memory blocks of a certain size is insufficient, and the number of memory blocks of the corresponding size needs to be increased until the application runs stably.
[0019] There are two main defects in the existing technology. First, the allocation of shared memory segments requires users to adjust subjectively, which is difficult and inefficient. It is difficult for users to grasp the size of all application data. During the adjustment process, it is easy to cause the size and number of memory blocks to be larger. For example, the application only needs 100 128KB memory blocks, but it is finally adjusted to 200 128KB memory blocks, or 100 256KB memory blocks, or 150 256KB memory blocks, which will cause low utilization of shared memory. This problem is particularly prominent when the physical memory of the vehicle domain controller is small.
[0020] Second, according to the process of the local communication solution mentioned above, the sender needs to apply for a memory block in advance before sending data, and then fill the data into the memory block. The size of the data filled by the user may be larger than the size of the memory block, causing memory overflow. At the same time, even if the data is filled correctly, subsequent operations on the memory block are likely to cause memory overflow. Similarly, when the receiver receives the data and operates on the data, it may also cause memory overflow.
[0021] When memory overflows, not only will the current process crash abnormally, but other processes using the overflowed memory block will also crash abnormally, which can easily cause the entire system to crash.
[0022] In addition, this problem requires users to systematically check each module to locate the overflow point, which makes solving the problem inefficient. Summary of the invention
[0023] 1. Technical issues to be resolved
[0024] The technical problem to be solved by the present invention is: in view of the two main defects of the prior art, there are two technical problems to be solved by the present invention. In view of the defect 1 mentioned above, the main technical problem to be solved by the present invention is: how to improve the allocation efficiency and utilization rate of shared memory. In view of the defect 2 mentioned above, the main technical problem to be solved by the present invention is: how to efficiently give the size and number of memory blocks, minimize the size of shared memory segments as much as possible, reduce the impact of shared memory overflow on functions, and improve the location speed of shared memory overflow points.
[0025] (II) Technical solution
[0026] In order to solve the above technical problems, the present invention provides an unmanned driving shared memory intelligent management method, the method comprising the following steps:
[0027] Step 1: First, based on the experience of defining data for unmanned driving applications, a larger-granularity memory allocation method is given, namely, a configuration file, which is given to the daemon process. The application is started, and the memory size and amount are roughly adjusted according to the prompts to ensure that the application can run normally, thereby facilitating subsequent operations.
[0028] Step 2: Then start the daemon and application, and obtain the memory block size required by the application through the tracking method. That is, after the sender applies for the memory block, the required data size passed in by the user is sent to the daemon, and the statistics are continuously kept for a certain period of time. The maximum value of the data size required by each sender within a certain period of time is counted as the final required memory block size; here, a collection of required memory block size data is obtained Among them, m i represents the size of the i-th required memory block, and n is the number of required memory blocks;
[0029] In order to avoid the fragmentation of shared memory and improve management efficiency, the number of memory pools needs to be limited. To this end, the clustering algorithm in statistical methods is used to calculate the appropriate size of multiple memory blocks.
[0030] Finally, to determine the number corresponding to the above memory blocks, it is necessary to consider the size of the data sending buffer and the data receiving buffer corresponding to the memory blocks. The sending and receiving communication mode is essentially a producer and consumer mode, which is divided into two cases. One is that the producer's production speed is greater than the consumer's consumption speed, which will cause the positions of the data sending and receiving buffers to be occupied. In this case, the maximum number of memory blocks used is the second. The consumer's consumption speed is greater than or equal to the producer's production speed. In this case, the data sending buffer and the receiving buffer only occupy one position respectively. In this case, the minimum number of memory blocks used is the minimum value.
[0031] Among them, in the step 1, the content of the configuration file is as follows: 10,000 1024KB memory blocks, 5,000 16,384KB memory blocks, 2,000 131,072KB memory blocks, 2,000 262,144KB memory blocks, 1,000 524,288,000KB memory blocks, 100 1,048,576KB memory blocks, and 50 4,194,304KB memory blocks; the physical memory organization form corresponding to the configuration file forms a plurality of memory pools, the memory blocks in each memory pool are of the same size, and the memory blocks in different memory pools have different sizes.
[0032] Wherein, in the step 2, the required data size input by the user is sent to the daemon process via UDS communication.
[0033] Among them, in step 2, the required data size passed in by the user is sent to the daemon process and counted for 60 seconds. This is because the data size required by the user may be of indefinite length. Therefore, the maximum value of the data size required by each sender within 60 seconds is counted as the size of the final required memory block.
[0034] Wherein, in the step 2, a clustering algorithm in a statistical method is used to calculate and obtain a plurality of appropriate memory block sizes; specifically, as follows:
[0035] First, the optimal number of clusters is selected using the elbow rule;
[0036] Then, the K-Means clustering algorithm is applied to process the memory block size set M to obtain the division of memory clusters. Among them, C i represents the i-th memory cluster, k is the number of memory clusters; to ensure that the selected memory block size can meet the needs of all memory blocks in the memory cluster, each memory cluster C i The maximum value in is defined as the final memory block size, denoted as max(C i )=max{m ij |m ij ∈C i}, where m ij Represents the j-th required memory block size belonging to the i-th memory cluster in the set M.
[0037] The process of determining the number of memory blocks in step 2 is as follows:
[0038] Let C i A memory block m in the cluster ij , the corresponding data sending buffer size is sq ij , the corresponding data receiving buffer size is rq ij , then C i Cluster is the maximum size of memory block (Ci )The maximum number of memory blocks required is The minimum number of memory blocks is 2|C i |, where |C i Represents C i The number of memory blocks in the cluster;
[0039] The final required shared memory segment size is calculated as follows:
[0040]
[0041] Among them, k is the number of cluster centers determined by the elbow rule, S max is the maximum value of the shared memory segment required, S min is the minimum size of the shared memory segment required.
[0042] Among them, considering that the application can run stably in any case, the shared memory segment is created and allocated according to the required maximum number of memory blocks; in special cases, if the number of memory blocks is set as large as required and the physical memory of the domain controller is too large, the binary method is used to adjust the number of memory blocks in the memory pool one by one until the configuration of minimizing the shared memory segment is found and the application can run stably. It should be noted that the adjustment needs to start from the memory pool that stores larger memory blocks.
[0043] Among them, the above-mentioned steps, from starting and running the daemon process and application, to collecting the memory block size required by the system through tracking points, to determining the memory pool and memory block size and quantity range using the elbow rule and K-Means algorithm, and then to obtaining the minimum shared memory configuration under stable application operation through dichotomy, can all be automatically performed through scripts without human intervention, and finally directly provide users with an optimal available configuration for direct use.
[0044] In addition, in order to reduce the impact of shared memory overflow on functions and improve the location speed of shared memory overflow, in order to avoid the impact of shared memory overflow on functions being too large, the continuous physical memory organization form is modified to a multi-segment physical memory organization form, and multiple memory pools are separated from each other to form a multi-segment discontinuous physical memory organization form;
[0045] By creating multiple shared memory segments and linking them to different memory pools through indexes, that is, a memory pool index is set in a certain memory pool to connect to the first memory block of other memory pools;
[0046] Through the optimization of shared memory allocation, even if a process overflows at the end memory block of a memory pool, it will not affect the process using the first memory block in another memory pool, thereby avoiding excessive impact on the function.
[0047] In addition, in order to quickly locate the overflow point, a header and a tail are added before and after each memory block that stores user data to store the service name. Judgment is added in places where shared memory overflow is likely to occur to compare whether the service names stored in the header and tail are consistent. If they are inconsistent, it can be confirmed that an exception has occurred there, and an exception is thrown to inform the user of the service that caused the exception, so that the shared memory overflow point can be quickly located.
[0048] (III) Beneficial effects
[0049] Compared with the prior art, the key points of the present invention are as follows:
[0050] 1. Determine the number of memory pools through the elbow rule;
[0051] 2. Get a reasonable memory block size through the K-Means algorithm;
[0052] 3. Use the binary method to adjust the number of memory blocks again;
[0053] 4. Automatically calculate and adjust the size and quantity of memory blocks without manual intervention;
[0054] 5. Allocate corresponding shared memory segments for each memory pool;
[0055] 6. Add service name identifiers at the head and tail of the memory block as a basis for judging shared memory overflow;
[0056] 7. Add shared memory overflow monitoring points in key execution logic.
[0057] Compared with the closest prior art, the technical effects of the present invention are:
[0058] 1. Compared with the previous coarse-grained adjustment of shared memory allocation, a more reasonable shared memory allocation strategy is obtained through the elbow rule and K-Means algorithm to improve the allocation efficiency and utilization of shared memory.
[0059] 2. Adjust the number of memory blocks through binary search to further improve the shared memory utilization.
[0060] 3. Compared with the previous manual adjustment by users, the allocation and adjustment of shared memory can now be automatically realized through scripts, which improves efficiency and reduces the error rate.
[0061] 3. The present application can effectively reduce the impact scope of shared memory overflow by dividing the continuous shared memory segment in the prior art into multiple continuous shared memory segments.
[0062] 4. The prior art does not prevent shared memory overflow. The present application adds service name identifiers to the head and tail of the memory block and adds shared memory monitoring points to the key execution logic, so that the shared memory overflow point can be quickly located. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1-Figure 3 It is a schematic diagram of the prior art.
[0064] Figure 4 Schematic diagram before and after the shared memory segment is modified.
[0065] Figure 5 A schematic diagram showing multiple shared memory segments linked to different memory pools by indexing.
[0066] Figure 6 Schematic diagram of the memory block layout before and after modification.
[0067] Figure 7 This is the sending timing diagram.
[0068] Figure 8 This is the receiving timing diagram. DETAILED DESCRIPTION
[0069] In order to make the purpose, content, and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the accompanying drawings and examples.
[0070] In order to solve the problems in the prior art, the present invention provides an unmanned driving shared memory intelligent management method, the method comprising the following steps:
[0071] Step 1: First, based on the experience of defining data for unmanned driving applications, a larger-granularity memory allocation method is given, namely, a configuration file, which is given to the daemon process. The application is started, and the memory size and amount are roughly adjusted according to the prompts to ensure that the application can run normally, thereby facilitating subsequent operations.
[0072] The configuration file content is as follows: 10,000 1024KB memory blocks, 5,000 16,384KB memory blocks, 2,000 131,072KB memory blocks, 2,000 262,144KB memory blocks, 1,000 524,288,000KB memory blocks, 100 1,048,576KB memory blocks, and 50 4,194,304KB memory blocks.
[0073]
[0074]
[0075] Step 2: Then start the daemon and application, and obtain the memory block size required by the application through the tracking method. That is, after the sender applies for the memory block, the required data size passed by the user is sent to the daemon through UDS (UNIX Domain Socket) communication, and the statistics are continuously counted for 60 seconds. This is because the data size required by the user may be of variable length. Therefore, the maximum data size required by each sender within 60 seconds is counted as the final required memory block size; here you will get a collection of required memory block size data Among them, m i represents the size of the i-th required memory block, and n is the number of required memory blocks;
[0076] In order to avoid the fragmentation of shared memory and improve management efficiency, the number of memory pools needs to be limited. To this end, the clustering algorithm in the statistical method is used to calculate the appropriate size of multiple memory blocks. First, the elbow rule is used to select the best number of clusters, and then the K-Means clustering algorithm is applied to process the memory block size set M to obtain the division of memory clusters. Among them, C i represents the i-th memory cluster, k is the number of memory clusters; to ensure that the selected memory block size can meet the needs of all memory blocks in the memory cluster, each memory cluster C i The maximum value in is defined as the final memory block size, denoted as max(C i )=max{m ij |m ij ∈C i}, where m ij represents the jth required memory block size belonging to the i-th memory cluster in the set M;
[0077] Finally, to determine the number corresponding to the above memory blocks, it is necessary to consider the size of the data sending buffer and the data receiving buffer corresponding to the memory blocks. The sending and receiving communication mode is essentially a producer and consumer mode, which is divided into two cases. One is that the producer's production speed is greater than the consumer's consumption speed, which will cause the positions of the data sending and receiving buffers to be full. In this case, the maximum number of memory blocks used is the second. The consumer's consumption speed is greater than or equal to the producer's production speed. In this case, the data sending buffer and the receiving buffer only occupy 1 position respectively. In this case, the minimum number of memory blocks used is the minimum value.
[0078] Let C i A memory block m in the cluster ij , the corresponding data sending buffer size is sq ij , the corresponding data receiving buffer size is rq ij , then C i Cluster is the maximum size of memory block (C i)The maximum number of memory blocks required is The minimum number of memory blocks is 2|C i |, where |C i Represents C i The number of memory blocks in the cluster; the final required shared memory segment size calculation formula is, Among them, k is the number of cluster centers determined by the elbow rule, S max is the maximum value of the shared memory segment required, S min is the minimum value of the shared memory segment required;
[0079] Generally, considering that the application can run stably in any case, the shared memory segment is created and allocated according to the maximum number of memory blocks required; in special cases, if the number of memory blocks is set as large as required and the physical memory occupied by the domain controller is too large, the binary method can be used to adjust the number of memory blocks in the memory pool one by one until the configuration of the minimum shared memory segment is found and the application can run stably. It should be noted that the adjustment should start from the memory pool with larger memory blocks;
[0080] The above steps, from starting and running the daemon process and application, to collecting the memory block size required by the system through tracking points, to determining the memory pool and memory block size and quantity range using the elbow rule and K-Means algorithm, and then to obtaining the minimum shared memory configuration under stable application operation through the dichotomy method, can all be automatically performed through scripts without human intervention. Finally, the user is given the optimal available configuration directly for direct use.
[0081] Regarding the technical problem 2, how to reduce the impact of shared memory overflow on functions and improve the location speed of shared memory overflow;
[0082] In order to avoid the impact of shared memory overflow on the function, this application changes the continuous physical memory organization form to a multi-segment physical memory organization form, as follows: Figure 4 As shown:
[0083] In the prior art solutions, Figure 4 As shown, only one shared memory segment is created, and different memory pools are physically connected together. This application creates multiple shared memory segments and links them to different memory pools through indexes. The specific organization form is as follows Figure 5 As shown:
[0084] Through the optimization of shared memory allocation, even if a process overflows at memory block NN1 in memory pool 1, it will not affect the process using memory block 1 in memory pool 2, thus avoiding excessive impact on the function.
[0085] In addition, in order to quickly locate the overflow point, a header and a tail are added before and after each memory block storing user data to store the service name. A judgment is added in places where shared memory overflow is likely to occur. The service names stored in the header and tail are compared to see if they are consistent. If they are inconsistent, it can be confirmed that an exception has occurred there, and an exception is thrown to inform the user of the service that caused the exception, so that the shared memory overflow point can be quickly located; the layout diagram of the memory block before and after modification is shown in the figure. Figure 6 As shown;
[0086] Add the location of the shared memory overflow checkpoint and describe it with a timing diagram:
[0087] Figure 7 To send a timing diagram, the figure describes the location where the memory overflow check is added. The main purpose is to add a memory overflow check mechanism after executing the user logic;
[0088] Figure 8 For receiving the timing diagram, the figure describes the location of adding the memory overflow check, which is mainly to add the memory overflow check mechanism when releasing the memory block after executing the user logic.
[0089] In addition, the specific means in the implementation process of the present invention can be replaced as follows:
[0090] 1. When the elbow rule is used to determine the number of cluster centers, other algorithms can be used, such as the Silhouette Method, Gap Statistics, and Davies–Bouldin Index, which can achieve this function.
[0091] 2. When using K-Means to determine the classification of clusters, other algorithms can be used, such as Hierarchical Clustering, Density-Based Clustering, Spectral Clustering, Gaussian Mixture Model (GMM), Agglomerative Clustering, etc., which can achieve this function.
[0092] 3. When using the binary search method to determine the minimum number of memory blocks, other algorithms can be used, such as Interpolation Search, Newton's Method, Secant Method, Jump Search, Exponential Search, etc., which can be used to find the optimal solution within the interval.
[0093] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. An unmanned driving shared memory intelligent management method, characterized in that: The method comprises the following steps: Step 1: First, based on the experience of defining data for unmanned driving applications, a larger-granularity memory allocation method is given, namely, a configuration file, which is given to the daemon process. The application is started, and the memory size and amount are roughly adjusted according to the prompts to ensure that the application can run normally, thereby facilitating subsequent operations. Step 2: Then start the daemon and application, and obtain the memory block size required by the application through the tracking method. That is, after the sender applies for the memory block, the required data size passed in by the user is sent to the daemon, and the statistics are continuously kept for a certain period of time. The maximum value of the data size required by each sender within a certain period of time is counted as the final required memory block size; here, a collection of required memory block size data is obtained Among them, m i represents the size of the i-th required memory block, and n is the number of required memory blocks; In order to avoid the fragmentation of shared memory and improve management efficiency, the number of memory pools needs to be limited. To this end, the clustering algorithm in statistical methods is used to calculate the appropriate size of multiple memory blocks. Finally, to determine the number corresponding to the above memory blocks, it is necessary to consider the size of the data sending buffer and the data receiving buffer corresponding to the memory blocks. The sending and receiving communication mode is essentially a producer and consumer mode, which is divided into two cases. One is that the producer's production speed is greater than the consumer's consumption speed, which will cause the positions of the data sending and receiving buffers to be occupied. In this case, the maximum number of memory blocks used is the second. The consumer's consumption speed is greater than or equal to the producer's production speed. In this case, the data sending buffer and the receiving buffer only occupy one position respectively. In this case, the minimum number of memory blocks used is the minimum value.
2. The unmanned driving shared memory intelligent management method according to claim 1, characterized in that: In the step 1, the content of the configuration file is as follows: 10,000 1024KB memory blocks, 5,000 16,384KB memory blocks, 2,000 131,072KB memory blocks, 2,000 262,144KB memory blocks, 1,000 524,288,000KB memory blocks, 100 1,048,576KB memory blocks, and 50 4,194,304KB memory blocks; the physical memory organization form corresponding to the configuration file forms a plurality of memory pools, the memory blocks in each memory pool are of the same size, and the memory blocks in different memory pools have different sizes.
3. The unmanned driving shared memory intelligent management method according to claim 1, characterized in that: In step 2, the required data size input by the user is sent to the daemon process through UDS communication.
4. The unmanned driving shared memory intelligent management method according to claim 1, characterized in that: In step 2, the required data size passed in by the user is sent to the daemon process and is counted for 60 seconds. This is because the data size required by the user may be of indefinite length. Therefore, the maximum value of the data size required by each sender within 60 seconds is counted as the final required memory block size.
5. The unmanned driving shared memory intelligent management method according to claim 1, characterized in that: In step 2, a clustering algorithm in a statistical method is used to calculate multiple appropriate memory block sizes; specifically, as follows: First, the optimal number of clusters is selected using the elbow rule; Then, the K-Means clustering algorithm is applied to process the memory block size set M to obtain the division of memory clusters. Among them, C i represents the i-th memory cluster, k is the number of memory clusters; to ensure that the selected memory block size can meet the needs of all memory blocks in the memory cluster, each memory cluster C i The maximum value in is defined as the final memory block size, denoted as max(C i )=max{m ij |m ij ∈C i }, where m ij Represents the j-th required memory block size belonging to the i-th memory cluster in the set M.
6. The unmanned driving shared memory intelligent management method according to claim 5, characterized in that: The process of determining the number of memory blocks in step 2 is as follows: Let C i A memory block m in the cluster ij , the corresponding data sending buffer size is sq ij , the corresponding data receiving buffer size is rq ij , then C i Cluster is the maximum size of memory block (C i )The maximum number of memory blocks required is The minimum number of memory blocks is 2|C i |, where |C i Represents C i The number of memory blocks in the cluster; The final required shared memory segment size is calculated as follows: Among them, k is the number of cluster centers determined by the elbow rule, S max is the maximum value of the shared memory segment required, S min is the minimum size of the shared memory segment required.
7. The unmanned driving shared memory intelligent management method according to claim 6, characterized in that: Considering that the application can run stably in any case, the shared memory segment is created and allocated according to the maximum number of memory blocks required. In special cases, if the number of memory blocks is set as large as required and the physical memory occupied by the domain controller is too large, the binary method is used to adjust the number of memory blocks in the memory pool one by one until the configuration of the minimized shared memory segment is found and the application can run stably. It should be noted that the adjustment needs to start from the memory pool that stores larger memory blocks.
8. The unmanned driving shared memory intelligent management method according to claim 7, characterized in that: The above steps, from starting and running the daemon process and application, to collecting the memory block size required by the system through tracking points, to determining the memory pool and memory block size and quantity range using the elbow rule and K-Means algorithm, and then to obtaining the minimum shared memory configuration under stable application operation through the dichotomy method, can all be automatically performed through scripts without human intervention. Finally, the user is given the optimal available configuration directly for direct use.
9. The unmanned driving shared memory intelligent management method according to claim 8, characterized in that: In order to reduce the impact of shared memory overflow on functions and improve the location speed of shared memory overflow, the continuous physical memory organization form is changed to a multi-segment physical memory organization form to separate multiple memory pools from each other to form a multi-segment discontinuous physical memory organization form. By creating multiple shared memory segments and linking them to different memory pools through indexes, that is, a memory pool index is set in a certain memory pool to connect to the first memory block of other memory pools; Through the optimization of shared memory allocation, even if a process overflows at the end memory block of a memory pool, it will not affect the process using the first memory block in another memory pool, thereby avoiding excessive impact on the function.
10. The unmanned driving shared memory intelligent management method according to claim 9, characterized in that: In order to quickly locate the overflow point, a header and a tail are added before and after each memory block storing user data to store the service name. A judgment is added in places where shared memory overflow is likely to occur to compare whether the service names stored in the header and tail are consistent. If they are inconsistent, it can be confirmed that an exception has occurred there, and an exception is thrown to inform the user of the service that caused the exception, so that the shared memory overflow point can be quickly located.