Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

c) On a running Linux kernel (version> 2.6) at some point the thread_info.preemp

ID: 3908375 • Letter: C

Question

c) On a running Linux kernel (version> 2.6) at some point the thread_info.preempt_count field for a kernel task we call A is equal to 2. (Linux kernel synchronization is discussed in the textbook). Answer these questions: c1) Is task A currently preemptable? Explain. c2) what is new value of thread-in fo·preempt-count field for task A after it acquires a new lock ? Explain. c3) What is the condition for kernel task A to be safely interruptible ? c4) Assuming that all locks held by task A are spinlocks, how many CPUs are on that computer ?

Explanation / Answer

c1)Current Task A is not preemptable as in thread_info.preempt_count field is non zero.This value indicated that the task A holds 2 active locks and it is not safe to preempt this task.

Preemption will be carried out only after checking whether thread_info.preempt_count field of active task is zero.

c2)If task A acquires new lock then value of thread_info.preempt_count will be incremented by 1.

Therefore current value becomes 3.

c3) Condition for Kernal task A to be safely interruptible is when the task doesnot hold any active lock on the resources.

That is determined by checking the value of thread_info.preempt_count.

c4)

If all the locks held by task A is spin locks then it means that the System has multiple CPU's or Multiple Core.

because the thread which is being blocked by spinlock continues to execute in a infinite while loop until it gets the requested resource therefore it needs CPU time.

Therefore ideally the Number of CPU/Core = Number of Spinlocks acquire

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote