[M3devel] Threads summary for m3gdb

Tony Hosking hosking at cs.purdue.edu
Fri Aug 10 05:58:21 CEST 2007


On Aug 8, 2007, at 7:20 PM, Rodney M. Bates wrote:

> I have been doing some work on m3gdb lately and am mulling over
> trying to improve the very rudimentary thread support.  With
> the new thread implementation, it is a good time.  I would like
> confirmation (or correction) of the following impressions I have
> gotten about thread handling in implementations of Modula-3.
>
> Here's what I think I understand:
>
> The old system uses threads entirely implemented in libm3core,
> using setjmp/longjmp to get execution moved around where it is
> needed.

Yes, though this needs migration to using getcontext/setcontext/ 
makecontext instead so as to work properly on systems that implement  
secure setjmp/longjmp.

> The new system, called for by -DPTHREAD  uses the pthreads library  
> instead.

Yes.  gdb handles pthreads on most systems.

> There is no use of any kind of kernel threads.

pthreads are usually scheduled as a thin veneer over kernel threads.   
For example, there is a 1-1 map between pthreads and Mach threads on  
Darwin (similarly for Solaris and Linux).

> The old thread system is tied to the older GC, which requires that
> system-dependent wrappers be used for many OS system calls.

Not true.   The old thread system works fine with the new GC.

> The new thread system is tied to the new GC, which doesn't need
> the wrappers, but has the compiler inserting calls to the GC in
> a few places.

Not true.  The new GC works fine with the old threads system.

> Is this all correct?

Hope this helps.

>
> -- 
> -------------------------------------------------------------
> Rodney M. Bates, retired assistant professor
> Dept. of Computer Science, Wichita State University
> Wichita, KS 67260-0083
> 316-978-3922
> rodney.bates at wichita.edu




More information about the M3devel mailing list