The ZNS SSD standard was approved as a standard within NVMe and is part of version 2.0 of it. It involves major changes in the way you access and organize the data stored inside. So far the SSD has been accessed as if it were a conventional hard drive, which is not the best method for this type of memory
What is an SSD?
A conventional SSD at the hardware level is a set of non-volatile RAM memories, specifically NAND Flash memory, which are connected to a flash controller, which works the same as a normal memory controller and is responsible for managing access requests to the memory you have connected.
So far, SSDs have used the same way of managing their data as a conventional hard drive, which is not very efficient in terms of their lifespan and how to use their capabilities. The reason is that the NAND Flash memory, despite not being volatile like that of a hard disk, is more similar to RAM in terms of data access. What makes it better to adopt a new way of accessing this type of memory that is more advanced and therefore in line with its capabilities.
The ZNS is precisely that shape, let’s now see its characteristics.
What is a ZNS SSD?
First of all, what does ZNS mean? Well, they are the acronym for Zoned NameSpaces. Which is a way to organize storage on a disk and therefore we are talking about the way in which data is stored on the SSD. In hard drives what is done is to organize the information in pages, which are stored in tables and the latter in directories. The paging system is used to organize data on a conventional hard disk in which each page has a fixed and specific space.
On the other hand, in a ZNS SSD what is done is to divide the space into zones of different sizes. The objective is that when the CPU, the GPU or any other element needs to write the data in memory instead of pointing to a virtual memory address, what it will do is point to that area. Which will have been previously defined in terms of size. What is its operation? Simple, every time you want to write to flash memory, the Namespace assigned to that zone is invoked. The flash controller will then write the data in that zone and not outside of it. It will also do it sequentially, so as not to leave dead spaces on the disk and to optimize its use.
What is achieved with this technique is that the flash memory controller does not have to handle writes to random memory addresses and the use of space on the SSD is optimized. The CPU simply reserves a delimited part of the storage as an area to store the data. When you need to access that zone, the PC will tell the flash memory controller that it wants to access the data in that specific zone by invoking that specific Namespace.
ZNS SSDs use what we call logical block addressing, each and every zone is made up of logical blocks or LBAs. Each zone can have any number of logical blocks to store data, but it must be a minimum of 2 in size and when the data of a logical block or LBA has been written then the information of the next one is filled in sequentially.
The main advantage is that it does not create dead spaces on the SSD by not reserving more memory than necessary at all times. This makes the write cycles much shorter and also allows us to more easily predict the latency in the access of the data as it is organized sequentially instead of being distributed by the unit.
State machine on a ZNS SSD and commands
To support the Zones NameSpaces then the flash memory controller must be able to perform a series of instructions to handle the information and access to the SSD properly. That is why a series of finite state machines are used to control the information on the SSD. Finite state machines are micro-wired code in the hardware, in this case the flash controller, which, based on input information, indicates how to work with that area of flash memory.
- Empty: data can be written when there is nothing, if a reading is done, it will return the data that is predefined by the manufacturer. Most of the time rubbish. A zone can be completely erased through the reset command, this destroys the organization of the different zones.
- Full: the zone is full of data and cannot store any more information, but it can be used for read only.
- Open: allows data to be read and written to the zone’s current active LBA. Each zone can be either implicitly open or explicitly open. The first refers to the fact that we can open it by invoking the Open command of the flash controller. The explicit mode instead has the same function, but from the application itself.
- Closed: when a zone is closed it only accepts read commands and does not allow the entry of new data.
- Finish: it does not erase the data, but marks the zone as complete. Regardless of whether more memory was originally allocated for storage in the form of multiple LBAs, no more data can be stored in that zone.
At the beginning of each zone, what the flash controller does is place a label that will remind you of the status of that zone in memory.