Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 11: Flash Memory and File System Abstraction

Similar presentations


Presentation on theme: "Lecture 11: Flash Memory and File System Abstraction"— Presentation transcript:

1 Lecture 11: Flash Memory and File System Abstraction
SE350: Operating Systems Lecture 11: Flash Memory and File System Abstraction

2 Main Points Flash Storage hardware characteristics
File systems abstraction File system usage patterns

3 Flash Memory Storage that rarely becomes corrupted
Capacity at intermediate cost More expensive than magnetic disks Block level random access Good performance for reads High overhead for random writes

4 www.androidcentral.com and flashdba.com
Flash Memory Cells and flashdba.com

5 Read/Write in Flash Memory
Writes must be to “clean” cells Large block erasure required before write Erasure block: 128 – 512 KB Erasure time: Several milliseconds Write/read page (2-4KB) usec

6 Flash Drive (Intel 710 SSD 2011)

7 Flash Translation Layer
Flash device firmware Maps logical page # to a physical location Garbage collects erasure blocks by copying live pages to new location, then erase More efficient if blocks stored at same time are deleted at same time (e.g., keep blocks of a file together) Wear-levels by only writing each physical page a limited number of times Remaps pages that no longer work (sector sparing)

8 TRIM Command How does Flash device know which blocks are live?
Live blocks must be remapped to a new location during erasure File system tells device when blocks are no longer in use

9 Main Points Flash Storage hardware characteristics
File systems abstraction File system usage patterns

10 File System as Illusionist: Hide Limitations of Physical Storage
Persistence of data stored in file system: Keep data persistent even if crash happens during an update, or disk block becomes corrupted, or flash memory wears out Naming: Allow named data instead of disk block numbers Allow directories instead of flat storage Allow byte addressable data even if devices are block-oriented Performance: Improve storage devices’ performance overhead by caching data and efficient data placement and data structure organization Controlled access to shared data: Restrict users’ access to data by adding access-control metadata

11 File System Abstraction
Persistent, named data Hierarchical organization (directories, subdirectories) Access control on data File: named collection of data Linear sequence of bytes (or a set of sequences) Read/write or memory mapped Crash and storage error tolerance OS crashes (and disk errors) leave file system in a valid state Performance Achieve close to the hardware limit in the average case

12 File System Abstraction (cont.)
Directory Group of named files or subdirectories Mapping from file name to file metadata location Path String that uniquely identifies file or directory E.g., /se/www/education/courses/se350/w19 Links Hard link: link from name to metadata location Soft link: link from name to alternate name

13 File System Abstraction (cont.)
Volume Logical storage disk which is a collection of one or more physical storage devices Single physical device could be partitioned into multiple logical volumes Each instance of file system manages files and directories for a single volume

14 File System Abstraction (cont.)
Mount: Mapping from name in one file system to root of another

15 UNIX File System API create, link, unlink, createdir, rmdir
Create file, link to file, remove link Create directory, remove directory open, close, read, write, seek Open/close a file for reading/writing Seek resets current position fsync File modifications can be cached fsync forces modifications to disk (like a memory barrier)

16 File System Interface UNIX file open is a Swiss Army knife:
Open the file, return file descriptor Options: if file doesn’t exist, return an error If file doesn’t exist, create file and open it If file does exist, return an error If file does exist, open file If file exists but isn’t empty, nix it then open If file exists but isn’t empty, return an error

17 Interface Design Question
Why not separate syscalls for open/create/exists? Would be more modular! if (!exists(name)) create(name); // can create fail? fd = open(name); // does the file exist?

18 Acknowledgment This lecture is a slightly modified version of the one prepared by Tom Anderson


Download ppt "Lecture 11: Flash Memory and File System Abstraction"

Similar presentations


Ads by Google