You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's launch two threads and see if they actually run in parallel:
4006
4002
@@ -4034,7 +4030,7 @@ Possible very likely outcome:
4034
4030
4035
4031
The threads almost always interleaved nicely, thus confirming that they are actually running in parallel.
4036
4032
4037
-
===== sleep
4033
+
==== sleep
4038
4034
4039
4035
Count to dmesg every one second from `0` up to `n - 1`:
4040
4036
@@ -4044,14 +4040,14 @@ insmod /sleep.ko n=5
4044
4040
4045
4041
Source: link:kernel_module/sleep.c[]
4046
4042
4047
-
The sleep is done with a call to `usleep_range` directly inside `module_init` for simplicity.
4043
+
The sleep is done with a call to link:https://github.com/torvalds/linux/blob/v4.17/kernel/time/timer.c#L1984[`usleep_range`] directly inside `module_init` for simplicity.
The sleep is done indirectly through: `queue_delayed_work`, which waits the specified time before scheduling the work.
4088
+
The sleep is done indirectly through: link:https://github.com/torvalds/linux/blob/v4.17/include/linux/workqueue.h#L522[`queue_delayed_work`], which waits the specified time before scheduling the work.
4093
4089
4094
4090
Source: link:kernel_module/work_from_work.c[]
4095
4091
4096
-
===== schedule
4092
+
==== schedule
4097
4093
4098
4094
Let's block the entire kernel! Yay:
4099
4095
@@ -4128,6 +4124,31 @@ The system also responds if we <<number-of-cores,add another core>>:
0 commit comments