Swapping and wmgr

Ford Prefect ford at elgar.UUCP
Wed Jun 1 15:06:40 AEST 1988


In article <271 at uncle.UUCP> jbm at uncle.UUCP (John B. Milton) writes:
>In article <3030 at crash.cts.com> ford at crash.CTS.COM (Michael Ditto) writes:
>...
>>The Unix PC supports 4M of virtual memory PER PROCESS, with a total amount
>>dependant on your physical memory + swap space.
>
>I read somewhere in the docs that the UNIXpc actually limits each process to
>2.5M virtual. It could not be as high as 4.0M because the kernel ALWAYS takes
>up some 340k+. Then there are loadable drivers, etc. If user processes were
>allowed to get near 4M, they could easily force the machine into constant
>thrash and eventual crash.

Yes, 2.5M is the maximum "normal" memory in one process.  The four meg
address space is used up by: .5M of kernel, 2.5M of user code/stack/data,
.5M for the shared library, and .5M for shared memory.  The 340k figure
for the kernel is the physical memory for the plain kernel; loadable
drivers will use more physical memory, but no user virtual memory because
they first fill up the rest of the kernel's .5M and then start in the
shared library range.

I don't think you can crash a machine by making it thrash for memory, and
besides, that isn't caused by a process that allocates lots of memory
unless it is actually referencing lots of pages.  You can make things
awfully slow though.

>I just whipped up a quicky, and here's what I got (2.5M=2609152)
>
>max allocate ~= 2535424
>
>main()
>{
>	int first,last,old;
>
>	first=sbrk(0);
>	while ((old=sbrk(4096))!=-1)
>		last=old;
>	printf("max allocate ~= %d\n",last-first);
>}

If you add to that 2535424 the memory taken up by the program itself and
its data and stack, you'd probably be within one page of the 2M limit.
If you need more, you could create half a meg of shared memory!


					-=] Ford [=-

"Once there were parking lots,		(In Real Life:  Mike Ditto)
now it's a peaceful oasis.		ford%kenobi at crash.CTS.COM
This was a Pizza Hut,			...!sdcsvax!crash!kenobi!ford
now it's all covered with daisies." -- Talking Heads



More information about the Unix-pc.general mailing list