Devices that take time, and a filesystem that waits for one
The disk's status has always had a bit meaning "still going", and the header beside it has always said to honour it. Nothing did, because nothing could: the host finished the transfer inside the instruction that asked for it, so the bit could never be seen up and asking about it was asking about something that cannot happen. --disk-cycles gives it a latency. The command is still checked at once, because a refusal is not work - a block that is not there fails before any head moves - but the transfer is remembered and done when the machine has run that far. Until then the buffer holds the block BEFORE this one. That last part is the point. A program that does not wait gets the wrong bytes rather than an error, which is the failure the bit exists to prevent and the one that would never have shown up. With a latency of two thousand, CosmOS could not even mount: sbfsMount reads block zero and looks straight at the buffer. deviceTick is the general shape rather than a disk feature. Called once per instruction with the machine's clock, it lets anything whose moment has come finish - which is what a display that refreshes, or a port that waits on the host, would want in exactly the same way. The filesystem watches the bit now, in one small routine reached with RCAL. That is not decoration: what it hands back is the settled status in A, and CALL puts A back the way it found it, so an ordinary call cannot carry the one thing this exists to carry. Two bytes of Stack rather than ten, in a routine that runs on every block the machine ever touches - the first place in the system where the new call is the right one rather than merely a cheaper one. The manifest takes a @N after a disk, the way it already takes :ro, so a test can ask for a slow one. cosmosSlowDisk lists a directory at two thousand cycles a block and gets the same listing as everything else, which is the whole assertion: a filesystem that did not wait would print nonsense rather than fail. Zero is the default and every other test runs at it. What waiting costs, on a directory heavy run: 229k cycles at zero, 275k at five hundred, 415k at two thousand, 1.16M at ten thousand. 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
e0cf0a9a25
commit
d4cba36c5e
@@ -113,12 +113,23 @@ writes that set it up and nothing for the quarter of a kilobyte that moved.
|
||||
|
||||
The transfer stalls the program that asked for it. Whether hardware would let the two run at
|
||||
once is left open, the same way pipelining is: the memories are separate, so it plausibly
|
||||
could, and the measurements say it would buy less than it sounds like. Whether real hardware would overlap a fetch with the end of the
|
||||
could, and the measurements say it would buy less than it sounds like.
|
||||
|
||||
**The disk can be given a latency** with `--disk-cycles`, and then it really does take that
|
||||
long: it says busy, finishes when the machine has run that far, and a program that does not
|
||||
wait reads the block *before* the one it asked for. That is not an error anywhere - just
|
||||
quietly the wrong bytes - which is why the filesystem now watches the busy bit rather than
|
||||
trusting the answer to be there. Zero is the default and is how the machine has always run.
|
||||
|
||||
The waiting is one small routine, and it is reached with `RCAL` rather than `CALL` because
|
||||
what it hands back is the settled status in A, and an ordinary call would put A back the way
|
||||
it found it. Whether real hardware would overlap a fetch with the end of the
|
||||
previous instruction is left open, and deliberately: this is the conservative model, and
|
||||
pipelining is a decision to make while drawing the hardware rather than one to inherit from
|
||||
an emulator.
|
||||
| `-f`, `--fast` | Run as fast as the host allows, ignoring the emulated cycle rate. |
|
||||
| `-D`, `--disk <file>` | Attach a disk image, creating a 128K one if the file is not there. |
|
||||
| `-L`, `--disk-cycles N` | How many cycles a block read or write takes. Zero, the default, finishes before the next instruction starts. |
|
||||
| `-W`, `--write-protect` | Attach the disk read only. A disk whose image the host will not let you write is read only whether you ask for this or not. |
|
||||
| `-h`, `--help` | Show help and usage information. |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user