[comp.arch] Contiguous address spaces

chip@ateng.ateng.com (Chip Salzenberg) (10/14/88)

Let's get this segment thing straight.

According to peter@ficc.uu.net (Peter da Silva):
>This is a UNIX assumption, not a 'C' one. 'C' works just fine with non-
>contiguous segments *if* the segments can be made large enough for any
>given memory object. 'C' has definite problems with memory objects bigger
>than a segment.

True.  Microsoft's solution ("huge") is kludgy, but better than nothing.

>UNIX, however, likes each address space to be contiguous. Look at the
>behaviour of sbrk(), for example.

Sbrk() works just fine on the very segmented '286, thank you very much.
Some *programmers* assume that:

	char *p = sbrk(512) + 512;
	char *q = sbrk(512);

implies "p == q".  It doesn't, and it never did.  (Read the man page again.)

>(actually, what /bin/sh does can't be explained in polite company).

Can you say "catch SIGSEGV, call sbrk() and retry"?  I knew you could.
-- 
Chip Salzenberg             <chip@ateng.com> or <uunet!ateng!chip>
A T Engineering             Me?  Speak for my company?  Surely you jest!
	   Beware of programmers carrying screwdrivers.