[m-users.] What is the threading model

Paul Bone paul at bone.id.au
Fri Mar 7 15:17:21 AEDT 2014

On Fri, Mar 07, 2014 at 02:50:25PM +1100, Julien Fischer wrote:
> On Fri, 7 Mar 2014, Paul Bone wrote:
>> On Fri, Mar 07, 2014 at 02:25:19AM +1300, ardeujho wrote:
>>> What is the threading model of Mercury? Does it depend on the grades? Is
>>> it native threads or some form of green threads?
>> It's grade dependent, basically:
>> low level C:    green threads running on a fixed number of OS threads.
>> high level C:   OS threads only
>> Java:           Java's threads
>> C#:             C#'s threads, I think I don't really know
> Yes, it uses C#'s threads.
>> In the C grades you must have the .par grade component to access these
>> features.
> In high-level C grades you must have .par grade component.  The thread
> features will work in low-level C grades without it, but you won't
> (obviously) get parallel execution of threads without it.

It may be more limited than that in the low-level C grades.  I know that's
how it used to be but it may have changed when I re-wrote the task switching
code for the parallel grades.  I didn't change anything to do with the
non-parallel grades specifically, but if we assume the worst then they may
be broken in this respect.  It's easier to say that it's not currently

Paul Bone

More information about the users mailing list