Subject: Re: ffs fragmentation
To: Manuel Bouyer <>
From: Mike Cheponis <mac@Wireless.Com>
List: tech-kern
Date: 05/17/1999 00:14:18
>Manuel Bouyer <> writes:

>> char big[9876543210]; /* That's 9.876.543.210 bytes */
>> void main(){
>>   big[ ] = foo;
>> }
>> or, even better:
>> void main(){
>>   char big[9876543210]; /* That's 9.876.543.210 bytes */
>>   big[ ] = foo;
>> }
>> In the second case, it's stack space that's used.

>Ok. So imagine we support Dynaswap, and you have 10G free on our HD.
>A user starts such a program, and you want to install emacs. How
>surprising, there's not enough free space.

First, this -can- be handled, as I've said, by merely setting a limit on
what percentage (or absolute size, etc) of the disk will be allowed for

But I must admit that I'm not much thinking of "timesharing" systems, but
rather of the single workstation that is connected with a network to
other workstations and servers.

>Second scenario: A user ftp'd 10G of MP3 files. You can't start your program
>any more.

This is an issue whenever there are resource constraints.  But look at it
this way: if I had pre-reserved 10 G of swap, then the user -could not-
have downloaded 10G of MP3s.

And, once again, this is just a system policy decision, which can be done
on-the-fly as conditions warrant, rather than statically.  (Although
DynaSwap is 100% backward compatible with fixed size swaps!)

>So you need to be able to reserve some space for swap, which will not be used
>for files, and some space for filesystem, which will not be used for swap,
>if you want to be sure you'll always have enough resources. And you can't rely
>on space that can be used for both, because you'll never be sure they will 
>be free when you need it. I'd qualify such space "wasted".
>So I can't see how this will be different from 2 separate partitions.

I hope I've addressed this, above.

>> IMHO, an OS should provide the proper support to handle the
>> above-mentioned cases.

>We do. If you need 10G of VM, just make a 10G (or bigger) swap partition.
>I can't see how different it is from enforcing that you'll ever have
>10G free on your filesystem.

I'd like a much more general and clean scheme that just grabbing a pile of
diskspace and calling it temp swap (although I admit that in some
cases, this is adequate.)

No, I want to be able to handle dynamic needs without precomputation,
and I want to be able to have the OS handle the two code fragments as I've
shown above.

Plus, I'd like the program to have some "warning" before it is terminated,
so it can recover; for example, run a few of these on your system:

#define SIZE 71000000 /* Or whatever is a nice big size for you */

char big[SIZE];
long i;
void main(){
  for(i=0; i<SIZE;i++)big[i] = (char)i;

I think you'll find that once swap space is exhausted, the offending
process is just killed.  A "SIGYELLOW" and a "SIGRED" would be nice.