mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: linux-kernel@vger.kernel.org
Subject: Re: #define HZ 1024 -- negative effects?
Date: Thu, 26 Apr 2001 11:19:23 -0700	[thread overview]
Message-ID: <200104261819.LAA03836@adam.yggdrasil.com> (raw)

	I have not tried it, but I would think that setting HZ to 1024
should make a big improvement in responsiveness.

	Currently, the time slice allocated to a standard Linux process
is 5*HZ, or 50ms when HZ is 100.  That means that you will notice
keystrokes being echoed slowly in X when you have just one or two running
processes, no matter how fast your CPU is, assuming these processes 
do not complete in that time.  Setting HZ to 1000 should improve that
a lot, and the cost of the extra context switches should still be quite
small in comparison to time slice length (a 1ms time slize = 1 million
cycles on a 1GHz processor or a maximum of 532kB of memory bus
utilization on a PC-133 bus that transfer 8 bytes on an averge of every
two cycles based to 5-1-1-1 memory timing).

	I would think this would be particularly noticible for internet
service providers that offer shell accounts or VNC accounts (like
WorkSpot and LastFoot).

	A few of other approaches to consider if one is feeling
more ambitious are:
	1. Make the time slice size scale to the number of
	   currently runnable processes (more precisely, threads)
	   divided by number of CPU's.  I posted something about this
	   a week or two ago.  This way, responsiveness is maintained,
	   but people who are worried about the extra context switch
	   and caching effects can rest assured that this shorter time slices
	   would only happen when responsiveness would otherwise be bad.
	2. Like #1, but only shrink the time slices when at least
	   one of the runnable processes is running at regular or high
	   CPU priority.
	3. Have the current process give up the CPU as soon as another
	   process awaiting the CPU has a higher current->count value.
	   That would increase the number of context switches like
	   increasing HZ by 5X (with basically the same trade-offs),
	   but without increasing the number of timer interrupts.
	   By itself, this is probably not worth the complexity.
	4. Similar to #3, but only switch on current->count!=0 when
	   another process has just become unblocked.
	5. I haven't looked at the code closely enough yet, but I tend
	   to wonder about the usefulness of having "ticks" when you have
	   a real time clock and avoid unnecessary "tick" interrupts by
	   just accounting based on microroseconds or something.  I
	   understand there may be issues of inaccuracy due to not knowing
	   exactly where you are in the current RTC tick, and the cost
	   of the unnecessary tick interrupts is probably pretty small.
	   I mention this just for completeness.

Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."

             reply	other threads:[~2001-04-26 18:19 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-26 18:19 Adam J. Richter [this message]
2001-04-26 18:31 ` Rik van Riel
2001-04-26 20:24   ` Dan Mann
2001-04-27 10:04     ` Mike Galbraith
2001-04-27 15:06       ` Dan Mann
2001-04-27 19:26       ` Nigel Gamble
2001-04-27 20:28         ` Mike Galbraith
2001-04-27 23:22           ` Nigel Gamble
2001-04-28  4:57             ` Mike Galbraith
2001-04-29  8:46               ` george anzinger
     [not found] <fa.gh4u8sv.17i1q6@ifi.uio.no>
2001-04-26  2:02 ` Dan Maas
2001-04-26  2:30   ` Werner Puschitz
2001-04-26  3:51   ` Mike Galbraith
2001-04-28  8:23   ` Guus Sliepen
  -- strict thread matches above, loose matches on Subject: below --
2001-04-24 23:20 Michael Rothwell
2001-04-25 22:40 ` Nigel Gamble
2001-04-29 21:44 ` Jim Gettys
2001-04-29 21:59   ` Michael Rothwell

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=200104261819.LAA03836@adam.yggdrasil.com \
    --to=adam@yggdrasil.com \
    --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

all inboxes | Powered by JetHome®