Link to home
Start Free TrialLog in
Avatar of Madhukar_Mythri
Madhukar_Mythri

asked on

doubt in Memory map and IO map

Hi all,
         
------>How Memory mapped address is fast than IO mapped address???

------> Is IO mapped address is a physical address???
            (Ex: COM port IO-address is 0x3f8  is it physical address... or  processor bus address which is directly linked to COM port IO???)

Rgds
Madhukar
Avatar of sunnycoder
sunnycoder
Flag of India image

Hi Madhukar_Mythri,

> ------>How Memory mapped address is fast than IO mapped address???
Memory operations (they are hardware instructions taking n number of cycles) are typically faster than I/O operations
 
> ------> Is IO mapped address is a physical address???
>             (Ex: COM port IO-address is 0x3f8  is it physical address...
> or  processor bus address which is directly linked to COM port IO???)
Physical address not in the sense of physical memory address .. rather an independent separate address which the CPU recognizes refering to a device

Cheers!
sunnycoder
Avatar of derekrv
derekrv

I/O versus memory mapped addressing:
As sunnycoder says, I/O instructions often (usually?) take a few clock cycles more than memory-to-memory (or register to memory) moves.  Look at your CPU's instruction manual to find out the difference.  

However, that doesn't mean that I/O mapped devices are always slower - in real implementations, I/O devices (and memory devices) often insert wait states on the bus until they are ready to provide (or accept) data.  Compared to today's CPU speeds, almost all real I/O devices are terribly slow - you'd have a tough time measuring the difference in performance between an I/O mapped device and a memory mapped device doing the same thing.

As to the physical I/O address question - it depends.  The Intel architecture machines all have separate I/O and memory space (meaning that you can have an I/O port for a COM port at 0x3F8, as well as a memory location at address 0x3F8).  However, by the time you're writing code that runs under a real operating system (Win XP or Linux), you don't get access to the "real device" from your program.   The OS prevents you from doing that, and (usually) wants to handle all interaction with physical devices, while providing virtual device services to the program.  The idea is that the program can't tell the difference, but the OS keeps things under control so that a poorly behaved application doesn't take the system down or give an inappropriate device command to the real device.  If you're talking about embedded systems, which often don't protect programmers from themselves, you might be able to write application programs that do direct device control.


Avatar of Madhukar_Mythri

ASKER

Hi Derekrv & Sunny...
 Thanks for  reply..
       
             Is physical address is different form physical memory(RAM) addrress ??? if so, can u please explain how???
         
           my doubt is:   if we see  /proc/ioports ....
 Is the address show are  of physical memory address???
          or  without physical memory interaction, some CPU bus lines are dedicated to IO's ???
   
     Generally what im thinking is ..the address shown in  /proc/iomem is of physical address and /proc/ioports are of directly CPU to PCI bus lines...

  Rgds
Madhukar
ASKER CERTIFIED SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks  for clearing my doubts Sunny...

Rgds
Madhukar