Home > Blockchain >  What's differences between address space, addressability, word-addressable, addressing mode?
What's differences between address space, addressability, word-addressable, addressing mode?

Time:05-26

As far as I know:

  • Address space: the amount of usable memory allocated for program or process
  • Addressability: the way in which computer identifies different memory locations.
  • Word-addressable: refers to a memory unit whose size is equal to "word", usually one byte and pointed by a single binary address
  • Addressing mode: refers to the way in which the operand of an instruction is specified

I'm not sure if I was right since those terms are quite similar and sometimes I have trouble in mentioning the right thing.

CodePudding user response:

Address space: the amount of usable memory allocated for program or process

Yes, mostly: so in the context of a program in a process, an address space goes to the possible addresses that could be used, not the ones that are in actual use.  This includes unusable locations as well as usable locations.  An address space is commonly described by its size in width of bits, e.g. 32-bits or 64-bits.

Key point about the address space is that each process has its own, so the same addresses are available to be used in each process.  There is no address one process could conjure that will access the memory (address space) of another process (modulo intentionally shared memory).

In the context of hardware, the address space size goes to the number of bits used for the address bus, which communicates addresses between the processor and main memory.  This number of bits can be more than the address space, for example, on a modern 32-bit machine, it may be capable of a 33-bit address space, meaning there's more actual memory than could be addressed by a single process.  On a 64-bit machine, the number of bits used for addressing main memory might be as high as 48 (mine has 35 bits for a max of 32 GB).

Software generally doesn't know the sizing of the hardware address bus, so that and some other reasons mean programs will use a full 32-bit word for addresses on a 32-bit process and a full 64-bit word for addresses on a 64-bit process.

Addressability: the way in which computer identifies different memory locations.

Yes.  A fundamental property or quality of memory is that it has addressability, which is that we can take the address of some storage (an address being a number) and use that address as a first-class entity, which means we can pass an address as a parameter to a function, for example, and that function can use the address to access the memory it refers to.  In this manner we can pass data structures of arbitrary size to functions.  Further, one entity can also refer to another entity by its address, used to represent rich data structures.

Let's contrast this with the CPU registers, which can be named in machine code instructions, but they do not have addresses, they cannot have their address taken, they cannot be indexed: they do not have addressability (most CPUs).

Word-addressable: refers to a memory unit whose size is equal to "word", usually one byte and pointed by a single binary address

In this context, X-addressable refers to how many bits of storage we get by using a single memory address, a.  This goes to the concept that if we also store at a 1 or a-1 those represent different storage locations, each of width X.

It is unusual to use the term word-addressable while defining a word as an 8-bit byte.  Usually the term word-addressable is used in contrast with the term byte-addressable.  Modern computers are byte addressable, which means that each address holds one byte, 8 bits.  Multi byte items like a 32-bit word occupy multiple bytes of storage (4), which also means they occupy multiple (byte) addresses.  We refer to one multi byte item by its lowest address.

Some computers, especially educational computers like LC-3, MARIE, and Hack are word addressable, where word is 16 bits wide; this simplifies indexing operations.  Word addressable for them means that each address (e.g. a and a 1) stores 16-bits.  The early computers, e.g. of the 1950' & 60's also used word addressing, with word sizes anywhere from 12 bits to 36 bits being fairly common.

Addressing mode: refers to the way in which the operand of an instruction is specified

Yes, it usually refers to a memory operand, but on some processors refers to any operand when the operand could be either in memory or in register.  The most fundamental addressing mode is probably register indirect.

Since addressing memory is fundamental to data structures, some processors offer many ways to compute addresses without needing separate instructions for those addressing computations.  This is very handy.  In complex addressing modes, the processor computes an address (e.g. using addition and possibly scaling), uses that effective address, then discards the address.

If we want to access the exact same memory location repeatedly, we might perform the same computation that a complex addressing mode can do, but capture the computed address so we can use that directly later without repeating the complex address calculation.

CodePudding user response:

Eriks answer is fine have some different ways to think about it or describe it based on context of the question. Which we dont know.

Address space: the amount of usable memory allocated for program or process

The amount of addresses a processor can access. Do not confuse this with memory which implies read/write (sram/dram) or read only (flash, etc) storage that can be mapped into the address space. But you also have peripherals in the address space which are not memory, and you may have other things in the address space (virtual mappings from an mmu, etc).

It is a better term to use than memory space, even when folks use memory space or memory map to define everything, the memory, the peripherals and the unused space. Since folks always think everything is memory...it is not.

Addressability: the way in which computer identifies different memory locations.

can you access bytes, can you access words, etc. Are you limited to words and cannot access bytes...

Word-addressable: refers to a memory unit whose size is equal to "word", usually one byte and pointed by a single binary address

Usually when seen means the smallest addressable unit is a word. address 0 is word 0 address 1 is word 1. Assuming a word is not a byte this means that word addressable in this context means you cannot address/access an individual byte.

Addressing mode: refers to the way in which the operand of an instruction is specified

So depending on what you meant, yes. Specific instruction sets have different addressing modes, that are basically different instructions or instruction options. So you might have a direct addressing mode where the actual address is in the instruction. Or one level of indirection through a general purpose register. That is a different addressing mode. some have two levels of indirection a gpr contains an address, you read that address and then that address is the address for the operation. double indirect. sometimes you have memory based operands instead of register based, so indirection through a memory location that is in the instruction....Go look at msp430 and pdp11

  • Related