Subject: Re: wscons scroll support
To: =?iso-8859-1?Q?Jarom=EDr?= Dolecek <dolecek@ics.muni.cz>
From: Paolo Losi <p.losi@lombardiacom.it>
List: tech-kern
Date: 01/05/2001 11:24:10
"Jaromír Dolecek" wrote:
> 
> Paolo Losi wrote:
> > approximately 160 KB of KVM (20,000 * 2 (byte per char) * 4). Isn't that too
> > much?
> > It would not be a problem anyway to implemet that solution...
> > if I could count an you, David and Matthew, for a vote pro code merge I'll do it
> > right now :)
> 
> You could make the default much smaller (like 512 characters or even less)

for speed and cleanness and simplicity the scroll 
buffer implementation is the following:
the KVM allocated memory is handled as a ring buffer. 
Every time rows scroll out the physical screen they are copied 
to the buffer. When you scroll back the screen the whole physical 
screen is saved to the buffer as well in order to restore it back 
once you are finished. This is in fact a waste since the space used
to store the physical screen is needed only when scrolling.
But that is only 80*25*2 bytes (a page on the i386) when the
scroll buffer is shared among screens. 

Moreover if it useful to have a virtual screen that is at least 
3 times bigger that the physical screen. The percentage of "wasted" 
scroll buffer is 30% in the worst case and 10% in the case I use 
(80x250 virtual screen). 

The overkill is when you do not share the buffer and 
you have a per screen buffer. But again, the space "wasted" is only
a small percentage with respect to the complexity you should
deal with in order not to waste it.

> and only allocate bigger buffer as needed (with some limit, for example those
> 20KB, preferably sysctlable).

On the ioctlable part I agree with you. If there are big problems with
memory it's probably better to default to scroll deactivated and to 
enable it during startup as we do with virtual screens.

> And once the scrolling is unlocked, release the buffer memory as soon
> as possible.

See above: the memory that we could release is only small in the
"average" case.

So my solution would be: rather that a small buffer
(that is probably not useful) let's default to scroll not
active. The only open point is:
- per screen scroll buffer?
- shared scroll buffer?

Couldn't we afford a 160KB KVM?

	Thank 
		Paolo

P.S.   I should learn to be more synthetic :)

> Jaromir
> --
> Jaromir Dolecek <jdolecek@NetBSD.org>      http://www.ics.muni.cz/~dolecek/
> @@@@  Wanna a real operating system ? Go and get NetBSD, dammit!  @@@@