Book publishers used to print India/SEA-only editions of books only sold in those countries, significantly cheaper than in the US or Europe.
Then a Thai guy realized that this would be a good business opportunity: buy cheaper books and then import them to the US. Wiley brought him to court, went to the SCOTUS, Wiley lost the case. So they ended up printing cheaper edition books.
Mind you "price discrimination" like this still exist in the digital world where locality is easier to be enforced. For example Steam has extensive regional pricing across countries so the same game can be significantly cheaper in Russia, India, Brazil etc. compared to US or EU
the end struck me - a picture of an os book. I wonder if students these days retain their books after college, or do they get returned as a rental?
linguae 13 hours ago [-]
I'm a professor at a community college in Silicon Valley, and my students use online textbooks. I try to use Creative Commons or other libre textbooks, but sometimes I use paid textbooks when they are heads-and-shoulders better than their libre alternatives. Some e-textbooks can be accessed on a subscription basis. I admit I prefer non-subscription materials, but a colleague advised me that often the book that students learn from is different from a good reference book that students can use once they've already learned the material. For example, my colleagues and I have had great success with an online, interactive textbook for discrete math. While the subscription is unfortunately only valid for the duration of the course, once students have learned discrete math, they could buy a used copy of Rosen's discrete math textbook as a reference.
The nice thing about e-textbooks is not needing to carry around a bunch of heavy books. I remember the tomes I had in my college days, such as Stewart's Calculus.
NooneAtAll3 12 hours ago [-]
just hint students towards anna's archive and then sky's the limit
post-it 13 hours ago [-]
I bought as few textbooks as I could, but the few that I did buy are sitting in my parents' basement bookshelves somewhere.
efxhoy 12 hours ago [-]
Great job on getting the fixes merged!
jmclnx 14 hours ago [-]
Interesting post, it made me wonder. At one time FreeBSD swap usage/logic was far better than what Linux did. Is that still the case ?
man8alexd 12 hours ago [-]
FreeBSD didn’t have memory overcommit and instead used strict swap reservation - each allocated anonymous memory page was supposed to have a corresponding swap page. This required 2x RAM swap space, otherwise you would get “out of swap” when forking a large process. FreeBSD implemented memory overcommit around 2000.
jandrese 12 hours ago [-]
Oh, so that's where that old nugget of wisdom came from! I've heard the rule about making your swap at least 2x your RAM for ages and thought it was just some old rule of thumb from the 80s. I didn't know there used to be a legitimate reason for it.
Yes, It's just not every tool is aware of ZFS ARC. Which is what this post is about. Author just describes in an odd way.
shevy-java 13 hours ago [-]
I remember how NetBSD promoted itself as running on many more
toasters than Linux once.
Then some NetBSD dev wrote on their mailing list that this is
no longer true. Linux runs on more toasters now. (And also top 500 supercomputers, but toasters are the real metal to the petal test.)
It's an interesting piece of history too. I kind of evaluate it a
bit differently, e. g. my summary is "momentum beats academic
perfection". Which is not completely what it is about, but it is
my own imperfect TL;DR summary.
bee_rider 12 hours ago [-]
This basically fits my stereotype of BSD being a little bit more hardcore while Linux is a little more accessible… when the question was “can you install an OS on a toaster,” BSD had an advantage. Now that normal engineers have to make IOT toasters (for some reason) Linux should have the advantage, right?
sublinear 12 hours ago [-]
Normal engineers don't do that either.
Levitating 12 hours ago [-]
why did that url point me to a scrotum in an egg cup
UnlockedSecrets 12 hours ago [-]
Seems like at a glance that website if it sees a referral from ycombinator, it redirects to that image.... In a private window it loads the 'intended' page.....
m0llusk 9 hours ago [-]
HN has disappointed JWZ
tom2ow 12 hours ago [-]
[flagged]
tomeow 13 hours ago [-]
[flagged]
tom2ow 12 hours ago [-]
[flagged]
hnloser 13 hours ago [-]
[flagged]
naturalmovement 13 hours ago [-]
ZFS cache. The end.
User installs an unfamiliar server OS with an enterprise filesystem and is stunned when it works differently. I fail to see a teachable moment here.
13 hours ago [-]
craftkiller 11 hours ago [-]
I've noticed that the various tools report different amounts of free memory. I appreciate finally having an explanation for why.
toast0 13 hours ago [-]
Sure, but also some tools needed fixing.
shevy-java 13 hours ago [-]
This is why I use Linux. :>
Poor FreeBSD folks though. After so many years trying to
present themselves as better alternative, the road just
got steeper ...
2 hours ago [-]
edoceo 13 hours ago [-]
The OS Crusades are over man
irishcoffee 11 hours ago [-]
For real though, what is the point of running a bsd on a personal computer? Seems like intentionally handicapping yourself.
BSDobelix 2 hours ago [-]
I have FreeBSD on all my personal machines and i feel the opposite of handicapped, however i use Linux (CachyOS) for gaming (as a VM with pass-thru).
soupbowl 9 hours ago [-]
Consistent ZFS tooling around the OS and ZFS support out of the box, which always works.
acheron 7 hours ago [-]
Netcraft confirms it.
BSDobelix 26 minutes ago [-]
~all Browsers on FreeBSD (Chromium/Firefox/Librewolf) have Linux as User-Agent.
vermaden 12 hours ago [-]
No ZFS no problem :)
drdexebtjl 11 hours ago [-]
I don’t understand the part about using heuristics and deciding what counts as used memory…
Used memory for the system is always total minus available.
Heuristics? I would hope that the system knows precisely what is using every single byte of physical and virtual memory. Is this a reporting problem? Why do we have to settle for heuristics and not the exact number?
toast0 11 hours ago [-]
> I would hope that the system knows precisely what is using every single byte of physical and virtual memory.
Of course the system knows what is using every page. The difficulty is really in how to account for pages that are backed by disk.
If you count all of those as free, that's not accurate. If you count all of those as used, that's not accurate either. Additionally, FreeBSD (at least) doesn't have separate queues for disk backed pages, so there's not really a good way to know how much of your active (or inactive) memory is disk backed.
As an additional caveat that measuring active/inactive has costs. In the past, FreeBSD wouldn't really do the work for that until it needed to... I know some stuff changed, but I don't remember where it ended up; it wasn't great when it bulk marked a ton of pages as inactive and then the active ones would fault back in.
jkrejcha 9 hours ago [-]
This is only really a problem if you accept overcommit as a force of nature that can't be changed or tweaked (you can still do address space reservation without needing overcommit)
If you don't, it becomes rather easy (and strict commit accounting is done for example on Linux even if it isn't used in some cases)
Memory mapped files can be entirely recreated from the disk so no need to charge for them. Anonymous pages (whether private or shareable) have to be charged. Shareable memory is the harder one to charge. (The case where a mapping is used by only one can get charged as private commit.) These two previous cases are charged even if in a swap file or whatnot
drdexebtjl 10 hours ago [-]
> If you count all of those as free, that’s not accurate.
Why not? It depends on what you’re measuring. Physical memory? They count as free. Virtual memory? They count as used.
The ambiguities only arise when we stop making that distinction very clear.
toast0 7 hours ago [-]
> It depends on what you’re measuring.
What I want to know is do I have enough physical memory for what I'm running.
Sure, I can drop disk backed pages and recreate them as needed, but when it happens too often, there goes performance.
jsmith45 6 hours ago [-]
Yep.
Thrashing is a well known known issue that can occur with swap, but it can also happen from page cache or memory mapped files. Indeed not having swap enabled can make things worse, as private pages that haven't been used in a hours cannot be swapped out to keep the important files cached or memory mapped.
Realistically for measuring physical memory sufficiency, you care about memory/data of any type (even files) that will be used in use upcoming time period, and ensuring that a sufficient percentage of it can be held in physical memory to avoid thrashing.
This is hard! Technically impossible to know for the general case (halting problem), and all methods of trying to approximate it involves trade-offs.
CrociDB 11 hours ago [-]
The thing is it's easy to define free, unused memory. But a lot of the used memory is your system caching stuff that would be free if you needed more than what's actually free. So you can see you have 1g of free memory out of your 4g, but then you allocate 3g and it will do without a sweat and you'd be confused. So you have to go and dig for what those caches are and report that they're effectively free too.
drdexebtjl 10 hours ago [-]
Instantly reclaimable disk caches should count as available, and they do.
This isn’t hard. The OS should just expose a counter for available memory instead of having applications understand every type of memory reservation.
edit:
Linux does this, but it has its own share of issues with memory counters. The “cached” memory includes tmpfs and ramfs for seemingly no reason.
jkrejcha 9 hours ago [-]
> The “cached” memory includes tmpfs and ramfs for seemingly no reason.
If you're curious why that is by the way, it's because that's actually how these are implemented (tmpfs/ramfs is just a mount to a filesystem where the files never get marked clean[1])
AFAIK the only way for you to figure out how much of your disks is actually cached involves enumerating all tmpfs and ramfs mounts, summing their sizes, and subtracting the sum from the cache size reported by the kernel.
jkrejcha 9 hours ago [-]
Ostensibly you could subtract "Shmem"[1] in /proc/meminfo from the cached value... maybe?
Do agree it's not the best UX and utilities should probably do a better job at showing that
Linux MemAvailable from /proc/meminfo is just an estimation calculated as an arbitrary percentage (50%) of free and potentially reclaimable memory.
You can't determine how much of the memory can actually be reclaimed under memory pressure until you try to reclaim it.
killerstorm 3 hours ago [-]
That metric would give you a number of bytes which can be used for pages not backed by files, but it won't give you actual memory usage statistics:
It won't count executable pages and memory-mapped file use as "used" memory, so your system might display gigabytes "free" when it's starving, executables getting paused when code pages are paged-in from disk.
It's just less useful than what's displayed now. "Everyone is doing it wrong" is usually a signal that you're missing something.
man8alexd 11 hours ago [-]
You will be surprised by how inaccurate memory measurements are.
Rendered at 10:09:05 GMT+0000 (Coordinated Universal Time) with Vercel.
Book publishers used to print India/SEA-only editions of books only sold in those countries, significantly cheaper than in the US or Europe. Then a Thai guy realized that this would be a good business opportunity: buy cheaper books and then import them to the US. Wiley brought him to court, went to the SCOTUS, Wiley lost the case. So they ended up printing cheaper edition books.
https://en.wikipedia.org/wiki/Kirtsaeng_v._John_Wiley_%26_So....
Mind you "price discrimination" like this still exist in the digital world where locality is easier to be enforced. For example Steam has extensive regional pricing across countries so the same game can be significantly cheaper in Russia, India, Brazil etc. compared to US or EU
An example: https://steamdb.info/app/413150/
https://partner.steamgames.com/pricing/explorer
https://partner.steamgames.com/doc/store/pricing/currencies
https://peteris.rocks/blog/htop/
I was looking forward for web protocol, but alas...
But there is an http headers article you might like.
https://peteris.rocks/blog/exotic-http-headers/
I like the command for viewing the ARC cache size, never knew that. It's only 2GB on my system (of 64GB RAM).
zfs-stats is also nice for more zfs internals like hit-rate L2 etc..
https://www.freshports.org/sysutils/zfs-stats
The nice thing about e-textbooks is not needing to carry around a bunch of heavy books. I remember the tomes I had in my college days, such as Stewart's Calculus.
Then some NetBSD dev wrote on their mailing list that this is no longer true. Linux runs on more toasters now. (And also top 500 supercomputers, but toasters are the real metal to the petal test.)
These fights always remind me of:
https://www.jwz.org/doc/worse-is-better.html
It's an interesting piece of history too. I kind of evaluate it a bit differently, e. g. my summary is "momentum beats academic perfection". Which is not completely what it is about, but it is my own imperfect TL;DR summary.
User installs an unfamiliar server OS with an enterprise filesystem and is stunned when it works differently. I fail to see a teachable moment here.
Poor FreeBSD folks though. After so many years trying to present themselves as better alternative, the road just got steeper ...
Used memory for the system is always total minus available.
Heuristics? I would hope that the system knows precisely what is using every single byte of physical and virtual memory. Is this a reporting problem? Why do we have to settle for heuristics and not the exact number?
Of course the system knows what is using every page. The difficulty is really in how to account for pages that are backed by disk.
If you count all of those as free, that's not accurate. If you count all of those as used, that's not accurate either. Additionally, FreeBSD (at least) doesn't have separate queues for disk backed pages, so there's not really a good way to know how much of your active (or inactive) memory is disk backed.
As an additional caveat that measuring active/inactive has costs. In the past, FreeBSD wouldn't really do the work for that until it needed to... I know some stuff changed, but I don't remember where it ended up; it wasn't great when it bulk marked a ton of pages as inactive and then the active ones would fault back in.
If you don't, it becomes rather easy (and strict commit accounting is done for example on Linux even if it isn't used in some cases)
Memory mapped files can be entirely recreated from the disk so no need to charge for them. Anonymous pages (whether private or shareable) have to be charged. Shareable memory is the harder one to charge. (The case where a mapping is used by only one can get charged as private commit.) These two previous cases are charged even if in a swap file or whatnot
Why not? It depends on what you’re measuring. Physical memory? They count as free. Virtual memory? They count as used.
The ambiguities only arise when we stop making that distinction very clear.
What I want to know is do I have enough physical memory for what I'm running.
Sure, I can drop disk backed pages and recreate them as needed, but when it happens too often, there goes performance.
Thrashing is a well known known issue that can occur with swap, but it can also happen from page cache or memory mapped files. Indeed not having swap enabled can make things worse, as private pages that haven't been used in a hours cannot be swapped out to keep the important files cached or memory mapped.
Realistically for measuring physical memory sufficiency, you care about memory/data of any type (even files) that will be used in use upcoming time period, and ensuring that a sufficient percentage of it can be held in physical memory to avoid thrashing.
This is hard! Technically impossible to know for the general case (halting problem), and all methods of trying to approximate it involves trade-offs.
This isn’t hard. The OS should just expose a counter for available memory instead of having applications understand every type of memory reservation.
edit:
Linux does this, but it has its own share of issues with memory counters. The “cached” memory includes tmpfs and ramfs for seemingly no reason.
If you're curious why that is by the way, it's because that's actually how these are implemented (tmpfs/ramfs is just a mount to a filesystem where the files never get marked clean[1])
[1]: https://www.kernel.org/doc/Documentation/filesystems/ramfs-r...
AFAIK the only way for you to figure out how much of your disks is actually cached involves enumerating all tmpfs and ramfs mounts, summing their sizes, and subtracting the sum from the cache size reported by the kernel.
Do agree it's not the best UX and utilities should probably do a better job at showing that
[1]: https://man7.org/linux/man-pages/man5/proc_meminfo.5.html
You can't determine how much of the memory can actually be reclaimed under memory pressure until you try to reclaim it.
It won't count executable pages and memory-mapped file use as "used" memory, so your system might display gigabytes "free" when it's starving, executables getting paused when code pages are paged-in from disk.
It's just less useful than what's displayed now. "Everyone is doing it wrong" is usually a signal that you're missing something.