Welcome to the Linux Foundation Forum!

In depth explanation of Spinlock, Semaphore, Mutex

Seeking in depth explanation for Spinlock, Semaphore, Mutex.

I tried Google but everywhere I am just getting basic working of these things. I need more explanation.

like,

1. what to use when and why.

2. what is system's status while using one of these

3. Concrete differences between these

Few things that I am Confused about

Mutex:-

1. Recursive locking allowed or not ?

Answer- As I think its operating system dependent.

2. holder can sleep or not ?

Answer- Can Sleep, even while holding lock.

3, is scope limited within the process ??? that is it can't be used between two process ?

Answer- Can be used between processes

4. It can't be acquired by interrupt handler or bottom half

5. to be used when u want long lock hold time ?????

6 its used for locking

Semaphore:-

1. Recursive locking allowed or not ?

Answer- not allowed ?

2. can sleep or not ?

Answer- Can Sleep.

3, is scope limited within the process ??? that is it can't be used between two process ?

Answer- Can be used between processes

4. its for synchronization or can be taken as signaling mechanism.

Thanks a lot!

Categories

Upcoming Training