linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: Timothy Miller <miller@techsource.com>
Cc: Con Kolivas <kernel@kolivas.org>,
	linux kernel mailing list <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>, Ingo Molnar <mingo@elte.hu>,
	gaxt <gaxt@rogers.com>, Mike Galbraith <efault@gmx.de>
Subject: Re: [PATCH] O16int for interactivity
Date: Fri, 15 Aug 2003 14:45:40 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.53.0308151422140.19832@chaos> (raw)
In-Reply-To: <3F3D25D0.7010701@techsource.com>

On Fri, 15 Aug 2003, Timothy Miller wrote:

>
>
> Con Kolivas wrote:
>
> > Preemption of tasks at the same level with twice as much timeslice has been
> > dropped as this is not necessary with timeslice granularity (may improve
> > performance of cpu intensive tasks).
>
> Does this situation happen where two tasks at different nice levels have
> dynamic priority adjustments which make them effectively have the same
> priority?
>
> > Preemption of user tasks is limited to those in the interactive range; cpu
> > intensive non interactive tasks can run out their full timeslice (may also
> > improve cpu intensive performance)
>
> What can cause preemption of a task that has not used up its timeslice?
>   I assume a device interrupt could do this, but... there's a question I
> asked earlier which I haven't read the answer to yet, so I'm going to guess:
>
> A hardware timer interrupt happens at timeslice granularity.  If the
> interrupt occurs, but the timeslice is not expired, then NORMALLY, the
> ISR would just return right back to the running task, but sometimes, it
> might decided to end the time-slice early and run some other task.
>
> Right?
>

Never. However, since the time-slice is 'time', the very instant that
the hardware interrupt executes it's "iret", the hardware-timer may
interrupt and the CPU gets taken away from the task.

Suppose that the preemption timer ticked at 1 HZ intervals. Suppose
that an awful interrupt service routine (one that loops inside) took 1
second to be serviced. What would happen if a task was 3/4 of a second
into its time-slice and then a hardware interrupt occurred?

The CPU would be taken away at 3/4 second, given to the bad ISR, then
the CPU would not be returned until (1) the one-second execution time
had occurred, and (2), all other higher priority tasks had gotten their
time-slices. Each of those higher-priority tasks, could further get
interrupted by the rogue ISR. The result may be that you get the CPU
back next Tuesday.

> So, what might cause the scheduler to decide to preempt a task which has
> not used up its timeslice?
>

The scheduler does not preempt a task until its time has expired.
However time is a constantly-expiring thing so interrupts can
eat up a processes' time.

The usual way for a process (task) to lose it's allocated CPU time-
slice is to perform some I/O. When waiting for I/O, the kernel may
give the CPU to somebody else.

If, the scheduler worked on task-CPU time, rather than hardware-clock
"wall time", maybe it would be more "fair" during periods of high
interrupt activity. However, since interrupts occur anytime, they
tend to attack all competing processes equally, therefore becoming
"fair" unless it's one task that's generating all that interrupt
activity, like network I/O, or some kinds of screen-interactivity.

Cheers,
Dick Johnson
Penguin : Linux version 2.4.20 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



  reply	other threads:[~2003-08-15 18:45 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-15 15:49 [PATCH] O16int for interactivity Con Kolivas
2003-08-15 18:26 ` Timothy Miller
2003-08-15 18:45   ` Richard B. Johnson [this message]
2003-08-16  2:31   ` Con Kolivas
2003-08-18 15:46     ` Timothy Miller
2003-08-18 15:43       ` Nick Piggin
2003-08-18 19:48         ` Timothy Miller
2003-08-18 22:46           ` Nick Piggin
2003-08-15 19:00 ` Felipe Alfaro Solana
2003-08-16  2:14   ` [PATCH]O16.1int was " Con Kolivas
2003-08-15 21:01 ` Mike Fedyk
2003-08-15 23:03 ` Scheduler activations (IIRC) question Jamie Lokier
2003-08-15 23:54   ` Mike Fedyk
2003-08-16  0:54     ` Jamie Lokier
2003-08-16  6:14       ` Mike Galbraith
2003-08-16 14:18         ` Jamie Lokier
2003-08-17  5:51           ` Mike Galbraith
2003-08-17  6:55             ` Jamie Lokier
2003-08-17  7:05               ` Nick Piggin
2003-08-17  8:34               ` Mike Galbraith
2003-08-17 17:12                 ` Jamie Lokier
2003-08-17 17:15                   ` Arjan van de Ven
2003-08-17 18:26                     ` Jamie Lokier
2003-08-17 18:27                   ` Mike Galbraith
2003-08-17 18:29                     ` Jamie Lokier
2003-08-17 18:46                     ` Jamie Lokier
2003-08-16 20:54         ` Ingo Oeser
2003-08-16 21:39           ` Jamie Lokier
     [not found]             ` <20030817144203.J670@nightmaster.csn.tu-chemnitz.de>
2003-08-17 20:02               ` Jamie Lokier
2003-08-18  0:23                 ` William Lee Irwin III
2003-08-18 10:38                 ` Ingo Oeser
2003-08-18 13:09                   ` Jamie Lokier
2003-08-16  7:01 ` [PATCH] O16int for interactivity Con Kolivas
2003-08-18 10:08 ` Apurva Mehta
2003-08-18 10:30   ` Con Kolivas
2003-08-18 12:13     ` Apurva Mehta
2003-08-15 20:50 Voluspa

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=Pine.LNX.4.53.0308151422140.19832@chaos \
    --to=root@chaos.analogic.com \
    --cc=akpm@osdl.org \
    --cc=efault@gmx.de \
    --cc=gaxt@rogers.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miller@techsource.com \
    --cc=mingo@elte.hu \
    /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;
as well as URLs for NNTP newsgroup(s).