views:

164

answers:

4

Here where I work I am attending a series of lectures about database query optimizers. While the speaker was introducing databases, he made a very insightful comment about a kernel having basically to administer tables of processes, pointers to open files, inodes, etc, and it's therefore basically a POSIX-compliant database engine. Clearly, having read the Bach a long time ago, when I was young and more inexperienced, I never got to analyze the thing from this point of view, but it's fundamentally true.

As you can imagine, it's not easy to google... so I ask: I was wondering if some crazy guy out there designed a (hopefully, just for fun, real fun) userspace POSIX-compliant kernel on top of MySQL...

Edit: please note. I'm not talking about a kernel having a database filesystem. I am talking about a kernel having the whole ring-0 state handled by MySQL.

Edit 2: clarification as it seems I've been misunderstood. I did not look for it to use it in production. I was just wondering if someone did it because he wanted to have fun. The real fun was a reference to the fact that Linux was done "just for fun" as I wrote, but it ended up as a serious product, hence my addition of real to imply total lack of seriousness. There's a bunch of useless projects out there that are made just because they are unusual or crazy enough to be funny just for the idea of it. My question was looking for something developed under this point of view.

+4  A: 

I don't know if it's been done, but if so, I wouldn't want to use it. Regardless of how fast it was, I can't believe it would be as fast as a highly-tuned, kernal specific set of data structures. I would think that you'd start throwing out features as quickly as possible from a general purpose DB to get performance and likely still end up with something slower than a purpose-built data structure.

tvanfosson
clearly it would be slow, but it would have a lot of nice properties:1) you can have atomic commits, redundancy, isolation, locking for free. 2) you can run the kernel to use a data space sitting on a remote machine. Clearly, it's not productive-relevant, but as a teaching aid, it would be cool.
Stefano Borini
I could see it as an interesting exercise to write a process-based VM that runs on top of some real OS that uses a DB for it's kernel data structures. That's probably marginally easier for someone who is already familiar with SQL than designing the data structures, locking mechanisms, etc. at a very low level -- on the other hand it's not very realistic either as an OS course assignment.
tvanfosson
Why not realistic ? ok, clearly it's not a "real kernel", but if you know how a database works, it should be easier to explain how a kernel works in terms of relational database terminology and actions.
Stefano Borini
Precisely because it removes the complexity of managing the kernel data structures. IMO that's half the battle.
tvanfosson
@Stefano: OS kernels are not ordinary applications. Performance is much more important, and they don't need to be produced in great variety so it isn't as important to streamline development. Therefore, getting features "for free" (as in "using off-the-shelf general solutions sacrificing a lot of efficiency") is much less important. I don't know how good a teaching aid it would be, since when you abstract all that out of the kernel you're removing a lot of important stuff.
David Thornley
A: 

BeOS was database-based wasn't it?

In the other direction, Plan 9 makes everything part of the filesystem.

profjim
A: 

That wouldn't work - by definition MySql depends on the Kernel in order to function (it is a process, and in order to function it needs filesystem access), and so we are left in the impossible "which comes first" situation.

Kragen
you could say the same for user-mode-linux :)
Stefano Borini
I don't see why this reply was down-voted. If you intend to store all OS datain a relational database the database engine would have to beimplemented and would contain most of what an OS needs soyou just end up moving that code from place A to place B.The database engine cannot exist in a vacuum.
Per Ekman
+1  A: 

I would expect the point of any operating system course be to teach students about software/hardware interfaces, inherent concurrency in dealing with hardware, various synchronization techniques, physical and virtual memory management, etc. and thus proper design of appropriate kernel data structures. There's also wealth of history and open source code to go over.

What you are describing is a toy. It might be fun to draw on a board and argue about, but it takes you much further from the actual hardware machine by introducing some fat abstraction. Given that most CS students nowadays have very vague idea about hardware and OS internals, I wouldn't want to hire anybody who had this for an OS course :)

Nikolai N Fetissov