On 18 August 2011 03:35, 陳韋任 <che...@iis.sinica.edu.tw> wrote: > I am wondering if there is any plan to support multi-threaded > program in QEMU. I find a patch [1] which adds i386-linux-user NPTL > support, but I don't see it's merged back into the trunk. I don't > know why. Is there any consideration or difficulty on multi-threaded > support?
So there are a number of issues here. Firstly, x86 targets in particular are worse than others for multi-threaded user mode: the patch you note is almost certainly not the only area that needs addressing. (Properly handling the x86 LOCK prefix by making sure we take a host mutex is very likely broken, for instance.) If you look in MAINTAINERS you'll see that the status of the x86 target is listed as "Odd Fixes", which is why it's behind some of the others. So it's really waiting for somebody to step forward and start reviewing patches, fixing bugs and generally give it a bit of love and attention :-) More generally and not x86-specific, there are problems with the multithreaded user-mode support which I suspect exist because nobody has ever sat down and worked out a coherent design for it, including what might need to be thread-local and what locking is required. So the result is that it mostly works but if you stress it (by spawning lots of interacting threads, for instance) qemu can crash. Fixing this is harder and may involve tough decisions like choosing to sacrifice a few % of performance in order to get a design that doesn't have locking issues... -- PMM