can you show me where these threads get created in the qemu code ? Thanks
Xin On Tue, Feb 7, 2012 at 5:25 AM, Stefan Hajnoczi <stefa...@gmail.com> wrote: > 2012/2/7 陳韋任 <che...@iis.sinica.edu.tw>: >> Hi Stefan, >> >> Thanks for the explanation. :) >> >>> > 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. >> >> The option "--enable-io-thread" should have been gone sine QEMU 1.0, right? >> Or you just use the term to mean IO thread? > > Yes, I just used that term to describe the "IO thread". > >>> --enable-io-thread means there is a dedicated thread (created at >>> startup) which runs the event loop. >> >> I want to know where IO thread is lauched but I am lost in vl.c. Would you >> mind to shed some light on that? > > The IO thread is actually the main thread of the process. vcpus are > created as separate threads but the main loop in vl.c becomes the IO > thread. > >>> 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. >> >> So, IO thread runs the event loop (I think it's main_loop_wait in >> main-loop.c, >> right?), and it leave blocking I/O system calls to posix-aio-compat.c worker >> threads? Is that correct? > > Yes. The posix-aio-compat.c only handles block I/O, so subsystems > like networking, VNC, and character devices use other mechanisms to > avoid tying up the main loop. > > Stefan