How can I put process into "uninterruptible sleep"? How can I put process into "uninterruptible sleep"? unix unix

How can I put process into "uninterruptible sleep"?


Most proper way is to use freezer cgroup. It puts process to uninterruptible sleep in case of FROZEN cgroup state.

# mkdir /sys/fs/cgroup/freezer# mount -t cgroup -ofreezer freezer /sys/fs/cgroup/freezer# mkdir /sys/fs/cgroup/freezer/frozen# echo FROZEN > /sys/fs/cgroup/freezer/frozen/freezer.state# echo `pidof you_process` > /sys/fs/cgroup/freezer/frozen/tasks

To put again to interruptible sleep, just change cgroup state to THAWED.


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.


One reliable (if complicated) way to do this is to hard-mount an NFS directory and then take down the NFS server.