From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,b9c84b1914162ecd X-Google-Attributes: gidfee84,public From: Brian Silver Subject: Re: HOW-TO KILL THREADS Date: 1997/10/28 Message-ID: <34563964.6488@my.sig.for.address>#1/1 X-Deja-AN: 286275688 References: <632s9v$r99$0@206.165.146.124> <3455C9DB.CDC9DE0@zko.dec.com> Organization: DECthreads Newsgroups: comp.unix.osf.osf1 Dave Butenhof wrote: > > Richard Spangenberg wrote: > > > > We are trying to install a database (MYSQL) in a Dec/ALpha OSF1 3.2 machine. > > Everything is up and running but we are concerned that there appears to be > > do way to stop a thread if it starts to eat up CPU time. [Snip] > So the answer is, "no, you can't". And furthermore, even if you were on > a Digital UNIX 4.0 system, which has POSIX threads, with pthread_kill > and cancellable I/O functions, you shouldn't WANT to. Once something is > wrong with the PROCESS, destroying a misbehaving thread is usually just > removing a symptom of the real problem. Just to add a little to this, it seems to me like the original poster wanted to kill a thread from outside of the process. (Like using the kill command). This isn't possible in 4.0 (and 3.2 for different reasons that Dave outlined previously) because there is no way for a generic process to get the necessary thread ids of threads in any other generic process. Furthermore, even if you had the necessary thread id, you'd still need a mechanism that said "signal this thread, but it lives in this process", and this just doesn't exist unless you write it into both processes. Even if you could cancel what you see as a "kernel" thread on 4.0 (and decendants) it won't do remotely what you expect it to do, and will (more than likely) cripple the process in some way that that will be unclear and non-predictable. Kernel threads don't map 1-1 to user threads like they did on 3.2 (and predecessors) as there is a 2-level scheduling implimentation in DECthreads. Bottom line: Nuke the process. You'll be happier in the end. Brian. -- Replace ! with @ for email address: silver!zko.dec.com