public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Jesper Juhl <juhl-lkml@dif.dk>
Cc: Arun Srinivas <getarunsri@hotmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: sched /HT processor
Date: Sun, 03 Apr 2005 11:31:03 -0400	[thread overview]
Message-ID: <1112542263.27149.113.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.62.0504031253060.2448@dragon.hyggekrogen.localhost>

On Sun, 2005-04-03 at 13:17 +0200, Jesper Juhl wrote:
> 
> A reschedule can happen once every ms, but also upon returning to 
> userspace and when returning from an interrupt handler, and also when 
> something in the kernel explicitly calls schedule() or sleeps (which in 
> turn results in a call to schedule()). And each CPU runs schedule() 
> independently.
> At least that's my understanding of it - if I'm wrong I hope someone on 
> the list will correct me.

You're correct, but I'll add some more details here.  The actual
schedule happens when needed.  A schedule may not take place at every
ms, if the task running is not done with its time slice and no events
happened where another task should preempt it. If an RT task is running
in a FIFO policy, then it will continue to run until it calls schedule
itself or another process of higher priority preempts it. 

Now if you don't have PREEMPT turned on, than the schedule won't take
place at all while a task is in the kernel, unless the task explicitly
calls schedule.

What happens on a timer interrupt where a task is done with its time
slice or another event where a schedule should take place, is just the
need_resched flag is set for the task.  On return from the interrupt the
flag is checked, and if set a schedule is called. 

This is still a pretty basic description of what really happens, and if
you want to learn more, just start searching the kernel code for
schedule and need_resched. Don't forget to look in the asm code (ie
entry.S, and dependent on your arch other *.S files).

-- Steve



  reply	other threads:[~2005-04-03 15:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bpH71yEXU00000397@hotmail.com>
2005-04-03  0:37 ` sched /HT processor Arun Srinivas
2005-04-03  1:17   ` Steven Rostedt
2005-04-03  2:16     ` Arun Srinivas
2005-04-03  4:22       ` Steven Rostedt
2005-04-03  7:52     ` Arun Srinivas
2005-04-03 11:17       ` Jesper Juhl
2005-04-03 15:31         ` Steven Rostedt [this message]
2005-04-03 22:52           ` Arun Srinivas
2005-04-03 23:08             ` Steven Rostedt
2005-04-04 23:06               ` scheduler/SCHED_FIFO behaviour Arun Srinivas
2005-04-04 23:17                 ` Steven Rostedt
2005-04-05  2:16                   ` Arun Srinivas
2005-04-05  3:33                     ` Steven Rostedt
2005-04-03 22:52           ` sched /HT processor Arun Srinivas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1112542263.27149.113.camel@localhost.localdomain \
    --to=rostedt@goodmis.org \
    --cc=getarunsri@hotmail.com \
    --cc=juhl-lkml@dif.dk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox