Date: Fri, 26 Oct 2007 10:38:22 +0400 From: Igor Sysoev <is@rambler-co.ru> To: freebsd-threads@freebsd.org Cc: David Xu <davidxu@freebsd.org> Subject: kqueue based thread pool Message-ID: <20071026063822.GA91344@rambler-co.ru>
next in thread | raw e-mail | index | archive | help
The modern threads implementation works fine with program that requires fair threads scheduling, like Apache and MySQL. However, there are programs (like varnish) that use FSM and thread pool. The threads allow to run on SMP and reduce blocking on disk I/O. These programs use an acceptor/listener thread and worker pool threads. In this model it's preferable to have one RUNnable worker thread per CPU and to start next one only when the current thread blocks. Also, when scheduler chooses next thread to run it should get the more recently run (cache hot) thread instead of fair scheduling. It's good to have some idle threads in pool, those run very seldom when active threads are blocked on I/O, etc. Just wonder whether current scheduler is easy extendable to create thread pool controlled by kqueue: that is the kernel acts as acceptor/listener thread that wakes up worker threads waiting in kevent() ? -- Igor Sysoev http://sysoev.ru/en/
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20071026063822.GA91344>