Received: from eggs.gnu.org ([208.118.235.92]:41188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si42J-0008PX-9O for qemu-devel@nongnu.org; Fri, 22 Jun 2012 09:36:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Si42E-0003SV-8E for qemu-devel@nongnu.org; Fri, 22 Jun 2012 09:36:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Si42E-0003SA-08 for qemu-devel@nongnu.org; Fri, 22 Jun 2012 09:36:26 -0400 From: Markus Armbruster References: <1340347459-29861-1-git-send-email-peter.crosthwaite@petalogix.com> <4FE423B0.9020702@siemens.com> Date: Fri, 22 Jun 2012 15:36:19 +0200 In-Reply-To: (Peter Maydell's message of "Fri, 22 Jun 2012 13:30:32 +0100") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC] block: Removed coroutine ownership assumption List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: kwolf@redhat.com, stefanha@linux.vnet.ibm.com, Jan Kiszka , qemu-devel@nongnu.org, Peter Crosthwaite , edgar.iglesias@gmail.com, john.williams@petalogix.com Peter Maydell writes: > On 22 June 2012 13:04, Markus Armbruster wrote: >> Peter Maydell writes: >> >>> On 22 June 2012 09:48, Markus Armbruster wrote: >>>> In my opinion, coroutines have been useful for us so far. =C2=A0Whethe= r they >>>> remain useful, or serve us just as a stepping stone towards general >>>> threads remains to be seen. >>> >>>>From my point of view I've seen a whole pile of problems and not >>> really any advantages... >> >> Advantages over what? > > Over what we had before we had coroutines. I know there are > advantages, I'm just saying that personally I've been largely > on the downside rather than the upside. Granted. Just saying that there's an upside, too :) >>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0I particularly think it's a really bad >>> idea to have a complex and potentially race-condition-prone bit >>> of infrastructure implemented three different ways rather than >>> having one implementation used everywhere -- it's just asking >>> for obscure bugs on the non-x86 hosts. >> >> Fair point, but it's an implementation problem, not a fundamental >> problem with coroutines. =C2=A0You *can* implement coroutines portably, >> e.g. on top of gthread. > > If you're implementing them on top of separate threads then > you just have an obfuscated API to threads. No, what you really have is yet another means to express control flow. The fact that it can be implemented on top of threads doesn't necessarily make it an obfuscated API to threads. Look, a while loop isn't an obfuscated API to continuations, either. It's less general, but when it's all you need, it's easier to use. When all you need is coroutines, not having to worry about preemption makes them easier to use in my experience.