开发者

Memory Units, calculating sizes, help!

I am preparing for a quiz in my computer science class, but I am not sure how to find the correct answers. The questions come in 4 varieties, such as--

Assume the following system: Auxiliary memory containing 4 gigabytes, Memory block equivalent to 4 kilobytes, Word size equivalent to 4 bytes.

  1. How many words are in a block, expressed as 2^_? (write the exponent)
  2. What is the number of bits needed to represent the address of a word in the auxiliary memory of this system?
  3. What is the number of bits needed to represent the address of a byte in a block of this 开发者_运维百科system?
  4. If a file contains 32 megabytes, how many blocks are contained in the file, expressed as 2^_?

Any ideas how to find the solutions? The teacher hasn't given us any examples with solutions so I haven't been able to figure out how to do this by working backwards or anything and I haven't found any good resources online.

Any thoughts?


Questions like these basically boil down to working with exponents and knowing how the different pieces fit together. For example, from your sample questions, we would do:

How many words are in a block, expressed as 2^_? (write the exponent)

From your description we know that a word is 4 bytes (2^2 bytes) and that a block is 4 kilobytes (2^12 bytes). To find the number of words in one block we simply divide the size of a block by the size of a word (2^12 / 2^2) which tells us that there are 2^10 words per block.

What is the number of bits needed to represent the address of a word in the auxiliary memory of this system?

This type of question is essentially an extension of the previous one. First you need to find the number of words contained in the memory. And from that you can get the number of bits required to represent a word in the memory. So we are told that memory contains 4 gigabytes (2^32 bytes) and that the word is 4 bytes (2^2 bytes); therefore the number words in memory is 2^32/2^2 = 2^30 words. From this we can deduce that 30 bits are required to represent a word in memory because each bit can represent two locations and we need 2^30 locations.

Since this is tagged as homework I will leave the remaining questions as exercises :)


Work backwards. This is actually pretty simple mathematics. (Ignore the word "auxilliary".)

  1. How much is a kilobyte? How much is 4 kilobytes? Try putting in some numbers in 2^x, say x == 4. How much is 2^4 words? 2^8?
  2. If you have 4GB of memory, what is the highest address? How large numbers can you express with 8 bits? 16 bits? Hint: 4GB is an even power of 2. Which?
  3. This is really the same question as 2, but with different input parameters.
  4. How many kilobytes is a megabyte? Express 32 megabytes in kilobytes. Division will be useful.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜