[CS61C FA20] Lecture 26.3 - Caches III: Fully Associative Caches — Transcript
Full transcript
- 0:00and welcome back we last left our
- 0:03hero when we were thinking about could
- 0:06possibly two different
- 0:07memory requests that were blue end up
- 0:11being kind of together rather than only
- 0:13one of them was only one blue spot maybe
- 0:14there could be two blue spots or more
- 0:16so the extreme idea is a fully
- 0:18associative cache
- 0:20might as well go all the way it's almost
- 0:21like you're over compensating one says i
- 0:23know exactly where you go
- 0:25and the fully associative says maybe you
- 0:26go anywhere it's like
- 0:28rather than give you an assigned seat
- 0:30sit anywhere go crazy
- 0:32that's kind of what fully associative
- 0:33caches are like so let's see what that
- 0:35means
- 0:36so a fully associated cache what i mean
- 0:39is
- 0:39you can literally go anywhere so tag was
- 0:42before the offset's the same as before
- 0:45but there's no index the the index would
- 0:48tell me exactly what row to go to i'm
- 0:50telling you there's no rows
- 0:51there's no idea of rows any block goes
- 0:53anywhere see it anywhere you want go
- 0:55crazy
- 0:56and you have to compare all the tags in
- 0:57the entire cache you see the data is
- 0:59there
- 0:59which now means because there's no
- 1:01remember the tag width
- 1:03is a function of i and o i is nothing
- 1:06there's no more i anymore so now there's
- 1:07only an o
- 1:08which means the tag got bigger so
- 1:10remember that the tag has to get bigger
- 1:11when you have a fully associative cache
- 1:13to factor it in so here's an example
- 1:16a 32-byte block that's five
- 1:19bits to specify through to the two to
- 1:22the five or 32 different bytes i want
- 1:24there
- 1:26well 32 bits wide is my total address
- 1:30if 5 is here that means 27 is my tag so
- 1:32remember that that tag would have grown
- 1:34if i had an index there
- 1:35then my tag would have grown okay think
- 1:37about that so i've got my tag my valid
- 1:39bits my cache data like that
- 1:41and the key here is i'm going to try to
- 1:43as it was hardware
- 1:45i'm going to try to compare my tags in
- 1:47parallel
- 1:48that's amazing if i can do that if i can
- 1:50build circuitry i should show you a
- 1:52picture in a second
- 1:53then that's great it means i can compare
- 1:54tags in parallel and figure out whether
- 1:56i got it or not if they match
- 1:58benefits what are the huge benefits are
- 2:01you kidding me
- 2:02no more conflict misses the whole idea
- 2:03that the two blues only one of the two
- 2:05there's not enough room for this whole
- 2:07cache for the two of us
- 2:09that's what that model is only one of
- 2:11those blues can exist in that blue spot
- 2:13this is anybody puts their stuff
- 2:15anywhere just find us find a seat that's
- 2:17what they're kind of saying
- 2:18the drawbacks of that again the
- 2:20drawbacks are just in the hardware point
- 2:21of view which
- 2:22is not algorithmic it is it's hard
- 2:25to build hardware comparators for every
- 2:28single entry if i have it for two
- 2:30we can do that if it's not that bad but
- 2:31for have i mean it's just end up
- 2:3316 000 comparators which is just too
- 2:35hard to do this
- 2:36in a normal in a normal cache so these
- 2:39are hard to do
- 2:40a software fully associative cache i
- 2:42love
- 2:43but a hardware one is hard to build so
- 2:45that's the key here
- 2:47the third kind of miss is called a
- 2:49capacity miss
- 2:51and this means this is a miss that if if
- 2:54i could have
- 2:55just grown my cash bigger i wouldn't
- 2:57have had that missed that's what a
- 2:58capacity misses capacity this is
- 2:59one that wouldn't have wouldn't have
- 3:01occurred if i would have had a bigger
- 3:02cache
- 3:03um this is kind of a soft idea i'm going
- 3:05to show you an action algorithm for that
- 3:06and by the way
- 3:07this is the kind of misses you get with
- 3:09fully associated caches you obviously
- 3:11hit
- 3:11take a compulsory miss for every time
- 3:13you ever visit a piece of memory right
- 3:15every every block of memory
- 3:17i'm going to take a compulsory miss
- 3:18because i never visited before but
- 3:21even if i visit the same one that's one
- 3:22cache above you fully associative can
- 3:24handle that i'll take another compulsory
- 3:26miss to grab it for the first time it's
- 3:27in there
- 3:28and the next kind of misses i get once
- 3:29i'm using these guys is
- 3:31a capacity one which means i want to fit
- 3:32more guys in here but i only have a
- 3:34certain
- 3:35space for my fully associative cache i
- 3:37can't fit anymore
- 3:38so capacity misses what the other set of
- 3:40misses you're going to see long term
- 3:42steady state once i've let's say you've
- 3:44exhausted visited
- 3:45everybody at least once well it's the
- 3:47capacity miss that really gets you
- 3:49because you've already taken the
- 3:50compulsory hit from every single cache
- 3:51block
- 3:52every single memory blocked but it's the
- 3:54capacity miss that way if i had remember
- 3:56if i had an
- 3:57infinite memory i wouldn't have had
- 3:58those capacity if if my cash
- 4:00if my cash were infinitely big i
- 4:02wouldn't have taken those capacity
- 4:03misses i would have loaded them all in
- 4:05if i could somehow is a crazy world
- 4:07storm all my memory in my cache
- 4:09well once i'm there it's there like
- 4:12literally it would be i would say a copy
- 4:14but
- 4:14it would be a a reordered copy of memory
- 4:17literally if i had a i think a fully
- 4:20associative cache
- 4:21there were 34 gibby bytes 2 to the 32
- 4:25or more i'll just say more but if
- 4:26exactly that once all the men and i
- 4:28visit
- 4:29i swept through all the memory i can hit
- 4:31it randomly i could hit an order
- 4:33once i've loaded them all in they'd be
- 4:35in my cash and i wouldn't have any more
- 4:37misses
- 4:37because they're all there so a capacity
- 4:41misses the miss that you get because
- 4:42your cash can't be any bigger and
- 4:44there's some fixed
- 4:45cost that you have so here this is a
- 4:48great
- 4:48algorithm to think about how to
- 4:50categorize these misses okay
- 4:52so first consider like the craziest bit
- 4:55like almost like what i was telling you
- 4:56now
- 4:56a second ago consider the most insanely
- 4:59sized cache you could ever
- 5:01infinite size all fully associative
- 5:04for every miss that occurs it's going to
- 5:06be a compulsory miss okay because
- 5:08it's never about a capacity because the
- 5:10infinite size
- 5:11it's never about conflict because it's
- 5:13fully associative
- 5:15so therefore all those misses that i
- 5:16have in that world are compulsory misses
- 5:19okay now consider
- 5:23i have a finite size cache okay
- 5:27and now let's start let's have let's
- 5:28start have let's start actually having a
- 5:30workload run it so as the first line
- 5:31says run an address trace
- 5:33against a set of caches so i have a
- 5:35particular cache i'm comparing to their
- 5:36neighbors that's the idea i'm comparing
- 5:38this design against those designs
- 5:40wow that's kind of interesting to have
- 5:4120 designs and see what happens but i
- 5:43have an address trace
- 5:44which means i have a list or stream
- 5:46could be infinite
- 5:47of address requests and maybe you want
- 5:50to have
- 5:50reads and writes in there to play with
- 5:52that as well to play with as a right
- 5:53back as a right through all those things
- 5:55i've got this address trace and i hit r
- 5:57i hit my cache with that trace
- 5:59and i hit the neighbor cache with that
- 6:01trace and i hit that okay and i'm
- 6:02comparing them all
- 6:04so when i'm comparing them i'm now
- 6:07looking at a reasonable you know finite
- 6:09size cache and
- 6:10a particular with all the parameters and
- 6:12now i hit it with this trace
- 6:14all the misses that are not
- 6:17in the first category compulsory i count
- 6:19these as capacity misses
- 6:21meaning the only thing i changed from
- 6:23step one to step two was
- 6:24change it from infinite size to finite
- 6:26size therefore the ones the new
- 6:28misses i get must be capacity misses
- 6:30must be because of the change
- 6:32kind of logically makes sense and now
- 6:35here's the piece of it i had it was
- 6:38fully it was finite but still fully
- 6:40associative
- 6:41what if i take it fully associative and
- 6:42i shrink it down
- 6:44less associative and kind of make it not
- 6:47fully associative
- 6:48you right now you only know of direct
- 6:49mapped there's something in the middle
- 6:51i'll mention it
- 6:52i'll mention a second all the remaining
- 6:54misses
- 6:56that um sorry
- 7:00yes finite associativity so i took away
- 7:02so i took away first of all it was
- 7:03infinite took away that
- 7:04like i take away your power as a
- 7:06superman oh i can't use the i-beams
- 7:07anymore i can't fly
- 7:09okay i took away from being infinite
- 7:10size made it finite now i take away your
- 7:13fully associativity and reduce it in
- 7:14some way either reduce it all the way to
- 7:16direct mapped or somewhere in the middle
- 7:18and i'll tell you in a second what that
- 7:19is
- 7:19as i do that what are the remaining
- 7:21misses i have those are conflict misses
- 7:23those are
- 7:23those are misses that i wouldn't have
- 7:24had if you were fully associative
- 7:26that's the idea so it's a really nice
- 7:28algorithm to think about how to think
- 7:29about it is it a comp
- 7:30compulsory miss capacity miss or
- 7:32conflict miss
- 7:33run this run this set of traces on that
- 7:36to see what would happen
- 7:37and those three cases will flag be
- 7:39flagged there's even by the way a fourth
- 7:41miss we're going to tell you
- 7:42in about a month ish we're talking about
- 7:44parallelism so say
- 7:45remember in your back your head say oh
- 7:47there's a fourth miss what is it i'm not
- 7:48gonna tell you yet i'll tell you later
- 7:51in conclusion this is the end of the
- 7:53third of the fourth lecture on cast as
- 7:54we're almost done
- 7:56we still haven't talked about what the
- 7:57thing between fully associative and
- 7:59direct map is
- 7:59somewhere in the middle that's what
- 8:01we'll talk about the next lecture and
- 8:02we'll show an example in demo too
- 8:05so step here's my algorithm let me make
- 8:06sure you understand the algorithm
- 8:08take my i have a memory request now we
- 8:10know it could be a write also but for
- 8:12now let's do a read okay
- 8:14divide into the tio bits go to nxi check
- 8:17if it's valid if zero
- 8:19it means it's a compulsory miss set the
- 8:22valid bis i said that compulsory miss
- 8:23and use the offset if you turn the right
- 8:25chunk figure out what what column i'm in
- 8:27return the right chunk
- 8:28okay if it's one that means
- 8:31somebody somebody's there but like
- 8:33goldilocks it could be somebody fits
- 8:35exactly in my clothes or
- 8:36somebody that's wrong oh that's you're
- 8:38not the same tag you're the wrong person
- 8:40so check tags okay if it's a match hit
- 8:43whoo and i use my offset to figure out
- 8:46which column i want what byte word or
- 8:47whatever i want from that
- 8:48maybe it's load double i grab two words
- 8:50from that
- 8:52if not then i have a conflict miss i
- 8:55gotta take that old block
- 8:57out and here's a part of this it's not
- 8:59written there
- 9:00if i have a right through i do nothing i
- 9:02kick the whole guy out
- 9:03if it's right back i check the dirty bit
- 9:05if the dirty blit is
- 9:07said oh man i gotta write that guy out
- 9:10send that guy back to memory now the
- 9:11memory is consistent and now i read the
- 9:13correct guy in load the tag
- 9:15turn the dirty bit off and we're back in
- 9:17business and we and return the value
- 9:18return the right chunk
- 9:19so i didn't mention the dirty bit in
- 9:21here you now know what the dirty bit is
- 9:22that factors into this
- 9:23algorithm as well and that's the picture
- 9:26so
- 9:26next lecture cash series four we're
- 9:29going to see an example
- 9:30a demo and talk about what is that
- 9:32associativity called
- 9:33that's not fully associative and not
- 9:35direct mapped who lives in that kind of
- 9:38flyover who lives in the flyover area
- 9:40here you know there's california and the
- 9:42east coast
- 9:42who lives in the flyover area that's not
- 9:44with somewhere between fully associative
- 9:46and direct but direct mapped
- 9:48we'll see you next time
About this transcript
This page contains the full transcript of [CS61C FA20] Lecture 26.3 - Caches III: Fully Associative Caches by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 2,075 words across 330 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.