Lecture 35 Review for Midterm 2 About Midterm
Lecture 35: Review for Midterm 2
About Midterm 2 • Cover scheduling, memory management, and file systems. • A double-side A 4 or US letter sheet of note is allowed • 50 minutes
Overview • Process Scheduling • Memory Management • File System
Process scheduling • What are the goals of process scheduling? • Scheduling Algorithms for Batch Systems – First come first serve – Shortest job first – Shortest remaining time next • Scheduling Algorithms for Interactive Systems – Round-Robin scheduling – Priority scheduling – Multiple queues – Lottery scheduling
Memory management • Memory allocation – A new process comes into memory • Memory de-allocation – A process leaves memory • Address translation – Virtual address to physical address • Process isolation – One process cannot access the memory of other processes
Virtual memory • Paging • Address translation via page table – MMU – Page fault • Speed up address translation – TLB • Large page tables – Multi-level page table – Inverted page table
Page Replacement Algorithms • FIFO (First-In-First-Out) • NRU (Not-Recently-Used) • Second Chance • LRU (Least-Recently-Used) • Clock Algorithm(s)
Belady's anomaly
Files • • • Naming Structure Types Access Attributes Operations
Directories • Directory systems • Path names • Operations
File system implmentation • Contiguous allocation • Linked list allocation with a table in memory • I-nodes
UNIX V 7 Directory Implementation The steps in looking up /usr/ast/mbox
Hard links vs. Symbolic links Inode 134. 12 . . 14 f 1 134 f 2 134 links=2 Hard link inode 134. 12 . . 14 f 1 134 f 2 208 special file /home/gong/f 1 Symbolic link data
Sample Questions
Sample Questions RR, Q = 10 0 P 1: 4 36 8 112 1 13 P 2: 23 40 2 16 P 3: 4 20 112 40 1 20 P 4: 2 150 3 10 1 Which process goes next, and when? Gantt chart P 1 idle P 2 P 3 P 4 0 4 13 23 27 29
Sample Questions MLFQ: Q 0 = 8, Q 1 = 16, Q 2 = 40 0 P 1: 4 36 8 112 1 q 1 13 P 2: 23 40 2 15 45 16 P 3: 4 20 112 40 1 177 20 P 4: 2 150 3 10 1 Gantt chart 1 idle 2 3 4 2 0 4 13 21 25 27
Sample Questions Page frame Time loaded Time referenced R bit M bit 0 60 161 0 1 1 130 160 0 0 2 26 162 1 0 3 20 163 1 1 Which page frame will be replaced? First-In-First-Out (FIFO) Not-Recently-Used (NRU) Second Chance Least-Recently-Used (LRU)
Sample Questions Assume file “x” content is: 0123456789876543210 fdrw = open("x", O_RDWR); fdr = open("x", O_RDONLY); read(fdrw, buf, 3); read(fdr, buf 2, 4);
Sample Questions Assume file “x” content is: 0123456789876543210 fdrw = open("x", O_RDWR); fdrw 2 = dup(fdrw); read(fdrw, buf, 3); read(fdrw 2, buf 2, 4);
Sample Questions Assume file “x” content is: 0123456789876543210 fdrw = open("x", O_RDWR); Fork(); Parent: read(fdrw, buf, 3); Child: read(fdrw, buf 2, 4);
- Slides: 20