From: kernelnewbies-bounces@kernelnewbies.org [mailto:kernelnewbies-bounces@kernelnewbies.org] On Behalf Of Joshi
Sent: Wednesday, June 11, 2014 11:33 AM
To: Valdis.Kletnieks@vt.edu
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Putting a thread to sleep using schedule() is foolproof?

 

Is not changing the state to TASK_INTERRUPTIBLE before calling schedule() renders it not-schedulable? I thought task would be removed off run-queue by schedule() because it is in TASK_INTERRUPTIBLE state. 

 

I was making a sort of task queue. Threads puts themselves into this queue when a resource(say memory-space) is not available. And other thread, post releasing the memory space, will wake the first thread in queue.

There are other means to achieve that, but I wondered why the above mentioned method did not succeed in making thread sleep.

 

I think TASK_INTERRUPTIBLE has to do with whether or not a task can be “interrupted” by a signal, as in wait_event_interruptible().

 

Jeff Haran