Questions tagged [spinlock]

9 questions
39
votes
5 answers

What is a spinlock in Linux?

I would like to know about Linux spinlocks in detail; could someone explain them to me?
Navaneeth Sen
  • 9,369
  • 17
  • 58
  • 65
15
votes
3 answers

what is the difference between spin locks and semaphores?

What are the basic differences between spin locks and semaphores in action?
Renjith G
  • 5,788
  • 16
  • 40
  • 48
7
votes
4 answers

Why are spin locks good choices in Linux Kernel Design instead of something more common in userland code, such as semaphore or mutex?

I understand that Spinlocks are real waste in Linux Kernel Design. I would like to know why is it like spin locks are good choices in Linux Kernel Design instead of something more common in userland code, such as semaphore or mutex?
Navaneeth Sen
  • 9,369
  • 17
  • 58
  • 65
2
votes
1 answer

How spin lock is implemented in Linux?

I'm thinking about how the feature "prevent from context switch" is achieved in Linux for a spinlock. A big picture / pseudocode is acceptable since I just what to know the logic behind it.
Kindred
  • 284
  • 1
  • 2
  • 15
1
vote
1 answer

How does a spinlock prevents context switching?

I am using this code in order to visualize how a spinlock would prevent context switching: pthread_spinlock_t lock; void pp() { pthread_spin_lock(&lock); char d = 'D'; while(1) write(1, &d, 1); } void ppp() { char a =…
Aramya
  • 27
  • 4
1
vote
1 answer

Fedora booting failure under VirtualBox

A student of mine stuck with a Fedora virtual machine under VirtualBox: I do not even recognize what is going on here. Do you have a clue what is going on? (on the left you see another VM that is broadcasted from me, a working instance of this…
Gergely
  • 794
  • 1
  • 10
  • 24
1
vote
1 answer

how to monitor spinlocks

I'm wondering how I could monitor spinlocks. At my client, we have cpu soft lockup failure, for which, if I understand well, spinlock is a likely cause. Different team use that server for predictive modeling using R, Python and SAS, meaning we often…
0
votes
1 answer

A question about spin locks

In studying the spin lock synchronization mechanism, i noticed that for each function there is also a corresponding macro, for example for spin_lock there is a function static __always_inline void spin_lock(spinlock_t *lock) { …
0
votes
1 answer

Basic spinlock doubt

I read that in spinlock, process keeps on waiting for the lock continuously in a loop until it receives signal(lock) or release(lock) from other process. This causes busy waiting and hence CPU cycles are wasted. My doubt is if CPU is continuously…
Zephyr
  • 183
  • 2
  • 10