[CS61C FA20] Lecture 21.4 - Pipelining I: Introduction to Pipelining — Transcript
Full transcript
- 0:01[Music]
- 0:10hi
- 0:11welcome back it's time to introduce the
- 0:14concept of pipelining which will
- 0:16increase the compute throughput
- 0:20but we're not going to start with
- 0:21computers and compute us
- 0:23for now let's start with a real life
- 0:24example or
- 0:26almost real life example let's suppose
- 0:29that tan and bora go back to
- 0:33college and they're in the same dorm
- 0:36with some of your favorite
- 0:38tas avi and caroline
- 0:41and now on say a sunday night
- 0:45abby borah caroline and dan all need to
- 0:48do the laundry
- 0:50in the basement of the la of the dorm
- 0:53there is
- 0:54a laundry room and the laundry room has
- 0:57a washer
- 0:58a dryer a place to
- 1:01fold the laundry and then a means to
- 1:04stash the laundry
- 1:05to take it back to the tower
- 1:10so the washer takes 30 minutes the dryer
- 1:12takes 30 minutes
- 1:13folding takes 30 minutes because it's
- 1:15kind of tight space
- 1:16in there and then stashing takes 30
- 1:18minutes because we need to walk our
- 1:20laundry back to our rooms
- 1:24so since there is four of us that need
- 1:26to do
- 1:27our laundry um we have four tasks
- 1:30a ferrari b for bora c for caroline
- 1:34and d for dan
- 1:37so let's see how we could do that so if
- 1:39you have a kind of a
- 1:41strange ra they may decide that we have
- 1:44to do it sequentially
- 1:46meaning that only one person can do the
- 1:48laundry at a time
- 1:50so first would go
- 1:52[Music]
- 1:53at uh 6 pm he would start his
- 1:56laundry and he would go through his four
- 1:59cycles or four
- 2:00four four phases of processing the
- 2:02laundry he would first go
- 2:04wash it for 30 minutes then dry it fold
- 2:07it
- 2:07and stash it and we'll be done at eight
- 2:10then borax okay go at eight and
- 2:15wash it dry it fold it and stash it
- 2:18it'll be done
- 2:19by 10 pm then carolyn can start
- 2:23she would wash it dry it
- 2:28fold it and stash it will be done by
- 2:30midnight
- 2:31and then would have to start at midnight
- 2:35and finish these four
- 2:37phases of laundry execution
- 2:41by 2 am
- 2:44is there a better way to do this yeah
- 2:47i mean if you look at this scenario we
- 2:50had
- 2:52three quarters of a time our resources
- 2:55were not utilized
- 2:58washer was used for 30 minutes every two
- 3:00hours
- 3:01dryer was used for 30 minutes for
- 3:06every two hours and the folding area was
- 3:09utilized only for 30 minutes every two
- 3:11hours
- 3:12we used the say the the
- 3:15stairs for stashing our laundry only 30
- 3:19minutes
- 3:21every two hours into ours
- 3:25so we certainly can try to do
- 3:28multiples of these things concurrently
- 3:31multiples of these
- 3:32phases of laundry concurrently
- 3:35so instead of having sequential laundry
- 3:38that takes
- 3:39eight hours for four loads perhaps we
- 3:41can do better
- 3:43so here is an approach of pipelining
- 3:46laundry processing we still have four
- 3:48tasks
- 3:49avis boras caroline's and dance
- 3:53and we are still going to start at 6 pm
- 3:57but we should be able to take less time
- 3:59if we
- 4:00overlap our tasks so ivy still
- 4:04has to start at six and he's going to go
- 4:06through his cycle of
- 4:07washing drying folding and stashing and
- 4:10he will be
- 4:11done at eight but pora doesn't have to
- 4:13wait to start
- 4:14at
- 4:18eight borah can just start
- 4:22at 6 30
- 4:25and go through the four phases of
- 4:28laundry processing
- 4:31carolyn can start at seven wash dry fold
- 4:34and stash and then
- 4:36can start at 7 30 and be done by 9 30
- 4:39just in time to record his next lecture
- 4:44all right so that there was a dramatic
- 4:48speed up
- 4:48that happened here but notice what
- 4:51happened
- 4:52you know let's just make sure that we
- 4:53understand exactly what happened
- 4:56the speed up was
- 5:00instead of eight hours it took us three
- 5:02and a half hours
- 5:04for four loads so that's pretty good
- 5:08there's still things that happen
- 5:09sequentially
- 5:11so phases of laundry processing still
- 5:14happen sequentially
- 5:15so each one of us took
- 5:18two hours like before
- 5:22but multiple phases
- 5:25or multiple stages of laundry processing
- 5:28happen simultaneously
- 5:32and in particular take a look at what
- 5:35happened at 7 30
- 5:37while avi was stashing his laundry
- 5:40carol borah was folding his laundry
- 5:43caroline was drying her laundry and dan
- 5:45was washing
- 5:46his laundry which
- 5:49fully utilized all the resources but
- 5:53while we were starting up the
- 5:56resources are not fully utilized it took
- 5:58us
- 6:00three cycles so to fill up the pipeline
- 6:05such that we had the full utilization
- 6:08and then it took us three
- 6:10cycles to drain the pipeline so if that
- 6:12is not obvious at 6 pm only the washer
- 6:15was used
- 6:18at the 6 30 pm washer and dryer were
- 6:22used
- 6:24and so on now if there are a thousand
- 6:27people trying to use
- 6:29this laundry system
- 6:33it wouldn't have taken 2 000 hours if we
- 6:36were to pipeline it it would have taken
- 6:39503 hours because
- 6:42it would take us still three cycles
- 6:46to fill the pipeline then everybody
- 6:49would be
- 6:50running four tasks four
- 6:53tasks in four phases concurrently and
- 6:56finally
- 6:57in the final three cycles
- 7:00we would drain that pipeline and all
- 7:03thousand
- 7:04loads would be
- 7:08processed in roughly
- 7:12500 hours okay
- 7:17so here are some of the key points to
- 7:19take away about pipelining
- 7:21laundry processing pipeline link doesn't
- 7:25help the latency
- 7:26of a single task because a single task
- 7:30still takes two hours no matter what but
- 7:33it
- 7:33helps with the throughput of the entire
- 7:35workload
- 7:36the entire workload got done
- 7:39significantly faster
- 7:41in this case 2.3 times faster
- 7:45there are multiple tasks that are
- 7:47operating simultaneously or concurrently
- 7:50using different resources now the
- 7:53potential
- 7:54speed up equals to the number of pipe
- 7:57stages
- 7:58that can be simultaneously used in this
- 8:00case there are four of them so
- 8:02the theoretical speed up that we can
- 8:05have
- 8:06is four but we did not achieve the speed
- 8:09up of four we achieved the speed up of
- 8:112.3
- 8:12because we needed some time to
- 8:17fill the pipe and then drain the pipe
- 8:21if there were
- 8:24a thousand tasks that were using the
- 8:27same pipeline
- 8:28then we would have gotten much closer to
- 8:31the
- 8:32forex of theoretical speedup so that's
- 8:36one of the key ideas
- 8:41a few other takeaways here now somebody
- 8:44decides to
- 8:45invest in in improving the laundry
- 8:49system
- 8:50so supposedly they get a new washer
- 8:54that takes 20 minutes instead of 30
- 8:56minutes
- 8:58and then new stasher new stashing system
- 9:01perhaps uses an elevator and
- 9:02i'll take 20 instead of 30 minutes
- 9:05how much would that improve the whole
- 9:08operation of the laundry in that dorm
- 9:11so it you know for example if you had
- 9:14thousand
- 9:15people using that laundry uh would it
- 9:18dramatically shape it
- 9:19instead of 500 hours would it take about
- 9:22two-thirds of 500 hours
- 9:24no because
- 9:28the trumpet of this whole system is set
- 9:32by the slowest
- 9:34slowest tasks or the slowest resources
- 9:37that we have in the pipeline
- 9:39this would shave off 10 minutes of the
- 9:41beginning
- 9:42and 10 minutes of the end the washer is
- 9:44going to take
- 9:4610 minutes less will be done in 20
- 9:48minutes
- 9:50instead of 30 and stashing will be done
- 9:52in 20 minutes instead of 30.
- 9:54so for four of us instead of three and a
- 9:56half hours it would take three hours and
- 9:58ten minutes
- 9:59but it would not change
- 10:02the the the time that it takes
- 10:07a thousand people process their laundry
- 10:09it would still be about
- 10:10500 hours why is that because
- 10:14even if these tasks tasks
- 10:17take 20 minutes in the beginning in the
- 10:20end
- 10:21the time is set by the slowest
- 10:25resources that we have in here which
- 10:27will be the washer
- 10:29and the folding station
- 10:36that's about it so what we're going to
- 10:37do in the next segment
- 10:39we are going to translate this to a risk
- 10:415
- 10:42pipeline see you then
About this transcript
This page contains the full transcript of [CS61C FA20] Lecture 21.4 - Pipelining I: Introduction to Pipelining by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 1,326 words across 251 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.