Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to sleep in the Linux kernel?

Can I use the msleep() function to sleep for a specified amount of time in kernel space? If so, which header files do I need to include? #include <linux/time.h> doesn't seem to be the right one. Is there perhaps a better function for this purpose?

like image 716
John Roberts Avatar asked Apr 14 '13 00:04

John Roberts


People also ask

Does Linux go to sleep?

Linux does indeed log out, but jupyter notebook calculations run further and Linux does not go to sleep unless they are done. If you wake the computer in the morning, you will find the finished calculations with all variables still in memory.

What is sleep Linux?

What Does the Linux sleep Command Do? The sleep command suspends the calling process of the next command for a specified amount of time. This property is useful when the following command's execution depends on the successful completion of a previous command.

How do I suspend RAM in Linux?

An easier way to do things, and presumably the default way on all modern Linux operating systems, would be to simply leave /sys/power/mem_sleep set to deep and write freeze to /sys/power/state to Suspend-To-Idle, and to write mem to /sys/power/state to Suspend-To-RAM.


1 Answers

I needed to include <linux/delay.h> to use msleep in kernel space.

like image 132
John Roberts Avatar answered Sep 22 '22 02:09

John Roberts