public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: #define HZ 1024 -- negative effects?
@ 2001-04-26 18:19 Adam J. Richter
  2001-04-26 18:31 ` Rik van Riel
  0 siblings, 1 reply; 18+ messages in thread
From: Adam J. Richter @ 2001-04-26 18:19 UTC (permalink / raw)
  To: linux-kernel

	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."

^ permalink raw reply	[flat|nested] 18+ messages in thread
[parent not found: <fa.gh4u8sv.17i1q6@ifi.uio.no>]
* #define HZ 1024 -- negative effects?
@ 2001-04-24 23:20 Michael Rothwell
  2001-04-25 22:40 ` Nigel Gamble
  2001-04-29 21:44 ` Jim Gettys
  0 siblings, 2 replies; 18+ messages in thread
From: Michael Rothwell @ 2001-04-24 23:20 UTC (permalink / raw)
  To: linux-kernel

Are there any negative effects of editing include/asm/param.h to change 
HZ from 100 to 1024? Or any other number? This has been suggested as a 
way to improve the responsiveness of the GUI on a Linux system. Does it 
throw off anything else, like serial port timing, etc.?


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2001-04-29 21:59 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-26 18:19 #define HZ 1024 -- negative effects? Adam J. Richter
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox