How to implement deferred operation in Linux
How to achieve deferred operation in Linux, I believe that many inexperienced people do not know what to do. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
1. The header function for timing in the kernel is # include
2. The Hz symbol indicates the number of clock ticks produced per second, that is, the time interrupt generated by 1 second.
3 、 # include
Volatile unsigned long jiffies uses this variable to measure the change of time.
4. Int time_after (unsigned long a, unsigned long b)
Int time_before (unsigned long a, unsigned long b)
These Boolean expressions compare jiffies values in a safe way, regardless of timer overflow.
5. The numerical conversion between the time represented by jiffies and other representation methods:
Struct timeval {time_t tv_sec; / * seconds * / suseconds_t tv_usec; / * microseconds * /}; struct timespec {long int tv_sec; long int tv_nsec;}
Header files that use this structure are commonly used in # include:
Int gettimeofday (struct timeval * tv, struct timezone * tz); after reading the above, have you mastered how to postpone the operation in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!