What does “address space” means when talking about IO devices

cpuhardwareiomemoryoperating systems

The following quote is from this page:

While some CPU manufacturers implement a single address space in their
chips, others decided that peripheral devices are different from
memory and, therefore, deserve a separate address space. Some
processors (most notably the x86 family) have separate read and write
electrical lines for I/O ports and special CPU instructions to access
ports.

I want to know what does "address space" means. This is what I think it means:

Say we have the following:

enter image description here

This is what happens when the OS starts running:

  • The OS will ask the memory controller for much memory the memory
    chip have, let's assume the memory chip have 2 GB of memory. Now the
    OS will pick a range of addresses that consists of 2 GB, let's assume
    the OS picked the range 30394 to 2147514042 (2147514042 – 30394 = 2
    GB), now the OS will tell the memory controller to respond to
    requests on the memory addresses from 30394 to 2147514042.
  • The OS will do the same thing with the IO devices as it did with
    the memory (it will ask each IO device controller how much memory the IO device
    have…), now the important thing here is that the memory addresses
    that will be allocated for the IO devices will not be in the same
    range allocated for the memory (30394 to 2147514042), so for example
    if the monitor have 12 KB of memory, the OS will pick for example
    the range 104 to 12392 (12392 – 104 = 12 KB). Note that I assuming
    that the IO devices uses memory-mapped IO
    .

So basically "address space" means that both the memory and the IO devices will be in the same "pool" of addresses, and so the CPU can treat the memory and the IO devices as one logical memory chip.

Am I correct?

Best Answer

An Address Space is simply a range of allowable addresses.

An I/O address is a unique number assigned to a particular I/O device, used for addressing that device. I/O addresses can be memory-mapped, or they can be dedicated to a specific I/O bus. When referring to a memory-mapped I/O address, I/O uses the same processor instructions that you would use for addressing, reading and writing actual memory. When referring to a dedicated I/O bus, there are special I/O processor instructions that are used exclusively for read/write purposes on the I/O bus.

Naturally, when using memory-mapped I/O, one must dedicate a range of memory addresses set aside specifically for I/O, not memory. In the context of I/O, it is accurate to say that the range of memory addresses set aside for I/O is the address space where memory-mapped I/O takes place.

Related Topic