[comp.unix.wizards] what does brk do on segmented architectures?

martyl@rocksvax.UUCP (10/02/87)

What should brk do on a segmented architecutre (like the 80286) without a 
linear address space.

If a process wants to change its memory allocation, what should break do
across segment boundaries (I'm really looking for a means to malloc/free 
memory blocks rather than just change a pointer to the top of the processes
virtual address space -- I don't see how this works on 286 machines).

Or would it be more meaningful to do something along the lines of the Sys V
shared memory stuff where a process could allocate additional regions as
additional private memory blocks).  Then the process would be reasponsible
for its own memory management by mallocing/freeing blocks as needed.

I suppose brk could be implemented across multiple segments, but some standard
set of conventions would have to exist between the operating system and the 
client programs.

Any ideas?

What do other 286 Unixes implement?  (I don't have access to any real 286
unixes yet).

marty leisner
xerox corp
ARPA:  leisner.henr@xerox.com
UUCP:  martyl@rocksvax.uucp

-- 
marty leisner
xerox corp
leisner.henr@xerox.com
martyl@rocksvax.uucp

dricej@drilex.UUCP (Craig Jackson) (10/05/87)

'brk' and 'sbrk' are two Unix system calls which are very difficult to
implement on many systems.  They assume a linear address space used linearly.
Most systems which don't have both these characteristics either kluge around
them or don't implement them at all.  For example, I believe that some
Apollo implementations just reserved some memory for 'brk', and when you
something else in the address space, that was all.  (I don't know if their
current version does this; not relevant.)

For non-linear address spaces, such as Zilogs or Intels, generally there is
no simple 'sbrk' or 'brk', except in the degenerate memory models.  Generally
there is one 'brk' per segment, and a call which sets it.
-- 
Craig Jackson
UUCP: {harvard!axiom,linus!axiom,ll-xn}!drilex!dricej
BIX:  cjackson