---
layout: class
title: "COMP 235, Fall 2021, Homework 1"
semester: f21
---

## Amdahl's Law and Data Representation

#### Due by September 22 by the start of class.

1. You have written a new program in assembly language, using only 4
   types of instructions. Let's call them types A, B, C, and D. Your
   program consists of 20% type A instructions, 40% type B, 30% type
   C, and 10% type D. You timed the program and it takes 100 seconds
   on your laptop.

    A. Your friend suggests replacing all the type D instructions with
    another type, E, which is 10x faster. How long will the improved
    program take to run?

    B. Consider the original program (no type E instructions). You are
    considering buying a new laptop which happens to execute type B
    instructions faster. How much faster (by what factor) must it
    execute type B instructions to get a total running time of 80
    seconds? Assume that the new laptop executes types A, C, and D the
    same as your old laptop.
2. 2.58 (from CSAPP)
3. 2.59
4. 2.61
5. 2.71. For part B, you need not limit yourself to left and right
   shifts and one subtraction; you may solve it anyway you'd like.
6. 2.72. For part B, assume that `maxbytes` is not used
   maliciously. In particular, assume `maxbytes` is always
   nonnegative.
   
   
Submit via Gradescope.

---
layout: class
title: "COMP 235, Fall 2021, Homework 1"
semester: f21
---

## Amdahl's Law and Data Representation

#### Due by September 22 by the start of class.

1. You have written a new program in assembly language, using only 4
   types of instructions. Let's call them types A, B, C, and D. Your
   program consists of 20% type A instructions, 40% type B, 30% type
   C, and 10% type D. You timed the program and it takes 100 seconds
   on your laptop.

    A. Your friend suggests replacing all the type D instructions with
    another type, E, which is 10x faster. How long will the improved
    program take to run?

    B. Consider the original program (no type E instructions). You are
    considering buying a new laptop which happens to execute type B
    instructions faster. How much faster (by what factor) must it
    execute type B instructions to get a total running time of 80
    seconds? Assume that the new laptop executes types A, C, and D the
    same as your old laptop.
2. 2.58 (from CSAPP)
3. 2.59
4. 2.61
5. 2.71. For part B, you need not limit yourself to left and right
   shifts and one subtraction; you may solve it anyway you'd like.
6. 2.72.
   
   
   
Submit via Gradescope.

Fix comp235 hwk1 (basically just for next time)
Fix comp235 hwk1 (basically just for next time)
