260 likes | 427 Views
File Systems in Real-Time Embedded Applications. Choosing the Right Storage Media. March 7th Eric Julien. Introduction. Storage media provides a nonvolatile backing device for one or multiple partitions. Different media, different attributes: Removability, Latency,
E N D
File Systems in Real-Time Embedded Applications Choosing the Right Storage Media March 7thEric Julien
Introduction Storage media provides a nonvolatile backing device for one or multiple partitions. Different media, different attributes: • Removability, • Latency, • Sequential write/read throughput, • Random write/read throughput, • Cost, density, • Reliability, wear, etc.
Latency in embedded systems Latency plays an often neglected role in FS performances on embedded systems. Limited memory availability in embedded system prevent writes or reads using large buffers. Global throughput becomes more affected by latency and less by I/O speed.
Latency: SD Card example SanDisk 2GB MicroSD Card, SD 4 bit mode • Access time: 1.5 ms (worst case). • I/O time, 512B @ 25MHz: 40.96 µs. • Total read time: 1541 µs (I/O 2.7% of total).
Storage Media Types • RAM (volatile) • Hard Disk Drive, Solid State Drive • Unmanaged Flash Memory • NOR Flash Memory • NAND Flash Memory • Managed Flash Memory • Secure Digital (SD)/MultiMediaCard • CompactFlash • USB Mass Storage Device
RAM Volatile storage technology, unless battery-backed that has almost ideal performance characteristics. • Very low latency, esp. static RAM, • Fast write and read throughput.
Hard Disk Drive Stores data on rotating discs called platters coated with a magnetic material. Integrate a controller providing a sector based interface. • Head movement imply seek time (latency): • Slower random access time. • Vulnerability to file system fragmentation. • Average latency around 12ms (mobile drives). • More RPM = less latency = more noise.
Hard Disk Drive • Huge capacity up to a few TB. • Very low cost per bit. • Good sequential throughput • Typical modern 7200 RPM drive can sustain “disk-to-buffer” rates up to 130 MB/s (outer tracks). • Reliability • Controller provides ECC, bad sector management. • Mechanical parts can cause data loss (eg. head crash): less suitable for mobile embedded systems.
Unmanaged Flash Memory Flash memory technology stores bits of information by modulating the charge on the floating-gate of field effect transistors. The presence of a charge on the floating gate affects the threshold required to activate the transistor, allowing its state to be read.
Unmanaged Flash Memory Types NOR Word line • Byte/word-addressable. • More metal contacts: bigger cell size. Bit line Source line NAND Word line Source line • Page-addressable. • Less metal contacts: smaller cell size. Bit line
NOR Flash • Cells must be erased prior to programming. • Byte/Word-addressable. • Suitable for eXecute In Place (XIP). • Cells are almost independent: • Byte/Word program possible. • Reads and programs don’t disturb neighboring cells. • NORs generally don’t require ECC. • Erases do affect multiple cells (page, sector, block).
NOR Flash • Single-byte/word random reads are fast and low-latency. No moving mechanical parts. • Very good random and sequential read throughput. • Slow programming and erase operations. • Poor sequential and random write throughput. • High cost per bit, medium density (bigger cells). • Requires wear levelling: cell life 10 000 to 100 000 P/E cycles. • No bad blocks.
NOR Flash: interface Two types of interfaces: • Parallel memory-mapped, using standard external bus interface. • Best throughput/latency, XIP support, but uses more pins. • Serially-interfaced devices (often SPI and variants). Common Flash memory Interface (CFI) standard. • Provides info on queried device including: • Size, block configuration, voltage, command set, etc. • Eliminate need for descriptor tables. • Allows new devices to be used without SW updates.
NAND Flash • Cells must be erased prior to programming • Page addressable. • Not suitable for XIP (unless special controller). • Cells aren’t independent: • Smallest programmable unit: page. • Smallest erasable unit: block (many pages). • Reads and programs cause disturbance to other cells in a block. • Data reliability affected; use of ECC mandatory.
NAND Flash • Page random reads are fast and low-latency. • Very good random and sequential read throughput. • Fast programming and erase operation. • Good sequential and random write throughput. • Low cost per bit, high density (smaller cells). • Requires wear leveling: • Average cell life SLC: 100 000 to 1 000 000 P/E cycles. • Average cell life MLC: 10 000 to 100 000 P/E cycles. • Bad blocks must be dealt with (incl. factory).
NAND Flash: interface • Most common interface: parallel on IO bus. • Less pins than parallel NOR. • Some serial devices (often integrate ECC). • Multiple plane, multiple die devices. • Open NAND Flash Interface (ONFI) standard. • Standard pinout for multiple packages. • Standard command set. • Parameter page for querying device parameters. • Timing requirements, etc.
Managed Flash Memory NOR and NAND Flash memories, due to their erase before write nature, need to be handled differently than traditional devices. The algorithms involved are often complex and/or costly. Managed flash memory devices provide a simpler interface, taking care of logical block abstraction, wear leveling, EDC data protection, bad block management, etc.
Secure Digital/MultiMediaCard Secure Digital (SD) and MultiMediaCard are removable devices that contain a storage device (often NAND) along with a controller. • Provides a standardized physical interface, socket and command set. • Basic variants of SD and MMC have identical pinouts and almost identical command set. • SD has a SPI compatible mode (MMC: opt.).
Secure Digital • Maximum capacity is 2GB for SD cards, 32 GB for SDHC cards and 2TB for SDXC cards. • SDA has recommended exFAT as FS for SDXC cards. • Speed class: minimum sustained sequential read/write speed in MB/s with a card in a fragmented state (class 10: non-fragmented). • Random read/write performance not controlled. • Ultra High Speed (UHS): bus modes increasing max bus bandwidth (DDR, clk rate, 1.8V).
e•MMC Managed flash memory in a non-removable package, compatible with MMCplus, convenient for integrated embedded system storage. • Higher throughput bus modes, • TRIM (background erase), • Secure erase (purge), • Sanitize (purge unmapped), • Reliable writes, • Boot areas…
Secure Digital/MultiMediaCard Performance of SD/MMC cards are highly dependent on embedded controller and storage device used. • Sequential read/write throughput is usually good, but may be limited by max bus rate. • Random read performance is usually middling, depending on controller latency. • Random write performance is usually poor to mediocre, depending on controller.
USB Mass Storage Class Devices USB standard has a device class specifying a protocol for controlling a logical block addressed storage device through USB. Most common types: • External HDD: similar performance to internal HDDs, but may be limited in throughput by bus. • Flash memory (USB Flash drives): similar performance to SD/MMC cards, dependent on embedded controller and storage device.
Storage Media Comparison USB HDD: similar to Hard Disk, USB Flash Drive: similar to SD/MMC