# Article about migrating from Linux to FreeBSD



## alie (Jun 17, 2013)

On the article below, Nilesh Govindrajan is describing his experiences with the switch 

http://nileshgr.com/2013/06/07/the-move-from-linux-to-freebsd


----------



## NewGuy (Jun 17, 2013)

I'm glad the author is happy with the switch. Seems he's enjoying FreeBSD and that is good. I have to wonder about some of his claims though. The idea that a Linux server would use over 1 GB of RAM for a simple AMP stack, for example, doesn't ring true. I suspect either he made a mistake when comparing memory usage on FreeBSD vs his Linux distribution (the output looks different on the two OSes) or maybe something wasn't configured properly. A stock Linux server can easily serve up a simple AMP site with 256 MB of RAM.

He also claims his Linux desktop was too crowded with only 3 GB of RAM. Even while running KDE and LibreOffice and a media player and GIMP and a VM my Linux laptop doesn't use more than 3 GB of RAM. I have to assume he is confusing cached files with active memory usage.

Please note I'm not saying FreeBSD isn't lighter on memory. In my experience FreeBSD often does use slightly less RAM than Linux. I'm just saying it's not going to reduce RAM usage by 50% as the author claims.


----------



## jozze (Jun 17, 2013)

I like the article and links that were there. I agree with @NewGuy, that the kernel itself probably cannot decrease RAM usage by 50 %.


----------



## ShelLuser (Jun 17, 2013)

NewGuy said:
			
		

> The idea that a Linux server would use over 1GB of RAM for a simple AMP stack, for example, doesn't ring true. I suspect either he made a mistake when comparing memory usage on FreeBSD vs his Linux distro or maybe something wasn't configured properly.


I was thinking the same thing.

There is however a third possibility, a very common misconception when dealing with memory usage on Unix environments: more than often do people think that the operating system is using huge amounts of memory while in fact it's merely using it for caching purposes.

The real memory usage (so for actively running processes) is often but a fraction of what they're seeing.


----------



## fonz (Jun 17, 2013)

ShelLuser said:
			
		

> The real memory usage (so for actively running processes) is often but a fraction of what they're seeing.


Good shout. Unfortunately I don't remember the exact details off the top of my head, but I do seem to recall that there are significant differences in how Linux and FreeBSD organise their memory management. For example:

How much memory does a process initially get?
Or more to the point: given a certain size code segment and data segment, how is the above question answered?
When a process needs more, how much more does it get?
When are memory pages moved from RAM to swap?
What do people actually see, is it allocated memory, used memory, cached, what?
How much memory is kept in RAM for the OS datastructures?
Etc.
Different Unices answer such questions differently.


----------



## NewGuy (Jun 17, 2013)

Not only are those questions answered differently, but the way memory usage is displayed is different. Quite often I encounter people who are comparing FreeBSD's "active" memory with Linux's total usage (in use, plus cached). This makes it look as though Linux is using many times the RAM FreeBSD is. Or, as another poster pointed out, people compare FreeBSD's total usage (active + cached + swapped) against a system like Windows where they only see the actively used memory. This doesn't make for good apples-to-apples comparisons. A common mistake and the original author did say this was their first trip into FreeBSD land. I suspect they fell into the common memory statistics trap.


----------



## fonz (Jun 17, 2013)

NewGuy said:
			
		

> Not only are those questions answered differently, but the way memory usage is displayed is different.


That was actually one of the questions  But nevertheless, you are quite right.


----------



## h3z (Jun 18, 2013)

I am also glad that he is enjoying FreeBSD. He did mention Gentoo and Arch Linux. But, he did not specify that these where the distributions used for the comparisons. One thing that might be noted is that with almost all Linux distributions, many background services are enabled by default upon installation of the service. With FreeBSD, you are often given a message on the procedure for enabling the service, but it is by default not enabled. Since he is using GNOME, I can imagine it is in his practice to allow a Linux installation the inclusion of many, bloated bells and whistles. Its hard to say for certain. I don't and have hardly ever used GNOME. But, I have come to understand that some of the GNOME services available on Linux are not always included in a FreeBSD compilation of GNOME. Furthermore GNOME service available on FreeBSD, may not be enabled by default.

I didn't see a complete list of running applications and services, for either of his installations. But, I would bet that these things could make a huge difference. Maybe not a 50% difference in free ram. But, probably close depending on configuration.

It is still a plus for FreeBSD. He may have just enjoyed the ground up approach to the installation of FreeBSD on the whole, in comparison to Arch and Gentoo Linux. And, having tried them all myself, I can concur that FreeBSD is a far more logically designed installation. I can also add that, I have noticed less memory consumption from a base FreeBSD installation. I have also noticed more responsiveness from basic FreeBSD installation, when compared to basic Linux installations. But, that is just on my specific hardware. None of my machines being considered, up to date.


----------



## NewGuy (Jun 18, 2013)

I've tried running GNOME on several Linux distributions and on FreeBSD. There is virtually no difference in memory usage between the two. Certainly not as much a 50%. 

It's true many Linux distributions enable services by default, but even with many services installed it's likely to be a difference of around 50 MB of memory, which is hardly noticeable on a machine with 3 GB of RAM.


----------



## jozze (Jun 18, 2013)

Well, I've tried (been using it for a few years) Slackware 13.37 + KDE, the default (complete) installation, which installs around 6 GB of programs. Just to run idle it was consuming 1 GB of RAM (yes, I disabled those background file checks). I switched to x11-wm/fluxbox -- still it was using around 300 MB when idle. After that, I had enough of both (I made comparisons with some Debian based distributions and fluxbox was using up ~150 MB), so I installed x11-wm/spectrwm (known as scrotwm at the time), and Slackware was still eating up 200 MB. So yes, the differences can be drastic, since my FreeBSD consumes only ~60MB when idle (I use x11-wm/dwm).

To conclude, this doesn't mean that Linux uses more RAM, it just means that default Slackware installation isn't good for system resources. I prefer FreeBSD because it gives me power to tune my ports with this in mind, and not just mindlessly install programs like joe, nano or thunderbird, and a fistful of daemons running in the background by default (well, at least the contents of /etc/rc.d are well documented). The problem with Slackware is its main feature: it doesn't automatically resolve the dependencies, which is good if you install "ports" but for the "base" system, there shouldn't be such a thing (oh, base vs ports is another good FreeBSD thing).

So I prefer the FreeBSD make-me-what-you-want-me-to-be way, which is the canonical way for some other Linux distributions as well (Arch, Gentoo, Linux From Scratch and so on).


----------



## h3z (Jun 19, 2013)

NewGuy said:
			
		

> I've tried running GNOME on several Linux distributions and on FreeBSD. There is virtually no difference in memory usage between the two. Certainly not as much a 50%.
> 
> It's true many Linux distributions enable services by default, but even with many services installed it's likely to be a difference of around 50 MB of memory, which is hardly noticeable on a machine with 3 GB of RAM.



I fall short in GNOME experience. So, I am going to guess that you are for the most part right. I would still wager that some default GNOME installations use more RAM. I have seen some very bloated configurations. Just long enough not to use them though. These configurations from some of the more user friendly distributions. I'll admit that I never did check for RAM usage. The performance drag was enough for me to recognize a difference. But, I would not blame a bloated GNOME for the whole of it. 

I would guess that whatever the Linux distribution, the user likely caused the inflation of memory consumption. I could easily see someone installing a ton of software and not realizing the configuration changes taking place. Adding this to whatever was already running and this claim of excessive memory use, may just show that the user isn't understanding the cause of the usage. You'd think anyone actually experienced enough to express such a huge difference in RAM consumption would know to post a process list. And, having not done so is either exaggerating for some reason, or just doesn't understand why his system is now operating as he desires.

It is of no doubt, that he could get similar lean RAM usage results with whatever system he had been using.

Even if his claim is complete exaggeration, I am sure I could install/configure FreeBSD or any of the main Linux distributions with the high RAM usages he is claiming he had. So, without knowing if the guy is full of it or not, it could be possible that he just didn't understand how to get whatever distribution configured to his liking under certain RAM constraints. For some reason he was able to do so under FreeBSD. As stated before, he could simply not know how to read the free RAM outputs correctly between the two kernels. But, I wouldn't rule out poor configuration skills. Which if he is reading the output correctly, it would have to be poor configuration.

NewGuy, it might just be that you are a more experienced Linux user, than the fellow that made the switch. It does take more skill to undo the unwanted configurations of a Linux distribution, than it does to configure a FreeBSD system from base up.


----------



## NewGuy (Jun 19, 2013)

h3z said:
			
		

> NewGuy, it might just be that you are a more experienced Linux user, than the fellow that made the switch. It does take more skill to undo the unwanted configurations of a Linux distribution, than it does to configure a FreeBSD system from base up.



While it is true I have a lot of Linux experience under my belt, I was speaking of RAM/resource usage with stock installations. It is very rare I tweak an installation for performance or try to make a system leaner. Since even low end machines typically come with a few GB of RAM there is rarely a need to shrink things down.

I do install a lot of Linux distributions on a regular basis and I can tell you that, out of the box, most of the ones running GNOME 2 (or MATE) use around 120-150 MB of RAM. Ones running KDE default to around 220-240 MB of RAM. Ones using LXDE need around 100 MB or less. This is out out of the box without any tweaking or removing configuration options. Hardly numbers that justify the need for more than 3 GB of RAM.


----------



## sossego (Jun 19, 2013)

Another set of notes for desktop usage:

Linux systems do not always separate GUI/DE and you may have GtkX and QtX running simultaneously.
Linux is limited to 1000 Hz with a 2000 Hz kernel being unstable. FreeBSD can run unpatched at 2250 Hz and has been listed at 40 kHz for kernel rate.
As in point one, FreeBSD desktops rarely mix.
By default, the FreeBSD system is more secure. Having everyone with su access or using sudo for default is a bad accident waiting to happen.
The more you understand a system closer to UNIX, the more you will understand a clone of UNIX.


----------



## h3z (Jun 19, 2013)

NewGuy said:
			
		

> Hardly numbers that justify the need for more than 3 GB of RAM.



Yeah, you are spot on there. I don't think I have ever seen any default installation require close to that.


----------



## h3z (Jun 19, 2013)

jozze said:
			
		

> After that, I had enough of both (I made comparisons with some Debian based distributions and fluxbox was using up ~150 MB), so I installed x11-wm/spectrwm (known as scrotwm at the time), and Slackware was still eating up 200 MB. So yes, the differences can be drastic, since my FreeBSD consumes only ~60MB when idle (I use x11-wm/dwm).



Nice. I've been wanting to try a tiling window manager out.


----------



## jozze (Jun 19, 2013)

They're awesome, but like the authors of x11-wm/spectrwm say, x11-wm/dwm has silly defaults (no really, they're terrible), so be prepared for some tweaking yourself. For starters try x11-wm/spectrwm or x11-wm/i3, so you can live and tell how horrible x11-wm/dwm is with them.


----------

