# Is is FreeBSD's kernel cleaner and smaller than Linux?



## owemeacent (Jul 10, 2014)

This might be somewhat controversial topic, but I need to ask this question.Which kernel is better? I don't mean which has more support for every single driver or a firewall and a virtual machine built in. But which is more "pure"; stable, faster, more easy to read and develop on? I know Linux is HUGE and has everything you could put  in a kernel. I don't know about FreeBSD though. Or any of the *BSD's.


----------



## Crivens (Jul 10, 2014)

Here you may find some answers to this.

True, Linux has thrown anything in that was in reach. But last time I checked they still had no gold plating on their kitchen sinks. 

I also found that not the source code determines if you can more easily develop for something but the strategy, the pattern, the mental processing of all people involved needs to be on the same line. I have found code that reads like a poem, is crisp and clear, but I would not want to touch it because I simply can not get my mind into compatibility mode for that structure. So while it is good code, I would only mess it up. So in the end - you need to read the code, see it working. See if you can _grok_ it, be comfortable with it. That is your decision to make.

But *BSD kernels are of course way better, cleaner and more robust. You can ask anyone around here  :e


----------



## owemeacent (Jul 10, 2014)

Is it smaller? In the way where it only does what a kernel is supposed to do? Not have a firewall, a virtual machine, and its own command line? What about modularity? Does it have the ability to not have audio built in, but be able to mount it using a module?


----------



## bsdkeith (Jul 10, 2014)

I am pretty sure all kernels, Linux or BSD, can be built without sound & and a lot of other things that some people don't use, but you will have to determine the exact pieces to include/exclude when compiling them. (So it is really a case of six of this, half a dozen of that.)


----------



## drhowarddrfine (Jul 10, 2014)

Development and architecture questions like yours are best on the mailing list because more of the FreeBSD developers are there on a regular basis and know the ins and outs and details.


----------



## CurlyTheStooge (Jul 10, 2014)

drhowarddrfine said:
			
		

> Development and architecture questions like yours are best on the mailing list because more of the FreeBSD developers are there on a regular basis and know the ins and outs and details.



And developers are known to answer questions like this in spite of working on important stuff?

Regards.


----------



## drhowarddrfine (Jul 10, 2014)

I'm saying I see a lot of them there plus a lot of people who know the bowels of the system far more than me.


----------



## wblock@ (Jul 10, 2014)

CurlyTheStooge said:
			
		

> drhowarddrfine said:
> 
> 
> 
> ...



In preference to actual work, oftentimes. 

But "better" and "cleaner" are subjective and vary depending on viewpoint.


----------



## Oko (Jul 10, 2014)

BSD kernels are significantly smaller than a generic Linux kernel. Last time I checked it was like ten times smaller.


----------



## drhowarddrfine (Jul 11, 2014)

You can flame me for this but I'll say it anyway. Unix, and therefore FreeBSD, has its origins in a research lab by computer scientists who are hailed as having developed one of the greatest accomplishments in computer history. Linux has its origins by some kid in his basement who is hailed for copying Unix and making it successful.

Now I'm not pooh-poohing that all that went well for Linux, or that the current developers are kids who don't know what they're doing, but, when you are buying a house, you'd turn down anything based on its foundation and how much tinkering was done with it. Linux does a lot of questionable tinkering with its foundation for questionable purposes and that bothers me quite a bit; not to mention the culture.


----------



## kpa (Jul 11, 2014)

drhowarddrfine said:
			
		

> You can flame me for this but I'll say it anyway. Unix, and therefore FreeBSD, has its origins in a research lab by computer scientists who are hailed as having developed one of the greatest accomplishments in computer history. Linux has its origins by some kid in his basement who is hailed for copying Unix and making it successful.



You're completely wrong about this. Linus was a university student in the same university and department (Department of Computer Science at the University of Helsinki) where I studied in the early 90's. He was far from being a model student but he knew his stuff damn well, well enough to build his own operating system. He was as far as from the "kid in his basement" you're trying to portray him as you can get.


----------



## CurlyTheStooge (Jul 11, 2014)

drhowarddrfine said:
			
		

> You can flame me for this but I'll say it anyway. Unix, and therefore FreeBSD, has its origins in a research lab by computer scientists who are hailed as having developed one of the greatest accomplishments in computer history. Linux has its origins by some kid in his basement who is hailed for copying Unix and making it successful.
> Linux does a lot of questionable tinkering with its foundation for questionable purposes and that bothers me quite a bit; not to mention the culture.



Kid in the basement? Wow, how many lines of C code have you contributed to _the_ FreeBSD kernel or CVS? I _[who? -- mod.]_ don't get offended anymore because this is exactly the same attitude of some *BSD users which kept the Linux developers as well as users away from *BSD as a whole and makes them think that all the *BSD guys are elitist. I think this thread has served its purpose now, trash talking Linux and its developers.

Regards.


----------



## drhowarddrfine (Jul 11, 2014)

kpa said:
			
		

> You're completely wrong about this. Linus was a university student


My comparison is no less true. A young student versus a research department filled with experienced computer scientists. There is nothing elitist about the truth which you verified.


> Wow, how many lines of C code have you contributed to FreeBSD kernel or CVS?


It was my reason for choosing FreeBSD over Linux years ago. Whether I contribute code to anything does not matter. If you ever had eye surgery, chances are the computer system controlling the surgeon's instrument was designed by me but what does that matter? You wouldn't want me cutting on your eye.

I also had an article published in Byte magazine back when it mattered but that's not gained me much. What does that prove?


----------



## fonz (Jul 11, 2014)

This thread is eerily similar to this one and this one before that, all from the same OP who appears to have nothing else to talk about.

Wrap it up, guys. Or it gets locked.


----------



## zspider (Jul 11, 2014)

I knew the title sounded suspicious, I didn't look at the poster's name originally, but now it's obvious what's probably intended.


----------



## Deleted member 9563 (Jul 12, 2014)

I was watching this thread because I had hoped that some insights would emerge.  I guess the title should have been a clue. There's lots of ways to discuss things, but I don't think that putting down other operating systems is classy on this particular forum.


----------



## drhowarddrfine (Jul 12, 2014)

If you were referring to what I said, please point out anything that wasn't true. In fact, I even said this which was ignored:



> Now I'm not pooh-poohing that all that went well for Linux, or that the current developers are kids who don't know what they're doing


----------



## max21 (Jul 12, 2014)

Why do people loss focus?  I can’t go into the compete history of UNIX butUNIX/FreeBSD runs an ATT, Cell-phone companies, Fortune 500's, home and small business as server, router, gateway, firewall, etc in the most secured fashion, to this very day!  It is only a bonus at developer efforts, all for FREE, forever, _those guys with the big chip on their shoulders, an a tiny wing to beat you down_, to make it desktop/workstation compatible like no other.

Even most users of this system and administrators don’t know the FULL power that this tool has to offer.  The most important thing to me is duel-booting and I learn all I ever need to know.  Example; you can see Windows with LINUX, but it can’t see or read FreeBSD _slices_, its partition,  with out tools ... _which is impossible to limited_.  You can’t see LINUX or FreeBSD using Windows which may be possible with special tools but they are very limited and surely read-only.

You can use FreeBSD to see, read and write to Windows and LINUX files or any distribution.  You can manipulate these files for the better.  THEY DON’T LIKE IT because they can’t do it and they love hiding things from the root _the owner_, such as Ubuntu, Red-Hat Enterprise and Windows.  But they all know if they go too far they will get rejected.  OS’s is for the user and programmer written carefully by the author.  FreeBSD don’t even have to hide anything because everything is a file!

When all is said and done, if you need more control than that, beyond an FreeBSD server or Desktop Hosting system, we got PcBSD with PBI to take care of the rest of the business.   PcBSD is a Fedora equivalent which is the toughest I use when it runs open-office.  PcBSD may not be  faster than Fedora, but it will win out soon ... but look at what you get as an experenced computer user... *all of the above*.

UNIX/BSD is where Windows and LINUX got their ideas from.  FreeBSD like anything else is only a tool, but it’s is the best tool of our day since it was invented.  It may be old, but even dirt is old.  You can pollute it but *it will never die*!!!



> Is is FreeBSD's kernel cleaner and smaller than Linux?


Sorry for overlooking the OP’s question.  Yes FreeBSD's kernel cleaner and smaller than Linux as it comes out the box, and if you like, you can build your own custom kernel even smaller to meet only your needs.  To my knowledge, Windows nor LINUX don’t allow that.  Who could ask for more?


----------



## CurlyTheStooge (Jul 12, 2014)

max21 said:
			
		

> ... LINUX don’t allow that.  Who could ask for more?



This is plain FUD. Please stop, sir. What do you think DSL and TinyCore Linux are running under 20 MB?
You can strip the kernel down (compile modules only for things that you require at the moment), compress the kernel / optimize for size etc. You can make even smaller ones, for specific systems, one example - embedded ones. Why do you think Linux is running on so many embedded boards alongside NetBSD and other BSDs?

On a running 300-500 MB CentOS minimal server install, I need to download just <30 MB kernel source to study the innards. I may or may not be able to do this on FreeBSD but I'm not spreading FUD about it.

Regards.


----------



## TiberiusDuval (Jul 12, 2014)

As far as I know, you certainly can compile your own custom Linux kernel and make it with a very small footprint. How else you could run it with many embedded devices without much resources?


----------



## max21 (Jul 13, 2014)

> On a running 300-500 MB CentOS minimal server install, I need to download just <30 MB kernel source



@CurlyTheStooge, what is FUD?  Anyway, I forgot about embedded systems.  A full-blown FreeBSD kernel is about 19.3 MB and a Arch Linux kernel can be under 1 MB, but what can it do?  It’s like comparing apples to oranges.  I know Linux is fast but it doesn’t handle memory and other things well enough when under high load I read.  Even you know there are more issues with Linux than with a raw FreeBSD server.

I see that the OP's main concern is the ease of working with the kernel to do some programming.  On that note, I might have to say Linux because there is not much help beyond configuring a FreeBSD system to do specific things and they do this very well.

You would have to do a lot of searching, join the FreeBSD news group and visit the Kerneltrap website.  I plan to do this myself one day.  But what makes Linux cool to program is that you can deal directly with the registers, just like Windows, that’s what makes it fast vs FreeBSD coding.

You have to push when doing ASM coding with FreeBSD.  Other wise it’s best to have some C experience.  I've been hoping for someone to post what registers have been available to use under FreeBSD over the years.  For me, C is simply for the complicated minds who can match its complexity.  I can deal with JAVA, C++ or ASM.  There is something new about it that was in the release notes a few years ago, where FreeBSD made it possible to touch a few few unused (maybe) kernel registers but I have not been able to find it since.  And I tried hard, it’s like it was erased from the notes.  If there is a way, I would choose FreeBSD to program over Linux any day.  But I plan to do a little of both once I get the 10.0 upgrade set up just the way I need it.  Web and system development is my entire reason for doing so.  I’m hoping to break some  speed barriers.  I use Linux to take care of my FreeBSD disk for years.  How I do this is in all my most _[all or most, which is it? -- mod.]_ of my previous threads.


----------



## CurlyTheStooge (Jul 14, 2014)

max21 said:
			
		

> what is FUD?



Fear, uncertainty and doubt. Just in case I was not clear.



			
				max21 said:
			
		

> Even you know there are more issues with Linux than with a raw FreeBSD server.



No, I'm not aware of any more "known" issues with a raw Linux install than a raw FreeBSD install and I'd like to know about those.

Regards.


----------



## Cthulhux (Jul 14, 2014)

Linux's kernel won't be any cleaner nor smaller in the foreseeable future, thanks to systemd. A pity.


----------



## ucsdboy (Jul 17, 2014)

This question sounds like flame-bait. If the user doesn't do kernel-work, it shouldn't really matter to them; if they do, they know how to answer the question themselves.


----------



## ShelLuser (Jul 18, 2014)

Amazing how quickly this thread derailed.

Although I really don't like "RTFM" kind of answers my first and foremost advice would still be to "RTFH"; Read The Fine (FreeBSD) Handbook, because it contains all the basic information which you seem to be after. I'm specifically referring to chapter 9 of the handbook which explains how and why one would build a customized kernel.

The reason I point this out is because of the OP's second post in this thread where he clearly shows to be unaware that you can indeed customize the kernel. But also seems to be unaware of the modular build. Yes; the FreeBSD kernel is modular, and can load (and optionally unload) kernel modules in the same way as Linux can (look into the kldload(8) manualpage for that, don't forget to pay attention to the SEE ALSO section since it contains very useful references as well).

As to the "_which one is better_" question my answer would be "It depends" as both have advantages and disadvantages.

When looking at the process of customization I'd say that for single machines and/or servers the Linux process is far out superior because it provides an interactive option to configure your kernel. Not only that but it also supports all commonly used environments such as the commandline (you can even script this if you want), a graphical environment and even X itself. Where (IIRC) it even has native support for both X as well as GNOME. Keep in mind: I could be wrong on the GNOME part (and I'm not interested enough to look this up), but it most certainly knows the `make xconfig` option.

FreeBSD on the other hand provides a common text file with (most) options mentioned which you can use to base your own configuration on. Either by copying the file and editing it to suit your needs or by simply including it and then overruling whatever option you (don't) need. It could be a little more tedious in comparison.

However... When looking at maintaining a whole server park this immediately becomes a different ballgame. Where Linux relies on a single configuration file called .config which, also due to the hidden nature, isn't very easy to work with, FreeBSD allows you to use whatever you want. I'm now referring to the KERNCONF compiler option which allows you to specify what kernel configuration you want to use. Not only makes this the configuration file a _lot_ more portable, it also makes the whole process more flexible (in my opinion) because you could actually build several kernel configurations side-by-side and use them as such.

Fictional example (something I thought about but never got around to implement): building both a customized and a fail-safe kernel, where the latter is basically the kernel provided "as is" by the system (default configuration). On Linux this would require a lot of tinkering, on FreeBSD such a setup can be done "out of the box".

SO yeah, which one is better? I don't know...  The real question here which should matter, in my humble opinion naturally, is if this even matters at all? Simply because you can't define "better" in the first place.

Having all the facts out of the way I'd also like to vent my opinion on the matter. Personally I do think the FreeBSD kernel is better in some ways, or perhaps more professional would be a better description for it. It starts with the configuration process of course, but what to think about all the different kernel variables which you can use to tweak the system into doing exactly what you want?

I'm now of course referring to the kernel variables which you can easily check yourself using sysctl (see for example the `$ sysctl -ah | less` command). And which you can set using that very same command or, if you need this to be set during the boot stage, using the /boot/loader.conf file (see loader.conf(5)).

In this field I personally think that the FreeBSD kernel is by far superior feature wise. From controlling user access, RAID (storage) flags, access limits to simply checking up on current activities. However, in all fairness, also keep in mind that I haven't paid any attention to the developments which have happened in the Linux kernel (apart from stuff you sporadically pick up on common tech magazines) for over two - three years or so.

Still; flags like security.bsd.see_other_uids keep amazing me; all supported "out of the box" ((dis)allowing users to see processes other than their own).

Then another pro (and once again I'm only stating opinions here): the way the kernel interacts with the base system. You don't simply download "the kernel source", but you download the full FreeBSD source code (the base system) from which the kernel can also be built. Effectively allowing you to build both a customized kernel as well as a customized base system. Using that approach you can be fairly sure that the both of them will interact fine with each other. After all; you're using the same source tree in the first place. That's a totally different approach than a kernel with a lot of different ("separate") user-land tools built "around" it.

Finally...  To close off with some cold hearted facts again. A very important, yet also usually completely overlooked feature is of course the documentation. It's cool if your kernel can support a thousand and one (night) features, but who is going to use them if only the programmers know for sure how to use them?

I already mentioned Chapter 9 of the FreeBSD handbook (dealing with kernel configuration), but there's a lot more. If you really wish to know more about the kernel then you'd also want to learn how it actually works. How it functions; how does it get loaded, how does it treat those different modules, what about the whole _architecture_? Enter the FreeBSD Architecture Handbook. Which will explain the bootstrapping process, jail sub systems, (virtual) memory usage/administration and of course how the device drivers ("kernel modules") work, behave and are to be built.

Which immediately touches a different subject: developers. So you want to be a FreeBSD developer? You want the FreeBSD Developers Handbook then. Not only does this handbook explain more about the whole architecture and the structure behind FreeBSD in general, it also provides more technical details on how to build and debug your kernel.

That's a whole mouth full 

So if we then head over to kernel.org in comparison I think it's safe to say that the documentation part is a little lacking in comparison; I couldn't find a straight forward link which explained to me how to compile the kernel.

Eventually I checked the FAQ section and found a reference to the Kernel newbies website. It still doesn't feature an obvious link which points you to the instructions on how to compile the kernel, but if you check its own FAQ section you will finally discover the entry on How to compile the Linux kernel.

Both projects provide the documentation on how to set the whole thing up, but of course I think the FreeBSD documentation is much more straight forward.

Which boils down to my end conclusion here; there is no "better" kernel.

In general both roughly provide the same feature set, both can be customized, both are modular and both are documented.

Would I have to chose between the two then I would say that the FreeBSD counterpart appears to be much more professional, based on both the feature and documentation set it provides.


----------



## SirDice (Jul 18, 2014)

Something I haven't seen mentioned here yet, the Linux and FreeBSD kernels are both _monolithic_ kernels. Just because you can load and unload modules doesn't change this fact.

If you want a real small kernel look for a Microkernel like MACH.


----------

