200 likes | 215 Views
Lecture 35: Review for Midterm 2. About Midterm 2. Cover scheduling, memory management, and file systems. A double-side A4 or US letter sheet of note is allowed 50 minutes. Overview. Process Scheduling Memory Management File System. Process scheduling.
E N D
About Midterm 2 • Cover scheduling, memory management, and file systems. • A double-side A4 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)
Files • Naming • Structure • Types • Access • Attributes • Operations
Directories • Directory systems • Path names • Operations
File system implmentation • Contiguous allocation • Linked list allocation • Linked list allocation with a table in memory • I-nodes
UNIX V7 Directory Implementation The steps in looking up /usr/ast/mbox
Hard links vs. Symbolic links Inode 134 Hard link inode 134 Symbolic link
Sample QuestionsRR, Q = 10 0 13 16 20 P1: 4 36 8 112 1 P2: 23 40 2 P3: 4 20 112 40 2 40 2 40 1 P4: 2 150 3 10 1 Which process goes next, and when? Gantt chart P1 idle P2 P3 P4 0 4 13 23 27 29
Sample QuestionsMLFQ: Q0 = 8, Q1 = 16, Q2 = 40 q1 45 177 0 13 16 20 P1: 4 36 8 112 1 P2: 23 40 2 15 P3: 4 20 112 40 2 40 2 40 1 P4: 2 150 3 10 1 Gantt chart 1 idle 2 3 4 2 0 4 13 21 25 27
Sample Questions 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, buf2, 4);
Sample Questions Assume file “x” content is: 0123456789876543210 fdrw = open("x", O_RDWR); fdrw2 = dup(fdrw); read(fdrw, buf, 3); read(fdrw2, buf2, 4);
Sample Questions Assume file “x” content is: 0123456789876543210 fdrw = open("x", O_RDWR); Fork(); Parent: read(fdrw, buf, 3); Child: read(fdrw, buf2, 4);