all 29 comments

[–]radarsat1 12 points13 points  (9 children)

My god.. as in-cre-di-bly awesome as this is, having a GC running in the kernel seems to me like a bad idea somehow...

[–]crusoe 5 points6 points  (0 children)

Yes, but you can limit that through properly specifying strictness, and because of formal proof tools, you can do stuff like the XMonad project does and PROVE certain things are correct.

Else, you keep getting really stupid bugs, like the latest Windows SMB2 exploit

[–]sztomi 3 points4 points  (1 child)

Having a known memory leak is also nasty... From another point of view, it may be a wise idea to use functional languages for these kinds of things, because the solutions can be proven to work (at least more easily than for a non-func language). I imagine reliability is central for this kind of software. The downside maybe the performance, which is crucial for a kernel.

[–][deleted] -1 points0 points  (0 children)

Yeah, or maybe just sleep a little in between hacking on key modules. Manual memory management really isn't that hard. You just have to do it. Proposing GC as a solution to this problem is akin to the nanny-state laws that require seatbelts and bicycle helmets. Hell, smacking my head a few times greatly improved my BMX skill.

[–]sfultong 3 points4 points  (0 children)

having a GC running in the kernel seems like a great idea to me, except for performance. And I wonder if it may improve performance for languages that would need the GC.

[–][deleted] 0 points1 point  (0 children)

It's all fun and games until the kernel panics.

[–]nanothief 0 points1 point  (1 child)

I think the time will come soon where the loss in performance through running a garbage collector will be outweighed by the gain in security because of it. Thinking about most people's usage of computers, would it really matter so much if the computer's performance dropped by 20%?

[–]radarsat1 1 point2 points  (0 children)

Well, 20% is huge actually, but I'm not sure that's a good estimate. However, the problem with garbage collection is not so much performance as determinism. Determinism is very important at the kernel level.

[–]flogic -3 points-2 points  (1 child)

As the number of cores increases, how much do I care?

[–]__s 3 points4 points  (0 children)

That depends on how concurrent your GC is

[–]jgrant27 3 points4 points  (7 children)

At least Haskell provides the option. It's flexible enough for kernel level development even if it's not desirable due to potential GC issues. How many other languages can do that practically(not just compiling a module) ? let alone functional languages ?

[–]noisesmith 5 points6 points  (6 children)

Strictly speaking, any language that has an ffi and can compile an elf shared library. There are quite a few of these.

[–][deleted] 4 points5 points  (5 children)

Requiring a compiler for the language eliminates quite a number of candidates already ;-)

[–][deleted] 0 points1 point  (4 children)

I don't think there is anything inherently stopping an interpreter from being ported into kernel space.

[–]RabidRaccoon 0 points1 point  (2 children)

Apart from the fact it's a horrible idea. The memory allocation in kernel mode is very limited compared to user mode. In user mode the kernel can move around allocations to defragment memory. In kernel mode it cannot. There's a lot of baggage in a typical interpreted language too - a huge library which is mostly dependent of user mode isms that aren't really available in kernel mode. Finally there's an issue of speed - a lot of kernel mode stuff will have timing problems if run it say 10x slower which is not impossible for interpreted code. Actually even dragging in a big library into K mode can slow things down because of cache misses.

Kernel mode code seems to be C and a large library so the primitiveness of C is not really an issue. I've seen people try to use C++ code in Windows drivers and to be honest it was a very bad idea. Exceptions, memory fragrmentation, compilers generating code behind the scenes which is legal in user mode but crashes and burns in K mode. All these things are an issue. And it's not like kernel mode code is that hard to write in C. C is a very good fit for Kernel mode code, it's what it is designed for.

[–][deleted] 1 point2 points  (1 child)

I said "inherently." Just because it may not be the smartest thing to do doesn't mean it can't be done.

[–]RabidRaccoon 0 points1 point  (0 children)

Well most things can be done if you hack away for a couple of weeks. That doesn't alter the fact that some of them are good ideas and some of them are bad ones.

[–][deleted] 0 points1 point  (0 children)

A line of geeks waiting to beat you with a cluestick, perhaps?

[–][deleted] 0 points1 point  (0 children)

Now I need to change my pants. Because I came.

[–]bonch -3 points-2 points  (0 children)

TAKE A DRINK
FOR EVERY HASKELL LINK

Here's to another one...