Separate data and function address spaces

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Thu Nov 16 01:24:29 AEST 1989


In article <930 at fiver.UUCP>, palowoda at fiver.UUCP (Bob Palowoda) writes:

|  > I don't know what unix you are using, but the System V/386 Unixs use the small
|  > model for compiled programs which place the data and text portion into the 
|  > same segment.  I have executed out of data space on these systems.  I have
|  > even executed out of a shared memory segment.
|  
|    I'm curious, where did you find out that the System V/386 Unixs use the
|  small model?  I look through my manuals and cannot find the refernce to
|  "models".

  Please don't confuse this already confusing issue. In the small model
the text and data do not share a segment, that is the "tiny" model.
Here's how models work for Intel systems (and others I've seen).

tiny:	the text, data, and stack segments are all the same. All
	pointers hold only an offset into the default segment.

small:	text is in one segment, data and stack are in another.
	All pointers hold only an offset into the default
	segment.

compact: The text is in a single segment. Pointers to procedures
	hold only the offset into the default segment. Data and
	stack are in separate segments. Data pointers hold both segment
	and offset information (and are therefore usually larger than
	text pointers).

medium: text is in multiple segments. Pointers to procedures
	hold both segment and offset information. Pointers to data hold
	only offset information relative to the default segment.

large:	both text and data pointers hold segment and offset
	information.

  In addition there is the software "huge" model, in which a
single array may be larger than the size of a single segment.
For 80286 and Z8000 this is 64k and makes a difference, while
for machines with 4GB segment size the need is much smaller.
Again the hardware implication is that all pointers are segment
and offset.

  The implication of using models beyond small is that the
process will run somewhat slower, depending on the ability of
the CPU to process the segment and offset information. Since
most programs do more data access than procedure calling, the
performance penalty for multisegment data is usually greater.

  On many UNIX systems the choice between small and tiny model
is made by using the -i option (selects small, default tiny).
Tiny model does not allow sharing of the text segment between
multiple processes, at least on 286, 386 and Z8000 CPUs.

  If in the effort to simplify this I have left something out,
apologies in advance.
-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon



More information about the Comp.lang.c mailing list