Skip to contentSkip to conversation

Does the scheduler run every time jiffies is incremented?

DISCUSSION Francis Litterio 3 participants 3 messages Apr 22, 2001

lore
Share & tools
lore
#0 lore raw

I'm reading Rubini's "Linux Device Drivers" and it isn't clear to me whether the scheduler runs every time the timer interrupt increments jiffies or less frequently.

Does the scheduler run every time jiffies is incremented? --
Francis Litterio
[email protected]
http://world.std.com/~franl/
PGP public keys available on keyservers.

#1 lore raw

[please remove linux-kernel from the CC and move it to the
more appropriate kernelnewbies list]

Quoted 5 lines · Francis Litterio

I'm reading Rubini's "Linux Device Drivers" and it isn't clear to me whether the scheduler runs every time the timer interrupt increments jiffies or less frequently.

Does the scheduler run every time jiffies is incremented?

No. Every timer interrupt a bunch of functions in kernel/timer.c is run, amongst them the following lines of code (from update_process_times):

                if (--p->counter <= 0) {
                        p->counter = 0;
                        p->need_resched = 1;
                }

As you can see, we will only reschedule when the time slice of the currently running process is over.

regards,

Rik
--
Virtual memory is like a game you can't win; However, without VM there's truly nothing to lose...

		http://www.surriel.com/

http://www.conectiva.com/ http://distro.conectiva.com.br/

#2 lore raw
In reply to Francis Litterio
Quoted 1 line · Francis Litterio

Does the scheduler run every time jiffies is incremented?

No, it runs when something needs to be rescheduled (ie, when the current tasks need_resched element (current->need_resched) is set). This typically happens when someone wakes up, or the task reaches the end of its allotted quantum.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html