ls says in green what the shell will start
Directories were already blue. Something the shell will run is green now, and it is asked by LOOKING rather than looked up. This was priced once as needing a runnable bit in the directory entry, set by the filesystem from a list of magic numbers it would have to be taught - declined twice, for putting format knowledge in the filesystem and giving two implementations a registry to keep in step. It costs nothing of the sort any more. The shell decides what to run by reading a file's first block, so "will this run" is a question with an answer already, and this asks the same one the shell would: SBEX for a program, "#!" for a script. Nothing is written down and nothing has to agree about anything. The price is a block read per file, which is exactly what the bit existed to avoid: a listing of thirty seven files went from 260,593 cycles to 635,321. It is paid in ls and not in dir on purpose - dir is the listing you audit and is built into the shell, this is the one you read and was loaded off the disk anyway. The fast one stays fast. plain.script is the proof on the test disk: it sits among a dozen scripts that are green and is not one, because it is the fixture with no shebang and the shell will not start it. The extension is decoration and the colour is the truth, which is the whole of what running by content means, finally visible. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E2JrLzFvuFX9fgi1LDRjrW
This commit is contained in:
co-authored by
Claude Opus 5
parent
afda6ca83b
commit
eaeb473176
@@ -724,6 +724,17 @@ sorting. Nothing here sorts; entries come back in the order the directory holds
|
||||
order arbitrary, down-and-across buys nothing and costs a division on a machine that cannot
|
||||
divide. If sorting ever arrives, that is the moment to change it.
|
||||
|
||||
**Something that will run is green**, and that is asked by looking rather than looked up. The
|
||||
shell decides what to run by reading a file's first block, so "will this run" already has an
|
||||
answer and this asks the same question the shell would: `SBEX` for a program, `#!` for a
|
||||
script. It costs a block read per file, which is exactly the price a *runnable bit* in the
|
||||
directory entry was proposed to avoid - and that bit was declined twice for putting format
|
||||
knowledge in the filesystem and giving two implementations a registry to keep in step. Paying
|
||||
the price here instead buys the same listing and writes nothing down.
|
||||
|
||||
It is paid in `ls` and not in `dir` on purpose. Reading every file roughly doubles what a
|
||||
listing costs; `dir` stays the fast one, and this one was loaded off the disk anyway.
|
||||
|
||||
**The width comes from the screen**, port `0x32`, which is 80 while CosmOS is running because
|
||||
CosmOS asks for the wide mode as it starts.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user