The idea of address space (AS) appeared in the earliest general purpose computers. The AS is a place to store data arranged in equal size slots. In modern computers a slot almost always holds one 8 bit byte and we will assume that size henceforth. The address space assigns a number to each of its slots and this number is called the address of the slot. It is customary to refer to the address of a byte rather than the address of a slot but this leads to much confusion. Sticking to our terminology we can assert that there are just 256 bytes even when our computer has many millions of slots (megabytes in the vernacular).

As a program runs its evolving state resides largely in an address space that the program lives in and owns. It remembers what it is doing largely by putting new bytes in the slots of its address space—keeping notes to itself as it were. For us, memory refers to the address space used by the program under consideration.

These days addresses are binary numbers. Today an address is usually 4 bytes long but sometimes 8 bytes long. Such a number is stored in successive slots (slots with consecutive addresses). Whether the most significant or least significant byte is placed in the slot whose address is smallest, is a continuing battle. It is referred to as Big or Little endian issue. In big endian architectures the most significant part of a number or address is stored in the smallest address. In little endian systems the least significant byte of the number is put in the low address. In either case the smallest slot address is used to refer to the four slots. It is good or even mandatory for this address to be a multiple of 4.

Usually each slot has just one address, some addresses may not correspond to any slot. (Sometimes one slot has more than one address which is called aliasing.) Unusual things happen to programs that use an address with no associated slot.

The program

See this for some history of the idea of storing a program in memory. Modern computers fetch instructions from a portion of their address space called the program. Today computer instructions tend to be about 32 bits long. The instructions of most machines have short fields that name registers somewhat like addresses name slots in the address space. These registers are sort of like memory but they are many fewer and much faster. A common microprocessor may have 32 registers each with 32 bits. An instruction might be to add 244 to the current value in register 21, interpret the sum as an address and fetch the 4 bytes from 4 consecutive slots and put the fetched value into register 13. 244, 21 and 13 are from fields of the instruction, of course. Another instruction might be to subtract the values from two named registers and put the difference in a third. Such an operation would likely record whether the result had been positive or zero in a condition register which might influence another later instruction saying: “branch to X if the result was negative”.

Except for a few special instructions, instructions are fetched from slots in the address space whose addresses are consecutive. The branch above is one of these and the subroutine call is another. On most machines the address of the subroutine is in the instruction. After executing the call the machine is fetching instructions from the subroutine and the address following the call instruction has been placed in some particular register awaiting an instruction at the routine’s end to use the value to resume obeying the instructions after the call. Input to and output from the routine is typically in registers.