Is the new D threading model emulating processes + shared memory?

Lionello Lunesu lionello at lunesu.remove.com
Thu Aug 7 02:40:44 PDT 2008


"Leandro Lucarella" <llucax at gmail.com> wrote in message 
news:20080801144452.GA4673 at burns.springfield.home...
>I was thinking about the thread "Sharing in D" and it came up to my mind
> that what it's been done with this model is just emulating processes +
> shared memory. If you program you application with processes instead of
> threads and shared memory instead of "D shared" type (or global variables
> in general), you get what D is trying to do: clearly separated memory
> areas for shared and unshared data, and protection.

I think this analogy is pretty good! Sure helps explaining the plan.

> So, what are the advantages of using threads+shared in D 2.0 compared with
> processes+shared memory in D 1.0? I guess it's just simpler to program,
> and maybe, more familiar to "threads programmers" (people that are not
> very used to program using processes). Well, I guess you can have a little
> faste context switches too, but I don't think this his a huge gain in
> modern operating systems.

Well, threads use the same virtual memory, that's a huge plus. For example, 
the software I'm currently working on is a 3D product that uses 1 thread for 
rendering and the other for loading 3D resources. This is impossible to do 
with processes.

L. 




More information about the Digitalmars-d mailing list