Empezar Enviar un sitio

sebsite

sebsite.pwDR 29 Accessible 300 views

Desarrollo y programación A personal blog post explaining a Linux memory trick that uses memfd_create and mmap with MAP_PRIVATE to duplicate large memory templates via copy-on-write without upfront physical allocation.

Editor's Review

For reference only
sebsite page preview

The post is a focused, code-first write-up aimed at systems programmers, walking through a concrete memfd_create plus mmap workflow and a 32 MiB test. Its value lies in the precise page-level explanation of copy-on-write behavior; readers wanting broader context or higher-level language examples wil

Site introduction

sebsite is a personal site that publishes short technical notes and experiments, and this page is one such note about reusing physical memory on Linux. Rather than a general tutorial, it records a single discovery the author found worth sharing, written in a casual first-person voice.

The core content is a minimal C example: create a memory-backed file descriptor with memfd_create, size it with ftruncate, map it shared, fill it with a template pattern, then map the same descriptor again with MAP_PRIVATE to obtain a copy. The author explains that the copy consumes no physical memory until pages are mutated, and that a single write only allocates one 4 KiB page while the rest stay shared.

A 32 MiB test is described to show the behavior in practice. The author also notes a wish for easier access to this pattern through higher-level standard library functions, which frames the trick as a low-level technique rather than a packaged API.

The page suits C and systems programmers already comfortable with mmap, file descriptors, and copy-on-write semantics, and it works best as a reference snippet to adapt rather than a step-by-step guide. Error handling is omitted, so readers should add their own checks before using it in production code.

Comments & Ratings

0

No comments yet. Be the first to review.

Write the first comment

Your email won't be made public; fields marked with * are required.

Rate this site

Click the stars to rate; rating is optional, and clicking the selected star again cancels it.