Operating System Dr. Hamada Lecture 4: Virtual Memory - Segmentation

StatuesqueFable avatar
StatuesqueFable
·
·
Download

Start Quiz

Study Flashcards

24 Questions

What is the purpose of modifying the dirty bit in the page frame?

To reduce the overhead of page transfers

Which page replacement algorithm is considered the most optimal, but impractical?

Optimal Page (OPT) Algorithm

What is the number of page faults for the Optimal Page (OPT) Algorithm given the sequence of page references: 6, 7, 8, 9, 6, 7, 1, 6, 7, 8, 9, 1, 7, 9, 6?

8

What is the number of page faults for the First-In-First-Out (FIFO) Algorithm given the sequence of page references: 6, 7, 8, 9, 6, 7, 1, 6, 7, 8, 9, 1?

9

What is the number of page faults for the Least Recently Used (LRU) Algorithm given the sequence of page references: 6, 7, 8, 9, 6, 7, 1, 6, 7, 8, 9, 1, 7, 9, 6?

12

What is the purpose of the page and frame tables in the page replacement process?

To keep track of which pages are currently in memory

What is the purpose of the segment table in segmentation?

To map logical addresses to physical addresses

What does the limit field in a segment table entry represent?

The length of the segment in memory

Which register is used to point to the location of the segment table in memory?

Segment-table base register (STBR)

What is the main problem associated with segmentation as a memory management scheme?

External fragmentation

In the logical address for a segment, what does the segment-number represent?

The index of the segment in the segment table

What is the first step in the paging memory management scheme?

Divide physical memory into frames

What is the purpose of the valid-invalid bit associated with each page table entry?

To indicate whether the page is currently in memory or not

What happens when the MMU encounters a page table entry with the valid-invalid bit set to 'i' during address translation?

The MMU will generate a page fault

What is the purpose of the lazy swapper strategy?

To only swap pages into memory when they are needed

What is the key difference between global and local page replacement strategies?

Global replacement allows one process to take a frame from another, while local replacement does not

What are the main steps the operating system takes when handling a page fault?

  1. Find a free frame, 2. Swap the page into the frame, 3. Update the page table, 4. Restart the faulting instruction

What is the goal of page replacement algorithms?

To minimize the number of page faults

What is the purpose of the page offset in the address translation scheme?

To combine with the base address to define the physical memory address

If a process has a size of 72,766 bytes and the page size is 2,048 bytes, how many pages will be required to load the process?

36 pages

What is the purpose of the valid-invalid bit associated with each entry in the page table?

To identify if the page is part of the process' logical address space

Which type of fragmentation is associated with paging?

Internal fragmentation

In the provided example, what is the amount of internal fragmentation for the process with a size of 72,766 bytes and a page size of 2,048 bytes?

962 bytes

What is the purpose of the protection bit associated with each frame in memory protection?

To indicate if the page is read-only or read-write

Study Notes

Page Replacement Algorithm

  • Victim frame selection is made using page replacement algorithms to reduce overhead of page transfers
  • Algorithms: FIFO, OPT, LRU

FIFO (First-In-First-Out) Algorithm

  • Replaces the oldest page that has been present in the main memory for the longest time
  • Number of Page Faults = 9

OPT (Optimal Page) Algorithm

  • Replaces page that is farthest to come in the upcoming sequence
  • Not practical because it is impossible to predict upcoming page references
  • Number of Page Faults = 8

LRU (Least Recently Used) Algorithm

  • Replaces page that has not been used in the most amount of time
  • Associate time of last use with each page
  • Number of Page Faults = 12

Memory Management Schemes

  • Segmentation: a memory-management scheme that supports user view of memory
  • Segmentation allows physical address space of a process to be non-contiguous and not equally divided
  • Suffers from external fragmentation problem

Segmentation Architecture

  • Segment table has a separate entry for each segment
  • Logical address of a segment consists of a two-tuple: base and limit
  • Used to map two-dimensional user-defined addresses into one-dimensional physical addresses

Paging

  • Paging steps: divide physical memory into fixed-sized blocks called frames, divide logical memory into blocks of same size called pages
  • Swapping: pager guesses which pages will be used before swapping out again
  • Page table entry has a valid-invalid bit associated with it

Page Fault

  • Occurs when a program tries to access a page that is not in physical memory
  • Steps to resolve page fault: find free frame, swap page into frame, reset table to indicate page now in memory, set validation bit = v, restart the instruction that caused the page fault

Page Replacement

  • Finds a page in memory, but not really in use, and pages it out
  • Goal: minimize number of page faults
  • Steps: find location of desired page on disk, find a free frame (or select a victim frame if no free frame), set up a page table to translate logical to physical addresses

This quiz covers memory-management schemes, specifically focusing on segmentation in the context of virtual memory. Segmentation allows for a user view of memory by organizing a program into logical segments such as main program, functions, and variables. Learn about how segmentation permits non-contiguous physical address spaces for processes.

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free

More Quizzes Like This

Operating Systems Fundamentals Quiz
3 questions
Manajemen Memori: Merambah Konsep Sistem Operasi
10 questions
Virtual Memory and Memory Pages Quiz
30 questions
Inf2C Computer Systems: Virtual Memory
10 questions
Use Quizgecko on...
Browser
Browser