LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 02-01-2007, 02:17 PM   #1
tbui57
LQ Newbie
 
Registered: Jan 2007
Posts: 2

Rep: Reputation: 0
Linux Scheduler


I found out that the linux schedule() is called on every system call. I also thought that the tick timer interrupt should invoke the schedule() ?

I trace the linux kernel code but could not find any where the schedule is called from the tick timer interrupt.

I am sure there are some one with linux kernel knowledge, please help.

Thanks in advance,
Tung
 
Old 02-02-2007, 03:18 AM   #2
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
Its called from sched.c, rtc.c, rtc-dev.c, signal.c, processor.c, mutex.c, semaphore.c, idle.c, genrtc.c, hpet.c and probably in 50 other files.
 
Old 02-03-2007, 10:27 PM   #3
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,671
Blog Entries: 4

Rep: Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945Reputation: 3945
When a timer interrupt happens, it cannot immediately call schedule() because, at that moment, it is still in an interrupt-handler context.

What it does, instead, is to set the NEEDS_RESCHEDULE flag. This flag is checked when we are otherwise ready to return to user mode.

Generally speaking, any interrupt-handler is divided into what is casually called the top half and the bottom half. (While these terms were literally used as the names of now-deprecated mechanisms in the kernel itself, the essential notion denoted by terms such as these, remains useful: interrupt processing occurs in two stages.) Conceptually, "the top half" is the immediate and very-brief response to the actual hardware signal, but almost all that we actually do at that time is to arrange for the "real" interrupt response to occur "soon." That work is done in "the bottom half."

For example, a timer-interrupt will cause the current process to be pre-empted "soon." It may cause task-queues, tasklets, or other deferred-execution units-of-work to become "runnable," so that they will occur "soon." An I/O interrupt's top-half handler will scoop status-information from the controller's registers, then schedule the bottom-half, which is where the consequences of the data-transfer that has just happened will be dealt with.
 
Old 02-04-2007, 12:37 PM   #4
studioj
Member
 
Registered: Oct 2006
Posts: 460

Rep: Reputation: 31
yea a scheduling slice is/can be larger than timer ticks so there is also p->counter
leading to p->need_resched
timeslice is dynamically calculated based on priorities i think and different people run ticks of different frequencies for various reasons.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Linux Scheduler Scarlett_987 Linux - Kernel 1 01-23-2007 08:54 PM
linux 2.6 scheduler panandsapphire Linux - Kernel 1 08-26-2006 09:01 PM
Modification Linux 2.6 Scheduler aerofloat Programming 1 07-26-2006 11:51 PM
Linux Scheduler - Redhat 2.4.18 KidVI Linux - Software 2 05-03-2005 03:34 AM
chaning linux scheduler() dumb82 Linux - General 0 07-22-2004 11:50 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration