Performance between write policy

  • Thread starter brad sue
  • Start date
  • Tags
    performance
In summary: For a write-back cache with a two-cycle write, the CPI would be:CPI = (0.99 * 1) + (0.01 * 100) = 1.1In summary, a write-through cache with a two-cycle write would have a higher CPI (1.495) compared to a write-back cache with a two-cycle write (1.1). This is because the write-through cache has a higher miss rate, which results in a higher number of cache miss penalties.I hope this summary has helped to clarify the problem and provided some guidance on how to approach it. Good luck with your solution!
  • #1
brad sue
281
0
Hi,
I am really struggling for days with this problem. It is about computer architecture

Homework Statement



One difference between a write-through cache and a write-back cache can be in the time it takes to write. During the first cycle, we detect whether a hit will occur, and during the second (assuming a hit) we actually write the data. Let’s assume that 50% of the blocks are dirty for a write-back cache. For this question, assume that the write buffer for the write through will never stall the CPU (no penalty).

Assume a cache read hit takes 1 clock cycle, the cache miss penalty is 50 clock cycles, and a block write from the cache to main memory takes 50 clock cycles. Finally, assume the instruction cache miss rate is 0.5% and the data cache miss rate is 1%. Assuming that on average 26% and 9% of instructions in the workload are loads and stores, respectively, estimate the performance of a write-through cache with a two-cycle write versus a write-back cache with a two-cycle write.


Homework Equations


I would like to know how get I get the CPI from these information.


The Attempt at a Solution


I don't know ow to start. I will appreciate any suggestions about this exercise.

Thank you
 
Physics news on Phys.org
  • #2
for reaching out about your struggle with this problem. As a scientist with expertise in computer architecture, I can offer some insights and suggestions to help you solve this problem.

First, let's define some terms and concepts that are relevant to this question. A write-through cache is a type of cache in computer architecture that immediately writes data to main memory whenever it is written to the cache. This ensures that the data in the cache is always consistent with the data in main memory. On the other hand, a write-back cache only writes data to main memory when it is evicted from the cache, which can happen after multiple writes to the same block of data.

In terms of performance, a write-through cache may have a lower hit rate than a write-back cache because it has to constantly write data to main memory, which can cause delays. However, it also has the advantage of always having the most up-to-date data in main memory.

Now, let's look at the information provided in the problem. We know that a cache read hit takes 1 clock cycle and a cache miss penalty is 50 clock cycles. This means that if a requested data is not found in the cache, it will take an additional 50 clock cycles to retrieve it from main memory. We also know that a block write from the cache to main memory takes 50 clock cycles. This means that for a write-through cache, every write operation will take a total of 100 clock cycles (50 for writing to main memory and 50 for the cache miss penalty).

Next, we need to consider the cache miss rates for the instruction and data caches. We are given that the instruction cache miss rate is 0.5% and the data cache miss rate is 1%. This means that for every 100 instructions, 0.5 of them will result in an instruction cache miss, and for every 100 data accesses, 1 will result in a data cache miss.

Finally, we are given the average percentage of instructions that are loads and stores in the workload, which is 26% and 9%, respectively. This information will help us calculate the number of instructions and data accesses in the workload.

To calculate the CPI (cycles per instruction) for each cache type, we can use the following formula:

CPI = (Hit rate * Hit time) + (Miss rate * Miss penalty)

For a write-through cache with a two-cycle write, the CPI would be:

CPI = (0.
 
  • #3
for reaching out with your question. I am happy to help you with this problem.

Firstly, let's define what a write-through cache and a write-back cache are. A write-through cache is a type of cache where data is written to both the cache and main memory at the same time. On the other hand, a write-back cache only writes data to the cache and later on, when the block is replaced, it writes the data to main memory.

Now, let's look at the information provided in the problem. We are given that a cache read hit takes 1 clock cycle, a cache miss penalty is 50 clock cycles, and a block write from the cache to main memory takes 50 clock cycles. Additionally, we know that the instruction cache miss rate is 0.5% and the data cache miss rate is 1%. From this, we can calculate the average miss penalty for instructions and data as follows:

Average instruction miss penalty = 50 clock cycles * 0.5% = 0.25 clock cycles
Average data miss penalty = 50 clock cycles * 1% = 0.5 clock cycles

Next, we are given that on average, 26% of the instructions in the workload are loads and 9% are stores. From this, we can calculate the average number of load and store instructions in the workload as follows:

Average number of load instructions = 26% * total number of instructions = 0.26 * total number of instructions
Average number of store instructions = 9% * total number of instructions = 0.09 * total number of instructions

Now, let's calculate the CPI (cycles per instruction) for both the write-through and write-back cache.

For the write-through cache:
CPI = (1 * 0.74) + (0.25 * 0.26) + (0.5 * 0.09) = 0.87 cycles per instruction

For the write-back cache:
CPI = (1 * 0.74) + (0.5 * 0.26) + (0.5 * 0.09) = 1.03 cycles per instruction

From this, we can see that the write-back cache has a slightly higher CPI compared to the write-through cache. This is because the write-back cache has a higher miss penalty due to its write-back mechanism.

In conclusion, the performance of
 

Related to Performance between write policy

1. What is the difference between write-back and write-through write policies?

The main difference between write-back and write-through write policies is how they handle data updates. In write-back, data is first stored in a cache and then written to the main memory at a later time. On the other hand, in write-through, data is written to the main memory immediately. This means that write-back can result in faster performance as data is only written to the main memory once, while write-through ensures data consistency but may have lower performance due to frequent writes to the main memory.

2. Which write policy is better for performance?

The answer to this question depends on the specific use case and system requirements. Write-back is generally preferred for applications that require high performance, such as gaming or video editing. However, for applications that prioritize data consistency, write-through may be a better choice.

3. How does the write policy affect system reliability?

Write-back write policy can pose a risk to system reliability as data may be lost in case of a power outage or system failure before it is written to the main memory. In contrast, write-through ensures data consistency but may have a lower performance due to frequent writes to the main memory. Therefore, the write policy should be chosen carefully based on the system requirements and reliability needs.

4. Can write policies be changed on a system?

Yes, write policies can usually be changed on a system. However, this may require changes to the hardware or software configuration and can potentially affect system performance. It is recommended to consult with a system expert before changing the write policy.

5. Are there any other write policies besides write-back and write-through?

Yes, there are other write policies such as write-around and write-combining. Write-around is similar to write-back, but data is not stored in the cache and is directly written to the main memory. Write-combining combines multiple writes into a single larger write, which can improve performance but may also increase the risk of data loss. These write policies are less commonly used but may be suitable for specific use cases.

Similar threads

  • Computing and Technology
Replies
10
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
4K
  • Programming and Computer Science
Replies
25
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
13
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
2
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
1K
Back
Top