Task: Another Time Slice
Enter the labs/lab-06/tasks/libult/support/ folder and go through the practice items below.
-
Modify the time slice set to the timer to 2 seconds. Re-run the code in
test_ult.c. Notice that now no context switch happens between the 2 created threads because they end before the timer can fire. -
Now change the
printer_thread()function intest_ult.cto make it run for more than 2 seconds. See that now the prints from the two threads appear intermingled. Add prints to thehandle_sigprof()function inthreads.cto see the context switch happen.
If you’re having difficulties solving this exercise, go through this reading material.