The difference between lwip using sending and receiving threads and not using sending and receiving threads

insert image description here
Compared with the method of not using the sending and receiving thread, the method of using the sending and receiving thread may be slightly lower, depending on the specific application scenario and implementation method.

lwIP (Lightweight IP Protocol Stack) is an open source TCP/IP protocol stack for embedded systems. It can run in a single thread or in multiple threads. When lwIP runs in a single thread, all network sending and receiving operations are done in the same thread. This method can save the overhead of thread switching, and is suitable for embedded systems with limited resources.

However, using multiple sending and receiving threads can provide better concurrency performance and responsiveness. By assigning network sending and receiving operations to independent threads, multiple network connections can be processed at the same time, making full use of the advantages of multi-core processors. This is very important for high-concurrency network applications or real-time applications that require timely response.

Although using multiple sending and receiving threads can provide better concurrency performance, there is some additional overhead to consider. Thread switching may introduce some latency and overhead, especially in embedded systems with limited resources. In addition, synchronization and communication between threads also require some additional overhead to ensure data consistency and correctness.

Therefore, choosing whether to use sending and receiving threads should be decided according to specific requirements and system limitations. If your application needs to handle a large number of concurrent connections or require real-time response, using the send and receive thread may be a good choice. But if your system resources are limited or the real-time requirements are not high, the single-threaded method may be simpler and more efficient.

insert image description here

Guess you like

Origin blog.csdn.net/qq_33471732/article/details/132218398