Podcast
Questions and Answers
What is the main advantage of using mmap in relation to page tables?
What is the main advantage of using mmap in relation to page tables?
How many memory lookups are needed for each memory access in a system using page tables?
How many memory lookups are needed for each memory access in a system using page tables?
What is the relationship between address sizes and the addressable space?
What is the relationship between address sizes and the addressable space?
Which formula correctly indicates the physical address composition?
Which formula correctly indicates the physical address composition?
Signup and view all the answers
What is the benefit of allowing multiple processes to share the same physical memory?
What is the benefit of allowing multiple processes to share the same physical memory?
Signup and view all the answers
What does virtualization provide each process in terms of resources?
What does virtualization provide each process in terms of resources?
Signup and view all the answers
How does the operating system virtualize the CPU?
How does the operating system virtualize the CPU?
Signup and view all the answers
What is the purpose of the Memory Management Unit (MMU) in virtual memory?
What is the purpose of the Memory Management Unit (MMU) in virtual memory?
Signup and view all the answers
What does each process's view of memory represent?
What does each process's view of memory represent?
Signup and view all the answers
What is the starting point of a process's virtual address space referred to as?
What is the starting point of a process's virtual address space referred to as?
Signup and view all the answers
What can occur if two processes are allocated overlapping address ranges?
What can occur if two processes are allocated overlapping address ranges?
Signup and view all the answers
What is a primary challenge when trying to support multiple process address spaces?
What is a primary challenge when trying to support multiple process address spaces?
Signup and view all the answers
What happens when a context switch occurs during CPU processing?
What happens when a context switch occurs during CPU processing?
Signup and view all the answers
What is the purpose of paging in memory management?
What is the purpose of paging in memory management?
Signup and view all the answers
What mechanism is used to map virtual page numbers (VPN) to physical page numbers (PPN)?
What mechanism is used to map virtual page numbers (VPN) to physical page numbers (PPN)?
Signup and view all the answers
How does demand paging work?
How does demand paging work?
Signup and view all the answers
What determines the location of a byte within a physical page?
What determines the location of a byte within a physical page?
Signup and view all the answers
What size virtual addresses are required for a 64-bit address space with 16-byte pages?
What size virtual addresses are required for a 64-bit address space with 16-byte pages?
Signup and view all the answers
How are physical addresses represented when using a 128-byte physical memory space?
How are physical addresses represented when using a 128-byte physical memory space?
Signup and view all the answers
What role does the Memory Management Unit (MMU) play in address translation?
What role does the Memory Management Unit (MMU) play in address translation?
Signup and view all the answers
Which of the following is NOT a characteristic of a page table?
Which of the following is NOT a characteristic of a page table?
Signup and view all the answers
What does the Resident bit in a page table entry indicate?
What does the Resident bit in a page table entry indicate?
Signup and view all the answers
When a page fault occurs, what is the first action taken by the MMU?
When a page fault occurs, what is the first action taken by the MMU?
Signup and view all the answers
What is the purpose of the dirty bit in a page table entry?
What is the purpose of the dirty bit in a page table entry?
Signup and view all the answers
In a system with limited memory, what strategy can help manage memory efficiently?
In a system with limited memory, what strategy can help manage memory efficiently?
Signup and view all the answers
Which page replacement policy is mentioned as being applied in the discussed system?
Which page replacement policy is mentioned as being applied in the discussed system?
Signup and view all the answers
If a page is not present in physical memory and is needed for access, what occurs?
If a page is not present in physical memory and is needed for access, what occurs?
Signup and view all the answers
What does the OS do when it runs a new process regarding the BASE and BOUND registers?
What does the OS do when it runs a new process regarding the BASE and BOUND registers?
Signup and view all the answers
What does the term 'locality' refer to in the context of memory management?
What does the term 'locality' refer to in the context of memory management?
Signup and view all the answers
What is the role of the free list in memory management?
What is the role of the free list in memory management?
Signup and view all the answers
In a virtual memory system, what is the purpose of mapping a Virtual Page Number (VPN) to a Physical Page Number (PPN)?
In a virtual memory system, what is the purpose of mapping a Virtual Page Number (VPN) to a Physical Page Number (PPN)?
Signup and view all the answers
What is one benefit of dynamic relocation in memory management?
What is one benefit of dynamic relocation in memory management?
Signup and view all the answers
How does the MMU contribute to the property of isolated address spaces?
How does the MMU contribute to the property of isolated address spaces?
Signup and view all the answers
What is a key characteristic of internal fragmentation in memory systems?
What is a key characteristic of internal fragmentation in memory systems?
Signup and view all the answers
What is the proposed solution to internal fragmentation in memory management?
What is the proposed solution to internal fragmentation in memory management?
Signup and view all the answers
What problem does the OS encounter when managing physical memory for processes?
What problem does the OS encounter when managing physical memory for processes?
Signup and view all the answers
What happens when a process accesses an address beyond its BOUND register?
What happens when a process accesses an address beyond its BOUND register?
Signup and view all the answers
Study Notes
Operating System Part Two: Virtual Memory
- Virtual memory is a core concept in operating systems.
- It gives the illusion that each process has its own dedicated memory space.
- This is achieved by dividing physical memory into fixed-sized chunks called "pages."
- Virtual memory pages are mapped to physical memory pages.
Virtualization
- Virtualization allows each process to have its own illusion of a separate, non-shared device.
- It means a physical shared device is given to each process.
- This results in each process believing they have their own device, when in fact they are sharing just one.
Virtualization of the CPU:
- The operating system virtualizes a CPU via time-sharing and scheduling.
- Time slicing is used to give each process a small slice of CPU time.
- Each process gets time on the CPU.
Virtualization of Memory
- The operating system gives each process the illusion of its own address space using memory virtualization.
- Each process's view of memory is isolated from other processes.
- Processes can't access another process's memory.
Physical Memory
- Physical memory is composed of memory devices directly connected to the CPU through address and data buses.
- It is organized as an array of byte-sized locations.
- Each location can hold a single 8-bit value.
- The number of locations is proportional to the installed physical RAM units.
- Physical address space is the range of locations in physical memory.
Process's View of Memory
- Processes have their own address space, ranging from 0x00 to 0xFF.
- This depends on the size.
- All assembly instructions a process uses are virtual addresses, meaning they are not the actual physical addresses.
The Problem with Non-overlapping Memory Regions
- Attempts to place processes into non-overlapping memory regions to support multiple processes with a single physical memory fail because this leads to memory fragmentation.
- Physical memory is not fully used by processes.
- There is wasted space between processes.
- Processes need to be non-overlapping.
Address Translation Using MMU
- MMU (Memory Management Unit) is a hardware component.
- The MMU translates virtual addresses to physical addresses.
- The MMU converts a process's virtual address into a corresponding physical address to access data.
- Virtual address = physical address + base
- The MMU verifies that the translation is within the boundaries of the allocated address space.
OS Management of Address translation
- The operating system maintains registers.
- The base register stores a starting address for a process’s memory.
- The bound register stores the size of a process’s memory.
- When a process accesses memory, the MMU calculates the physical address.
- If the address is within the bounds, the MMU allows access; otherwise, it's denied.
Free Space Management
- The operating system maintains a free list to track available physical memory.
- Dynamic relocation is a technique that moves processes’ addresses around to make free spaces larger.
- The OS reconfigures addresses to improve memory utilization.
Good Properties of Address Translation
- The MMU performs address translation quickly.
- Processes are isolated from each other, and can't access another's memory.
- Processes don't know that their addresses are being translated.
Paging
- Paging is a memory management technique.
- Virtual memory is broken up into fixed-sized chunks called pages, and physical memory is as well.
- It maps virtual pages to physical pages dynamically as needed.
- Only allocates physical memory when actually used.
- The operating system manages page tables, storing mappings of virtual page numbers to physical page numbers.
How to Do Address Translation
- MMU takes a VPN (virtual page number) and finds the corresponding PPN (physical page number) from the page table to convert a virtual address to a physical address.
- The process happens in hardware and is very fast.
- A 64-bit address space requires representing 0 to 63 using binary notation.
- 128 bytes of physical memory might need 7-bit physical addresses.
Page Tables
- Page tables store the mapping between virtual page numbers and physical page numbers.
- The OS manages the page table's contents.
- The MMU has a register that points to the page table.
- Page table entries record details like the resident (or present/valid) bit, dirty bit, showing if a page has been changed, and permission bits.
Page Swapping
- Pages that aren’t in use but are needed are swapped out to disk and back in as needed.
- This helps expand the accessible memory for processes.
- Only pages actually needed by the process are loaded in memory during time-sharing/scheduling.
Page Fault
- It occurs when a process tries to access a page not in physical memory.
- The operating system handles the fault by swapping the required page.
- OS loads the page from the disk into memory, replacing an already allocated page if needed.
Replacement Policy (LRU)
- The least recently used (LRU) replacement policy chooses the page not used for a while.
- This page is usually swapped out for a new one.
Page Tables : Neat Bonuses
- The mmap system call allows for mapping files on disk to locations in a process’s virtual address space (VAS).
- Processes can share the same physical memory page for greater resource efficiency.
Next Time
- The study notes highlight several memory access considerations for the next study period.
Examining Virtual Memory Through Examples
- Address sizes correlate directly to describing/accessing addressable data/memory spaces.
- Number of bits in an address dictates the amount of bytes in memory you can address. (e.g. 10-bit addresses = 2^10 bytes)
The Math of Page Tables
- The size of virtual and physical addresses depends on the number of pages and each page's size.
- Calculating these sizes involves using logarithms, relating them to the amount of memory and page sizes a system can support.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
This quiz delves into key concepts of virtual memory in operating systems, focusing on the advantages of mmap, page table operations, and the function of the Memory Management Unit (MMU). Explore how virtualization affects resource allocation and manage multiple process address spaces effectively.