210 likes | 243 Views
Stay updated on project due dates & study key topics like OS components, memory management, paging, page faults, page tables, disks, file systems, RAID, networking, RPC, security, and more for the upcoming final exam. Make sure to refresh your knowledge and review lecture notes to ace the exam!
E N D
Week 10 March 10, 2004 Adrienne Noble
Important Dates • Project 4 due tomorrow (Friday) • Final Exam on Tuesday, March 16, 2:30-4:20pm
Questions? • Lecture • Project 4
Pre-Midterm Topics • Basic OS components and architectural support • Processes • User versus protected mode • Threads • Synchronization • Mutexes • Semaphores • Monitors • Condition variables • Deadlock • Scheduling
Memory Management • Multiprogramming brought some problems • Protection • Fast memory access • Consistent way to talk to memory • So we use virtual addresses
Segmentation • Partitions an address space into logical units • Today usually code, stack, heap, etc. • Advantages • Nice to have logical blocks • Disadvantages • Can lead to bad external fragmentation
Paging • Partitions memory into fixed sized chunks • Usually used with segmentation • One page table per segment
Page Faults • OS uses main memory as a cache of disk storage • Just keep accessed pages in main memory • How it happens: • PTE set as invalid when page was evicted • Causes an exception to be thrown when a process tries to access an invalid page • OS runs page fault handler • Uses invalid PTE to locate page on disk (possibly through another data structure) • Gets an empty physical page frame from page replacement algorithm • Reads page into physical page frame • Updates PTE to point to that physical page and be valid • OS restarts faulting process (by putting it on the ready queue)
Page Replacement • Chooses “best” page to evict when more space is needed • Algorithms • Belady’s Algorithm – optimal (page that will be reference furthest in the future) • FIFO – page that was brought in longest ago • LRU – least recently used • LRU clock – approximation of LRU • Hypothetical Working Set Algorithm – try optimize memory given to each process by looking at their working sets • Page Fault Frequency – try to equalize the page fault rate between processes • Thrashing – when the system uses most of it’s time dealing with page faults and very little time doing actual work
Page Tables • One level page table • Simple, but takes lots of space • Two/Three/Four level page tables • Save space • Only need to allocate the blocks that actually contain data • Can page page tables in and out of memory • Slower because more memory accesses are needed • Solution? • TLB • Cache virtual to physical translations • Fully associative (all entries searched in parallel) • Implemented in hardware • >99% hit rate
Disks • Performance depends on • Seek – how fast the disk arm can move • Rotation – how fast the disk can rotate • Transfer – getting data from disk surface to memory • Disk Scheduling • FCFS – ok when load is low • SSTF – minimize seek time, but favors middle blocks and can cause starvation (why?) • SCAN – elevator, favors middle blocks • C-SCAN – one way elevator
File Systems • cse451fs • File names, inodes, writing/reading • Protection • ACLs – list of who has access to file • Capabilities – easy to transfer (like keys) • Disks are divided up:
BSD UNIX Fast File System • Cylinder groups • Blocks for one file must all be located in the same cylinder (along with the file’s inode too) • Seek times are shorter • Increased block size – 4KB • Faster • More internal fragmentation • Aware of hardware • Knows about disk parameters, so it can optimize operations • More complicated code
Berkley Log-Structured File System • Uses disk as a log • Written only at one end • Challenges • Locating inodes • Keep an inode map at fixed location • Free space management • Divide disk into segments, then clean and combine those segments periodically
RAID • Goals - speed and reliability • Level 0 • Striped • Level 1 • Striped and mirrored • Level 2,3,4 • Parity disk • Level 5 • Interleaved distributed parity
Networking • IP (Internet Protocol) • A way of naming hosts and routing packets between hosts • TCP (Transmission Control Protocol) • Makes reliable multi-packet messages • Abstraction above IP
Distributed Systems • Loosely coupled • Network protocols • Autonomous systems • Closely coupled • Single OS • Shares logical and physical resources
RPC (Remote Procedure Call) • Used to call a method on a remote host • Server publishes API • Client does local procedure calls • Calls a stub which manages the details using the RPC runtime system • Transparent to the programmer
Security • Authentication • Username/password • Public/private keys • Authorization • Keep track of user’s read/write access to different objects • Auditing • Record what’s going on
Other Tips • Refresh your knowledge about the projects • Review lecture notes and homework problems • Congratulations on making it through a tough class!