Physical address calculation

How we can calculate actual memory address if we know segment and offset address?
Answer:

Physical address =segment address * 16 + offset address; (in decimal)
Physical address =segment address * 0x10 + offset address; (in hexadecimal)


Example:
Let far address is 0x59994444 (in c hexadecimal integer constant has prefix 0x);
Offset address is 0x4444
Segment address is 0x5999
Temp = segment address *0x10
=0x59990 (trick: only write one 0 to the right side)

=0x9990 (since offset address can have only for hexadecimal digit, so remove the last digit)

Physical address = temp + offset address
= 0x9990 + 0x4444

= 0x0DDD4 (physical address are 20 bit so it is represented in 5 hexadecimal digit)
Process of conversion of 32 bit far address into 20 bit physical address is called normalization.

Note: It is possible that two different far addresses can represent same physical address.

1 comment:

mughal hunki said...

hi! me FAHAD MUGHAL and i want to know how to access a physical addrress of any file???