Message processing method and device
A message processing and message technology, applied in digital transmission systems, electrical components, transmission systems, etc., can solve problems such as expensive, difficult to expand, and processing performance degradation, so as to improve hit rate, reduce mutual influence, and improve processing efficiency effect
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0023] figure 1 It is a flow chart of a message processing method provided in Embodiment 1 of the present invention. The method can be executed by any device for performing message processing, and the device can be implemented by software and / or hardware. Such as figure 1 As shown, the method includes:
[0024] S110. In the main thread, sequentially copy the received messages into the array.
[0025] In this embodiment, the packets may be packets such as IP packets, TCP packets, or UDP packets.
[0026] Exemplarily, before the main thread receives the message, a two-dimensional array may be created first, and when the main thread receives the message, the received message is copied into the two-dimensional array. Preferably, the received messages can be copied into the two-dimensional array in the received order. Preferably, the headers of the received packets may be copied into a two-dimensional array in sequence. For example, create a two-dimensional array G_PKG[MAX*N][...
Embodiment 2
[0037] figure 2 The flow chart of a packet processing method provided by the embodiment of the present invention is further optimized on the basis of the foregoing embodiments.
[0038] Furthermore, before copying the received messages to the array in the main thread, first create the main thread, the message shunting thread and no less than two worker threads, and bind these threads to different CPUs respectively. Specifically include:
[0039] S210. Create a main thread, and bind the main thread to a corresponding CPU.
[0040] Exemplarily, create a main thread HANDLE, and bind the thread to the corresponding CPU, so that the CPU only needs to process the work of the thread, that is, only need to process the work of copying the message, for example, the HANDLE thread can be bound to on CUP1. Preferably, before creating the main thread, the memory in the user state can be directly mapped to the network card through memory mapping, so that the packets received by the netwo...
Embodiment 3
[0051] image 3 It is a structural block diagram of a message processing device provided in Embodiment 3 of the present invention. As shown in FIG. 4 , the device includes: a message receiving module 301 , an address extraction module 302 , an address calculation module 303 and a message distribution module 304 .
[0052] Wherein the message receiving module 301 is used to copy the received messages into the array in the main thread; the address extraction module 302 is used to extract the source address and the source address of the message in the array in the message shunting thread Target address; address calculation module 303, used to calculate the source address and the destination address according to a preset algorithm; message distribution module 304, used to send the message to the corresponding worker according to the calculation result thread.
[0053] On the basis of the above embodiments, the message receiving module may be specifically configured to: create a ...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com