Cookie Throughput And Latency

Ben Bitdiddle is throwing a milk and cookies party to celebrate the installation of his traffic light controller. It takes him 5 minutes to roll cookies and place them on his tray. It then takes 15 minutes for the cookies to bake in the oven. Once the cookies are baked, he starts another tray. What is Ben's throughput and latency for a tray of cookies?

As you might imagine, the throughput can be improved by processing several tokens at the same time. This is called parallelism, which comes in two forms: spatial and temporal. With spatial parallelism, multiple copies of the hardware are provided so that multiple tasks can be done at the same time. With temporal parallelism, a task is broken into stages, like an assembly line. Multiple tasks can be spread across the stages. Although each task must pass through all stages, a different task will be in each stage at any given time, so multiple tasks can overlap. Temporal parallelism is commonly called pipelining. Spatial parallelism is sometimes just called parallelism, but we will avoid that naming convention because it is ambiguous.

Spatial Parallelism: Ben asks Alyssa P. Hacker to help out. She has her own cookie tray and oven.

Temporal Parallelism: Ben gets a second cookie tray. Once he puts one cookie tray in the oven, he starts rolling cookies on the other tray rather than waiting for the first tray to bake.

The latency is the time required to complete one task from start to finish. In all cases, the latency is 1/3 hour. If Ben starts with no cookies, the latency is the time he has to wait until he gets to eat the first cookie.

The throughput is the number of cookie trays per hour. With spatial parallelism, Ben and Alyssa each complete one tray every 20 minutes. Hence, the throughput doubles, to 6 trays/hour. With temporal parallelism, Ben puts a new tray in the oven every 15 minutes, for a throughput of 4 trays/hour.

Pipelining (temporal parallelism) is particularly attractive because it speeds up a circuit without *duplicating* the hardware. Instead, registers are placed between blocks of combinational logic to divide the logic into shorter stages that can run with a faster clock. The registers prevent a token in one pipeline stage from catching up with and corrupting the token in the next stage. 不是一点硬件都不增加。

Figure 3.58 shows an example of a circuit with no pipelining. It contains four blocks of logic between the registers. Figure 3.59 shows the same circuit partitioned into a two-stage pipeline by adding a register between blocks 3 and 4. Figure 3.60 shows the same circuit partitioned into a three-stage pipeline. Note that two more registers are needed to store the results of blocks 1 and 2 at the end of the first pipeline stage.

 5.5+4.5=10; 3.5+2.5+4.5=10.5. 

The bane [罹祸或不幸的原因] of parallelism is dependencies. If a current task is dependent on the result of a prior task, rather than just prior steps in the current task, the task cannot start until the prior task has completed. For example, if Ben wants to check that the first tray of cookies tastes good before he starts preparing the second, he has a dependency that prevents pipelining or parallel operation.

An assembly line is a sequence of machines and workers along which a product moves as it is assembled in stages. 装配线

If there is a concurrence [并发] of two or more things, they happen at the same time. 比如1万个用户同时下单,是系统设计者要应对的现象。parallelism是设计者的手段。

A pipeline is a large pipe which is used for carrying oil or gas over a long distance, often underground. If something is in the pipeline, it has already been planned or begun.

streamline:
1. 使成流线型, form something into a smooth shape, so that it moves easily through the air or water
2. 使某事物效率更高﹑作用更大, make sth such as a business, organization etc work more simply and effectively

“单发射流水线最多每个时钟周期一条指令。多发射(issue)增加流水线的宽度。”

“程序员既不写语法书也不看语法书。”

六级/考研单词: install, tray, oven, token, parallel, temporal, multiple, hardware, assemble, overlap, convention, ambiguous, hack, duplicate, logic, corrupt, partition, concurrent, seldom, subway, streamline, issue, eject, emit

ejaculate, eject, emit, launch, diddle

posted @ 2022-03-14 11:16  Fun_with_Words  阅读(69)  评论(0)    收藏  举报









 张牌。