[1868] in RedHat Linux List
Re: Swapping scheme
daemon@ATHENA.MIT.EDU (Otto Hammersmith)
Wed Oct 30 14:13:50 1996
From: Otto Hammersmith <ohammers@cu-online.com>
To: redhat-list@redhat.com
Date: Wed, 30 Oct 1996 13:10:58 -0600 (CST)
In-Reply-To: <Pine.LNX.3.95.961030132511.862C-100000@benatar.res.cmu.edu> from "William T Wilson" at Oct 30, 96 01:38:55 pm
Resent-From: redhat-list@redhat.com
Reply-To: redhat-list@redhat.com
William T Wilson wrote:
>
> Ariel Mazzarelli wrote:
>
> > I believe the various MS (again, I'm not sure which or if any apply)
> > OSes use a different swapping scheme. Linux uses demand paging, where I
> > believe Windows uses (dammit I can't rember the name) swapping... the
> > basic difference is that Linux can swap parts of a program, where
> > Windows* have to swap the entire application in and out of memory.
>
> Both Linux and Windows can swap portions of an application in and out of
> memory (the nature of the x86 CPU is that swapping is done in 4K blocks).
> Otherwise, Windows would not be able to swap because no program could run
> at all if it were swapped out.
The idea is that a whole program is swapped out when memory is needed
for something else... then when that program starts execution again,
the whole thing is swapped back in. That would seem to fit in with
the cooperative multitasking of Windows 3.11.
> Linux is just more selective about what
> gets swapped. Since program code doesn't change, Linux never writes it to
> disk. Instead, if program code is scheduled for swapping out, Linux just
> throws it away and reloads it from the original executable when it's
> needed; only data is ever actually written to swap. This saves swap space
> and cuts down on time-consuming disk writes. This isn't demand paging,
> although it is related.
Okay, so Windows*, does demand paging. (could someone provide a
reference? http, preferably, but anything would do... I shall check
some of my text books when I get home)
> Under demand paging, Linux only loads the portions of a program that are
> actually used. When an executable is run, Linux only actually loads the
> first 4K of it... the rest is left on disk until it's needed. This means
> that programs can start executing before they're finished loading, and it
> also cuts down on memory usage.
This is the definition of demand paging. (unless I didn't do as well
in my OSes classes as I thought)
This seems to contradict the premise that Windows* does demand
paging. You're saying Linux can start executing with the first page
in memory, but Windows can't... but that's the definition of demand
paging.
Perhaps I'm not understanding what you're saying.
> Linux can do this because all its applications are full 32-bit;
> Windows is hobbled by the need to support 16-bit software, which won't
> work this way (that I know of).
Why not?
Say we take NT, for example... why is it's swapping system
worse/better than Linux?
> Also keep in mind that the Linux kernel is much smaller than any Windows
> kernel (although X-server processes can take up plenty of RAM to make up
> for that), and that the extensive use of shared libraries also saves
> memory. Therefore, Linux simply requires less memory in the first place,
> which cuts down on memory bottlenecks in the first place.
I think the sum total of things, evens out in the end. At least, for
me... I run more programs under Linux than when I ran Windows, because
I can. I'd be willing to say that my memory usage is about the
same; Linux apps are smaller, but I run more.
(Though, you could probably argue that with modules and kswapd, the
kernel size really does matter, since Linux can swap parts out and
windows* can't... I'm mostly comparing Windows 3.11 and Linux 1.2.13,
since I haven't run windows since long before I upgraded to the 2.0
kernels)
I think what I really want is a reference to the interneals of
Windows*, to find out what really is going on there. Too bad theres
no source code. :)
--
-Otto
--
PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
________________________________________________________________________
http://www.redhat.com/RedHat-FAQ http://www.redhat.com/RedHat-Errata
http://www.redhat.com/RedHat-Tips http://www.redhat.com/mailing-lists
------------------------------------------------------------------------
To unsubscribe: mail -s unsubscribe redhat-list-request@redhat.com < /dev/null