Diary

Just random thoughts.

The content of this page is highly volatile. I don't want to give each day and each thought a permalink. Some of these thoughts may grow to articles, some never won't. Thus, comments and webmentions will never be implemented for this page. But for archived pages, well, they might be.

Archives

2026-09

2026-10-01

If source code produces binaries that software developers distribute to bring food on their tables, the source code is the means of production for a developer.

Open source is a way to exproptiate those means of production thus bringing software developers down to slaves and the only thing they can sell is labor.

Some may object, take open source, make binaries, sell, make money. It's like clay, sculpt anything you want. Well, clay is not free, strictly speaking. Even water is not free nowadays. Moreover, following one popular license, if you make anything from free clay, those things must be free too. The only way to make money is to sculpt free things from free clay for someone.

It's a perfect slavery!

Of course it's a shitty analogy. Developers including me love taking such analogies out of thin air. Especially from fields in which they have neither comprehension nor skills.

Anyway, it smells so.

Some jurisdictions place the equal sign between source code and literary work. That not quite correct. Literary work is consumed by readers. By humans. Source code is beyond of comprehension of most of them. It's for machines. It can be written in a human-readable way but, heck, only few are able to do that.

Just thoughts. When it came to the end I started to guess.

♡♡♡

Sometimes windows API looks more consistent than unix mess. But I don't know if windows does not behaves the same way.

In unix the memory is allocated with mmap using anonymous mappings, and pages are cleaned as expected. They contain only zeros. But what if a page was reclaimed and then committed back again?

It stays dirty and needs explicit cleaning!

Unless the mapping was destroyed by munmap and then mmaped back again.

But that's troublesome approach if we need to decommit a hole that should stay reserved. Say, we decommit a page in a reserved region. Another thread may call mmap and break everything.

A man page on madvice explains this:

MADV_FREE: The kernel can thus free these pages, but the freeing could be delayed until memory pressure occurs. For each of the pages that has been marked to be freed but has not yet been freed, the free operation will be canceled if the caller writes into the page.

So, this sequence brings the same dirty page back into the addess space:

mprotect(page, 4096, PROT_NONE);
madvise(page, 4096, MADV_FREE);
mprotect(page, 4096, PROT_READ | PROT_WRITE);

Actually, the page stayed in.

A couple of (ir)relevant links, more or less:

And as a note for myself, do not forget about madvise when you'll get to thansparent huge pages.