Subject: smp & lwps
To: None <>
From: Mihai CHELARU <>
List: tech-smp
Date: 06/11/2004 22:13:30

On a multiprocessor machine, a simple code like this, may become unkillable.

#include <stdio.h>
#include <unistd.h>
#include <lwp.h>

void pt(void *unused)
int i;
while(1) {
        for (i=0;i<100;i++);

main ()
ucontext_t c;
lwpid_t lpid;
char buf[9000], buf2[9000];
_lwp_makecontext(&c, pt, NULL, NULL, buf, 8192);
_lwp_create(&c, 0x00000040, &lpid);
_lwp_makecontext(&c, pt, NULL, NULL, buf2, 8192);
_lwp_create(&c, 0x00000040, &lpid);

run it like this:
$ ./test &
$ kill -2 %1

Looks like it kills only a lwp, while leaving the other running. Main problem 
is that the remaining one cannot be killed.