Problems discussed in the review session for the final COSC 4330/6310 Summer 2012.

Slides:



Advertisements
Similar presentations
1 Memory hierarchy and paging Electronic Computers M.
Advertisements

EECS 470 Virtual Memory Lecture 15. Why Use Virtual Memory? Decouples size of physical memory from programmer visible virtual memory Provides a convenient.
Module 9: Virtual Memory
Module 10: Virtual Memory Background Demand Paging Performance of Demand Paging Page Replacement Page-Replacement Algorithms Allocation of Frames Thrashing.
Computer Organization CS224 Fall 2012 Lesson 44. Virtual Memory  Use main memory as a “cache” for secondary (disk) storage l Managed jointly by CPU hardware.
Lecture 34: Chapter 5 Today’s topic –Virtual Memories 1.
Memory/Storage Architecture Lab Computer Architecture Virtual Memory.
Chapter 101 Virtual Memory Chapter 10 Sections and plus (Skip:10.3.2, 10.7, rest of 10.8)
Memory Management (II)
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Lecture 11: Memory Management
Virtual Memory Chapter 8.
Translation Buffers (TLB’s)
Virtual Memory. Why do we need VM? Program address space: 0 – 2^32 bytes –4GB of space Physical memory available –256MB or so Multiprogramming systems.
1 Chapter 8 Virtual Memory Virtual memory is a storage allocation scheme in which secondary memory can be addressed as though it were part of main memory.
Virtual Memory and Paging J. Nelson Amaral. Large Data Sets Size of address space: – 32-bit machines: 2 32 = 4 GB – 64-bit machines: 2 64 = a huge number.
Answers to the VM Problems Spring First question A computer has 32 bit addresses and a virtual memory with a page size of 8 kilobytes.  How many.
©UCB CS 161 Ch 7: Memory Hierarchy LECTURE 24 Instructor: L.N. Bhuyan
Chapter VIII Virtual Memory Review Questions Jehan-François Pâris
CS 153 Design of Operating Systems Spring 2015 Final Review.
Some VM Complications Extra memory accesses Page tables are huge
CS 153 Design of Operating Systems Spring 2015 Lecture 17: Paging.
CSE 451: Operating Systems Section 10 Project 3 wrap-up, final exam review.
Lecture 19: Virtual Memory
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
July 30, 2001Systems Architecture II1 Systems Architecture II (CS ) Lecture 8: Exploiting Memory Hierarchy: Virtual Memory * Jeremy R. Johnson Monday.
IT253: Computer Organization
Chapter VIIII File Systems Review Questions and Problems Jehan-François Pâris
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
1 Virtual Memory Main memory can act as a cache for the secondary storage (disk) Advantages: –illusion of having more physical memory –program relocation.
Virtual Memory 1 1.
A FAST FILE SYSTEM FOR UNIX Marshall K. Mckusick William N. Joy Samuel J. Leffler Robert S. Fabry CSRG, UC Berkeley.
Review °Apply Principle of Locality Recursively °Manage memory to disk? Treat as cache Included protection as bonus, now critical Use Page Table of mappings.
Introduction: Memory Management 2 Ideally programmers want memory that is large fast non volatile Memory hierarchy small amount of fast, expensive memory.
Multilevel Caches Microprocessors are getting faster and including a small high speed cache on the same chip.
CS2100 Computer Organisation Virtual Memory – Own reading only (AY2015/6) Semester 1.
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
Virtual Memory Ch. 8 & 9 Silberschatz Operating Systems Book.
Solutions for the First Quiz COSC 6360 Fall 2014.
LECTURE 12 Virtual Memory. VIRTUAL MEMORY Just as a cache can provide fast, easy access to recently-used code and data, main memory acts as a “cache”
COSC 3330/6308 Second Review Session Fall Instruction Timings For each of the following MIPS instructions, check the cycles that each instruction.
Virtual Memory What if program is bigger than available memory?
Virtual Memory Chapter 8.
CS161 – Design and Architecture of Computer
Translation Lookaside Buffer
Lecture 11 Virtual Memory
CS161 – Design and Architecture of Computer
CS703 - Advanced Operating Systems
Virtual Memory Chapter 8.
Module 9: Virtual Memory
EECE.4810/EECE.5730 Operating Systems
5: Virtual Memory Background Demand Paging
The Operating System Machine Level
Virtual Memory Hardware
Translation Lookaside Buffer
CSE451 - Section 10.
Translation Buffers (TLB’s)
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
CSE451 Virtual Memory Paging Autumn 2002
Translation Buffers (TLB’s)
CSE 451: Operating Systems Autumn 2003 Lecture 10 Paging & TLBs
Computer Architecture
Chapter VIIII File Systems Review Questions and Problems
CSE 471 Autumn 1998 Virtual memory
CSE451 - Section 10.
Translation Buffers (TLBs)
Module 9: Virtual Memory
Review What are the advantages/disadvantages of pages versus segments?
Virtual Memory.
Virtual Memory 1 1.
Presentation transcript:

Problems discussed in the review session for the final COSC 4330/6310 Summer 2012

True or false? External fragmentation is often the result of using very large page sizes.

Answer External fragmentation is often the result of using very large page sizes. – False Larger page sizes increase internal fragmentation but it rarely is an issue in virtual memory systems

True or false? Global page replacement policies cannot handle real-time processes.

Answer Global page replacement policies cannot handle real-time processes. – True Real-time processes must keep all their pages in memory all the time, which can only be achieved by giving them a private partition containing all the pages they will ever need

True or false? UNIX uses file-specific passwords to control access to files.

Answer UNIX uses file-specific passwords to control access to files. – False UNIX uses the file access control list to check which file access rights can be granted to a user process

True or false? UNIX stores the name of a file in its i-node.

Answer UNIX stores the name of a file in its i-node. – False See next answer

True or false? A UNIX file can have several names.

Answer A UNIX file can have several names. – True It can have as many names as there are directory entries pointing to it

An example Two directory entries pointing to same i-node The file has two names Bob Robert File i-node

True or false? UNIX special files are not files.

Answer UNIX special files are not files. – True. They are physical devices—or POSIX named semaphores

TLB misses When comparing the hit ratios of two translation look-aside buffers, which question should we ask first?

Answer Are TLB misses handled by the firmware or by the OS? – If TLB misses are handled by the firmware, the cost of a TLB miss is one extra memory reference – If TLB misses are handled by the OS, the cost of a TLB miss is two context switches.

The dirty bit What is the purpose of the dirty bit?

Answer The dirty bit tells whether a page has been modified since the last time it was brought into main memory. It is used whenever a page must be expelled from main memory. – If its dirty bit is ON, the page must be saved to disk before being expelled – If its dirty bit is OFF, there already is an exact copy of the page on disk.

The BSD page replacement policy How does the BSD UNIX page replacement policy simulate a missing page-referenced bit? What is the main drawback of the technique?

Answer (I) How does the BSD UNIX page replacement policy simulate a missing page-referenced bit? – Whenever the hand of the clock encounters a page that has been recently used, it marks it INVALID instead of clearing its page- referenced bit.

Answer (II) What is the main drawback of the technique? – The main drawback of this technique is that an interrupt will occur the next time that page will be accessed. The cost of handling this interrupt will be roughly equal to two context switches.

Page replacement policies Among the following page replacement policies: Local FIFO, Local LRU, Global FIFO, Global LRU, Original Clock, Berkeley Clock, and Windows – Which ones are the poorest performers?

Answer Among the following page replacement policies: Local FIFO, LOCAL LRU, Global FIFO, Global LRU, Original Clock, Berkeley Clock, and Windows – Which ones are the poorest performers? Local FIFO and Global FIFO

Page replacement policies Among the following page replacement policies: Local FIFO, Local LRU, Global FIFO, Global LRU, Original Clock, Berkeley Clock, and Windows – Which ones cannot be implemented at a reasonable cost?

Answer Among the following page replacement policies: Local FIFO, Local LRU, Global FIFO, Global LRU, Original Clock, Berkeley Clock, and Windows – Which ones cannot be implemented at a reasonable cost? Local LRU and Global LRU

Page replacement policies Among the following page replacement policies: Local FIFO, Local LRU, Global FIFO, Global LRU, Original Clock, Berkeley Clock, and Windows – Which ones provide a decent performance and do not require any special hardware support?

Answer Among the following page replacement policies: Local FIFO, Local LRU, Global FIFO, Global LRU, Original Clock, Berkeley Clock, and Windows – Which ones provide a decent performance and do not require any special hardware support? Berkeley Clock and Windows

Page replacement policies Among the following page replacement policies: Local FIFO, LOCAL LRU, Global FIFO, Global LRU, Original Clock, Berkeley Clock, and Windows – Which ones support real-time processes?

Answer Among the following page replacement policies: Local FIFO, LOCAL LRU, Global FIFO, Global LRU, Original Clock, Berkeley Clock, and Windows – Which ones support real-time processes? Windows (older exams mention VMS)

Page table organization A virtual memory system has a virtual address space of 4 GB and a page size of 4 Kilobytes. Each PTE occupies 4 bytes. a)How many bits are used for the byte offset?

Page table organization A virtual memory system has a virtual address space of 4 GB and a page size of 4 Kilobytes. Each PTE occupies 4 bytes. a)How many bits are used for the byte offset? Since 4K =2 12, the byte offset will use 12 bits.

Page table organization A virtual memory system has a virtual address space of 4 GB and a page size of 4 Kilobytes. Each PTE occupies 4 bytes. b)How many bits are used for the page number?

Page table organization A virtual memory system has a virtual address space of 4 GBs and a page size of 4 Kilobytes. Each PTE occupies 4 bytes. b)How many bits are used for the page number? Since 4G = 2 32, We have 32-bit virtual addresses Of these 32 bits the page number occupies = 20 bits

Page table organization A virtual memory system has a virtual address space of 4 Gigabytes and a page size of 4 Kilobytes. Each PTE occupies 4 bytes. c)What is the maximum number of page table entries in a page table?

Page table organization A virtual memory system has a virtual address space of 4 Gigabytes and a page size of 4 Kilobytes. Each PTE occupies 4 bytes. c)What is the maximum number of page table entries in a page table? Address space/ Page size = 2 32 / 2 12 = 2 20 PTE’s.

Page table organization A virtual memory system has a virtual address space of 4 GB and a page size of 4 Kilobytes. Each PTE occupies 4 bytes. d)What is the maximum size of a page table?

Page table organization A virtual memory system has a virtual address space of 4 GB and a page size of 4 Kilobytes. Each PTE occupies 4 bytes. d)What is the maximum size of a page table? Since each PTE occupies 4 bytes, 4 x 2 20 = 2 22 bytes = 4 MB.

UNIX file organization (I) A 32-bit UNIX file system has 16 kilobyte pages and i-nodes with 15 block addresses. How many file bytes can be accessed a)Directly from the i-node?

Answer A 32-bit UNIX file system has 16 kilobyte pages and i-nodes with 15 block addresses. How many file bytes can be accessed a)Directly from the i-node? The 12 first blocks that is 12 x 16 KB =192 KB.

UNIX file organization (II) A 32-bit UNIX file system has 16 kilobyte pages and i-nodes with 15 block addresses. How many file bytes can be accessed b)With one level of indirection?

Answer A 32-bit UNIX file system has 16 kilobyte pages and i-nodes with 15 block addresses. How many file bytes can be accessed b)With one level of indirection? An indirect block can store 16KB/4B = 4K block addresses. Hence we can access the next 4K x 16K = 64MB of the file

UNIX file organization (III) A 32-bit UNIX file system has 16 kilobyte pages and i-nodes with 15 block addresses. How many file bytes can be accessed c)With two levels of indirections?

Answer A 32-bit UNIX file system has 16 kilobyte pages and i-nodes with 15 block addresses. How many file bytes can be accessed c)With two levels of indirections? We should be able to access 4K  4K = 2 24 blocks of 16 KB = 256 GB Since the maximum file size is 4 GB we will be able to access 4 GB – 64 MB – 192 KB

UNIX file organization (IV) A 32-bit UNIX file system has 16 kilobyte pages and i-nodes with 15 block addresses. How many file bytes can be accessed d)With three levels of indirections?

Answer A 32-bit UNIX file system has 16 kilobyte pages and i-nodes with 15 block addresses. How many file bytes can be accessed d)With three levels of indirections? None

Internal fragmentation Internal fragmentation is not a big problem in virtual memory systems. Is it always so in file systems? Give a hypothetical example to support your argument.

Answer Internal fragmentation can be a big problem whenever the disk partition contains many files than are much smaller than the block size. Consider for instance a partition where many files are smaller than 1 KB and the block size is 4KB. More than 75 percent of the space used by these files will be wasted.

Controlling access to files Alice, Bob and Carol want to share a few files on a UNIX system while preventing other users to access these files. What should they do?

Answer Alice, Bob and Carol want to share a few files on a UNIX system while preventing other users to access these files. What should they do? – They should ask their system administrator to create a group “abc” for the three of them.

Access control lists and tickets Give examples of tickets and access controls lists in the UNIX file system.

Answer Give examples of tickets and access controls lists in the UNIX file system. – The file descriptor of an opened file acts as a ticket. – The protection bits of a file constitute its access control list.

Metadata updates Give examples of what could happen if metadata updates are written to disk in the wrong order. How does the “Fast” File System avoid that? What is the main drawback of this approach?

Answer (I) Whenever we create a new file, the block containing the new i-node must be written to disk before the block containing the directory entry pointing to that i-node. Otherwise, a crash happening after the directory block has been written to disk but before the block containing the new i- node has been written to disk would leave the file system in unsafe state

Answer (II) The “Fast” File System avoids that by requiring all I/O operations involving metadata updates to be blocking. This solution dramatically decreases the throughput of the file system.

Question What are the respective advantages of journaling file systems using (a) synchronous log updates and (b) asynchronous log updates?

Answer Journaling file systems using synchronous log updates guarantee that no metadata data update will be lost when the system crashes. Journaling file systems using asynchronous log updates are much faster (because they do much less physical I/Os).