kqueue, multithreading and architecture
kqueue, multithreading and architecture
- Subject: kqueue, multithreading and architecture
- From: Marco Bambini <email@hidden>
- Date: Fri, 9 Nov 2007 09:30:57 +0100
Hi guys,
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.
Thanks a lot,
Marco Bambini
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden