Re: schdule() doubt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On Fri, Nov 14, 2008 at 1:58 PM, nidhi mittal <nidhimittal19@xxxxxxxxx> wrote:

actually i saw that ..
set_current_state (TASK_INTERRUPTIBLE)
schedule()

as far as i understood
these two are independent statements

where in first statement we just change the state variable in proces descriptor
and in 2nd statement we put process to actual sleep

now my ques is
if process is interrupted between these two statements by any means......
wont it be in some corrupt state
where its not sleeping but running but its state is changed to TASK_INTERRUPTIBLE...............


pl clarify why didnt we make these statements as one atomic statement ....


--
Thanks & Regards
Nidhi

As I understand the problem, process has set the state to TASK_INTERRUPTIBLE but its still in run queue (since schedule() has not been called). Now if this process gets interrupted (by higher priority process I suppose), its current state will be saved, and new process will be executed. Since our process is in runqueue still, it will be reschedule again after some time. Since while rescheduling, scheduler does not check the status bit, these will be no effect of this TASK_INTERRUPTIBLE status bit. And just after getting rescheduled, process is going to sleep (call schedule()) again. Please let me know if my understanding is correct.

--
Dinesh Bansal
The Law of Win says, "Let's not do it your way or my way; let's do it the best way."

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux