Linux is an interpreter (astrid.tech)

by frizlab 55 comments 241 points
Read article View on HN

55 comments

[−] tosti 48d ago
This article was painful to read because of all the misconceptions. A cpio archive is not a filesystem. Author uses initramfs, which is based on tmpfs. Linux can extract cpio to tmpfs. An archive of files and directories is in itself not a program.

Just because something looks similar doesn't mean it's equivalent. Binary programs are executed on the CPU, so if there's an interpreter involed it's hiding in the hardware environment. That's outside the scope of an OS kernel.

If you have a shell script in your filesystem and run it, you need to also provide the shell that interprets the script. Author omits this detail and confuses the kernel with the shell program.

Linux can easily be compiled without support for initramfs and ramdisk. It can still boot and run whatever userland sits in the filesystem.

"Linux initrd interpreter" hurts my brain. That's not how it works.

Edit: should've read further. Still a backwards way of explaining things imho.

[−] jeffbee 48d ago
Binary programs are executed on the CPU but the program file is an archive with sections, and only one of them is the program, usually, while the others are all metadata. The CPU isn't capable of understanding the program file at all. Linux has to establish the conditions under which the program runs, that means at a minimum establishing the address space in which the program counter lies then jumping to that address. The instructions for how to do that are in the metadata sections of the ELF executable.
[−] saidnooneever 48d ago
not too bad explain, though the 'usually' might be clarified that an ELF file 'can have sections marked as executable' (tho ofc i get not wanting to get into segment flags :p) and also a program is cobbeled together potentially from many of these ELF files. in most cases the single file is useless. (most cases as in binaries provided by a standard linux distro, now 'producible binaries')
[−] Hasslequest 48d ago
It's the init in the cpio which is the interpeted program, and the rest of the cpio is memory for this interpeted progam.
[−] tremon 48d ago
How is it interpreted? Something that you load into memory and then set the processor's Instruction Pointer at is not interpreted at all. And in case /init is a shell script, it's not the kernel doing the interpreting -- the interpreter would be /bin/sh, which would still be loaded into memory and executed by the processor. Claiming that machine code is "interpreted" because it still needs to be finalized by a loader is not a clever gotcha -- it's ignorant erasure of relevant distinctions.
[−] commandersaki 48d ago
At least it isn't AI slop!
[−] vatsachak 48d ago
Isn't every OS an interpreter for machine code with kernel privileges?
[−] djmips 48d ago
Everything is an interpreter?
[−] qubex 48d ago
Turing’s Theta Combinator
[−] lstodd 48d ago
man ld.so:

... (in which case no command-line options to the dynamic linker can be passed and, in the ELF case, the dynamic linker which is stored in the .interp section of the program is executed)

note how the ELF section is named.

[−] pugchat 48d ago
[dead]
[−] ryguz 48d ago
[dead]
[−] kevinbaiv 48d ago
[flagged]
[−] ssyhape 48d ago
[flagged]
[−] unit149 48d ago
[dead]