What is the process state when pthread_mutex() is executed
1
vote
1
answer
1311
views
Following are the Linux Process states;
R: running or runnable, it is just waiting for the CPU to process it
S: Interruptible sleep, waiting for an event to complete, such as input from the terminal
D: Uninterruptible sleep, processes that cannot be killed or interrupted with a signal, usually to make them go away you have to reboot or fix the issue
Z: Zombie, we discussed in a previous lesson that zombies are terminated processes that are waiting to have their statuses collected
T: Stopped, a process that has been suspended/stopped
I have two questions;
(1) When a mutex_lock() is called in a process/thread, and if it is waiting for the lock to acquire(another thread locked the mutex already), will the process go to
or
?
(2) I know that spinlock() will put the process in busy waiting and it checks to see if the lock is unlocked by other thread. However in mutex_lock() how it knows that the lock is unlocked and it is available to lock and proceed? i.e; How the process wakes up from
to lock the mutex when it is available(unlocked by other thread)?
Asked by Franc
(309 rep)
Nov 17, 2020, 05:03 PM
Last activity: Nov 27, 2020, 03:56 PM
Last activity: Nov 27, 2020, 03:56 PM