×

Operating System Tutorial

Operating System Practice

How changing cache line size will affect other parameters?

In this tutorial, we will learn how changing cache line size will affect other parameters? By Monika Jha Last updated : May 08, 2023

While designing a cache system of a PC, the size of cache lines is an important parameter.

In the caching system, the size of the cache line affects a lot of parameters.

The following results show the effect of changing the cache block or line size in a caching system.

1. In what ways changing block size affect spatial locality?

  • Spatial Locality indicates, if any word is in the cache then next time it will be referenced in a short amount of time.
  • If the block size is large then the spatial locality will be better.
  • By keeping the cache size constant, we have two cases as follows,

Case 1: Decreasing the Block Size

  • Smaller block size will contain a less number of nearby addresses in it. Thus, only a small number of nearby addresses will be brought into the cache.
  • Due to the small size of the block increases the chances of cache miss which reduces the exploitation of spatial locality.
  • Thus, smaller is the block size, inferior is the spatial locality.

Case 2: Increasing the Block Size

  • A large block size will contain a number of nearby addresses in it. Thus, a larger number of nearby addresses will be brought into the cache.
  • This increases the chances of cache hit which increases the exploitation of spatial locality.
  • If the block size is large hen experiences better spatial locality.

2. In what ways changing block size affect On Cache Tag in Fully Associative Cache?

Case 1: Decreasing the Block Size

  • If we are keeping the cache size constant and decreasing the block size then it will decrease the number of bits in block offset.
  • With the decrease in the number of bits in block offset, the number of bits in tag increases.

Case 2: Increasing the Block Size

  • Keeping the cache size constant,
  • Increasing the block size increases the number of bits in block offset.
  • With the increase in the number of bits in block offset, the number of bits in tag decreases.

3. In what ways changing block size affect on Cache Tag in Set Associative Cache?

Case 1: Decreasing the Block Size

  • If we are keeping the cache size constant it will increase the number of lines in the cache and also the number of sets in the cache then the number of bits in set number increases.
  • When the block size decreases then the number of bits in block offset also decreases.
  • So, the number of bits in the set number and number of bits in block offset will remain constant that is no change on the cache tag.
effects of changing line size (1)

Case 2: Increasing the Block Size

  • If we are increasing the block size then it decreases the number of lines in the cache and increases the number of bits in block offset.
  • With the decrease in the number of cache lines, the number of sets in cache decreases and also the number of bits in set number decreases.
  • So, the number of bits in the set number and number of bits in block offset will remain constant that is no effect on the cache tag.
effects of changing line size (2)

4. In what ways Changing block size affect On Cache Miss Penalty?

  • When a cache miss happens, the required block of the word has to be brought from the main memory.
  • Time taken to bring the block in the cache will be less if the block size is small. Hence, less miss penalty will incur.
  • If the block size is large so the time taken to bring the block in the cache will be more. Hence, more miss penalty will incur.

5. In what ways changing block size affect on Cache Tag in Direct Mapped Cache?

Case 1: Decreasing the Block Size

  • If we are keeping the cache size constant and decreasing the block size, this will increases the number of lines in the cache.
  • With the decrease in block size, the number of bits in block offset decreases.
  • However, the number of bits in line number increases the cause of increasing the number of cache lines.
  • With the increasing number of cache lines, the number of bits in line number together with the number of bits in block offset will remain constant that is there is no effect on the cache tag.

Case 2: Increasing the Block Size

  • With increasing the block size the number of lines in cache decreases and the number of bits in block offset increases.
  • However, with the decreasing number of cache lines, the number of bits in line number decreases.
  • So, the number of bits in line number and number of bits in block offset will remain constant. Hence, no effect on the cache tags.

6. In what ways Cache Tag affect on Cache Hit Time?

  • The time required to find out whether the required block is in cache or not is cache hit time.
  • It this comparing the tag of cache lines with the tag of the generated address.
  • Hence, Smaller is the cache tag, lesser will be the time taken to perform the comparisons so smaller cache tag ensures lower cache hit time and larger is the cache tag results in a higher cache hit time.

References




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.