Efficient multithreaded server P&L: -7 (≃ -76 USD)
I have some epoll server code that I tweaked to run the server in a thread.
Now I'm taking this code and changing it so that each client connection is multiplexed by multiple threads.
The idea is that each thread has a ringbuffer, when a socket is accepted, a message is put on the ringbuffer and the thread begins listening to that user.
All the other threads are notified of all the users so they can also echo data to them.
This is efficient as a thread can serve thousands-millions of connections and there are multiple threads.
One problem, which is a generic problem for multithreading is servicing one of multiple kinds of events from one thread. I rely on the fact I am polling a ringbuffer and epoll.