Question

In: Computer Science

About Cache, computer organization, computer architecture, computer science. Cache Question: A[0] is at memory address 0x0FED...

About Cache, computer organization, computer architecture, computer science.

Cache Question:

A[0] is at memory address 0x0FED CBA0. Array B[] is right after array A[] in the data memory.

Both arrays have 10 integers

Based on memory address for A[0] of 32 bits, i know that the cache index and tag is 27 bits, offset is 4 bits and index is 1 bit.

Q: Will the tag and cache index change for A[8] and B[8]? And how will it change?

I personally feel that tag and cache index will not change for A[8]. But i'm not too sure about B[8]

Q: Does the cache behaviour affect the A[8] and B[8]?

E.g. Direct mapped cache vs 2-way set-associative cache

Solutions

Expert Solution

Q: Will the tag and cache index change for A[8] and B[8]? And how will it change?

Since the offset is 4 bits, which means block size = 24 = 16 bytes and since each integer requires 4 bytes of storage, hence there will be 4 elements per block and hence element A[8] and B[8] will not be in same block in main memory. Since their blocks are different, hence their tag field will definitely be different although they will have same index because there are only 2 cache blocks ( since index field is 1 bit, hence number of cache blocks = 21 = 2 blocks) and hence A[8] to B[1] will reside in one block, B[2] to B[5] in other block and then B[6] to B[8] in same block as A[8] to B[1].

Tag field of A[8] and B[8] will always be different as long as block size is 16 bytes.

Let calculate tag field for B[8]. Since there are 10 elements in array A and then 8 elements of array B are before B[8]. Hence B[8] is 19thelement if we combine array A and B and so B[8] is 18 elements ahead of A[0].

Hence the address of B[8] = address of A[8] + 18*4 = address of A[8] + 72 = address of A[8] + 0x48

=  0x0FED CBA0 + 0x48 =   0x0FED CBE8 = 1111111011011100101111101000

Now the tag filed of B[8] will be obtained by taking first 27 bits of binary i.e. 1111111011011100101111 will be tag field for B[8]

Does the cache behaviour affect the A[8] and B[8]?

Yes, if we use direct mapped then since A[8] and B[8] have same cache index, hence they both can never be simultaneously present in cache but if we use 2-way set associative memory then since there are only 2 cache blocks which means only 1 set, hence it is possible that they could be simultaneously be present in cache.

Please comment for any clarification.


Related Solutions

Computer Architecture Theme: External Memory Discuss the effectiveness of data striping in RAID 0 for the...
Computer Architecture Theme: External Memory Discuss the effectiveness of data striping in RAID 0 for the following two cases: A single process requests large data sets Multiple processes request several small sized data
Suppose a computer using direct mapped cache has 232 bytes of main memory and a cache...
Suppose a computer using direct mapped cache has 232 bytes of main memory and a cache of 1024 blocks, where each block contains 32 bytes. [2] How many blocks of main memory does this computer have? [4] Show the format of a memory address as seen by cache; be sure to include the field names as well as their sizes. [3] Given the memory address 0x00001328, to which cache block will this address map? (Give you answer in decimal.) A...
why study computer architecture and organization
why study computer architecture and organization
why study computer architecture and organization ?
why study computer architecture and organization ?
1. Describe the purpose of some components in Internal Memory of a computer. 2.  how Cache Memory...
1. Describe the purpose of some components in Internal Memory of a computer. 2.  how Cache Memory functions
Computer Architecture Theme: External Memory Very briefly discuss flash memory?
Computer Architecture Theme: External Memory Very briefly discuss flash memory?
briefly explain the principle that a cache improves the performance of memory access. For a computer,...
briefly explain the principle that a cache improves the performance of memory access. For a computer, suppose that the access to the cache takes 6 ns, and the access to the memory takes 40 ns, what’s effective access time (EAT) given a hit ratio of 90%?
Question 1. Differentiate between computer organization and computer architecture. State computer evolution and its various generations....
Question 1. Differentiate between computer organization and computer architecture. State computer evolution and its various generations. Differentiate between general purpose and special purpose computers. Which computer can be truly named as the first general-purpose computer? Question 2. Differentiate the high level, assembly, and machine-level languages. How compilers are different from interpreters? Write a brief note on system software and how it is different from application software? Write a brief note on Mnemonic and registers. Question 3. Briefly explain the function...
Computer Architecture Theme: External Memory Very briefly define the seven RAID levels, providing information about stripe...
Computer Architecture Theme: External Memory Very briefly define the seven RAID levels, providing information about stripe size, synchronization, data transfer rate and their applications. (total less than a page)
Course: Computer Architecture Theme: Internal Memory What is parity bitHow do the following work: flash memory,...
Course: Computer Architecture Theme: Internal Memory What is parity bitHow do the following work: flash memory, STT-RAM, PCRAM, ReRAM?? What is Hamming code? Give examples.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT