Computer Science 822 Quiz 3 Name_______________________ 1. a. Describe the layout of each block of memory that contains a Linux task_struct It is an 8K block with the kernel stack at the high address end growing down toward the task_struct proper which starts at the low address end b. How does the "current()" pseudo-function work? (I KNOW that it returns a pointer to the task struct of the currently running process..) I'm ASKING how does it do this?? And SP with ~8191 (zero low order 13 bits) The Linux task_struct contains two structures used to link tasks together struct list_head run_list; : : struct task_struct *next_task, *prev_task; 2. Under what conditions does a task enter / exit each list run_list: enter each time task becomes runnable (wakes up) exit at each sleep() next/prev_task: enters at creation time; exits at exit time. 3. While a process sleeps, its wait_queue_element resides: a. on the user stack b. on the kernel stack B c. in kmalloc'd memory d. in user memory 4. The interruptible_sleep_on function looks like: 811 SLEEP_ON_HEAD 812 schedule(); 813 SLEEP_ON_TAIL For each of the following answer H, S, or T depending upon where it occurs _S_ a. The task struct is removed from the runqueue _H_ b. The task struct is linked into the waitqueue _T_ c. The task struct is put back on the runqueue _T_ d. The task struct is removed from the waitqueue. _S_ e. The task snoozes here waiting for the wakeup call. 5. What is the purpose of the "unlikely()" pseudo function Assist the compiler to optimize code path for the more likely possible path. 6. Identify ALL cases in which SCHED_OTHER user processes will get no CPU time at all. a. A SCHED_FIFO is in an infinite b. A SCHED_RR is in an infinite Loop. loop A,B c. A kernel daemon running as d. Another user process is ahead of SCHED_OTHER is in an in an infinite loop. infinite loop. 7. Suppose there are NO FIFO or RR processes. Is it possible for a nice +19 process to be starved of CPU time when competing with several nice +0 processes in an infinite loop? Explain why or why not. No, the +19 process will get 1 tick after all of the +0 processes have their counter values reach 0. 8. Suppose a process enters a 2 hour sleep with p->counter = 2 and a NICE_TO_TICKS value of 4. Approximately what will p->counter be when the process wakes up? 7 or 8 (About 2 x the NICE_TO_TICKS value) 9. The largest amount of time a nice+0 process can hold the CPU without being preempted in favor of another competing nice+0 process is closest to: a. 500 usec b. 5 msec c c. 50 msec d. 500 msec 10. The p->counter values are incremented at the end of what is called a "scheduling epoch". Exactly what triggers the "end-of-epoch" condition in the scheduling algorithm. No runnable SCHED_OTHER process has counter value > 0.