CAS 3 SH 3 Final Review The Final

  • Slides: 18
Download presentation
CAS 3 SH 3 Final Review

CAS 3 SH 3 Final Review

The Final Tue 28 th, 7 pm, IWC 3 closed book, closed note Non-comprehensive:

The Final Tue 28 th, 7 pm, IWC 3 closed book, closed note Non-comprehensive: memory management, storage & file system Types of questions: multiple choice, long answers You can bring Mc. Master standard calculator; no Internet-enabled devices • All-in-one slides on course page • Office hrs: (April 6 – 10 th, 20 th – 24 th) • • • – – Tue. 4 – 6 pm, Wed. 10 – 3 pm; By appt other time Please resolve all grading related issues by April 24 th >= 85 -- A; > 90 – A+ Note: out of town April 13 th – 17 th

Materials covered since midterm • Memory management • Storage and file systems Two key

Materials covered since midterm • Memory management • Storage and file systems Two key aspects • Data structure – What – Where: in memory/cache/register, on disk • Algorithms

Memory Management • • Understand the distinctions between virtual (logical) address space and physical

Memory Management • • Understand the distinctions between virtual (logical) address space and physical address space Understand different approaches to memory management: contiguous vs. noncontiguous, fixed vs variable size partitions, segmentation, paging. Pros and cons of each approach What are external fragmentation and internal fragmentation? Segmentation: segmentation table, how to translate from virtual address to physical address? when errors occur? Virtual Address Seg # offset Offset Base 0 Base 1 Base 2 Base 3 Base 4 Base 5 Base 6 Base 7 Limit 0 Limit 1 Limit 2 Limit 3 Limit 4 Limit 5 Limit 6 Limit 7 V V V N N V > Error + Physical Address Check Valid Access Error

Memory Management • Paging: page table, page table entry, how to translate from virtual

Memory Management • Paging: page table, page table entry, how to translate from virtual address to physical address? when errors occur? • Special bits in PTE • Impacts of page size Virtual Address: Page # Offset Page. Table. Ptr Page. Table. Size > Access Error page #0 page #1 page #2 page #3 page #4 page #5 V, R, W N V, R, W Physical Page # Offset Physical Address Check Perm Access Error

Paging (cont’d) • TLB, multilevel paging, inverted page table, combing paging with segmentation –

Paging (cont’d) • TLB, multilevel paging, inverted page table, combing paging with segmentation – Pros and cons • Compute the size of page table(s) and the maximum size of logical address space of 32 -bit and 64 -bit systems Advantages Disadvantages Segmentation Fast context switching: Segment mapping maintained by CPU External fragmentation Paging (singlelevel page) No external fragmentation, fast easy allocation Large table size ~ virtual memory Paged segmentation Table size ~ # of pages Multiple memory references in virtual memory, fast per page access easy allocation Two-level pages Inverted page table Table size ~ # of pages Lookup time in physical memory If combined with hash table, two memory lookups

Virtual memory • • Swap file/partition on disk (in raw, no file system) Understand

Virtual memory • • Swap file/partition on disk (in raw, no file system) Understand the needs for on-demand paging Valid bit in PTE to indicate whether a page in memory Page faults – Type of pages faults: compulsory misses, policy misses, capacity misses – Cost of page faults – Steps in handling page faults • Understanding the notions of temporal and spatial locality, and their implication on page replacement policies and working sets • Page replacement policies (FCFS, OPT, LRU, 2 nd chance, clock algorithm) – Given a reference sequence, can determine the # of page faults – Belady’s anomaly • Working sets: the definition, how to compute working sets, how to avoid thrashing

Types of page faults & remedies Bag of tricks • Prefetching • Tracking workset

Types of page faults & remedies Bag of tricks • Prefetching • Tracking workset • Swapping processes • Page replacement algorithms • Copy-on-write • Capacity misses • Compulsory misses • Policy misses

Storage and File Systems • Organization of magnetic disks • Average access time of

Storage and File Systems • Organization of magnetic disks • Average access time of magnetic disk • Disk addressing: organize sectors into blocks and use logical block address (LBA) • Disk scheduling: – Goal: minimizing seek time – Policies: FIFO, SSTF, SCAN, C-LOOK • Disk management [file systems]: – Formatting in two steps: 1) partitioning 2) making file system (not applicable for raw disk partitioning) – Boot sequence: BIOS, master boot record (locate boot partition), volume boot record (loading OS) • Swap space [memory management]

Storage • Understand MTF, MTR and MTDL – Able to determine MTF, MTDL for

Storage • Understand MTF, MTR and MTDL – Able to determine MTF, MTDL for simple schemes such as mirroring • Redundant array of inexpensive (independent) disks (RAID) – Mirroring, stripling, parity, (7, 4) hamming code – Error detection vs error correction; bit level vs. block level stripling – Different RAID configuration

File systems • Directory – what is stored in directory: (file name, FCB block)

File systems • Directory – what is stored in directory: (file name, FCB block) organized as a linear array or hash table – How are directories organized: tree, acyclic graphs – How to locate a file “/home/me/file 1”? (starting from the root directory, find the FCB corresponding to the subdirectories and finally the file) – Recently accessed directories cached in memory • Files: abstract data type, contiguous logical space (to users) – File operations: read, write, open, close, … – FCB – Disk allocation and translation: contiguous allocation, linked allocation, index allocation – The maximum size of file is determined by the allocation schemes

File systems • In memory and on-disk data structure – What happens when creating,

File systems • In memory and on-disk data structure – What happens when creating, opening, reading a file? In memory on-disk Mount table Directory cache system-wide open-file table per-process open file table (PCB) Buffers for file system blocks MBR Boot control block Volume control block Directory structures FCB and data blocks of each files

Discussion • In paging, the physical address can be computed by adding the physical

Discussion • In paging, the physical address can be computed by adding the physical page # and the offset (false) – Adding appending • Consider the use of multilevel paging. Suppose a page table in each level can be no larger than 4096 Byte, and the size of each entry in the page table is 4 Byte. With 32 -bit logical address space, a) what is the minimum # of levels needed if the page size is 4096 Byte, and b) how many physical memory references are needed for each logical memory reference if no TLB is used. – (a) 232/212 = 220 2 levels – (b) # of memory reference = # of levels + 1 • The following bits are typically kept in a page table entry: valid bit, read-only bit, use bit, reference bit, and dirty bit. – use bit is the same as reference bit

Discussions • Consider the following memory references 2 1 4 2 5 2 1

Discussions • Consider the following memory references 2 1 4 2 5 2 1 6 5. Suppose only 3 physical frames in the memory. The number of page faults generated by FIFO (including compulsory PFs) is, ______The number of page faults generated by OPT is, ______The number of page faults generated by LRU is, ______The number of page faults generated by the clock algorithm is, ______ 2 FIFO 2 OPT 2 2 5 5 5 6 6 1 1 1 2 2 2 5 4 4 4 1 1 1 2 2 2 6 1 1 4 5 5

2 1 4 2 5 2 1 6 5 2 LRU Clock 2 u:

2 1 4 2 5 2 1 6 5 2 LRU Clock 2 u: 0 2 2 2 5 1 1 5 5 6 6 4 4 1 1 1 2 u: 0 2 u: 1 1 u: 0 4 u: 0 2 u: 1 1 u: 0 4 u: 0 2 u: 0 6 u: 0 5 u: 0 1 u: 0 6 u: 0 5 u: 0 2 u: 1 5 u: 0 4 u: 0

C-SCAN

C-SCAN

C-LOOK

C-LOOK

Good luck • Please remember to fill in teaching evaluation!

Good luck • Please remember to fill in teaching evaluation!