1 April 2002 Operating Systems Memory Management wrap up File Management Read Nutt Ch 13 ------------------- ------- caches sit between processor and memory tlb is one form of cache fully associative - expensive find index x less than 100 entries cache thousands of entries set associative find index x - might be in one of several locations cache entry : line > word < page when cache miss, bring in line works because of 1. temporal locality - if a program accesses a variable once, it's likely to access it again soon. 2. spatial locality - if a program accesses a given variable, it's likely to access nearby variables soon. keeping something in cache exploits temproal locality. bringning in the entire line exploits spatial locality. typiclaly data cache separte from instr cache reduces cache collisions: cache and data always separate want 2 cycle access time 8-64k primary cache secondary (on-chip) cache , 10 cycles, 256k-1MB off chip cache, 50 cycles, a few MB main memory, 100 cycles or more Secondary and tertiary caches (on-chip and off) are typically combined - no I/D split cache concerns write to cache needs to get back to memory write-through: immediate to memory, simple, more bus traffic write-back: dirty bits, written when cache entry replaced coherence among multiprocessors snoop for writes write to line x, evicts x from other caches only on secondary cache if primary cache is write-through 2nd cache evicts items from primary cache ------------ ------------ ------------ File Systems - Chapter 13 Most visible part of OS Convenience for users today: user perspective/demands next: realizing demands Objectives: meet data management needs and requirements of the user storage & data operations create delete, read change files controlled access to other user's files controll access to own files restructure guarantee data in file is valid optimize performance throughput and latency provide i/o support for a variety of storage device types support multiple users extend memory space. Not restricted to physical memory Persistence - survive single execution Can be used for IPC - multiple procs need access to same file - global name space - need way to locate/name file - priveledges - how changes made are visible - can multiple processes have simultaneous access? Operations: create - give a name, find space, create directory entry delete - remove storage/ directory entry rename - same as create/copy into/ delete open - get access read - give fname, location, amount - usually current file position write - fname, data - usually current file position close - release access - multiple procs open file same time each proc has current file ptr seek - reposition file pointer map - put into memory - access as memory write back when close file mult procs can map same file - protections managed as other files. File System Issues naming - unique names intra file structures - high level: executable, text, images file extensions - hints to sys/user - tops 20 would compile for you unix - magix number for executables Mac - application creator lower level: impose structure on data - simplify life of novice complicate life of power user e.g., treat progr foo.c as data to print unix - 8 bit byte sequqence flexible, little support application providdes code to interpret files Mac - resource fork - info of interest to user e.g., button/menu labels data fork - code or data = file contents file structure find location in a file user defined record size diff from block (sector) internal fragmentation --blocks written/read for efficiency FS Organization - efficient use of disk recovery protection - which procs can access which files