bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

more clever cache maintenance


From: OKUJI Yoshinori
Subject: more clever cache maintenance
Date: Wed, 13 Dec 2000 02:50:21 +0900

I think of a more clever way of the cache maintenance.

  Currently, GRUB always flushes a disk cache whenever it waits for a
user intervention (such as when it prints a new prompt). This is
necessary, because the user may exchange a removable media with no
announcement. But I have been irritated with this, especially when
accessing a floppy disk several times rapidly (e.g. using
TAB-completions to find a file). Floppy drives are really slow, so I
felt that it would be useful to improve the cache algorithm.

  My idea is heuristic. When you exchange a media (such as a floppy
disk, a ZIP disk, or a MO disk), can you do that so quickly? You must
part your hards with your keyboard, you must push the eject button in
the front of your machine, you must hold the media and put it
somewhere, you must take a new media and push it to your drive, and
you must put your hands at the home position of your keyboard. Even if
two persons coordinate, the media wouldn't move quickly, anyway.

  Thus, GRUB actually needs to invalidate the cache, only when *the
user doesn't push any key for a certain amount of time*. This is the
summary of the algorithm:

1. Record current time when GRUB begins to wait for an input.
2. When an input arrives, compare current time with the recorded time
   above.
3. If the difference is more than a certain value (e.g. 5 seconds),
   flush the cache. Otherwise, do nothing.
4. Handle the input.

As GRUB caches one track at a time for now, this wouldn't improve the
performance very much, but that will change in a future version.

Okuji



reply via email to

[Prev in Thread] Current Thread [Next in Thread]