Calculating number of blocks in memory.

Thread Starter

AndrieGnd

Joined Jun 25, 2019
52
Hi !
**in advance maybe this problem is more like math manipulation over computer's memory terms**
I'm struggling how should I imagine the problem to crack it down ..
the problem is that's given Memory size for example 128KB and block size is 256B so how many blocks on the Memory?
well, what I'm struggling is that I imagine *my logical view of memory* the memory like this :
---------------------------------------------------------------
|
|
|
|
|
---------------------------------------------------------------

so on the width I don't know what its distance assume it's x, on the height I don't know what's the distance assume it's y so we must get x*y=128KB
now I don't know how to continue to calculate how many block of 256B I have on my memory .. any help?

maybe I imagine it wrong which make the problem hard to solve?! it would be much appreciated if anyone tells me please how could I imagine the memory in that case for calculating the number of blocks to have ..

thanks alot
 
Last edited:

WBahn

Joined Mar 31, 2012
26,398
Hi !
**in advance maybe this problem is more like math manipulation over computer's memory terms**
I'm struggling how should I imagine the problem to crack it down ..
the problem is that's given Memory size for example 128KB and block size is 256B so how many blocks on the Memory?
well, what I'm struggling is that I imagine *my logical view of memory* the memory like this :
---------------------------------------------------------------
|
|
|
|
|
---------------------------------------------------------------

so on the width I don't know what its distance assume it's x, on the height I don't know what's the distance assume it's y so we must get x*y=128KB
now I don't know how to continue to calculate how many block of 256B I have on my memory .. any help?

maybe I imagine it wrong which make the problem hard to solve?! it would be much appreciated if anyone tells me please how could I imagine the memory in that case for calculating the number of blocks to have ..

thanks alot
If you have x*y = 128 KB and you have x = 256 B/block, what is y?

y = 128 KB / (256 B/block) = 0.5 K·block * (2^10 / K) = 512 blocks

Another way of thinking about it to consider how many 256 B blocks of memory does it take to get a total of 1 KB of memory? Answer: 4 blocks. If you have 4 blocks for each 1 KB, how many blocks does it take to get 128 KB. Answer: 512 blocks.
 

Thread Starter

AndrieGnd

Joined Jun 25, 2019
52
If you have x*y = 128 KB and you have x = 256 B/block, what is y?

y = 128 KB / (256 B/block) = 0.5 K·block * (2^10 / K) = 512 blocks

Another way of thinking about it to consider how many 256 B blocks of memory does it take to get a total of 1 KB of memory? Answer: 4 blocks. If you have 4 blocks for each 1 KB, how many blocks does it take to get 128 KB. Answer: 512 blocks.
I understand the first analogy ..

May please elaborate more about the second analogy that you described at the end?!
 

WBahn

Joined Mar 31, 2012
26,398
I understand the first analogy ..

May please elaborate more about the second analogy that you described at the end?!
If asked how many quarts of water are in 128 gallons and you know that there are 4 quarts in a gallon, could you figure out how many quarts there are in 128 gallons?
 
Top