SlideShare a Scribd company logo
1 of 49
MEMORY
MANAGEMENT
PRESENTATION BY
MUHAMMAD AHMAD
1
2
Objectives
Memory Management
1. Basic memory management
2. Swapping
3. Virtual memory
4. Page replacement algorithms
5. Modeling page replacement
algorithms
6. Design issues for paging systems
7. Implementation issues
8. Segmentation
3
Memory Management
• Ideally programmers want memory that is
– large
– fast
– non volatile
• Memory hierarchy
– small amount of fast, expensive memory – cache
– some medium-speed, medium price main memory
– gigabytes of slow, cheap disk storage
• Memory manager handles the memory hierarchy
4
Basic Memory Management
Monoprogramming without Swapping or Paging
Three simple ways of organizing memory
- an operating system with one user process
5
Multiprogramming with Fixed Partitions
• Fixed memory partitions
– separate input queues for each partition
– single input queue
6
Modeling Multiprogramming
CPU utilization as a function of number of processes in memory
Degree of multiprogramming
7
Relocation and Protection
• Cannot be sure where program will be loaded in memory
1-Relocation is way to map virtual addresses into physical
addresses.
– address locations of variables, code routines cannot be absolute
– must keep a program out of other processes’ partitions
• Use base and limit values
– address locations added to base value to map to physical
address
– address locations larger than limit value is an error
8
Swapping (1)
Memory allocation changes as
– processes come into memory
– leave memory
Shaded regions are unused memory
9
Swapping (2)
• Allocating space for growing data segment
• Allocating space for growing stack & data segment
10
Memory Management with Linked Lists
Four neighbor combinations for the terminating process X
11
Virtual Memory
Paging (1)
The position and function of the MMU
12
Paging (2)
The relation between
virtual addresses
and physical
memory addres-
ses given by
page table
13
Page Tables (1)
Internal operation of MMU with 16 4 KB pages
14
Page Tables (2)
• 32 bit address with 2 page table fields
• Two-level page tables
Second-level page tables
Top-level
page table
15
Page Replacement Algorithms
• Page fault forces choice
– which page must be removed
– make room for incoming page
• Modified page must first be saved
– unmodified just overwritten
• Better not to choose an often used page
– will probably need to be brought back in soon
16
Optimal Page Replacement Algorithm
• Replace page needed at the farthest point in future
– Optimal but unrealizable
• Estimate by …
– logging page use on previous runs of process
– although this is impractical
17
Not Recently Used Page Replacement Algorithm
• Each page has Reference bit, Modified bit
– bits are set when page is referenced, modified
• Pages are classified
1. not referenced, not modified
2. not referenced, modified
3. referenced, not modified
4. referenced, modified
• NRU removes page at random
– from lowest numbered non empty class
18
FIFO Page Replacement Algorithm
• Maintain a linked list of all pages
– in order they came into memory
• Page at beginning of list replaced
• Disadvantage
– page in memory the longest may be often used
19
Second Chance Page Replacement Algorithm
• Operation of a second chance
– pages sorted in FIFO order
– Page list if fault occurs at time 20, A has R bit set
(numbers above pages are loading times)
20
The Clock Page Replacement Algorithm
21
Least Recently Used (LRU)
• Assume pages used recently will used again soon
– throw out page that has been unused for longest time
• Must keep a linked list of pages
– most recently used at front, least at rear
– update this list every memory reference !!
• Alternatively keep counter in each page table entry
– choose page with lowest value counter
– periodically zero the counter
22
Simulating LRU in Software (1)
LRU using a matrix – pages referenced in order
0,1,2,3,2,1,0,3,2,3
23
The Working Set Page Replacement Algorithm (1)
• The working set is the set of pages used by the k
most recent memory references
• w(k,t) is the size of the working set at time, t
24
The WSClock Page Replacement Algorithm
Operation of the WSClock algorithm
25
Review of Page Replacement Algorithms
26
Load Control
• Despite good designs, system may still thrash
• When PFF algorithm indicates
– some processes need more memory
– but no processes need less
• Solution :
Reduce number of processes competing for memory
– swap one or more to disk, divide up pages they held
– reconsider degree of multiprogramming
27
Page Size (1)
Small page size
• Advantages
– less internal fragmentation
– better fit for various data structures, code sections
– less unused program in memory
• Disadvantages
– programs need many pages, larger page tables
28
Page Size (2)
• Overhead due to page table and internal
fragmentation
• Where
– s = average process size in bytes
– p = page size in bytes
– e = page entry
2
s e p
overhead
p

 
page table space
internal
fragmentation
Optimized when
2
p se

29
Shared Pages
Two processes sharing same program sharing its page table
30
Cleaning Policy
• Need for a background process, paging daemon
– periodically inspects state of memory
• When too few frames are free
– selects pages to evict using a replacement algorithm
• It can use same circular list (clock)
– as regular page replacement algorithmbut with diff ptr
31
Implementation Issues
Operating System Involvement with Paging
Four times when OS involved with paging
1. Process creation
 determine program size
 create page table
2. Process execution
 MMU reset for new process
 TLB flushed
3. Page fault time
 determine virtual address causing fault
 swap target page out, needed page in
4. Process termination time
 release page table, pages
32
Page Fault Handling (1)
1. Hardware traps to kernel
2. General registers saved
3. OS determines which virtual page needed
4. OS checks validity of address, seeks page frame
5. If selected frame is dirty, write it to disk
33
Page Fault Handling (2)
6. OS brings schedules new page in from disk
7. Page tables updated
 Faulting instruction backed up to when it began
6. Faulting process scheduled
7. Registers restored
 Program continues
34
Locking Pages in Memory
• Virtual memory and I/O occasionally interact
• Issues call for read from device into buffer
– while waiting for I/O, another processes starts up
– has a page fault
– buffer for the first may be chosen to be paged out
• Need to specify some pages locked
– exempted from being target pages
35
Segmentation (3)
Comparison of paging and segmentation
36
Implementation of Pure Segmentation
(a)-(d) Development of checkerboarding
(e) Removal of the checkerboarding by compaction
37
Segmentation with Paging: MULTICS (1)
• Descriptor segment points to page tables
• Segment descriptor – numbers are field lengths
38
Segmentation with Paging: MULTICS (2)
A 34-bit MULTICS virtual address
39
Segmentation with Paging: MULTICS (3)
Conversion of a 2-part MULTICS address into a main memory address
40
Segmentation with Paging: MULTICS (4)
• Simplified version of the MULTICS TLB
• Existence of 2 page sizes makes actual TLB more complicated
41
Segmentation with Paging: Pentium (1)
Protection on the Pentium
Level
42
Segmentation with Paging: Pentium (2)
Conversion of a (selector, offset) pair to a linear address
43
Segmentation with Paging: Pentium (3)
Mapping of a linear address onto a physical address
44
MCQs
1. What is virtual memory in an operating system?
a. A type of memory used for storing graphics and video data
b. A method that allows programs to execute using a portion of a hard
disk as if it were an extension of RAM
c. A type of memory used only by operating systems
d. A type of memory used for storing temporary data
Answer: b
2. What is the purpose of page replacement algorithms?
a. To allow multiple programs to share the same memory space
b. To optimize the use of cache memory in a computer system
c. To manage memory allocation and deallocation in an operating system
d. To select which memory pages should be removed from RAM when
there is no room for incoming pages
Answer: d
45
3. What is thrashing in an operating system?
a. A high rate of swapping memory pages between RAM and virtual memory due
to insufficient memory
b. A method of allocating memory that requires contiguous blocks of memory
c. A mechanism that prevents access to memory by unauthorized programs
d. A scheduler algorithm for distributing CPU time between different programs
Answer: a
4. What is the role of the Memory Management Unit (MMU) in an operating
system?
a. To manage virtual memory for the operating system
b. To allocate memory resources to different programs
c. To protect memory from unauthorized access
d. To translate virtual addresses used by programs to physical addresses in
memory
Answer: d
5. Which of the following is an example of a page size used in memory
management?
a. 128 bytes
b. 256 kilobytes
c. 4 megabytes
d. 16 gigabytes Answer: c
46
1. What is the purpose of memory management in an
operating system?
Answer: The purpose of memory management in an operating
system is to allocate a portion of the computer's memory to
running programs, manage memory allocation and deallocation,
protect one program's memory from another program, optimize
the use of available memory space and prevent memory-related
errors or crashes.
2. What is a memory partition in memory management?
Answer: A memory partition is a fixed block of memory reserved
for a specific program or process. It is created by the operating
system and allocated to a running program or process.
3. What is a page table in memory management?
Answer: A page table is a data structure used in memory
management that maps virtual memory addresses used by a
program to physical memory addresses where the data is stored.
47
4. What is paging in memory management?
Answer: Paging is a technique used in memory management
to split a program's virtual memory into smaller blocks called
pages, which are stored in physical memory or on disk. The
operating system uses a page table to map the program's
virtual memory to physical memory locations.
5. What is thrashing in memory management?
Answer: Thrashing in memory management occurs when the
operating system spends a lot of time swapping pages between
physical memory and disk to create space for new pages. This
can lead to a severe drop in system performance and is caused
by insufficient physical memory for the programs being run.
48
49

More Related Content

Similar to Memory Management-Muhammad Ahmad.ppt

Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
Amanuelmergia
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
Google
 
Memory management
Memory managementMemory management
Memory management
Rasi123
 

Similar to Memory Management-Muhammad Ahmad.ppt (20)

08 operating system support
08 operating system support08 operating system support
08 operating system support
 
16. PagingImplementIssused.pptx
16. PagingImplementIssused.pptx16. PagingImplementIssused.pptx
16. PagingImplementIssused.pptx
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
 
Memory management
Memory managementMemory management
Memory management
 
OS Presentation 2023.pptx
OS Presentation 2023.pptxOS Presentation 2023.pptx
OS Presentation 2023.pptx
 
Virtual Memory.pdf
Virtual Memory.pdfVirtual Memory.pdf
Virtual Memory.pdf
 
Main Memory
Main MemoryMain Memory
Main Memory
 
Os4
Os4Os4
Os4
 
Os4
Os4Os4
Os4
 
chapter 2 memory and process management
chapter 2 memory and process managementchapter 2 memory and process management
chapter 2 memory and process management
 
Understanding memory management
Understanding memory managementUnderstanding memory management
Understanding memory management
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Unit 5Memory management.pptx
Unit 5Memory management.pptxUnit 5Memory management.pptx
Unit 5Memory management.pptx
 
CSE2010- Module 4 V1.pptx
CSE2010- Module 4 V1.pptxCSE2010- Module 4 V1.pptx
CSE2010- Module 4 V1.pptx
 
Virtual Memory in Windows
Virtual Memory in Windows Virtual Memory in Windows
Virtual Memory in Windows
 
Unit iiios Storage Management
Unit iiios Storage ManagementUnit iiios Storage Management
Unit iiios Storage Management
 
cache
cachecache
cache
 
UNIT-2 OS.pptx
UNIT-2 OS.pptxUNIT-2 OS.pptx
UNIT-2 OS.pptx
 

Recently uploaded

result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
rknatarajan
 

Recently uploaded (20)

(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur EscortsRussian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
Russian Call Girls in Nagpur Grishma Call 7001035870 Meet With Nagpur Escorts
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 

Memory Management-Muhammad Ahmad.ppt

  • 2. 2 Objectives Memory Management 1. Basic memory management 2. Swapping 3. Virtual memory 4. Page replacement algorithms 5. Modeling page replacement algorithms 6. Design issues for paging systems 7. Implementation issues 8. Segmentation
  • 3. 3 Memory Management • Ideally programmers want memory that is – large – fast – non volatile • Memory hierarchy – small amount of fast, expensive memory – cache – some medium-speed, medium price main memory – gigabytes of slow, cheap disk storage • Memory manager handles the memory hierarchy
  • 4. 4 Basic Memory Management Monoprogramming without Swapping or Paging Three simple ways of organizing memory - an operating system with one user process
  • 5. 5 Multiprogramming with Fixed Partitions • Fixed memory partitions – separate input queues for each partition – single input queue
  • 6. 6 Modeling Multiprogramming CPU utilization as a function of number of processes in memory Degree of multiprogramming
  • 7. 7 Relocation and Protection • Cannot be sure where program will be loaded in memory 1-Relocation is way to map virtual addresses into physical addresses. – address locations of variables, code routines cannot be absolute – must keep a program out of other processes’ partitions • Use base and limit values – address locations added to base value to map to physical address – address locations larger than limit value is an error
  • 8. 8 Swapping (1) Memory allocation changes as – processes come into memory – leave memory Shaded regions are unused memory
  • 9. 9 Swapping (2) • Allocating space for growing data segment • Allocating space for growing stack & data segment
  • 10. 10 Memory Management with Linked Lists Four neighbor combinations for the terminating process X
  • 11. 11 Virtual Memory Paging (1) The position and function of the MMU
  • 12. 12 Paging (2) The relation between virtual addresses and physical memory addres- ses given by page table
  • 13. 13 Page Tables (1) Internal operation of MMU with 16 4 KB pages
  • 14. 14 Page Tables (2) • 32 bit address with 2 page table fields • Two-level page tables Second-level page tables Top-level page table
  • 15. 15 Page Replacement Algorithms • Page fault forces choice – which page must be removed – make room for incoming page • Modified page must first be saved – unmodified just overwritten • Better not to choose an often used page – will probably need to be brought back in soon
  • 16. 16 Optimal Page Replacement Algorithm • Replace page needed at the farthest point in future – Optimal but unrealizable • Estimate by … – logging page use on previous runs of process – although this is impractical
  • 17. 17 Not Recently Used Page Replacement Algorithm • Each page has Reference bit, Modified bit – bits are set when page is referenced, modified • Pages are classified 1. not referenced, not modified 2. not referenced, modified 3. referenced, not modified 4. referenced, modified • NRU removes page at random – from lowest numbered non empty class
  • 18. 18 FIFO Page Replacement Algorithm • Maintain a linked list of all pages – in order they came into memory • Page at beginning of list replaced • Disadvantage – page in memory the longest may be often used
  • 19. 19 Second Chance Page Replacement Algorithm • Operation of a second chance – pages sorted in FIFO order – Page list if fault occurs at time 20, A has R bit set (numbers above pages are loading times)
  • 20. 20 The Clock Page Replacement Algorithm
  • 21. 21 Least Recently Used (LRU) • Assume pages used recently will used again soon – throw out page that has been unused for longest time • Must keep a linked list of pages – most recently used at front, least at rear – update this list every memory reference !! • Alternatively keep counter in each page table entry – choose page with lowest value counter – periodically zero the counter
  • 22. 22 Simulating LRU in Software (1) LRU using a matrix – pages referenced in order 0,1,2,3,2,1,0,3,2,3
  • 23. 23 The Working Set Page Replacement Algorithm (1) • The working set is the set of pages used by the k most recent memory references • w(k,t) is the size of the working set at time, t
  • 24. 24 The WSClock Page Replacement Algorithm Operation of the WSClock algorithm
  • 25. 25 Review of Page Replacement Algorithms
  • 26. 26 Load Control • Despite good designs, system may still thrash • When PFF algorithm indicates – some processes need more memory – but no processes need less • Solution : Reduce number of processes competing for memory – swap one or more to disk, divide up pages they held – reconsider degree of multiprogramming
  • 27. 27 Page Size (1) Small page size • Advantages – less internal fragmentation – better fit for various data structures, code sections – less unused program in memory • Disadvantages – programs need many pages, larger page tables
  • 28. 28 Page Size (2) • Overhead due to page table and internal fragmentation • Where – s = average process size in bytes – p = page size in bytes – e = page entry 2 s e p overhead p    page table space internal fragmentation Optimized when 2 p se 
  • 29. 29 Shared Pages Two processes sharing same program sharing its page table
  • 30. 30 Cleaning Policy • Need for a background process, paging daemon – periodically inspects state of memory • When too few frames are free – selects pages to evict using a replacement algorithm • It can use same circular list (clock) – as regular page replacement algorithmbut with diff ptr
  • 31. 31 Implementation Issues Operating System Involvement with Paging Four times when OS involved with paging 1. Process creation  determine program size  create page table 2. Process execution  MMU reset for new process  TLB flushed 3. Page fault time  determine virtual address causing fault  swap target page out, needed page in 4. Process termination time  release page table, pages
  • 32. 32 Page Fault Handling (1) 1. Hardware traps to kernel 2. General registers saved 3. OS determines which virtual page needed 4. OS checks validity of address, seeks page frame 5. If selected frame is dirty, write it to disk
  • 33. 33 Page Fault Handling (2) 6. OS brings schedules new page in from disk 7. Page tables updated  Faulting instruction backed up to when it began 6. Faulting process scheduled 7. Registers restored  Program continues
  • 34. 34 Locking Pages in Memory • Virtual memory and I/O occasionally interact • Issues call for read from device into buffer – while waiting for I/O, another processes starts up – has a page fault – buffer for the first may be chosen to be paged out • Need to specify some pages locked – exempted from being target pages
  • 35. 35 Segmentation (3) Comparison of paging and segmentation
  • 36. 36 Implementation of Pure Segmentation (a)-(d) Development of checkerboarding (e) Removal of the checkerboarding by compaction
  • 37. 37 Segmentation with Paging: MULTICS (1) • Descriptor segment points to page tables • Segment descriptor – numbers are field lengths
  • 38. 38 Segmentation with Paging: MULTICS (2) A 34-bit MULTICS virtual address
  • 39. 39 Segmentation with Paging: MULTICS (3) Conversion of a 2-part MULTICS address into a main memory address
  • 40. 40 Segmentation with Paging: MULTICS (4) • Simplified version of the MULTICS TLB • Existence of 2 page sizes makes actual TLB more complicated
  • 41. 41 Segmentation with Paging: Pentium (1) Protection on the Pentium Level
  • 42. 42 Segmentation with Paging: Pentium (2) Conversion of a (selector, offset) pair to a linear address
  • 43. 43 Segmentation with Paging: Pentium (3) Mapping of a linear address onto a physical address
  • 44. 44 MCQs 1. What is virtual memory in an operating system? a. A type of memory used for storing graphics and video data b. A method that allows programs to execute using a portion of a hard disk as if it were an extension of RAM c. A type of memory used only by operating systems d. A type of memory used for storing temporary data Answer: b 2. What is the purpose of page replacement algorithms? a. To allow multiple programs to share the same memory space b. To optimize the use of cache memory in a computer system c. To manage memory allocation and deallocation in an operating system d. To select which memory pages should be removed from RAM when there is no room for incoming pages Answer: d
  • 45. 45 3. What is thrashing in an operating system? a. A high rate of swapping memory pages between RAM and virtual memory due to insufficient memory b. A method of allocating memory that requires contiguous blocks of memory c. A mechanism that prevents access to memory by unauthorized programs d. A scheduler algorithm for distributing CPU time between different programs Answer: a 4. What is the role of the Memory Management Unit (MMU) in an operating system? a. To manage virtual memory for the operating system b. To allocate memory resources to different programs c. To protect memory from unauthorized access d. To translate virtual addresses used by programs to physical addresses in memory Answer: d 5. Which of the following is an example of a page size used in memory management? a. 128 bytes b. 256 kilobytes c. 4 megabytes d. 16 gigabytes Answer: c
  • 46. 46 1. What is the purpose of memory management in an operating system? Answer: The purpose of memory management in an operating system is to allocate a portion of the computer's memory to running programs, manage memory allocation and deallocation, protect one program's memory from another program, optimize the use of available memory space and prevent memory-related errors or crashes. 2. What is a memory partition in memory management? Answer: A memory partition is a fixed block of memory reserved for a specific program or process. It is created by the operating system and allocated to a running program or process. 3. What is a page table in memory management? Answer: A page table is a data structure used in memory management that maps virtual memory addresses used by a program to physical memory addresses where the data is stored.
  • 47. 47 4. What is paging in memory management? Answer: Paging is a technique used in memory management to split a program's virtual memory into smaller blocks called pages, which are stored in physical memory or on disk. The operating system uses a page table to map the program's virtual memory to physical memory locations. 5. What is thrashing in memory management? Answer: Thrashing in memory management occurs when the operating system spends a lot of time swapping pages between physical memory and disk to create space for new pages. This can lead to a severe drop in system performance and is caused by insufficient physical memory for the programs being run.
  • 48. 48
  • 49. 49