I want to understand some question of high-performance server program which use Multithreading.
epoll can handle TCP socket listening and socket connect,and i can use epoll_wait in the main thread, if there are any socket connect comming, program can accept connections and recv data in the work thread. there is no conflict between work thread. am i right?
udp is an connectionless protocol,can we use recvfrom function in the all of work thread at the same time? the main thread just use epoll to notice the work thread receive data. (assume that i can process each UDP packet individually).
this is a UDP server. i set it work with non-blocking socket. i receive data in the main thread and handle it , then send it to the task queue , if the task queue have data, the program wake up the work thread and lock the task queue ,then get the data from task queue, unlock the task queue so that other work thread can get task from task queue, and then handle it.
is this a good multithread UDP server?i am not sure. is there another design of UDP server with high-performance。</p>
I am in a puzzle about this questions, thank you very much!</p>