Live data from Hacker News

Executable Is a SQLite Database

fzakaria.com

21–30 of 116 posts

Re: Executable Is a SQLite Database

#21
The copied vs. mapped memory situation is the only deal breaker in this experiment. Otherwise, file format unification would be a big step forward. The PE/COFF executable file format used by Windows (and some older Unix systems) is a relational database as well. The same goes to .NET assembly format - it's a relational database too. The wheel gets reinvented over and over again.

Re: Executable Is a SQLite Database

#22
Yes !

This has been on the back of my mind for a while. And, as other commenters have noted, it would be great for the file to contain the (self-modifiable) Lisp image, a builtin virtual file system, and whatever the application want to use as (runtime modifiable) extra tables.

I find SQLite dynamic linking being basically compatible with ELF dynamic linking to be very impressive, I can imagine that if well done, it cloud replace most uses of AppImages with a much more efficient format, like the author suggests.

How about an option for compressing section contents within the SQLite blobs, since the author mentioned you can't mmap directly the text pages and have to copy anyway ?

There are two extensions that I was thinking would make a SQLite executable truly unique.

First, a linking extension that would allow patching in functions and hooks more directly to allow for a very powerful plug-in system. Imagine the plug-in SQLite defining a BEFORE/AFTER/REPLACE hook for some symbol the host SQLite defines as extensible.

Second, re-linking at runtime. This would require application author cooperation because you won't be able to do that from anywhere, but imagine changing a dependency or loading a plugin at runtime through editing the db, and the interpreter just maps that on demand/automatically in the background, now next time your web server accept(), it calls the new version of the handling function.

Re: Executable Is a SQLite Database

#23
post #19

What if, we put the sqlite driver in kernel space? So this is your only filesystem like a unikernel

It's a lot of machinery to put into a kernel.

(Even with ELF, a kernel can have a relatively simple parser and loader and leave more challenging work to user space... like relocations, dynamic libraries, etc.)

Re: Executable Is a SQLite Database

#27
post #20

A lot of kernel filesystem features should be inside a database as well.

Yes. In this interview Michael Stonebreaker, one of the original developers of PostgreSQL, discusses (among other topics) replacing the file system with a database :

https://www.youtube.com/watch?v=YPObBOwIrHk

Re: Executable Is a SQLite Database

#28
post #10

I was thinking that someone managed to put an ELF header in an SQLite file while keeping it compatible with SQLite... but no, "just" a new binary format. Very interesting nevertheless!

Unless I missed something. The author queries the bin in one of the examples using sqlite3.

The author instructs the OS to execute it natively my adding it as a binary format.

Re: Executable Is a SQLite Database

#30
I can buy that an object file can be viewed as a relational db. Why SQLite though? Why not SQL query engine over the object file using a virtual table abstraction? I’m not seeing how most the SQLite features, with the exception of a subset of the query engine would translate over.

If the author wants to make a case for including schema metadata in an object file, again why SQLite? This strikes me a lot as someone who is trying to find uses for their favorite hammer (a very useful hammer I might say) rather than a serious exploration of what a new, improved object file format would look like.

(And that’s totally ok)

Post reply on HN