kqueue, multithreading and architecture
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Hi guys, Thanks a lot, Marco Bambini _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... I am writing a network server that should also be both high performance and scalable, the architecture I decided to adopt is a threaded pool with a kqueue queue for each thread. Each kqueue will receive read notifications for the various connected sockets and then it will be responsible to do the required job. The idea was to have Thread1 blocked in a "listen" loop and each time a new socket connects, Thread1 pass that socket to the kqueue in Thread2. Thread2 is simply blocked waiting for socket events (or busy doing other operations). My question is if that could be a good solution and if I can safely add an event to a kqueue queue owned and created by another thread. Please note that I simplified the solution, because in my case Thread1 could also decided to pass the newly connected socket to Thread3 or Thread4. Please note that I don't want to use the listing socket inside the kqueue owned by the working threads because much of the time they will be busy trying to build a proper reply for an already connected socket. Any suggestion on how to improve that architecture is more than welcomed. This email sent to site_archiver@lists.apple.com
participants (1)
-
Marco Bambini