On Mon, Jan 30, 2012 at 05:52:48PM +0800, 陳韋任 wrote: > > On Thu, Jan 26, 2012 at 1:35 PM, Paolo Bonzini <pbonz...@redhat.com> wrote: > > > On 01/26/2012 07:31 PM, Xin Tong wrote: > > >> > > >> When i attach gdb to qemu running in system mode, i often get things like > > >> > > >> [Thread 0x7ffed2013700 (LWP 29499) exited] > > >> [New Thread 0x7ffed2013700 (LWP 29500)] > > >> > > >> what spawns these threads and what do these threads do ? > > > > > > > > > The block layer's thread pool. > > Qemu 1.0 enable IO thread by default, I think that's why you can see there > are > two threads. You can check block/raw-posix-aio.h, posix-aio-compat.c and > linux-aio.c.
--enable-io-thread is different from posix-aio-compat.c's thread pool. --enable-io-thread means there is a dedicated thread (created at startup) which runs the event loop. The temporary threads you are seeing are indeed posix-aio-compat.c worker threads. They execute blocking I/O system calls so that the QEMU event loop can continue to process events while I/O operations are running. Stefan