Unit 3

Pipelining

Vera and her two siblings are working on decorating holiday cookies for an upcoming holiday party. To save time, Vera and her siblings decide to use Pipelining. Decorating the cookies requires three steps:

  1. I: Ice the cookies (4 min)
  2. W: Trace “JOY!” with icing (4 min)
  3. S: Sprinkle the cookies with blue & white sprinkles (2 min)
Vera decided to map this pipelining process with a table. She makes the following attempts. For each of the attempts below, denote whether the table is correctly following the pipelining algorithm. If not, state why and how to fix the error.

[20.1] Attempt #1

Person0:002:004:006:008:0010:0012:00
Johnson Sibling 1I-I-I-
Johnson Sibling 2W-W-
Johnson Sibling 3SS

[20.2] Attempt #2

Person0:002:004:006:008:0010:0012:00
Johnson Sibling 1I-I-
Johnson Sibling 2W-W-
Johnson Sibling 3SSS

[20.3] Attempt #3

Person0:002:004:006:008:0010:0012:00
Johnson Sibling 1I-I-
Johnson Sibling 2--W-W-
Johnson Sibling 3----SS

[20.4] Attempt #4

Person0:002:004:006:008:0010:0012:00
Johnson Sibling 1I-I-
Johnson Sibling 2W-W-
Johnson Sibling 3SS

[20.5] Attempt #5

Person0:002:004:006:008:0010:0012:00
Johnson Sibling 1I-I-
Johnson Sibling 2W--
Johnson Sibling 3S

[20.6] Attempt #6

Person0:002:004:006:008:0010:0012:00
Johnson Sibling 1I-I-I-
Johnson Sibling 2W-W-W-
Johnson Sibling 3SS

[20.7] Aerie, Bea, and Cady want to wrap presents. To approach the task, they decide to use the Pipelining algorithm. Wrapping the presents requires three steps:

  • P: Pick out presents & wrapping paper (2 min)
  • C: Cut wrapping paper (2 min)
  • W: Wrap and tape wrapping paper over presents (2 min)

Q1. Fill out the following scheduling table using pipelining:

Person0:001:002:003:004:005:006:007:008:00
Aerie
Bea
Cady

Q2. In a 10-minute period, how many presents can the three wrap?

[20.8] You and your colleagues at Happy’s Bakery are tasked to bake the signature chocolate cakes. Your boss suggests a Pipelining approach due to limited resources available at the bakery. Baking the cake requires the following steps:

  • P: Prepare chocolate cake batter (10 min)
  • B: Bake cake in oven (20 min)
  • I: Ice the cake with Happy Bakery’s signature icing (5 min)
  • T: Top the cake with sprinkles (5 min)

Q1. Fill out the following scheduling table using pipelining:

Worker0:000:050:100:150:200:250:300:350:400:450:500:55
Worker 1
Worker 2
Worker 3
Worker 4

Q2. In this 1hr period, how many cakes can you and your colleagues make at Happy’s Bakery? If there were unlimited resources, is this method more efficient than baking the cakes using a parallelization approach?

[20.9] Three workers are involved in making a 3-course meal. The tasks are:

  • P: Prep ingredients (10 minutes)
  • C: Cook (30 minutes)
  • L: Plating (10 min)

If each person does a task at a time (using pipelining), how much time will it take to make 3 meals?

Parallel Programming

[20.10] The __________ is a computer component that takes information from the programs that are currently running and decides which program gets to use the CPU at any given moment.

[20.11] Explain the difference between multitasking and multiprocessing.

[20.12] Why do we say that parallel programming tends to be more difficult than regular programming? List all reasons.

[20.13] For the following statements, determine if they are True or False:


        a) A single CPU can only run one action at a time.
        b) Multitasking is a form of real simultaneous execution.
        c) Multiprocessing allows multiple actions to run at the exact same time.
        d) Throughput refers to the number of CPUs in a computer.
        e) Increasing the number of transistors in the computer increases efficency.
    

[20.14] Match each term below with the definition. There are more definitions than terms.

Terms


        1. Concurrency
        2. Parallel programming
        3. CPU
        4. Scheduler
        5. Throughput
        6. Multitasking
        7. Multiprocessing
    

Definition


        A. A method where multiple actions run at the exact same time on a single computer using multiple CPUs
        B. The amount of work a computer can do during a set length of time
        C. A component that decides which program gets to use the CPU
        D. Running multiple programs at the same time ( whether it is real or fake)
        E. When processes wait forever for resources held by each other
        F. A core composed of circuits including a control unit, logic units, and registers
        G. Splitting a single program so it runs on multiple CPUs at the same time
        H. Increasing the number of transistors on a chip
        I. Alternating between actions rapidly on one CPU
        J. A storage device that permanently saves data