Search code examples
unixprocesssignalscoredump

How can I put process into "uninterruptible sleep"?


I'm testing some functionality to monitor processes and I need to emulate long core dump with determined "delay" (for example I need to make a process to "dump core" for 30 seconds). I'm noticed that process that dumping a core is in uninterruptible sleep, so it can't be killed with SIGKILL, but when I'm trying to emulate this behavior using pipe commands that receives coredump I can easily kill such process. So is there some way to make process to get into uninterruptible sleep (with such status in ps) and make it ignore the SIGKILL?


Solution

  • To put a process in an interruptible sleep mode you will have to go into kernel code. Using the functionality of wake_up_interruptible and spin locks you will be able to achieve this state.