tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Strange behaviour with threads in zombie state



Hi,

While looking at other stuff, I've found that the following code:

#include <sys/module.h>
#include <sys/workqueue.h>

MODULE(MODULE_CLASS_MISC, test, NULL);

static struct workqueue *wq;

static int
test_modcmd(modcmd_t cmd, void *arg)
{
        int error;

        switch (cmd) {
        case MODULE_CMD_INIT:
                error = workqueue_create(&wq, "test", NULL, NULL, PRI_NONE,
                    IPL_SOFTCLOCK, WQ_MPSAFE);
                if (error)
                        return error;
                return 0;
        case MODULE_CMD_FINI:
                workqueue_destroy(wq);
                return 0;
        default:
                return ENOTTY;
        }
}

gives strange results once it's loaded/unloaded. Let's see what happens:

Before loading the module, the system process shows up as:

$ ps axl|grep system     
   0   0    0   0   0  0    0  13060 -       DKl  ?     0:00.05 [system]
1000 329  468   0  95  0  116    944 piperd  R+   ttyp1 0:00.00 grep system 
$

Once the module is loaded, all continues to be good but when it's unloaded
the system process is in zombie state, as well as all kernel threads.

$ sudo modload test.kmod                                                        
                                        
$ modstat |grep test                                                            
                                
test            misc    filesys 0       224     -
$ ps axl|grep system            
   0   0    0   0 125  0    0  12856 schedule DKl  ?     0:00.06 [system]
$ sudo modunload test
$ ps axl|grep system  
   0   0    0   0 125  0    0  12860 schedule ZKl  ?     0:00.06 [system]
1000 310  468   0  95  0  116    948 piperd   S+   ttyp1 0:00.00 grep system 
$

I noticed the same thing with gkrellm, which once started its state
is zombie and it's only shown in top with the lwp mode.

What's the reason of this? I don't think it's always been that way...

Please CC me, I'm not subscribed... thanks.


Home | Main Index | Thread Index | Old Index