Hello,
I'm facing an issue in thread sleep and wake up mechanism. Please answer the query if you've idea on this. I'll explain the current implementation first and then the problem that I'm seeing.
The current implementation is: When a thread issues a timed wait/sleep on on a CV (wchan), the below three steps are taken viz.,
Have you ever faced such a situation where, the wake up mechanism of a thread is broken in between... especially after removing the reference from callwheel entry and before removing from the wchan entry?
Thanks you for your time.
I'm facing an issue in thread sleep and wake up mechanism. Please answer the query if you've idea on this. I'll explain the current implementation first and then the problem that I'm seeing.
The current implementation is: When a thread issues a timed wait/sleep on on a CV (wchan), the below three steps are taken viz.,
- The callout reference of the thread is first added into callwheel bucket corresponding to the timeout required
- The thread reference is queued in the respective wchan (wait channel) list and
- The thread sleeps
- The entries in the callwheel bucket for this tick is parsed through and selects the thread waiting to be awakened at this tick and removes from the chain
- The thread reference is removed from the wchan and
- Put into runqueue.
Have you ever faced such a situation where, the wake up mechanism of a thread is broken in between... especially after removing the reference from callwheel entry and before removing from the wchan entry?
Thanks you for your time.