Comment 71 for bug 148454

Revision history for this message
micah4 (atomicsuntan) wrote : Re: console-kit-deamon spawns too many threads

A quick look at the code shows that the threads are created so that they can sleep on an ioctl to the virtual consoles, with one thread for each (possible) virtual console which waits for the VC to become active. The threads were probably created so that the application could be released without requiring a patch to the kernel. Note that this application does not need 60 threads on Solaris, which provides asynchronous notification of VC switching via SIGPOLL. A similar method could be achieved with a very small kernel patch to allow VT_WAITACTIVE to return whenever any VC switch occurs, e.g., by waiting on a magic console number or adding a new ioctl command which provides that behavior. In fact the kernel already wakes everybody up whenever a VC switch occurs, it just puts them back to sleep unless they are waiting on the specific vc that was requested- which is why there has to be one requesting thread for each possible vc. So it would be a very minor change but it would be a kernel change.