www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Call stack mechanism

reply Joshua Moore-Oliva <josh chatgris.com> writes:
I am doing research on multi-threaded call stack mechanisms, and in addition to
academic papers, I am surveying what mechanisms existing languages use. Does D
use a mechanism other than the standard C-pthread style "one stack is allocated
on thread creation for each thread, and if that space is exhausted it is
considered an error without recovery"? If so, could you detail your call stack
mechanism?

Thanks, Joshua Moore-Oliva 
Aug 14 2009
next sibling parent Walter Bright <newshound1 digitalmars.com> writes:
Joshua Moore-Oliva wrote:
 I am doing research on multi-threaded call stack mechanisms, and in
 addition to academic papers, I am surveying what mechanisms existing
 languages use. Does D use a mechanism other than the standard
 C-pthread style "one stack is allocated on thread creation for each
 thread, and if that space is exhausted it is considered an error
 without recovery"? If so, could you detail your call stack mechanism?
That's right. It's a layer over the C thread creation mechanism.
Aug 14 2009
prev sibling next sibling parent Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
On Fri, Aug 14, 2009 at 3:44 PM, Joshua Moore-Oliva<josh chatgris.com> wrot=
e:
 I am doing research on multi-threaded call stack mechanisms, and in addit=
ion to academic papers, I am surveying what mechanisms existing languages u= se. Does D use a mechanism other than the standard C-pthread style "one sta= ck is allocated on thread creation for each thread, and if that space is ex= hausted it is considered an error without recovery"? If so, could you detai= l your call stack mechanism? That's pretty much it. That being said, druntime and Tango's runtime (basically the same thing..) also allow for the creation of Fibers, which are cooperatively-scheduled threads of execution, as opposed to preemptively-scheduled ones. But they still work pretty much the same way, by allocating a new stack.
Aug 14 2009
prev sibling parent Brad Roberts <braddr bellevue.puremagic.com> writes:
On Fri, 14 Aug 2009, Joshua Moore-Oliva wrote:

 I am doing research on multi-threaded call stack mechanisms, and in 
 addition to academic papers, I am surveying what mechanisms existing 
 languages use. Does D use a mechanism other than the standard C-pthread 
 style "one stack is allocated on thread creation for each thread, and if 
 that space is exhausted it is considered an error without recovery"? If 
 so, could you detail your call stack mechanism?
 
 Thanks, Joshua Moore-Oliva 
Answering carefully, neither C, C++ nor D define how threads behave. Both C++ and D intend to but even there I don't think they define the specifics of stack usage but rather leave that to the ABI to define. However, practically speaking.. yes, D follows in the footsteps of C and defers that to the pthread libraries for the most part. See the other responses on the thread. Later, Brad
Aug 14 2009