IDE and Runtime communication structure and read-write method
Through system performance evaluation and intelligent frame skipping strategy, the ring buffer structure of IDE and Runtime is optimized, which solves the problem of inconsistent read and write speed of buffers, improves data transmission efficiency and system stability, and is suitable for complex application scenarios.
Patent Information
- Application Number
- CN202411227287.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2024-12-27
AI Technical Summary
The communication methods between the existing IDE and Runtime are prone to errors when high frequency and real-time requirements are high, and the buffer read and write speeds are inconsistent, resulting in low data transmission efficiency and poor stability.
Set the buffer size through system performance evaluation, build a fixed-size ring buffer, and initialize read pointers, write pointers and global variables. Intelligent frame skipping strategy and dynamic memory adjustment are adopted to optimize data transmission logic and read mechanism to achieve self-reliance Adaptive data transmission management.
It improves data transmission efficiency and system response speed, reduces error occurrence, improves data processing capabilities and system throughput, and significantly improves communication quality and resource utilization efficiency between IDE and Runtime.
Smart Images

Figure CN119201484A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to an IDE and Runtime communication structure and a reading and writing method. Background Art
[0002] In modern computing systems, IDE software and Runtime usually communicate via the network or serial port, 485 or CAN port. Since IDE software usually runs on the Windows platform, and Runtime often runs on various arm or single-chip microcomputer platforms, its available resources are relatively small and the operating rate is relatively low. The existing communication method usually performs one receive and one send at both ends and processes them simultaneously, or uses an old buffer structure. The ring buffer is a first-in-first-out closed-loop storage space. Most of the structures are single-byte structures with a simple structure. When used, the pointer is shifted in the ring buffer to achieve single-byte access. When high frequency and real-time requirements are high, it is often easy to make mistakes and confuse addresses. Summary of the invention
[0003] In view of the above existing problems, the present invention is proposed.
[0004] Therefore, the present invention provides an IDE and Runtime communication structure and a reading and writing method to solve the problem of inconsistent buffer read and write speeds.
[0005] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0006] In a first aspect, an embodiment of the present invention provides an IDE and Runtime communication structure and a read-write method, which includes setting a buffer size according to a system performance evaluation and constructing two fixed-size circular buffers for uplink and downlink data transmission;
[0007] Set the read pointer, write pointer and global variables to initialization, keep track of the number of readable frames in the buffer;
[0008] Construct a write function, calculate the next write position, update the total effective length according to the actual data length, and after executing the write, increment the global variable and the write pointer points to the next node;
[0009] Construct a read function, use internal variables to mark the read status, confirm that there are frames to read by checking global variables, and calculate the read position;
[0010] According to actual needs, perform a single read of a frame of data, read multiple times until a frame of data is complete, and move the read pointer after each read;
[0011] When the number of available frames reaches x and remains unread for y milliseconds, frame skipping is automatically enabled, and information about frames to be skipped is recorded through a dynamic array. Frames are periodically discarded through a frame skipping algorithm.
[0012] According to the single tail chain architecture, the memory space is dynamically adjusted, the member address is locked during reading, and the intelligent frame skipping strategy is adjusted in real time.
[0013] As a preferred solution of the IDE and Runtime communication structure and the reading and writing method of the present invention, the buffer size is set according to the system performance evaluation, and two fixed-size circular buffers for uplink and downlink data transmission are constructed. The specific operations are as follows:
[0014] By collecting key performance indicators from the system, including CPU processing power, memory size, disk I / O speed, and network transmission rate, the collected key performance indicators are normalized;
[0015] Based on the processed key performance indicators, the weighted average method is used to calculate the system comprehensive performance score to determine the buffer size n;
[0016] According to the obtained n, two upstream and downstream ring buffers of size n+5 are constructed, the members of each buffer node are initialized, and the data area is cleared.
[0017] As a preferred solution of the IDE and Runtime communication structure and the reading and writing method of the present invention, wherein: setting the read pointer, the write pointer and the global variable to be initialized, tracking the number of readable frames in the buffer, the specific operations are as follows:
[0018] Initialize the read and write pointers to point to the first element of their respective buffers, set the global variable to the initial value when there are no readable frames in the buffer, and track the number of readable frames.
[0019] As a preferred solution of the IDE and Runtime communication structure and the reading and writing method of the present invention, the following operations are performed: construct a writing function, calculate the next writing position, update the total effective length according to the actual data length, and after writing, increment the global variable and point the writing pointer to the next node.
[0020] By checking whether the current buffer has enough space to write a new data frame, using the write position function to calculate the next write position of the write pointer, combined with the total effective length function to update the total effective length of the specified node;
[0021] Create a linked list node and insert a frame of data to be written into the end of the data area of the node pointed to by the current write pointer;
[0022] After writing is performed, the write position function is called to update the write pointer position and adjust the number of readable frames in the buffer.
[0023] As a preferred solution of the IDE and Runtime communication structure and the reading and writing method of the present invention, a reading function is constructed, an internal variable is used to mark the reading state, a global variable is checked to confirm that there is a frame to read, and the reading position is calculated. The specific operations are as follows:
[0024] Set the initialization idle state, use internal variables to mark the start reading state, single reading completion state, and waiting for more reading state;
[0025] Check whether the global variable is greater than the initialization value to confirm whether there is a frame to read, and use the read position function to determine the current read position.
[0026] As a preferred solution of the IDE and Runtime communication structure and the reading and writing method of the present invention, according to actual needs, a single read of a frame of data is performed, and multiple reads are performed until a frame of data is complete, and the read pointer is moved after each read. The specific operations are as follows:
[0027] Use the frame reading function to manage single or multiple readings. When a frame of data can be read in one time, read it directly and move the read pointer. If a frame of data needs to be read multiple times, record the number of bytes read in the current frame until the reading of a frame is completed.
[0028] After successfully reading a frame of data, call the read position function to update the read pointer position and adjust the number of readable frames in the buffer.
[0029] As a preferred solution of the IDE and Runtime communication structure and the reading and writing method of the present invention, when the number of available frames reaches x and remains unread for y milliseconds, frame skipping is automatically enabled, and the information of the frame sequence number and frame length to be skipped is recorded through a dynamic array, and frames are periodically discarded through a frame skipping algorithm. The specific operations are as follows:
[0030] Use a frame skip timer, set initialization, record the time when consecutive frames are not read, set a threshold of y milliseconds as the judgment standard, and set a monitoring period to perform inspections;
[0031] By getting the number of readable frames in the current buffer, calculate the time difference since the last check and add it to the frame skip timer;
[0032] Check whether the local variable is greater than or equal to x, and whether the frame skip timer is greater than or equal to y milliseconds. When both conditions are met at the same time, it means that the buffer is saturated and no valid reading has been performed for a long time. At this time, the frame skip mechanism should be started;
[0033] Create a dynamic array to record the frame numbers and frame lengths to be skipped, use the heartbeat frame recognition function to check each frame, and when the frame length is equal to the preset heartbeat frame length, it is considered a heartbeat frame and its number and length are recorded in the dynamic array;
[0034] When the frame skipping condition is met, the frame skipping function is called to directly skip these frames according to the frame sequence number and length recorded in the dynamic array, update the read pointer, and subtract the number of skipped frames from the global variable.
[0035] As a preferred solution of the IDE and Runtime communication structure and the reading and writing method of the present invention, the memory space is dynamically adjusted according to the single tail chain architecture, the member address is locked during reading, and the intelligent frame skipping strategy is adjusted in real time. The specific operations are as follows:
[0036] According to the single tail chain architecture, a dynamic adjustment function is used to actually adjust the buffer size by monitoring the long-term deviation from the target utilization rate. After the adjustment, the buffer and related pointers are reinitialized;
[0037] Before the read operation begins, a mutex lock is selected and a lock mechanism function is used to lock the buffer read pointer area so that the write operation will not be performed at the same time. After the read is completed, the lock is released immediately to allow other read and write operations to continue.
[0038] Process key data in real time and use the frame skipping strategy function to decide whether to skip the current frame. Based on the calculated frame skipping index J, it is converted into the frame skipping probability P. sk ;
[0039] Before writing data, generate a random number r. When r is less than P sk , then execute the frame skipping operation, otherwise, continue to process according to the normal process;
[0040] After each frame jump, the system-related parameters are updated in real time and the system performance indicators are monitored. Based on the changes in system load, the policy parameters are adjusted.
[0041] In a second aspect, an embodiment of the present invention provides a computer device, comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, any step of the IDE and Runtime communication structure and reading and writing method described in the first aspect of the present invention is implemented.
[0042] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, it implements any step of the IDE and Runtime communication structure and reading and writing method described in the first aspect of the present invention.
[0043] The beneficial effects of the present invention are: dynamically setting the buffer size through system performance evaluation to ensure that the data transmission efficiency matches the system resources and improve the response speed and stability; initializing the read-write pointer and the global variables, streamlining the data transmission logic, reducing errors, and improving accuracy and efficiency; constructing a write function, optimizing the data storage structure, reducing memory usage, and enhancing data processing capabilities; constructing a read function, adopting an intelligent reading mechanism, reducing invalid reading, and improving data reading efficiency and accuracy; implementing an intelligent frame skipping strategy to cope with high loads, prevent data backlogs, and improve system throughput and performance; overall, the present invention significantly improves the efficiency, stability, and resource utilization efficiency of communication between IDE and Runtime through adaptive adjustment, fine management, and intelligent strategies, is suitable for various complex application scenarios, and greatly improves data transmission quality and system performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0045] Figure 1 It is a flow chart of the IDE and Runtime communication structure and the reading and writing method in Example 1;
[0046] Figure 2 The structure diagram of the ring buffer of the IDE and Runtime communication structure and the reading and writing method in Example 1;
[0047] Figure 3 A single read flow chart of the IDE and Runtime communication structure and the read-write method in Example 1;
[0048] Figure 4 It is a multiple reading flow chart of the IDE and Runtime communication structure and the reading and writing method in Example 1;
[0049] Figure 5 This is a frame jump flow chart of the IDE and Runtime communication structure and the reading and writing method in Example 1. DETAILED DESCRIPTION
[0050] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0051] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0052] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0053] Example 1, reference Figure 1 to Figure 5 , which is the first embodiment of the present invention, and which provides an IDE and Runtime communication structure and a reading and writing method, comprising the following steps:
[0054] S1. According to the system performance evaluation, the buffer size is set and two fixed-size circular buffers for uplink and downlink data transmission are constructed.
[0055] S1.1. By collecting key performance indicators from the system, including CPU processing power, memory size, disk I / O speed and network transmission rate, the collected key performance indicators are normalized;
[0056] Based on the processed key performance indicators, the weighted average method is used to calculate the system comprehensive performance score to determine the buffer size n;
[0057] According to the obtained n, two upstream and downstream ring buffers of size n+5 are constructed, the members of each buffer node are initialized, and the data area is cleared;
[0058] Specifically, based on the collected performance indicator data, the weighted average method combined with the exponential function is used to calculate the system comprehensive performance score, which is expressed as:
[0059]
[0060] Among them, S t represents the comprehensive performance score of the system at time t, W i represents the weight of the i-th performance indicator, n represents the total number of performance indicators, λ represents the adjustment parameter, X i ′(t) represents the normalization of the i-th performance indicator at time t, γ represents the time decay factor, which is less than 1;
[0061] Based on the comprehensive performance score, the piecewise function combined with polynomial interpolation is used to determine the buffer size. The expression is:
[0062] n(St )=B m +A·(S t -S m ) p +C·(S t -S a ) q +D;
[0063] Among them, n(S t ) indicates the comprehensive performance score S t Dynamically determined buffer size, B m represents the minimum size of the buffer, A, C, D represent the polynomial coefficients obtained by fitting, p, q represent the order of the polynomial, S m Indicates the minimum value of the system performance score, S a Represents the average value of system performance scores;
[0064] Furthermore, the weight of each performance indicator is set, for example: CPU usage 40%, memory usage 30%, disk I / O rate 20%, network transmission rate 10%;
[0065] It should also be noted that when building a ring buffer, two structure arrays, upstream n+5 and upstream n+5, are defined. Each element represents a buffer node and contains three members: whether to enable frame skipping, valid data length, and data area.
[0066] The data area is composed of a linked list. New members of the linked list can only be inserted at the tail end. The data area is a frame structure. For some communication protocols, such as ModbusRTU, the data received at a time is a frame, and 256 bytes is its frame upper limit. At this time, you can directly apply for 256 bytes of linked list memory space, and then read and write through the effective length byte.
[0067] S2. Set the read pointer, write pointer and global variables to initialization and track the number of readable frames in the buffer.
[0068] S2.1. Initialize the read and write pointers to point to the first element of their respective buffers, set the global variable to the initial value when there are no readable frames in the buffer, and track the number of readable frames.
[0069] S3. Build a write function, calculate the next write position, update the total effective length according to the actual data length, and after executing the write, increment the global variable and the write pointer points to the next node.
[0070] S3.1. Check whether the current buffer has enough space to write a new data frame, use the write position function to calculate the next write position of the write pointer, and combine the total effective length function to update the total effective length of the specified node;
[0071] Create a linked list node and insert a frame of data to be written into the end of the data area of the node pointed to by the current write pointer;
[0072] After writing is performed, the write position function is called to update the write pointer position and adjust the number of readable frames in the buffer.
[0073] S4. Construct a read function, use internal variables to mark the read status, confirm that there are frames to read by checking global variables, and calculate the read position.
[0074] S4.1, set the initialization idle state, use internal variables to mark the start reading state, single reading completion state, and waiting for more reading state;
[0075] Check whether the global variable is greater than the initialization value to confirm whether there is a frame to read, and use the read position function to determine the current read position.
[0076] S5. According to actual needs, read one frame of data once, read multiple times until one frame of data is complete, and move the read pointer after each reading.
[0077] S5.1. Use the frame reading function to manage single reading or multiple reading. When a frame of data can be completed in one reading, directly read and move the read pointer. If a frame of data needs to be read multiple times, record the number of bytes read in the current frame until the reading of a frame is completed.
[0078] After successfully reading a frame of data, call the read position function to update the read pointer position and adjust the number of readable frames in the buffer.
[0079] S6. When the number of available frames reaches x and remains unread for y milliseconds, frame skipping is automatically enabled, and information about frames to be skipped is recorded through a dynamic array. Frames are periodically discarded through a frame skipping algorithm.
[0080] S6.1, use the frame skip timer, set the initialization, record the time when the continuous frames are not read, set the threshold y milliseconds as the judgment standard, and set the monitoring period to perform the inspection;
[0081] By getting the number of readable frames in the current buffer, calculate the time difference since the last check and add it to the frame skip timer;
[0082] Check whether the local variable is greater than or equal to x, and whether the frame skip timer is greater than or equal to y milliseconds. When both conditions are met at the same time, it means that the buffer is saturated and no valid reading has been performed for a long time. At this time, the frame skip mechanism should be started;
[0083] Create a dynamic array to record the frame numbers and frame lengths to be skipped, use the heartbeat frame recognition function to check each frame, and when the frame length is equal to the preset heartbeat frame length, it is considered a heartbeat frame and its number and length are recorded in the dynamic array;
[0084] When the frame skipping condition is met, the frame skipping function is called to directly skip these frames according to the frame sequence number and length recorded in the dynamic array, update the read pointer, and subtract the number of skipped frames from the global variable;
[0085] Specifically, x can be set to x=n+4 based on the buffer size and expected latency, and y can be set to y=200ms based on the average system response time. When the number of available frames reaches n+4 and remains unread for 200ms, frame skipping is automatically initiated;
[0086] Furthermore, multiple frame skipping algorithms are configured. For example, Algorithm 1 needs to ignore the heartbeat frame of length n. When the number of received frames gNum is always high or full, the frame skipping algorithm here is If (n == gJump[1]) gNum-=1 to skip the heartbeat frame processing;
[0087] Algorithm 2: Question-and-answer frame. When the frame number gNum is always high or full, the frame skipping algorithm here takes the shortest value of the frame reply length and directly replies without data identification after taking the frame, such as crc.
[0088] Algorithm 3: Drop frames in sequence. When the full frame overflows, the frame response sometimes causes a delay. Here, the frame number of GJump[0] is used. For example, if GJump[0]=1, the next time GJump[0]=4, this algorithm of dropping a frame every 3 frames is used for processing.
[0089] Among them, gNum represents the number of readable frames, gJump[0] records the frame number, gJump[1] records the frame length, and gJump[2] is an array containing two numbers: gJump[0] and gJump[1].
[0090] S7. According to the single tail chain architecture, the memory space is dynamically adjusted. When reading, the member address is locked and the intelligent frame skipping strategy is adjusted in real time.
[0091] S7.1. Based on the single tail chain architecture, a dynamic adjustment function is used to actually adjust the buffer size by monitoring the long-term deviation from the target utilization rate. After the adjustment, the buffer and related pointers are reinitialized;
[0092] Before the read operation begins, a mutex lock is selected and a lock mechanism function is used to lock the buffer read pointer area so that the write operation will not be performed at the same time. After the read is completed, the lock is released immediately to allow other read and write operations to continue.
[0093] Process critical data in real time, adopt a frame skipping strategy function to determine whether to skip the current frame. Based on the calculated frame skipping index J, map it to the interval [0, 1], and convert the frame skipping into a frame skipping probability P sk , the expression is:
[0094]
[0095] where k is a positive adjustment parameter used to control the steepness of the curve, and a is an adjustment parameter used to control the center position of the curve;
[0096] When J > a, P sk is close to 1; when J < a, P sk is close to 0.
[0097] Before writing data, generate a random number r. When r is less than P sk , then perform the frame skipping operation, otherwise, continue to process according to the normal process;
[0098] After each frame skipping, update the system-related parameters in real time and monitor the system performance metrics, including base utilization, current utilization and maximum utilization, current latency and average latency, current input rate and average input rate, system quality, current temperature and reference temperature, maximum temperature, current power and average power, previous temperature and average temperature, and adjust the policy parameters based on the system load change.
[0099] Specifically, according to the single-tail chain architecture, adopt a dynamic adjustment function to adjust the memory space, and the expression is:
[0100]
[0101] where M t represents the system resource utilization rate at time t, C0 represents the base utilization rate, α represents the speed at which the system utilization rate changes over time, t0 represents the starting time point, N and L respectively represent the number of nodes and links in the system, β represents the influence of adjusting the number of nodes and links in the system on the resource utilization rate, C b represents the basic utilization rate coefficient, U and U max respectively represent the current utilization rate and the maximum utilization rate, γ represents the degree of influence of adjusting the current utilization rate and the maximum utilization rate on the resource utilization rate, D and D a respectively represent the current latency and the average latency, δ represents the influence of adjusting the latency on the resource utilization rate, I and I a respectively represent the current input rate and the average input rate, and η represents the influence of adjusting the input rate on the resource utilization rate;
[0102] Based on the analysis of the criticality of the current system load, a frame skipping strategy function is used to adjust the frame skipping strategy in real time. The expression is:
[0103]
[0104] Where J represents the frame skipping index, Q represents the quality of the system, p and R represent the nonlinear growth rate that affects the frame skipping index, sin(ωS) represents the periodic change of the system state over time, ω and S represent the frequency and the current system state, T and T r Indicates the current temperature and reference temperature, T max represents the maximum temperature, θ represents the effect of adjusting the temperature on the frame skipping index, P and P a represents the current power and average power, ζ represents the effect of adjusting power on the frame skipping index, T p and T a represents the temperature at the previous moment and the average temperature, and ξ represents the impact of adjusting the temperature at the previous moment on the frame skipping index.
[0105] Furthermore, regarding the handling of exceptions, in the process of acquiring or releasing locks, possible errors should be captured and handled, such as the lock being damaged or the thread being interrupted. For uncaught exceptions, ensure that the lock is released correctly to avoid deadlock.
[0106] This embodiment also provides a computer device, which is suitable for the IDE and Runtime communication structure and reading and writing method, including: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the IDE and Runtime communication structure and reading and writing method proposed in the above embodiment.
[0107] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0108] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the IDE and Runtime communication structure and the read-write method proposed in the above embodiment are implemented; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, referred to as EPROM), programmable read-only memory (Programmable Red-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic storage, flash memory, magnetic disk or optical disk.
[0109] In summary, the buffer size is dynamically set through system performance evaluation to ensure that the data transmission efficiency matches the system resources, thereby improving the response speed and stability; the read-write pointers and global variables are initialized, the data transmission logic is streamlined, errors are reduced, and accuracy and efficiency are improved; a write function is constructed to optimize the data storage structure, reduce memory usage, and enhance data processing capabilities; a read function is constructed to adopt an intelligent reading mechanism to reduce invalid readings and improve data reading efficiency and accuracy; an intelligent frame skipping strategy is implemented to cope with high loads, prevent data backlogs, and improve system throughput and performance; overall, the present invention significantly improves the efficiency, stability, and resource utilization efficiency of communication between IDE and Runtime through adaptive adjustment, fine management, and intelligent strategies, is suitable for various complex application scenarios, and greatly improves data transmission quality and system performance.
[0110] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. An IDE and Runtime communication structure and a reading and writing method, characterized in that: include, According to the system performance evaluation, the buffer size is set to build two fixed-size circular buffers for uplink and downlink data transmission; Set the read pointer, write pointer and global variables to initialization, keep track of the number of readable frames in the buffer; Construct a write function, calculate the next write position, update the total effective length according to the actual data length, and after executing the write, increment the global variable and the write pointer points to the next node; Construct a read function, use internal variables to mark the read status, confirm that there are frames to read by checking global variables, and calculate the read position; According to actual needs, perform a single read of a frame of data, read multiple times until a frame of data is complete, and move the read pointer after each read; When the number of available frames reaches x and remains unread for y milliseconds, frame skipping is automatically enabled, and information about frames to be skipped is recorded through a dynamic array. Frames are periodically discarded through a frame skipping algorithm. According to the single tail chain architecture, the memory space is dynamically adjusted, the member address is locked during reading, and the intelligent frame skipping strategy is adjusted in real time.
2. The IDE and Runtime communication structure and the reading and writing method as claimed in claim 1, characterized in that: According to the system performance evaluation, the buffer size is set to build two fixed-size circular buffers for uplink and downlink data transmission. The specific operations are as follows: By collecting key performance indicators from the system, including CPU processing power, memory size, disk I / O speed, and network transmission rate, the collected key performance indicators are normalized; Based on the processed key performance indicators, the weighted average method is used to calculate the system comprehensive performance score to determine the buffer size n; According to the obtained n, two upstream and downstream ring buffers of size n+5 are constructed, the members of each buffer node are initialized, and the data area is cleared.
3. The IDE and Runtime communication structure and the reading and writing method as claimed in claim 2, characterized in that: Set the read pointer, write pointer and global variables to initialization and track the number of readable frames in the buffer. The specific operations are as follows: Initialize the read and write pointers to point to the first element of their respective buffers, set the global variable to the initial value when there are no readable frames in the buffer, and track the number of readable frames.
4. The IDE and Runtime communication structure and the reading and writing method as claimed in claim 3, characterized in that: Construct a write function, calculate the next write position, update the total effective length according to the actual data length, and after writing, increment the global variable and point the write pointer to the next node. The specific operations are as follows: By checking whether the current buffer has enough space to write a new data frame, using the write position function to calculate the next write position of the write pointer, combined with the total effective length function to update the total effective length of the specified node; Create a linked list node and insert a frame of data to be written into the end of the data area of the node pointed to by the current write pointer; After writing is performed, the write position function is called to update the write pointer position and adjust the number of readable frames in the buffer.
5. The IDE and Runtime communication structure and the reading and writing method as claimed in claim 4, characterized in that: Construct a read function, use internal variables to mark the read status, check global variables to confirm that there are frames to read, and calculate the read position. The specific operations are as follows: Set the initialization idle state, use internal variables to mark the start reading state, single reading completion state and waiting for more reading state; Check whether the global variable is greater than the initialization value to confirm whether there is a frame to read, and use the read position function to determine the current read position.
6. The IDE and Runtime communication structure and the reading and writing method as claimed in claim 5, characterized in that: According to actual needs, perform single reading of a frame of data or multiple readings of a frame of data until a frame of data is completely read, and move the read pointer after each reading. The specific operations are as follows: Use the frame reading function to manage single reading and multiple reading. When a frame of data can be completed in one reading, read it directly and move the read pointer. When a frame of data needs to be read multiple times, record the number of bytes read in the current frame until the reading of a frame of data is completed. After successfully reading a frame of data, call the read position function to update the read pointer position and adjust the number of readable frames in the buffer.
7. The IDE and Runtime communication structure and the reading and writing method as claimed in claim 6, characterized in that: When the number of available frames reaches x and remains unread for y milliseconds, frame skipping is automatically enabled. The information of the frame sequence number and frame length to be skipped is recorded through a dynamic array. The frame skipping algorithm is used to periodically discard frames. The specific operations are as follows: Use a frame skip timer, set initialization, record the time when consecutive frames are not read, set a threshold of y milliseconds as the judgment standard, and set a monitoring period to perform inspections; By getting the number of readable frames in the current buffer, calculate the time difference since the last check and add it to the frame skip timer; Check whether the local variable is greater than or equal to x, and whether the frame skip timer is greater than or equal to y milliseconds. When both conditions are met at the same time, it means that the buffer is saturated and no valid reading has been performed for a long time. At this time, the frame skip mechanism should be started; Create a dynamic array to record the frame numbers and frame lengths to be skipped, use the heartbeat frame recognition function to check each frame, and when the frame length is equal to the preset heartbeat frame length, it is considered a heartbeat frame and its number and length are recorded in the dynamic array; When the frame skipping condition is met, the frame skipping function is called to directly skip these frames according to the frame sequence number and length recorded in the dynamic array, update the read pointer, and subtract the number of skipped frames from the global variable.
8. The IDE and Runtime communication structure and the reading and writing method as claimed in claim 7, characterized in that: According to the single tail chain architecture, the memory space is adjusted dynamically. When reading, the member address is locked and the intelligent frame skipping strategy is adjusted in real time. The specific operations are as follows: According to the single tail chain architecture, a dynamic adjustment function is used to actually adjust the buffer size n by monitoring the long-term deviation from the target utilization rate. After the adjustment, the buffer and related pointers are reinitialized; Before the read operation begins, a mutex lock is selected and a lock mechanism function is used to lock the buffer read pointer area so that the write operation will not be performed at the same time. After the read is completed, the lock is released immediately to allow other read and write operations to continue. Process key data in real time and use the frame skipping strategy function to decide whether to skip the current frame. Based on the calculated frame skipping index J, it is converted into the frame skipping probability P. sk ; Before writing data, generate a random number r. When r is less than P sk If the frame is skipped, the process continues as normal. After each frame jump, the system-related parameters are updated in real time and the system performance indicators are monitored. Based on the changes in system load, the policy parameters are adjusted.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the IDE and Runtime communication structure and the reading and writing method described in any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the IDE and Runtime communication structure and the reading and writing method described in any one of claims 1 to 8 are implemented.