inetd & kq Performance

Kernel Queues (from now on will be refered to as KQ) add a different way of looking at things. KQ allows you to recieve notification of various events and attached a void * to the event. This allows you to reduce the lookup you have to do when you need to handle an event.

The patch making inetd KQ aware is still in progress. I still need testers to test the code to make sure there aren't any behavior changes and/or bugs in the code.


On the old inetd, it would only be able to recieve one connection per service per select call. You would also have to loop over the entire services table to find out what service is ready to be servered. This means the more services the longer it takes to find the service you need. If the serverice was at the end of the table, this could be excesive.

With KQ, you will be notified with the service as a tag when it becomes available. You will not have to search and can immediately dispatch the proper acction for the service.


The old inetd would use a pipe to tell the main thread of execution when a signal was delivered. With KQ, you get a notification of when a signal happens. This means that you don't have to impose a context switch to notify the main thread. It also simplifies signal handling as you can put the function that needs calling in the tag.


KQ's also allow you to recieve an event when the child has exited. In the old inetd, when you recieved a SIGCHLD, you'd have to reap the child an then find out what service the child belonged to by searching a table of pids. With KQ, you can attach the service to the event notification saving the search for the child. You also don't have to watch SIGCHLD as you will get an event for each child when they exit.