Original Post
So, I've been working on my network stack, and it occured to me to wonder whether there're any real advantages to running the networking in its own thread. If I use nonblocking threads and pump the network stack every tick, I'm beginning to suspect that would be actually MORE efficient than keeping a thread around that just spent 90% of its time blocking on I/O and another 9% of its time waiting for mutexes to unlock. It's not an issue of leaving processors idle; there're lots of other tasks I can assign processors to. The particle engine, for instance, could happily consume a couple of extra processors. Does anyone know of any compelling reason to use blocking sockets and a seperate thread instead of nonblocking sockets? Is there a danger of overflowing packets? Is there some hidden cost in the operating system? Is it just cleaner?