something for the night: Can someone explain why normal pthreads can be
restricted to initially use only the stack size provided via
pthread_attr_setstacksize() while any rt-mapped thread (posix and
native) refuse to accept this? For a simple test, compile the attached
program one time as normal

    gcc -lpthread -o stacksize stacksize.c

and the other time against xeno's posix skin

    gcc `xeno-config --posix-cflags` `xeno-config --posix-ldflags` \
        -o stacksize.o stacksize.c

Then compare the memory requirements of both processes - they should
differ by 2M, the stack size when pthread_attr_setstacksize is not used.
Strange - and also critical when considering larger applications...

So far I only tested against 2.1, but I don't see a reason why 2.0.x
should behave different. Will get checked, though.

Any ideas?

#include <sys/mman.h>
#include <unistd.h>
#include <limits.h>
#include <pthread.h>

static void *simple_thread(void *arg)
    return 0;

int main (int ac, char **av)
    pthread_t pth;
    pthread_attr_t attr;

    mlockall(MCL_CURRENT | MCL_FUTURE);

    pthread_attr_setstacksize(&attr, PTHREAD_STACK_MIN);
    pthread_create(&pth, &attr, simple_thread, NULL);


    return 0;

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to