RUVIDEO
Поделитесь видео 🙏

[2min] Understanding Java 14 NVM feature

Summary
Java 14 adds new JDK-specific file mapping modes so that the FileChannel API can be used to create MappedByteBuffer instances that refer to non-volatile memory.




FileChannel use
Let's first understand what is FileChannel.

FileChannel is a nexus for I/O operations.

FileChannel is used for advanced applications needing file locking or memory-mapped I/O.

A channel is for reading, writing, mapping, and manipulating a file.

A file channel is a SeekableByteChannel that is connected to a file. It has a current position within its file which can be both queried and modified. The file itself contains a variable-length sequence of bytes that can be read and written and whose current size can be queried. The size of the file increases when bytes are written beyond its current size; the size of the file decreases when it is truncated. The file may also have some associated metadata such as access permissions, content type, and last-modification time; this class does not define methods for metadata access.





MappedByteBuffer
Let's understand what is MappedByteBuffer.

MappedByteBuffer is a ByteBuffer(used to transfer bytes) with operations that are specific to memory-mapped file regions.

By "memory-mapped file regions", I mean the ability to truncate the file in parts and handle(read/write) it independently.

MappedByteBuffer is a direct byte buffer(outside of JVM and heap) by representing a memory-mapped region of a file.

Key advantage of MappedByteBuffer is the resiliency at program crash when reading/writing (say OS will take care of writing content to File.)





Non Volatile Memory
Let's understand the advantages of Non-volatile memory:

With non-volatile memory, data or information remains keep within the memory albeit power is completed.

Non-volatile memory offers also many attractions:

Reduced startup time
Reduced latency of durable updates
Higher memory density and lower cost/bit than DRAM




Conclusion
With JDK 14, FileChannel API can be used to create MappedByteBuffer instances that refer to non-volatile memory




Links
FileChannel JavaDoc
https://docs.oracle.com/javase/7/docs/api/java/nio/channels/FileChannel.html

MappedByteBuffer JavaDoc
https://docs.oracle.com/javase/9/docs/api/index.html?java/nio/MappedByteBuffer.html

NVM Definition
https://www.geeksforgeeks.org/difference-between-volatile-memory-and-non-volatile-memory/

NVM Lab
https://labs.oracle.com/pls/apex/f?p=94065:40150:0::::P40150_PUBLICATION_ID:5633

JEP 352 Specification
https://openjdk.java.net/jeps/352



#technology #java #java14 #nvm #programming #jep352 #javalanguageprogramming #programming #mappedbytebuffer #filechannel

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «[2min] Understanding Java 14 NVM feature», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.