Concurrency in D and Active Objects

Craig Black cblack at ara.com
Mon Apr 21 10:09:24 PDT 2008


> OTOH, D's model is compiler-checkable (i.e. the compiler can guarantee you 
> no sync issues), while an event/active object model is not (since you can 
> access global state).

It is possible to implement active objects such that global state is not 
accessible via an active object unless the global variable is synchronized 
or thread local (if thread local support were added).  What I am saying is 
that thread safety could be enforced at compile time if the right language 
features were in place.

>> Also, to make D's functional subset run Concurrently doesn't D need a
>> special runtime that parallelizes the code (which D currently doesn't 
>> have)?
>
> Yes, but that can be done. Active objects would need one, too.
>

All that would be needed for active objects is a thread pool, which is cake. 
Each active object could just be a task added to the pool.

-Craig





More information about the Digitalmars-d mailing list