[mercury-users] Style, Newbie decision question, "What? No X?!", Microbenchmark

Richard A. O'Keefe ok at cs.otago.ac.nz
Tue Nov 19 15:59:03 AEDT 2002


Fergus Henderson <fjh at cs.mu.OZ.AU> asked:

	What exactly is evil about Posix threads?
	
Nothing, as long as you drive them from a high level language where
the compiler can give you some help, as opposed to driving them from C.

If you are driving them from C, you had better be omniscient
(so that you get the stack size right in your call to
pthread_attr_setstacksize(), because there is literally NO way to
get this information from the C compiler, and the size may depend not
only on which C compiler you used but what options you passed it)
and infallible (so that you don't forget to update the number when
you change anything about the code or the way it is compiled).

On one machine, I'm told that the default stack size is 1MB.
On another machine, I'm not told what the default stack size is,
only that there is a minimum (whose value I am not told) and a
maximum (ditto) and heaven help me if I get it wrong, because
pthread.so won't.

For a language like Mercury, where the compiler knows what is going on,
one would hope for a runtime system where separate threads start out
with small enough stacks that one can reasonably have thousands of them
(if I tried having thousands of pthreads with default stack size on one
of my machines, the operating system would choke, because there just isn't
that much swap space) and yet can grow when needed so that reasonable
processes just work.

--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list