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

It is stated in the text (exercises) that the Linux operating system does not al

ID: 3734262 • Letter: I

Question

It is stated in the text (exercises) that the Linux operating system does not allow a process holding a spinlock to attempt to acquire a semaphore. What is the source of this statement? What bad things could happen, which need to be avoided, if a process holding a spinlock could also try to access a semaphore (whether it gets in or not)? What is it that a process holding a spinlock cannot do, which implements the prohibition? Note that this is not the same as when a process is “spinning” waiting for the mutex.

Explanation / Answer

When two or more processes requires aan access to shared resource, they might need to enforce the condition.This is the most common lock in Linux kernel.A spinlock is a mutual exclusion that consist of only two values,such that “locked” and “unlocked.”

These are a problem such that blocks present in this lock, that thread's CPU core from doing alternate task. While the Linux kernel does provide multitasking services to user space programs running under it, then the multitasking facility doesn't extend to kernel code.A spin lock is considered bad because the process is consuming cycles needlessly. This results in deadlock.

A process cannot be preempted or sleep while holding a spinlock due to the behavior of spinlock. If a process acquires a spinlock and moves to sleep before releasing the spinlock. A second process ( an interrupt handler) that has to acquire the spinlock will busy wait. On uniprocessor machine the process that has to wait for lock will lock the CPU not allowing the other process to wake up and release the spinlock such that the second process can continue, which is usually a deadlock

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