CPSC 457 Operating Systems Lecture 12 Devices and File Systems
Last Time Deadlocks Resource Allocation Detecting Deadlocks Resolving Deadlocks CPSC 457 - Tyson Kendon 2016
This Time Devices File Systems Hosts and Controllers I/O Drivers File System Interface Directory Structures File System Implementation File Meta Data File Allocation CPSC 457 - Tyson Kendon 2016
Devices CPSC 457 - Tyson Kendon 2016
Devices and Hardware Host the CPU / Memory and OS, ”the computer” Controller the electronics and logic that operate the device, port or bus CPSC 457 - Tyson Kendon 2016
Communication with Devices Registers Data – In / Out Control – Status (what is the device doing) - Control (what to do) CPSC 457 - Tyson Kendon 2016
Drivers Interface Define how a type of device should behave Driver Write the software to conform the device to the interface the OS expects CPSC 457 - Tyson Kendon 2016
Device Characteristics aspect variation example Data-transfer mode Character block Terminal disk Access method Sequential random Modem DVD Transfer schedule Synchronous asynchronous Tape keyboard sharing Dedicated shareable CPSC 457 - Tyson Kendon 2016
Device Characteristics (2) Device speed Latency Seek time Transfer rate Delay between ops Electronic? - memory Physical? - disk Mechanical? – tape-robot I/O direction Read-only Write-only read-write DVD Graphics controller disk CPSC 457 - Tyson Kendon 2016
Working with Controllers Registers Keep registers available to pass data can control between host and controller Memory Mapped I/O Map information from/for the controller directly into virtual memory CPSC 457 - Tyson Kendon 2016
Controlling Controllers Polling OS Loops and waits for the device to work Interrupts Device does its work and interrupts the host Direct Memory Access Device moves a lot of memory then interrupts CPSC 457 - Tyson Kendon 2016
Device Interactions Block Character Socket Asynchronous CPSC 457 - Tyson Kendon 2016
Devices and the Kernel Scheduling Buffering Caching Spooling Error Handling CPSC 457 - Tyson Kendon 2016
File System Interface CPSC 457 - Tyson Kendon 2016
File System Interface How do we think about files? How do we organize files? How do we work with files? What to we track about files CPSC 457 - Tyson Kendon 2016
Directories Logical Construct to organize information Link the logical to the physical Tree Structures – not graphs CPSC 457 - Tyson Kendon 2016
File System Implementation CPSC 457 - Tyson Kendon 2016
File System Structure Layered – abstract to specific Applications Logical File System File Organization Module Basic File System Disk Drivers CPSC 457 - Tyson Kendon 2016
File System Data – on Disk Boot Control Block (per volume) Volume Control Block (per volume) Directory Structure (per volume) File Control Block (per file) CPSC 457 - Tyson Kendon 2016
File System Data – in Memory Mount Table Directory Cache System-Wide Open File Table Per-Process Open File Tables Read/Write Buffers CPSC 457 - Tyson Kendon 2016
Actions on Files Creating a new file Opening a file Reading, writing, seeking in, a file Closing a file CPSC 457 - Tyson Kendon 2016
Virtual File System Unify File System Types in an Abstract Whole Provide a clean interface to the OS Manage details at the low level CPSC 457 - Tyson Kendon 2016
File System Allocation CPSC 457 - Tyson Kendon 2016
Contiguous Allocation Files are laid out in a sequence of neighbouring blocks Fast Limited free space available Need to know the size of the file CPSC 457 - Tyson Kendon 2016
Linked Allocation Provide reference to the next block in each block of the file – put blocks wherever in memory Don’t need to know the size Waste space on pointers Harder to seek to the middle of a file CPSC 457 - Tyson Kendon 2016
Indexed Allocation Keep a block of indexes to the blocks of the file Easier to seek to a point in the file Possibly wasteful of space CPSC 457 - Tyson Kendon 2016
File System Considerations Space Time Failure How do we Recover Consistency Checking Transactional Systems CPSC 457 - Tyson Kendon 2016
File Systems CPSC 457 - Tyson Kendon 2016
Next Time Disks How do we organize data on secondary storage to make sense and access it quickly Review Multiprocessor Environments CPSC 457 - Tyson Kendon 2016