MiniD 2 - Tentative Release Candidate 1

Jarrett Billingsley jarrett.billingsley at gmail.com
Thu Dec 11 07:15:36 PST 2008


On Thu, Dec 11, 2008 at 2:06 AM, davidl <davidl at 126.com> wrote:
> Another thing is I really didn't pay attention to parallel in MiniD. So , the thread
> is not tradition thread in D? It's actually just a coroutine?

Right; it's more like a Fiber from Tango (and is implemented using
Fibers depending on the compilation options).

> I just thought that coroutine was implemented as several different MiniD interpret
> context for each coroutine, and resume a coroutine just simply resuming that interpret
> context which could be very costless.

You're actually right, in a way; each thread object is its own
_interpreter_, which has a call stack and locals.  But each thread is
_not_ its own VM; that is, all threads share the same globals and data
can be freely passed between them.

In MiniD, coroutine == thread.  "coroutine" creates a thread object.

> And the thread I though could be some native threads with several MiniD interpreters working.

MiniD was not designed with symmetric multithreading as a goal.
However, it would still be possible to make a library which you could
use to create and use other VMs from within MiniD.  It's been done
with Lua.


More information about the Digitalmars-d-announce mailing list