[CS61C FA20] Lecture 29.3 - Virtual Memory I: Memory Manager — Transcript
Full transcript
- 0:00[Music]
- 0:08hello
- 0:09welcome back to our discussion on
- 0:11operating system support in which
- 0:12virtual memory
- 0:14so we have seen how does the
- 0:17real physical memory work and one thing
- 0:19that you would like to take away from
- 0:20there is that
- 0:22that every uh location in that memory
- 0:25every word or a block
- 0:27has its own physical address that is the
- 0:30address that corresponds to the library
- 0:31or congress call
- 0:32for the books or a street address
- 0:36that the postal service uses to deliver
- 0:38mail
- 0:40let's see how does this memory and
- 0:43addressing of the memory
- 0:44work when there are multiple processes
- 0:47that are trying to use it so
- 0:51in the simplest case when we are running
- 0:54so-called a bare metal system
- 0:56where there is no other support
- 0:59addresses
- 1:00issued by loads and stores that
- 1:03the program has on real physical
- 1:05addresses
- 1:06so you know this process that is running
- 1:08on on a
- 1:09processor is going to be addressing
- 1:13real physical locations in the memory
- 1:18now if we have multiple processes
- 1:23then each of these processes can issue
- 1:25any address
- 1:26and can therefore address any part of
- 1:29the memory
- 1:30uh even those parts that it
- 1:33does not necessarily own that you know
- 1:35where another process believes
- 1:38um that that where another process
- 1:40believes that it has ownership up
- 1:43so that's kind of a problem because
- 1:44multiple processes can
- 1:46run over each other in the memory
- 1:50um even more dangerously um
- 1:53some processes when there is an
- 1:54operating system in this model
- 1:57would be able to run over the operating
- 1:59systems data structures
- 2:02in order to avoid that we need to have a
- 2:05translation mechanism
- 2:07where there would be
- 2:10each process would be
- 2:13using a virtual outer space and then
- 2:18those addresses would be somehow
- 2:20decoupled in the physical
- 2:22address space so before accessing a
- 2:25particular physical
- 2:26location in memory we would check if a
- 2:29particular process
- 2:30has access rights to that particular
- 2:34spot
- 2:35so when we look how things look with the
- 2:38virtual memory
- 2:40we are going to have hundreds of
- 2:41processes that are managed by the
- 2:43operating system
- 2:45each line here corresponds to a
- 2:48different process and each process lives
- 2:51under this illusion that it
- 2:52got at the time according to itself
- 2:56and the entire memory to itself
- 2:59and the next line here is another
- 3:01process that also
- 3:02lives under the illusion that it got the
- 3:04process to itself
- 3:06and all of the memory and the next one
- 3:08and the next one
- 3:10hundreds of processes can be there
- 3:14and they're all multiplexed onto the
- 3:16core
- 3:17by the operating system um each one of
- 3:20them runs for
- 3:21some time on the core and then
- 3:25through the mechanism of a contact
- 3:26switch another process
- 3:28takes ownership of the core but what are
- 3:31we going to do with the memory there is
- 3:33only one memory
- 3:34and we cannot just save its contents
- 3:37it's only because we have all of the
- 3:39memory
- 3:40and you know in the content switch run
- 3:43you know put the data from another
- 3:45process on it
- 3:48so what we do we run
- 3:51we we have to run this translation
- 3:55process we have seen
- 3:57a conceptual picture of that we are
- 3:58going to get into a more
- 4:00more details of its operation now so
- 4:03each process
- 4:07runs in its own world um it sees
- 4:11this memory here the entire memory from
- 4:13zero zero zero
- 4:14zero zero to at the fff
- 4:18where it can store the code the static
- 4:20data the heap
- 4:21and the stack
- 4:25but then then
- 4:28in some way those virtual addresses
- 4:31get translated to physical addresses in
- 4:33a different way for every single process
- 4:37that concept that the translation is
- 4:40owned by
- 4:41something it is called the memory
- 4:42manager
- 4:44memory manager is the thing that maps
- 4:47virtual addresses
- 4:48to physical addresses
- 4:51conceptually what it does it essentially
- 4:55maps
- 4:57each of these processes to a part of a
- 5:00memory
- 5:00so each of the processes um
- 5:04although it thinks it is running from
- 5:05the zero address to the
- 5:07top of the address actually gets to use
- 5:10only a part of the memory
- 5:13these parts of the memory are not
- 5:15necessarily contiguous
- 5:17as drawn here in practice they're all
- 5:21going to be more like interleaved
- 5:22they're going to be all over the place
- 5:25and
- 5:25mixed with each other
- 5:29furthermore conceptually what does the
- 5:31memory manager need to do first it needs
- 5:33to provide the translation
- 5:34of virtual to physical address
- 5:37spaces and then very importantly needs
- 5:41to provide the protection
- 5:42so the memory needs to be isolated
- 5:44between the processes
- 5:45such that each of these processes gets
- 5:48its own
- 5:49private memory consequence of that is
- 5:52that errors in one program
- 5:54you know coding errors that can happen
- 5:57accidentally in one
- 5:58program do not corrupt the memory of
- 6:00another program
- 6:01and very importantly prevents a user
- 6:04program
- 6:05from messing up with os's memory and
- 6:09crashing the system
- 6:12also since we have so many processes we
- 6:15may run out of dram
- 6:19but the memory manager is actually going
- 6:22to prevent that
- 6:22by expanding the memory system onto the
- 6:25disk
- 6:26so it will provide the solution that our
- 6:29dram is much bigger
- 6:32by swapping parts of the memory
- 6:35of dram contents onto the disk now disk
- 6:38is a lot
- 6:39slower than our dram
- 6:42so this should happen infrequently and
- 6:44what we are going to see here
- 6:45our dram is essentially going to be used
- 6:48as a cache some sort of a cache for the
- 6:52slower disk how does that all happen
- 6:55you're going to see after a quick break
About this transcript
This page contains the full transcript of [CS61C FA20] Lecture 29.3 - Virtual Memory I: Memory Manager by CS 61C Departmental, generated from the public captions YouTube serves with the video. The transcript has 924 words across 175 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.