CS 3204 Operating Systems Lecture 30 Godmar Back.

Slides:



Advertisements
Similar presentations
Disks Disk Hardware (1) Disk parameters for the original IBM PC floppy disk and a Western Digital WD hard disk.
Advertisements

Storing Data: Disks and Files: Chapter 9
CSE506: Operating Systems Disk Scheduling. CSE506: Operating Systems Key to Disk Performance Don’t access the disk – Whenever possible Cache contents.
1 Advanced Database Technology February 12, 2004 DATA STORAGE (Lecture based on [GUW ], [Sanders03, ], and [MaheshwariZeh03, ])
Lecture 17 I/O Optimization. Disk Organization Tracks: concentric rings around disk surface Sectors: arc of track, minimum unit of transfer Cylinder:
Disk Drivers May 10, 2000 Instructor: Gary Kimura.
1 Storage Hierarchy Cache Main Memory Virtual Memory File System Tertiary Storage Programs DBMS Capacity & Cost Secondary Storage.
Disks.
Introduction to Database Systems 1 The Storage Hierarchy and Magnetic Disks Storage Technology: Topic 1.
CS4432: Database Systems II Data Storage (Better Block Organization) 1.
CS 346 – Chapter 10 Mass storage –Advantages? –Disk features –Disk scheduling –Disk formatting –Managing swap space –RAID.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 10: Mass-Storage Systems.
CS 153 Design of Operating Systems Spring 2015 Final Review.
CS 162 Section Lecture 8. What happens when you issue a read() or write() request?
CS 3204 Operating Systems Godmar Back Lecture 20.
CS 3204 Operating Systems Godmar Back Lecture 22.
Lecture 3 Page 1 CS 111 Online Disk Drives An especially important and complex form of I/O device Still the primary method of providing stable storage.
CS 3204 Operating Systems Lecture 25 Godmar Back.
UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department
Disk Basics CS Introduction to Operating Systems.
Disk Systems Operating Systems 1 Computer Science Dept Va Tech August 2007 ©2007 Back What Disks Look Like Hitachi Deskstar T7K500 SATA.
LECTURE 12 Virtual Memory. VIRTUAL MEMORY Just as a cache can provide fast, easy access to recently-used code and data, main memory acts as a “cache”
Chapter 9 I/O System. 2 Input/Output System I/O Major objectives are: Take an application I/O request and send it to the physical device. Then, take whatever.
CPSC 231 Secondary storage (D.H.)1 Learning Objectives Understanding disk organization. Sectors, clusters and extents. Fragmentation. Disk access time.
1 Chapter 11 I/O Management and Disk Scheduling Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and.
Chapter 10: Mass-Storage Systems
Lecture 12 Virtual Memory.
Lecture 16: Data Storage Wednesday, November 6, 2006.
FileSystems.
Disks and RAID.
Database Management Systems (CS 564)
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
OPERATING SYSTEMS CS 3502 Fall 2017
CS 554: Advanced Database System Notes 02: Hardware
Chapter 12: Mass-Storage Structure
Secondary Storage Secondary storage typically: Characteristics:
CS703 - Advanced Operating Systems
Operating System I/O System Monday, August 11, 2008.
Lecture 45 Syed Mansoor Sarwar
CS 4284 Systems Capstone Disks & File Systems Godmar Back.
Lecture 11: DMBS Internals
Lecture 28: Virtual Memory-Address Translation
Lecture 13 I/O.
Lecture 9: Data Storage and IO Models
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Input-output I/O is very much architecture/system dependent
CS 4284 Systems Capstone Disks & File Systems Godmar Back.
CS 3204 Operating Systems Lecture 22 Godmar Back.
Selecting a Disk-Scheduling Algorithm
CS703 - Advanced Operating Systems
Overview Continuation from Monday (File system implementation)
Jonathan Walpole Computer Science Portland State University
CSE 451: Operating Systems Autumn 2003 Lecture 12 Secondary Storage
Secondary Storage Management Brian Bershad
Persistence: hard disk drive
Persistence: I/O devices
Chapter 11 I/O Management and Disk Scheduling
CSE 451: Operating Systems Winter 2003 Lecture 12 Secondary Storage
Disk Scheduling Carrying out disk accesses in the order they are received will not always produce optimal performance. Seek time is the reason for differences.
Chapter 13: I/O Systems I/O Hardware Application I/O Interface
Disks and Disk Scheduling
Secondary Storage Management Hank Levy
CS333 Intro to Operating Systems
CSE451 File System Introduction and Disk Drivers Autumn 2002
Device Mgmt © 2004, D. J. Foreman.
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
Device Mgmt © 2004, D. J. Foreman.
Lecture 10: Magnetic Disks
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Presentation transcript:

CS 3204 Operating Systems Lecture 30 Godmar Back

Announcements Project 3 due April 13 Th Apr 6, 7pm, 655 McBryde: attend town-hall meeting regarding planned restructuring of 6th floor undergrad space CS 3204 Spring 2006 5/24/2019

Kernel-level vs User-level Threads

M:N Model Solaris Lightweight Processes CS 3204 Spring 2006 5/24/2019

M:N Model (cont’d) Invented for use in Solaris OS early 90s Championed for a while Idea was to get the best of both worlds Fast context switches if between user-level threads Yet enough concurrency to exploit multiple CPUs Since abandoned in favor of kernel-level threads only approach Too complex – what’s the “right” number of LWP? 2-level scheduling/resource management was hard: both user/kernel operated with half-blind CS 3204 Spring 2006 5/24/2019

Multi-Threading in Linux Went through different revisions Today (Linux 2.6): NPTL – Next-Generation POSIX Thread Library 1:1 model optimizes synchronization via “futexes” avoids mode switch for common case of uncontended locks by performing atomic operation constant-time scheduling operation allow for scaling in number of threads CS 3204 Spring 2006 5/24/2019

Summary Memory Management Address Spaces vs Protection Domains Kernel vs User-Level Threads CS 3204 Spring 2006 5/24/2019

Disks & Filesystems

What Disks Look Like Hitachi Deskstar T7K500 SATA CS 3204 Spring 2006 5/24/2019

How Disks Work Flash Animation See http://cis.poly.edu/cs2214rvs/disk.swf CS 3204 Spring 2006 5/24/2019

Disk Schematics Source: Micro House PC Hardware Library Volume I: Hard Drives CS 3204 Spring 2006 5/24/2019

Typical Disk Parameters 2-30 heads (2 per platter) Diameter: 2.5” – 14” Capacity: 20MB-500GB Sector size: 64 bytes to 8K bytes Most PC disks: 512 byte sectors 700-20480 tracks per surface 16-1600 sectors per track CS 3204 Spring 2006 5/24/2019

What’s important about disks from OS perspective Disks are big & slow - compared to RAM Access to disk requires Seek (move arm to track) – to cross all tracks anywhere from 20-50ms, on average takes 1/3. Rotational delay (wait for sector to appear under track) 7,200rpm is 8.3ms per rotation, on average takes ½: 4.15ms rot delay Transfer time (fast: 512 bytes at 998 Mbit/s is about 3.91us) Seek+Rot Delay dominates Random Access is expensive and unlikely to get better Consequence: avoid seeks seek to short distances amortize seeks by doing bulk transfers CS 3204 Spring 2006 5/24/2019

Disk Scheduling Can use priority scheme Can reduce avg access time by sending requests to disk controller in certain order Or, more commonly, have disk itself reorder requests SSTF: shortest seek time first Like SJF in CPU scheduling, guarantees minimum avg seek time, but can lead to starvation SCAN: “elevator algorithm” Process requests with increasing track numbers until highest reached, then decreasing etc. – repeat Variations: LOOK – don’t go all the way to the top without passengers C-SPAN: - only take passengers in one direction CS 3204 Spring 2006 5/24/2019

Accessing Disks Sector is the unit of atomic access Writes to sectors should always complete, even if power fails Consequence: Writing a single byte requires read-modify-write void set_byte(off_t off, char b) { char buffer[512]; disk_read(disk, off/DISK_SECTOR_SIZE, buffer); buffer[off % DISK_SECTOR_SIZE] = b; disk_write(disk, off/DISK_SECTOR_SIZE, buffer); } CS 3204 Spring 2006 5/24/2019

Disk Caching – Buffer Cache How much memory should be dedicated for it? In older systems (& Pintos), set aside a portion of physical memory In newer systems, integrated into virtual memory system: e.g., page cache in Linux How should prefetching be done? How should concurrent access be mediated (multiple processes may be attempting to write/read to same sector)? How is consistency guaranteed? (All must go through buffer cache!) What write-back strategy should be used? CS 3204 Spring 2006 5/24/2019

Buffer Cache in Pintos Cache Block Descriptor disk_sector_id, if in use dirty bit valid bit # of readers # of writers # of pending read/write requests lock to protect above variables signaling variables to signal availability changes usage information for eviction policy data (pointer or embedded) desc 512 bytes desc 512 bytes desc 512 bytes desc 512 bytes 64 desc 512 bytes desc 512 bytes desc 512 bytes CS 3204 Spring 2006 5/24/2019

A Buffer Cache Interface // cache.h struct cache_block; // opaque type // reserve a block in buffer cache dedicated to hold this sector // possibly evicting some other unused buffer // either grant exclusive or shared access struct cache_block * cache_get_block (disk_sector_t sector, bool exclusive); // release access to cache block void cache_put_block(struct cache_block *b); // read cache block from disk, returns pointer to data void *cache_read_block(struct cache_block *b); // fill cache block with zeros, returns pointer to data void *cache_zero_block(struct cache_block *b); // mark cache block dirty (must be written back) void cache_mark_block_dirty(struct cache_block *b); // not shown: initialization, readahead, shutdown CS 3204 Spring 2006 5/24/2019