On Mon, Mar 04, 2002 at 11:05:03PM -0800, William Lee Irwin III wrote: > > > 2. When does the scheduler get control so that it can perform the task > > switch. i.e is the scheduler called from the timer interrupt or something > > like that? > > The scheduler gets control during explicit calls to schedule() and other > functions in sched.c ...during return to user mode (interrupts, exceptions, syscalls) figure 4.5 page 134 Understanding the Linux Kernel and and also with voluntary yield. > > 4. Does the linux kernel use the facilities provided by the processor ( I > > think x86 has facilities for task switch ) for the task switching? > > TSS's are essentially required for SMP operation. However, Linux uses > one TSS per cpu. I think this answers it -- arch/i386/kernel/process.c /* * switch_to(x,yn) should switch tasks from x to y. * * We fsave/fwait so that an exception goes off at the right time * (as a call from the fsave or fwait in effect) rather than to * the wrong process. Lazy FP saving no longer makes any sense * with modern CPU's, and this simplifies a lot of things (SMP * and UP become the same). * * NOTE! We used to use the x86 hardware context switching. The * reason for not using it any more becomes apparent when you * try to recover gracefully from saved state that is no longer * valid (stale segment register values in particular). With the * hardware task-switch, there is no way to fix up bad state in * a reasonable manner. * * The fact that Intel documents the hardware task-switching to * be slow is a fairly red herring - this code is not noticeably * faster. However, there _is_ some room for improvement here, * so the performance issues may eventually be a valid point. * More important, however, is the fact that this allows us much * more flexibility. */ void __switch_to(struct task_struct *prev_p, struct task_struct *next_p) { Regards, Sourav _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ IRC Channel: irc.openprojects.net / #kernelnewbies Web Page: http://www.kernelnewbies.org/