qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] spawning and killing threads in qemu


From: Xin Tong
Subject: Re: [Qemu-devel] spawning and killing threads in qemu
Date: Wed, 8 Feb 2012 21:40:08 -0500

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 <address@hidden> wrote:
> 2012/2/7 陳韋任 <address@hidden>:
>> 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]