- LWP - do stacks really return to the cache

Basile STARYNKEVITCH basile at soleil.cea.fr
Fri May 10 09:05:00 AEST 1991


About your problem read in Sun-Spots Digest, v10n81, here is an
(unchecked) diagnosis  ::

You create a lot of dynamically stacked (with lwp_newstk) lwp-s with
LWPNOLASTRITES. Since they don't recieve any last rites (i.e.  Postmortem
processing) their stack is not freed on exit..

I've read in the Sun manuals that NOLASTRITES is uncompatible with dynamic
stacks.  Practically, I only use that option for very few special lwps
(including my own LASTRITES server, my scheduler lwp, etc), and those
special lwps with NOLASTRITES shoudl have statically allocated stacks.  I
suppose that your program should run if you remove that NOLASTRITES
options.

There is another problem with dynamically stacked lwp-s :: memory
allocation on stack (by alloca()) doesn't work very well (producing
SIGSEGV for medium sized alloca requests, such as alloca(50000)).

I've experienced  other problems with lwps (and related stuff)::

1) Non blocking io library (liblnbio.a) is not compatible with nlist,
   dlopen, or mmap to /dev/zero calls.
2) Debugging is really painful,... sometimes, a where command under dbx
   with a core from a lwp program produces an infinite call stack...
3) some lwp. enumerating facilities (maybe mon_waiters..??) crash (core
   dump SIGSEGV)

I'm still using lwp, for the minimal stuff it gives - several threads of
control..  (I'm writing EUM - an A.I., reflexive, metaknowledge based
system, wich generates (parts of) its own code (in C), using
meta-knowledge about programming. So it is self modifying and
multithreaded (a thread generate code to be used in another one..), and so
I've spent lots of time turning around the bugs in the lwp lib.)

Basile STARYNKEVITCH
Commissariat a l'Energie Atomique
DMT/SERMA
C.E. Saclay bat 470
91191 GIF/YVETTE CEDEX
France

Email: basile at soleil.saclay.cea.fr




More information about the Comp.sys.sun mailing list