What is the exact definition of a memory address space?

Is it correct to name the set of all the numbers from 0 to the highest addressable byte the definition of an address space?

EDIT: I would like to know if there is a formal definition of an address space the same way as there is a mathematical formal definition for a Finite State Automata.

  • Possible duplicate of What are memory addresses? – gnat Oct 2 '17 at 12:23
  • Not necessarily contiguous. By convention labelled with numbers, but they could be labelled in any manner – Caleth Oct 2 '17 at 12:39
  • 3
    It's fine and good to be speculating, however as a programmer, you should never ever attempt to guess how the operating system handles memory for any reasons other than the two following exceptions: 1) you're writing drivers for your hardware containing onboard memory directly under your control, 2) your program IS the operating system. – Neil Oct 2 '17 at 14:34
  • The subset of memory addresses which you can write arbitrary data to and read from, and neither writing nor reading would cause any unforeseeable side effect other than due to code that is written by you. Basically, this is what we mean when we say "this is the part of memory you have allocated; and this is what you are allowed to write to or read from". Although you can write code that will write to or read from addresses which you haven't been given permission to, the possible consequences are truly "unbounded" (unspecified), including e.g. resurrection of dinosaurs. – rwong Oct 3 '17 at 5:54
  • There is something wrong from me, you want either the definition of memory address, memory space, or size of addressable memory or size of one addressed block of memory. Moreover, there is a difference between the usage of the memory : it can basically either be instruction to execute, or data. The pointer to the current instruction to execution is called the instruction pointer. You have to know when you pick an address if you're looking for data or instructions. – Walfrat Oct 3 '17 at 11:25

Sure, and it is pretty simple. A linear memory adress space can be mathematically modeled as an n-dimensional vector from the set Mn, where M represents the finite set of numbers which fit into one memory cell (for example, M={0,...,255} when the memory is addressed in portions of one byte), and n is the maximum number of addresses.

The "address of a memory cell" then is nothing but an index into the vector, from 0 to n-1, where the related coordinate represents the content of the memory cell.

  • 2
    I think your answer goes beyond memory address space, it's a modelling for the memory (including the contents). I'd see an address space as the set of addresses that belong to this space, e.g. {0, 1, 2, ... N-1} for a contiguous address space of N addresses (not necessarily bytes) starting from zero. – Ralf Kleberhoff Oct 2 '17 at 12:52
  • 3
    @RalfKleberhoff: without modeling the memory itself this becomes pretty meaningless. – Doc Brown Oct 2 '17 at 13:07
  • 1
    @RalfKleberhoff I guess in order to model a memory address space you need to model both the memory and the addresses. If you only model the addresses then it is just an address space. – Goyo Oct 2 '17 at 18:21
  • 1
    I'd also add that your definition implies that there is only one possible address space. There are systems which have segmented memory so that you would have N such vectors to truly describe their address spaces. – Peter M Oct 2 '17 at 22:15
  • 1
    @PeterM: my answer does in no way imply "there is only one possible address space", or that this is the one and only mathematical model for an adress space. It is one possible model, and as I wrote, a linear memory adress space can be modeled that way, and not "must be modeled". – Doc Brown Oct 2 '17 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.