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: Dave Butenhof Subject: Re: HOW-TO KILL THREADS Date: 1997/10/28 Message-ID: <3455C9DB.CDC9DE0@zko.dec.com>#1/1 X-Deja-AN: 285548475 References: <632s9v$r99$0@206.165.146.124> Organization: Digital Equipment Corporation Newsgroups: comp.unix.osf.osf1 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. > > The problem is that pthread_kill doesn't exits. Is it possible to send a > signal to a specific thread to abort a read or a select? > > Thank you for any assistance you may be able to give. You really can't kill a "runaway" thread and hope to regain control. Remember that all the threads in the process run the same code, and access the same data. If one thread is doing something wrong, and you don't know why, you CANNOT assume that the other threads are "safe". Kill the process. DCE threads, the loose implementation of POSIX draft 4 threads that's part of DEC OSF/1 3.2, didn't have any way to send a signal to a particular thread. The concept was not supported either by the draft standard nor by the implementation. You can't even use cancellation, because DCE threads didn't have sufficient integration with the kernel to make kernel blocking functions into cancellation points. 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. /---------------------------[ Dave Butenhof ]--------------------------\ | Digital Equipment Corporation butenhof@zko.dec.com | | 110 Spit Brook Rd ZKO2-3/Q18 http://members.aol.com/drbutenhof | | Nashua NH 03062-2698 http://www.awl.com/cseng/titles/0-201-63392-2/ | \-----------------[ Better Living Through Concurrency ]----------------/