Implement a Page-Mapped Flash Translation Layer With Greedy Garbage Collection
Last updated: November 29, 2026
Quick Overview
Implement a simplified SSD flash translation layer over B blocks of P pages: writes go out of place, overwrites invalidate the old page, and when free blocks drop to a reserve, garbage collection picks the block with the fewest valid pages, relocates them and erases it. Report write amplification.
Samsung
November 29, 20260
0
0 solved
Implement a simplified SSD flash translation layer over B blocks of P pages: writes go out of place, overwrites invalidate the old page, and when free blocks drop to a reserve, garbage collection picks the block with the fewest valid pages, relocates them and erases it. Report write amplification.
Samsung Semiconductor builds SSD controllers, and FTL logic is the core of that firmware. The interviewer checks that you understand erase-before-write, keep forward and reverse maps consistent, and can reason about write amplification and over-provisioning.
What the Interviewer Expects
- Keeps logical-to-physical and physical-to-logical maps in sync
- Writes append-only into an active block and never overwrites a page in place
- Triggers GC early enough that relocation always has space (reserve block)
- Chooses greedy victim selection and explains its trade-off versus cost-benefit
- Computes write amplification as NAND writes over host writes
- Limits logical capacity below physical to guarantee progress
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- Greedy GC hurts wear leveling. How would you add erase counts into victim choice?
- How do you separate hot and cold data to reduce write amplification?
- What must be persisted so the map survives sudden power loss?
- How would you make GC incremental so host latency stays bounded?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
API: write(lpn), read(lpn) -> (block, page), write_amplification(). Logical space is capped at (B - reserve - 1) * P pages so there is always at least one block's worth of invalid pages to rec...
High-Level Design
State: l2p dict, owner[block][page] reverse map, valid[block] counts, a free-block list, and one active block with a write pointer. _program places a page in the active block and invalidates t...