Page 92 - Computer_Science_F5
P. 92
1. Order taking (5 mins): Mama chapati greets the customer and takes their
order for a chapati.
2. Dough preparation (10 mins): She measures flour, water, and salt, then
kneads the dough by hand. This can be quite time-consuming.
FOR ONLINE READING ONLY
3. Rolling (5 mins): Once the dough is kneaded, she rolls it out into a thin Chapter Two: Performance and optimisation of computer processor
circle. While rolling, she also heats the frying pan on the cooking stove.
4. Cooking chapati (5 mins): The rolled-out dough is carefully transferred
to the hot frying pan and cooked until golden brown.
5. Serving (5 mins): Finally, the cooked chapati is presented to the customer,
and Mama chapati is ready to take the next order.
The problem: This non-pipelined approach creates a bottleneck at the kneading
and rolling stages. Mama chapati can only move on to the next order after
finishing the entire chapati for the previous customer. This leads to long wait
times, especially during peak lunch hour. Just like in a modern computer
processor, Mama chapati’s kitchen can be optimised using pipelining. Mama
chapati can have kitchen assistants at each stage; taking orders, preparing dough,
rolling, cooking and then serving. Therefore, once an order for customer 1 moves
to the second stage of dough preparation, Mama chapati can concurrently receive
order from customer 2. When the order of customer 1 moves to the third stage
of rolling, the order of customer 2 can move to stage two of dough preparation;
hence Mama chapati can concurrently take the order from customer 3. By the
time a cooked chapati is served to customer 1, Mama chapati will be taking the
fifth order from customer 5. Pipelining offers many benefits such as increased
throughput: by working on multiple stages simultaneously, Mama Chapati can
prepare chapatis much faster, reducing customer wait times significantly.
Questions:
(a) How much speedup is gained by introducing a pipeline into the process
of cooking chapatis?
(b) Think about the challenges of pipelining in Mama Chapati’s kitchen.
What if the frying pan is already occupied when a new chapati needs to
be cooked? How can Mama chapati address this data dependency?
83
Student’s Book Form Five
Computer Science Form 5.indd 83 23/07/2024 12:33