Wirth 1
CPU Performance: Amdahl's Law
Consider a CPU load that is, timewise:
• 20% integer instructions
• 10% branching instructions
• 70% floating point instructions.
Given that, what will be the speedup from:
1. Improving the overall integer performance of the ALU by a factor of 1.7?
2. Improving the overall floating-point performance of the ALU by a factor of 1.2?
3. Improving the overall performance of branching logic by a factor of 4?
Amdahl’s Law:
1
S= 𝑓
(1−𝑓)+( )
𝑘
1.
1 1 1.7 1.7
S= .2 → .2 → → = 1.08974358
(1−.2)+( ) .8+(1.7) 1.36+.2 1.56
1.7
2.
1 1 1.2 1.2
S= .7 → .7 → → = 1.13207547
(1−.7)+( ) .3+( ) .36+.7 1.06
1.2 1.2
.3
1 1 1
S= .1 → → ̅̅̅̅̅̅
= 1.0.81
(1−.1)+( ) .9+.025 .925
4
Wirth 2
Consider a CPU with a standard five-stage pipeline. Assume that:
• Without stalls, all instructions take the same amount of time
• 10% of instructions are branches
• We have branch prediction that is successful 95% of the time
• When branch prediction fails, the penalty is a 3-cycle stall
• Current CPI is 2.1
4. What would CPI become if we improved branch prediction to a 98% success rate?
5. What would CPI become if we improved the failure penalty to a 1-cycle stall?
Formula:
3∗0.005
=f
(100)+(3∗0.005)
f = .00014997
4.
3∗0.002
= f2
(100)+(3∗0.002)
f2 = .000059996
.00014997
k=
.000059996
???
Wirth 3
Consider a DRAM memory. Assume that:
• The memory has a single level of cache
• Checking the cache takes zero time
• Cache access time is 2ns
• DRAM access time is 30ns
• Accessing memory on a miss requires accessing the DRAM then accessing the cache to
retrieve
• The current effective access time is 11ns
Given all that:
6. If the current effective access time is 11ns, what is the current hit rate?
7. What would the effective access time be if we subtracted a flat 5% from the hit rate?
8. What hit rate would we need for an effective access time of 3ns?
Cache Equation:
𝑡𝑒𝑓𝑓𝑒𝑐𝑡𝑖𝑣𝑒 = 𝑡ℎ𝑖𝑡 + 𝑅𝑚𝑖𝑠𝑠 𝑡𝑝𝑒𝑛𝑎𝑙𝑡𝑦
6.
11ns = 2ns + 𝑅𝑚𝑖𝑠𝑠 * 30ns → 11 = 2 + 30 – 30 * 𝑡ℎ𝑖𝑡
30 * 𝑡ℎ𝑖𝑡 = 32 – 11
21
𝑡ℎ𝑖𝑡 = → 𝑡ℎ𝑖𝑡 = 0.7 = 𝑡ℎ𝑖𝑡 = 70% , 𝑅𝑚𝑖𝑠𝑠 = 30%
30
7.
𝑡ℎ𝑖𝑡 = 70% - 5% = 65%
𝑡𝑒𝑓𝑓𝑒𝑐𝑡𝑖𝑣𝑒 = 2 * 𝑡ℎ𝑖𝑡 + 𝑅𝑚𝑖𝑠𝑠 * 2 + 30 → 2 * 0.65 + 1 – 0.65 * 2 + 30
1.3 + 11.2 = 12.5 → 𝑡𝑒𝑓𝑓𝑒𝑐𝑡𝑖𝑣𝑒 = 12.5ns
Wirth 4
8.
3ns = 2ns + 𝑅𝑚𝑖𝑠𝑠 * 30ns → 3 = 2 + 30 – 30 * 𝑡ℎ𝑖𝑡
3 = 2 + 30 – 30 𝑡ℎ𝑖𝑡 → 30 𝑡ℎ𝑖𝑡 = 32 – 3
29
𝑡ℎ𝑖𝑡 = → 𝑡ℎ𝑖𝑡 = 0.96 → 𝑡ℎ𝑖𝑡 = 96% , 𝑅𝑚𝑖𝑠𝑠 = 4%
30
Storage Performance: Mixed Methods
Consider a spinning HDD with a random-access time of 90ms and an effective transfer rate of
60MB/s. Now consider an SSD with a random-access time of 100μs and an effective transfer
rate of 500MB/s. Assume all files are contiguous and that seeks within otherwise contiguous
reads take negligible time.
9. What will the speedup of the SSD over the HDD be when reading 5,000 files totaling
140MB? (Amdahl’s Law will not help you here, but you have enough information to
determine the answer without it.)
10. What will the speedup of the SSD over the HDD be when reading 130 files totaling
1GB? (Amdahl’s Law will not help you here, but you have enough information to
determine the answer without it.)
9.
140
(5000∗HDD+𝑇𝑇 )
𝐻𝐷𝐷
= 140
(5000∗SDD+ )
𝑇𝑇𝑆𝑆𝐷
140
(5000∗.09+ )
60
= 140
(5000∗.0001+ )
500
(450 + 2.33)
=
(0.5 + 0.288)
452.33
=
0.78
= 579.87179
Wirth 5
10.
1000
(130∗.09+ 60 )
= 1000
(130∗.0001+ 500 )
(11.7+16.66)
=
(0.013+2)
28.36
=
2.013
= 14.08842
Assume the chance of a single hard drive failing in a given year is 7%. What are the chances,
over that year, of:
11. Losing data from a 2-disc RAID 0 array?
12. Losing data from a 2-disc RAID 1 array?
13. Losing data from a 4-disc RAID 5 array? (Ignore the secondary URE problem.)
11.
1 – P(no discs fail) = (1 – (.93 *.93)) = (1 – (0.8649)) = 0.1351
= 13.51%
12.
Wirth 6
P(loss) = P(both discs failing) = (.07 * .07) = .0049
= .49%
13.
1 – (P(no discs fail) + P(1 disc fails)) = 1 – ((.934) + 4(.07* .93* .93*.93)) = 0.0267
= 2.67%