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
SoftwareLinux OS Dev

Avatar of undefined
Last Comment
Madhukar_Mythri

8/22/2022 - Mon
sunnycoder

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
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.


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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
sunnycoder

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Madhukar_Mythri

ASKER
Thanks  for clearing my doubts Sunny...

Rgds
Madhukar