Reputation: 583
I have an exercice that I couldn't resolve it, I have 3 memory range :
First @ Last @
range1: FD00 0000 to FDFF FFFF
range2 : D000 0000 to DFFF FFFF
range3 : FA00 0000 to FBFF FFFF
the question is :give the size of the memory for each range (Mega byte)?
what I know is that I should calculate size of the range = last address - first address so the result for the first range is : 00FF FFFF . Is this right? then what should I do? I have searched on the internet I didn't found an example
Please help
Upvotes: 17
Views: 129693
Reputation: 377
range1: FD00 0000 to FDFF FFFF:
FD FF FFFF
- FD 00 0000
------------
FF FFFF +1 = 1MB (0x100 0000)
range2 : D000 0000 to DFFF FFFF = 256MB (0x1000 0000)
range3 : FA00 0000 to FBFF FFFF = 32MB (0x200 0000)
It should be noted that +1 is added since both number are exclusive here
Upvotes: 0
Reputation: 31
Simple analogy, what is amount range (address) from 0 - 9? The answer is 10, not 9 because range/address 0 is counted.
So, Capacity = Last Address - First Address + 1.
Capacity for range1: FD00 0000 to FDFF FFFF will be FDFF FFFF - FD00 000 + 1 = FF FFFF + 1 = 100 0000 in hex Or 16777216 in dec (16MB).
Upvotes: 2
Reputation: 1
To make it easy for you to understand I just change the question as follows, what is the size of memory of a range of 2-9?.
The answer is 8 as follows 2, 3, 4, 5, 6, 7, 8, 9. The formula is the highest address-lowest address + 1.
For your first problem range1: FD00 0000 to FDFF FFFF, the answer is 00FF FFFF+1=0100 0000H=1 X 16^6= 1 X (2^4)^6=2^24=2^4 x 2^20. For in binary system 2^10= 1024=1K and 2^20=1K x 1 K = 1M then 2^4 x 2^20=16 M. For the second and the third problem please kindly do the same. Good luck.
Upvotes: 0
Reputation: 2012
I think the formula
size = end - begin
is always ok to use (no difference from other sizes, i.e. waist for pants)
memory size makes it bit harder due to HEX and DEC, in which decimal is easy for human to read, and often B(Bytes) is used.
to make things easy, if you have bc installed, you may want to try
echo 'ibase=16;yourendhex-yourbeginhex' | bc
in your case
echo 'ibase=16;FDFFFFFF-FD000000' | bc
echo 'ibase=16;DFFFFFFF-D0000000' | bc
echo 'ibase=16;FBFFFFFF-FA000000' | bc
16777215 #16MB
268435455 #268MB
33554431 #34MB
Upvotes: 0
Reputation: 41
the equation is
second_add - first_add + 1
example
fdff ffff - fd00 0000 + 1 = 0100 0000 = 2^24 = 2^4 * 2^20 = 16Mbyte [2^20 byte = 1 Mbyte]
Upvotes: 4
Reputation: 31
Sorry, to answer a question with another question/s...
Isn't the number of addresses available within a stated range inclusive of those range limiters aswell? e.g. (in decimal to illustrate my point) with a start address 5, and an end address of 10. With subtraction only i.e. end address minus start address (10-5) we get a range of 5. But there are actually six unique addresses in the range i.e. 5,6,7,8,9,10 (so we should add 1 to the result of the subtraction in Julie's original question?)
Also, memory address size versus actual memory size. Are we talking about the number of individual memory locations or the size of the memory available to store data in (which should take into account the size of each location)?
If its just memory locations, then we are almost done (I think this is referred to as memory address size). Just have to work out the MB part of the question (I'll come to that issue at the end)
If its the available storage space, this should include the size of each addressable portion of memory e.g. each address location holds an unknown sized chunk of data. Say if it is 1 byte (1B) of data per memory location than my example above means the memory size is: 6 (memory locations) multiplied by 1 Byte (volume of each memory location)for a total memory size of 6B
So based on my logic, the answer to original question for Range 1 should be 01000000hex (range1 = FDFF FFFF-FD00 0000 + 1 = 01000000h).
As for the memory size of that range, this is where I get really confused.... It is a specific number of memory locations i.e. 1000000h, of some undetermined size for each location. So why express it in MB or GB. If you do know the size of each memory location (and multiply number of locations by by the size of each location, then you have the memory size for that range and can express it in numerical form.
And while we are at it, where I get really really confused is the use of MB, GB etc. It is often cited as each prefix equates to a multiple of 1024 e.g. 1KB = 1024Bytes, 1MB = 1024kB etc but the IEC preferred convention is based on the ISO standard (according to my googling just now) which says Kilo (kB) = 1000, Mega (MB) = 1000000 etc.
So putting the unknown size of each location aside, and converting 1000000h to decimal i.e. 16,777,216 the answer is either:
Btw, Googling only just educated me (may be taken to mean recently and partially) on kibibytes and mebibytes...if you're interested, check out https://en.wikipedia.org/wiki/Kilobyte
Upvotes: 3
Reputation: 150118
In your example for Range 1, you are correct. That is the size of the memory, stated in hexidecimal, in bytes.
You may gain the most insight by first converting 00FF FFFF to a decimal number, then converting that number of bytes into megabytes.
To convert from bytes to megabytes use the relationship
1 MB = 1 Megabyte = 1024 * 1 KB = 1,048,576 bytes.
There are tons of online Hex to Decimal converters. The calculator built in to Windows can also do the conversion.
For the other ranges, you again want to do subtraction to determine the size of the range, and then apply the steps above, e.g.
FBFF FFFF
-
FA00 0000
---------
01FF FFFF
Having gone through those steps to better grasp what is happening, the following relationship will allow you to answer such questions faster:
0010 0000 = 1,048,576
So 1MB is the same as 0010 0000 (sometimes called 0x100000).
Upvotes: 9