public inbox for linux-8086@vger.kernel.org
 help / color / mirror / Atom feed
From: u-vpoa@aetey.se
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-8086 <linux-8086@vger.kernel.org>
Subject: Re: the memory model being used in elks?
Date: Mon, 11 May 2015 08:10:24 +0200	[thread overview]
Message-ID: <20150511061024.GP8197@example.net> (raw)
In-Reply-To: <20150510225118.6fca5977@www.etchedpixels.co.uk>

On Sun, May 10, 2015 at 10:51:18PM +0100, Alan Cox wrote:
> > Even without MMU overlapping 8086 segments allow the use of this <-Space->
> > for stack or data+bss of other processes. Wonder if/how this is handled
> > in elks (lacking the time to Use-The-Source...)
> 
> Only if you use far pointers which is incredibly expensive, otherwise
> taking the address of a stack based variable breaks.

Not at all. The process has its full 2^16 address space for data, the
stack always at the top, the data+heap at the bottom, no far pointers,
no problem to access stack based variables.

It is up to the kernel to keep track of the sizes of heaps and stacks
of all processes (which it does in any case) and move processes' data
segments in RAM when necessary so that the segments can and do overlap
but not the data. Then the RAM area inside the unused address space in
the middle of the segment is not wasted.

process1:      |data+heap>                            <stack|
process2:                     |--data+heap-->                    <--stack--|
               |<-------------------- 64K ----------------->|
                              |<-------------------- 64K ----------------->|

As many can overlap as it fits, with some extra margins for the stacks.
The same works of course for combined code+data+heap too.

Rl


  reply	other threads:[~2015-05-11  6:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-08 20:14 the memory model being used in elks? u-vpoa
2015-05-09 17:03 ` One Thousand Gnomes
2015-05-09 17:47   ` u-vpoa
2015-05-09 17:50     ` Jody Bruchon
2015-05-09 18:38       ` u-vpoa
2015-05-10 15:31         ` Juan Perez-Sanchez
2015-05-10 18:40           ` u-vpoa
2015-05-10 20:27             ` Alan Cox
2015-05-10 21:19               ` u-vpoa
2015-05-10 21:51                 ` Alan Cox
2015-05-11  6:10                   ` u-vpoa [this message]
2015-05-11  9:27                     ` Alan Cox
2015-05-11 11:25                       ` u-vpoa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150511061024.GP8197@example.net \
    --to=u-vpoa@aetey.se \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-8086@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox