CS 162 Discussion Section Week 7 (3/20 – 3/21). Administrivia Project 2 proj2-code due Thursday night proj2-final-design due Friday night Peer evals due.

Slides:



Advertisements
Similar presentations
Chapter 12: File System Implementation
Advertisements

Chapter 4 : File Systems What is a file system?
File Systems.
Lecture 17 I/O Optimization. Disk Organization Tracks: concentric rings around disk surface Sectors: arc of track, minimum unit of transfer Cylinder:
File System Implementation CSCI 444/544 Operating Systems Fall 2008.
Disk Drivers May 10, 2000 Instructor: Gary Kimura.
CS 104 Introduction to Computer Science and Graphics Problems Operating Systems (4) File Management & Input/Out Systems 10/14/2008 Yang Song (Prepared.
CS 333 Introduction to Operating Systems Class 18 - File System Performance Jonathan Walpole Computer Science Portland State University.
Ceng Operating Systems
1 Outline File Systems Implementation How disks work How to organize data (files) on disks Data structures Placement of files on disk.
CS162 Operating Systems and Systems Programming Lecture 18 File Systems, Naming, and Directories April 3, 2006 Prof. Anthony D. Joseph
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
12: IO Systems1 I/O SYSTEMS This Chapter is About Processor I/O Interfaces: Connections exist between processors, memory, and IO devices. The OS must manage.
File System Design David E. Culler CS162 – Operating Systems and Systems Programming Lecture 24 October 24, 2014 Reading: A&D 13.3 HW 4 due 10/27 Proj.
CS162 Operating Systems and Systems Programming Key Value Storage Systems November 3, 2014 Ion Stoica.
Secondary Storage Management Hank Levy. 8/7/20152 Secondary Storage • Secondary Storage is usually: –anything outside of “primary memory” –storage that.
Introduction to Database Systems 1 The Storage Hierarchy and Magnetic Disks Storage Technology: Topic 1.
Disk and I/O Management
1 File System Implementation Operating Systems Hebrew University Spring 2010.
File Systems (1). Readings r Silbershatz et al: 10.1,10.2,
Rensselaer Polytechnic Institute CSCI-4210 – Operating Systems David Goldschmidt, Ph.D.
Naming and Directories. Recall from the last time… File system components Disk management organizes disk blocks into files. Many disk blocks management.
CSC139 Operating Systems Lecture 18 File Systems, Naming, and Directories Adapted from Prof. John Kubiatowicz's lecture notes for CS162
COSC 3407: Operating Systems Lecture 18: Disk Management and File System.
File Implementation. File System Abstraction How to Organize Files on Disk Goals: –Maximize sequential performance –Easy random access to file –Easy.
Disk Access. DISK STRUCTURE Sector: Smallest unit of data transfer from/to disk; 512B 2/4/8 adjacent sectors transferred together: Blocks Read/write heads.
Operating Systems CMPSC 473 I/O Management (4) December 09, Lecture 25 Instructor: Bhuvan Urgaonkar.
1Fall 2008, Chapter 11 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
Copyright ©: Nahrstedt, Angrave, Abdelzaher, Caccamo1 Disk & disk scheduling.
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?
File System Implementation Chapter 12. File system Organization Application programs Application programs Logical file system Logical file system manages.
1Fall 2008, Chapter 12 Disk Hardware Arm can move in and out Read / write head can access a ring of data as the disk rotates Disk consists of one or more.
OSes: 11. FS Impl. 1 Operating Systems v Objectives –discuss file storage and access on secondary storage (a hard disk) Certificate Program in Software.
CSCI-375 Operating Systems Lecture Note: Many slides and/or pictures in the following are adapted from: slides ©2005 Silberschatz, Galvin, and Gagne Some.
CS 153 Design of Operating Systems Spring 2015 Lecture 22: File system optimizations.
File System Implementation
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 11: File System Implementation.
Module 4.0: File Systems File is a contiguous logical address space.
CS 153 Design of Operating Systems Spring 2015 Lecture 21: File Systems.
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.
Computer Science Lecture 19, page 1 CS677: Distributed OS Last Class: Fault tolerance Reliable communication –One-one communication –One-many communication.
Disk & File System Management Disk Allocation Free Space Management Directory Structure Naming Disk Scheduling Protection CSE 331 Operating Systems Design.
CS333 Intro to Operating Systems Jonathan Walpole.
Lecture 10 Page 1 CS 111 Summer 2013 File Systems Control Structures A file is a named collection of information Primary roles of file system: – To store.
File Systems Topics Design criteria History of file systems Berkeley Fast File System Effect of file systems on programs fs.ppt CS 105 “Tour of the Black.
14.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 10 & 11: File-System Interface and Implementation.
CS162 Operating Systems and Systems Programming Lecture 17 Disk Management and File Systems April 2, 2008 Prof. Anthony D. Joseph
11.1 Silberschatz, Galvin and Gagne ©2005 Operating System Principles 11.5 Free-Space Management Bit vector (n blocks) … 012n-1 bit[i] =  1  block[i]
CS162 Operating Systems and Systems Programming Lecture 14 Key Value Storage Systems March 12, 2012 Anthony D. Joseph and Ion Stoica
Lecture Topics: 12/1 File System Implementation –Space allocation –Free Space –Directory implementation –Caching Disk Scheduling File System/Disk Interaction.
CS399 New Beginnings Jonathan Walpole. Disk Technology & Secondary Storage Management.
CS4432: Database Systems II
CS162 Operating Systems and Systems Programming Lecture 14 File Systems (Part 2) March 18, 2013 Anthony D. Joseph
Lecture Topics: 11/22 HW 7 File systems –block allocation Unix and NT –disk scheduling –file caches –RAID.
W4118 Operating Systems Instructor: Junfeng Yang.
Computer Science Lecture 19, page 1 CS677: Distributed OS Last Class: Fault tolerance Reliable communication –One-one communication –One-many communication.
File-System Management
Jonathan Walpole Computer Science Portland State University
FileSystems.
File System Implementation
CS703 - Advanced Operating Systems
The UNIX File System Jerry Breecher Contains sections on:
CS162 Operating Systems and Systems Programming Lecture 18 File Systems, Naming, and Directories April 7, 2008 Prof. Anthony D. Joseph
Chapter 11: File System Implementation
April 1, 2010 Ion Stoica CS162 Operating Systems and Systems Programming Lecture 19 File Systems continued Distributed.
File Systems: Fundamentals.
Secondary Storage Management Brian Bershad
Secondary Storage Management Hank Levy
Department of Computer Science
Presentation transcript:

CS 162 Discussion Section Week 7 (3/20 – 3/21)

Administrivia Project 2 proj2-code due Thursday night proj2-final-design due Friday night Peer evals due Friday night Project 3 Still working out some details. Won’t be posted until ~Friday during break. Enjoy your break!

Lecture Review

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Properties of a Magnetic Hard Disk Properties –Independently addressable element: sector »OS always transfers groups of sectors together—“blocks” –A disk can access directly any given block either sequentially or randomly. Typical numbers (depending on the disk size): –500 to more than 20,000 tracks per surface –32 to 800 sectors per track Zoned bit recording –Constant bit density: more bits (sectors) on outer tracks –Apple ][gs/old Macs: speed varies with track location Track Sector Platters

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Magnetic Disk Characteristic Cylinder: all the tracks under the head at a given point on all surfaces Read/write: three-stage process: –Seek time: position the head/arm over the proper track (into proper cylinder) –Rotational latency: wait for the desired sector to rotate under the read/write head –Transfer time: transfer a block of bits (sector) under the read-write head Disk Latency = Queuing Time + Controller time + Seek Time + Rotation Time + Xfer Time Highest Bandwidth: –Transfer large group of blocks sequentially from one track Sector Track Cylinder Head Platter Software Queue (Device Driver) HardwareController Media Time (Seek+Rot+Xfer) Request Result

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Disk Scheduling Disk can do only one request at a time; What order do you choose to do queued requests? –Request denoted by (track, sector) Scheduling algorithms: –First In First Out (FIFO) –Shortest Seek Time First –SCAN –C-SCAN In our examples we will ignore the sector –Consider only track # 2,32,13,107,25,22,2 Head User Requests Disk Head 3

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Linked Allocation: File-Allocation Table (FAT) MSDOS links pages together to create a file –Links not in pages, but in the File Allocation Table (FAT) »FAT contains an entry for each block on the disk »FAT Entries corresponding to blocks of file linked together –Access properties: »Sequential access expensive unless FAT cached in memory »Random access expensive always, but really expensive if FAT not cached in memory

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Multilevel Indexed Files (UNIX 4.1) Multilevel Indexed Files: (from UNIX 4.1 BSD) –Key idea: efficient for small files, but still allow big files File hdr contains 13 pointers –Fixed size table, pointers not all equivalent –This header is called an “inode” in UNIX File Header format: –First 10 pointers are to data blocks –Ptr 11 points to “indirect block” containing 256 block ptrs –Pointer 12 points to “doubly indirect block” containing 256 indirect block ptrs for total of 64K blocks –Pointer 13 points to a triply indirect block (16M blocks)

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Example of Multilevel Indexed Files Sample file in multilevel indexed format: –How many accesses for block #23? (assume file header accessed on open)? »Two: One for indirect block, one for data –How about block #5? »One: One for data –Block #340? »Three: double indirect block, indirect block, and data UNIX 4.1 Pros and cons –Pros: Simple (more or less) Files can easily expand (up to a point) Small files particularly cheap and easy –Cons:Lots of seeks Very large files must read many indirect blocks (four I/O’s per block!)

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 How do we actually access files? All information about a file contained in its file header –UNIX calls this an “inode” »Inodes are global resources identified by index (“inumber”) –Once you load the header structure, all blocks of file are locatable Question: how does the user ask for a particular file? –One option: user specifies an inode by a number (index). »Imagine: open(“ ”) –Better option: specify by textual name »Have to map name  inumber –Another option: Icon »This is how Apple made its money. Graphical user interfaces. Point to a file and click

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Naming Naming (name resolution): process by which a system translates from user-visible names to system resources In the case of files, need to translate from strings (textual names) or icons to inumbers/inodes For global file systems, data may be spread over globe  need to translate from strings or icons to some combination of physical server location and inumber

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Directories Directory: a relation used for naming –Just a table of (file name, inumber) pairs How are directories constructed? –Directories often stored in files »Reuse of existing mechanism »Directory named by inode/inumber like other files –Needs to be quickly searchable »Options: Simple list or Hashtable »Can be cached into memory in easier form to search How are directories modified? –Originally, direct read/write of special file –System calls for manipulation: mkdir, rmdir –Ties to file creation/destruction »On creating a file by name, new inode grabbed and associated with new file in particular directory

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Directory Structure Not really a hierarchy! –Many systems allow directory structure to be organized as an acyclic graph or even a (potentially) cyclic graph –Hard Links: different names for the same file »Multiple directory entries point at the same file –Soft Links: “shortcut” pointers to other files »Implemented by storing the logical name of actual file

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Directory Structure (Con’t) How many disk accesses to resolve “ /my/book/count ”? –Read in file header for root (fixed spot on disk) –Read in first data block for root »Table of file name/index pairs. Search linearly – ok since directories typically very small –Read in file header for “my” –Read in first data block for “my”; search for “book” –Read in file header for “book” –Read in first data block for “book”; search for “count” –Read in file header for “count” Current working directory: Per-address-space pointer to a directory (inode) used for resolving file names –Allows user to specify relative filename instead of absolute path (say CWD=“ /my/book ” can resolve “count”)

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Where are inodes stored? In early UNIX and DOS/Windows’ FAT file system, headers stored in special array in outermost cylinders –Header not stored anywhere near the data blocks. To read a small file, seek to get header, seek back to data. –Fixed size, set when disk is formatted. At formatting time, a fixed number of inodes were created (They were each given a unique number, called an “inumber”)

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Where are inodes stored? Later versions of UNIX moved the header information to be closer to the data blocks –Often, inode for file stored in same “cylinder group” as parent directory of the file (makes an ls of that directory run fast). –Pros: »UNIX BSD 4.2 puts a portion of the file header array on each cylinder. For small directories, can fit all data, file headers, etc. in same cylinder  no seeks! »File headers much smaller than whole block (a few hundred bytes), so multiple headers fetched from disk at same time »Reliability: whatever happens to the disk, you can find many of the files (even if directories disconnected) –Part of the Fast File System (FFS) »General optimization to avoid seeks

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Key-Value Store Also called a Distributed Hash Table (DHT) Main idea: partition set of key-values across many machines key, value …

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Challenges Fault Tolerance: handle machine failures without losing data and without degradation in performance Scalability: –Need to scale to thousands of machines –Need to allow easy addition of new machines Consistency: maintain data consistency in face of node failures and message losses Heterogeneity (if deployed as peer-to-peer systems): –Latency: 1ms to 1000ms –Bandwidth: 32Kb/s to 100Mb/s …

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Discussion: Iterative vs. Recursive Query Recursive Query: –Advantages: »Faster, as typically master/directory closer to nodes »Easier to maintain consistency, as master/directory can serialize puts()/gets() –Disadvantages: scalability bottleneck, as all “Values” go through master/directory Iterative Query –Advantages: more scalable –Disadvantages: slower, harder to enforce data consistency … N1 N2N3N50 K14 V14 K14N3 Master/Directory get(K14) V14 … N1 N2N3N50 K14 V14 K14 N3 Master/Directory get(K14) V14 N3 Recursive Iterative

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Quorum Consensus Improve put() and get() operation performance Define a replica set of size N put() waits for acks from at least W replicas get() waits for responses from at least R replicas W+R > N Why does it work? –There is at least one node that contains the update Why you may use W+R > N+1?

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Quorum Consensus Example N=3, W=2, R=2 Replica set for K14: {N1, N3, N4} Assume put() on N3 fails N1N1 N2N2 N3N3 N4N4 K14V14K14V14 put(K14, V14) ACK put(K14, V14) ACK

/16/2013 Anthony D. Joseph and John Canny CS162 ©UCB Fall 2013 Quorum Consensus Example Now, issuing get() to any two nodes out of three will return the answer N1N1 N2N2 N3N3 N4N4 K14V14K14V14 get(K14) V14 get(K14) nill