CS 3204 Operating Systems Godmar Back Lecture 22.

Slides:



Advertisements
Similar presentations
COMP375 Computer Architecture and Organization Senior Review.
Advertisements

Disks Disk Hardware (1) Disk parameters for the original IBM PC floppy disk and a Western Digital WD hard disk.
Part IV: Memory Management
Operating Systems ECE344 Ding Yuan Final Review Lecture 13: Final Review.
OS Memory Addressing.
Lecture 14 I/O Devices & Hard Disk Drives. vgetmem only from private heap.
CS 311 – Lecture 21 Outline Memory management in UNIX
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.
SECTIONS 13.1 – 13.3 Sanuja Dabade & Eilbroun Benjamin CS 257 – Dr. TY Lin SECONDARY STORAGE MANAGEMENT.
Disks.
Device Management.
Disks CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
Disk and I/O Management
Device Management. So far… We have covered CPU and memory management Computing is not interesting without I/Os Device management: the OS component that.
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.
Operating Systems CMPSC 473 I/O Management (4) December 09, Lecture 25 Instructor: Bhuvan Urgaonkar.
CS 153 Design of Operating Systems Spring 2015 Final Review.
Disk Structure Disk drives are addressed as large one- dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer.
CE Operating Systems Lecture 20 Disk I/O. Overview of lecture In this lecture we will look at: Disk Structure Disk Scheduling Disk Management Swap-Space.
CS 3204 Operating Systems Godmar Back Lecture 20.
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
I/O and Disk Scheduling CS Spring Overview Review of I/O Techniques I/O Buffering Disk Geometry Disk Scheduling Algorithms RAID.
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.
Main Memory. Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure of the Page Table Segmentation Example: The.
UNIVERSITY of WISCONSIN-MADISON Computer Sciences Department
Disk Basics CS Introduction to Operating Systems.
1.  Disk Structure Disk Structure  Disk Scheduling Disk Scheduling  FCFS FCFS  SSTF SSTF  SCAN SCAN  C-SCAN C-SCAN  C-LOOK C-LOOK  Selecting a.
Processor Memory Processor-memory bus I/O Device Bus Adapter I/O Device I/O Device Bus Adapter I/O Device I/O Device Expansion bus I/O Bus.
Page Replacement Implementation Issues Text: –Tanenbaum ch. 4.7.
Device Management Mark Stanovich Operating Systems COP 4610.
Disk Average Seek Time. Multi-platter Disk platter Disk read/write arm read/write head.
Disk Systems Operating Systems 1 Computer Science Dept Va Tech August 2007 ©2007 Back What Disks Look Like Hitachi Deskstar T7K500 SATA.
Disk Scheduling The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk.
I/O Scheduling Computer Organization II 1 Disk Scheduling Carrying out disk accesses in the order they are received will not always produce optimal performance.
OS Memory Addressing. Architecture CPU – Processing units – Caches – Interrupt controllers – MMU Memory Interconnect North bridge South bridge PCI, etc.
Memory Management Chapter 5 Advanced Operating System.
Chapter 7: Main Memory CS 170, Fall Program Execution & Memory Management Program execution Swapping Contiguous Memory Allocation Paging Structure.
Lecture 17 Raid. Device Protocol Variants Status checks: polling vs. interrupts Data: PIO vs. DMA Control: special instructions vs. memory-mapped I/O.
Virtual Memory (Section 9.3). The Need For Virtual Memory Many computers don’t have enough memory in RAM to accommodate all the programs a user wants.
Chapter 10: Mass-Storage Systems
Memory Management Paging (continued) Segmentation
Operating Systems Disk Scheduling A. Frank - P. Weisberg.
Secondary Storage Secondary storage typically: Characteristics:
Mass-Storage Structure
Page Replacement Implementation Issues
CS 4284 Systems Capstone Disks & File Systems Godmar Back.
Operating Systems (CS 340 D)
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 8 11/24/2018.
Memory Management Paging (continued) Segmentation
CS 4284 Systems Capstone Disks & File Systems Godmar Back.
CS 3204 Operating Systems Lecture 22 Godmar Back.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 12/1/2018.
Main Memory Background Swapping Contiguous Allocation Paging
Page Replacement Implementation Issues
Persistence: hard disk drive
Persistence: I/O devices
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.
Memory Management Lectures notes from the text supplement by Siberschatz and Galvin Modified by B.Ramamurthy Chapter 9 4/5/2019.
CS 3204 Operating Systems Lecture 19 Godmar Back.
Virtual Memory – Page Replacement
CS 3204 Operating Systems Lecture 30 Godmar Back.
Lecture 10: Magnetic Disks
Memory Management Paging (continued) Segmentation
COMP755 Advanced Operating Systems
Virtual Memory – Page Replacement
Presentation transcript:

CS 3204 Operating Systems Godmar Back Lecture 22

10/25/2015CS 3204 Spring Announcements Project 3 due tomorrow Wed Apr 11, 11:59pm –See forum for additional office hours Check curator for P2 scores –(tonight/early tomorrow) Project 4 Help Sessions –Th, Fr: 5:30-7:30 in McB 223

Segmentation

10/25/2015CS 3204 Spring Segmentation Historical alternative to paging Instead of dividing virtual address space in many small, equal-sized pages, divide into a few, large segments Virtual address is then (segment number, segment offset) segno segmentoffset Segment Table seg base | seg limit memory + < limit?

10/25/2015CS 3204 Spring Segmentation (2) Advantages: –little internal fragmentation “segments can be sized just right” –easy sharing – can share entire code segment –easy protection – only have to set access privileges for segment –small number of segments means small segment table sizes Disadvantages: –external fragmentation (segments require physically continuous address ranges!) –if segment is partially idle, can’t swap out

10/25/2015CS 3204 Spring Segmentation (3) Pure segmentation is no longer used –(Most) RISC architectures don’t support segmentation at all –Other architectures combine segmentation & paging Intel x86 started out with segmentation, then added paging –Segment number is carried in special set of registers (GS, ES, FS, SS), point to “selectors” kept in descriptor tables –Instruction opcode determines with segment is used –Today: segmentation unit is practically unused (in most 32-bit OS, including Pintos): all segments start at 0x and end at 0xFFFFFFFF (Exception: for thread-local data!) –Do not confuse with Pintos’s code/data segments, which are linear subregions of virtual addresses spanning multiple virtual pages Note: superpages are somewhat of a return to segmentation

10/25/2015CS 3204 Spring Combining Segmentation & Paging

10/25/2015CS 3204 Spring Mem Mgmt Without Virtual Memory Book discusses this as motivation –Historically important, and still important for VM-less devices (embedded devices, etc.) Imagine if we didn’t have VM, it would be hard or impossible to –Retain the ability to load a program anywhere in memory –Accommodate programs that grow or shrink in size –Use idle memory for other programs quickly –Move/relocate a running program in memory VM drastically simplifies systems design

Disks & Filesystems

What Disks Look Like Hitachi Deskstar T7K500 SATA

Disk Schematics Source: Micro House PC Hardware Library Volume I: Hard Drives See narrated flash animation at

Tracks, Sectors, Cylinders

Typical Disk Parameters 2-30 heads (2 per platter) –Modern disks: no more than 4 platters Diameter: 2.5” – 14” Capacity: 20MB-500GB Sector size: 64 bytes to 8K bytes –Most PC disks: 512 byte sectors tracks per surface sectors per track

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 ms, 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

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-SCAN: - only take passengers when going up

Accessing Disks Sector is the unit of atomic access Writes to sectors should always complete, even if power fails Consequence of sector granularity: –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); } 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); }