# FEMU Introduction
###### tags: `Accelerator`
### SSD Research Category

> "[E] software SSD emulator" seems not support "[R] RAID of SSDs (flash array) and [D] distributed/multi-node SSDs"
* scale
* [1]: single SSD
* [R]: RAID of SSDs (flash array)
* [D]: distributed/multi-node SSDs
* platform
* [C]: commodity SSDs
* [E]: software SSD emulator
* [H]: hardware platforms
* [S]: trace-based simulator
* layer
* [A]: application layer
* [K]: OS kernel
* [L]: low-level SSD controller logic
### Why FEMU?
#### Better than other platforms
* following platforms only support internal-SSD research, but not kernel-level extensions.
* [S] trace-based simulator: DiskSim+SSD, FlashSim, SSDSim
* following platforms support full-stack research, but their high costs.
* [H] hardware platforms: FPGA boards, OpenSSD, OpenChannel SSD
* following platforms are cheap, but either outdated, non-scalable, or not open-sourced.
* [E] software SSD emulator: VSSIM, FlashEm, LightNVM’s QEMU
| | [S] simulator | [E] emulator | [H] hardware platform |
| ------------------- | ---------------------- | -------------------------- | --------------------- |
| Full-stack Research | Internal-research only | O | O |
| Cheap | -------- | O | X |
| Accurate | -------- | FEMU: soso<br>others: poor | O |
| Scalable | -------- | FEMU: good<br>others: poor | -------- |
| Extensible | -------- | FEMU: good | -------- |
#### FEMU's Limitation
* Not able to emulate large-capacity SSD
* because FEMU is DRAM-backed
* There is room for improving accuracy
### What is FEMU?
* FEMU is QEMU-based flash emulator
* QEMU is full-system emulator
* It supports emulating different types of SSDs:
* **Whitebox mode (OCSSD)** (a.k.a. Software-Defined Flash (SDF), or OpenChannel-SSD) with host side FTL (e.g. LightNVM or SPDK FTL)
* **Blackbox mode (BBSSD)** with FTL managed by the device (like most of current commercial SSDs). A page-level mapping based FTL is included.
* **ZNS mode (ZNSSD)**, exposing NVMe Zone interface for the host to directly read/write/append to the device following certain rules.
* **NoSSD mode**, emulating a as-fast-as-possible NVMe device with sub-10 microsecond latency. This is to emualte SCM-class block devices such as Optane or Z-NAND SSDs.
#### FEMU Architecture


### How FEMU works?
### Reference
1. 2018 USENIX, [The CASE of FEMU: Cheap, Accurate, Scalable and Extensible Flash Emulator](https://www.usenix.org/system/files/conference/fast18/fast18-li.pdf), [slides](https://www.usenix.org/sites/default/files/conference/protected-files/fast18_slides_li.pdf), [pdf](https://newtraell.cs.uchicago.edu/files/ms_paper/huaicheng.pdf)