Skip to content
Simon Willcocks edited this page Sep 22, 2022 · 1 revision

PipeOp

Operations

Create

Create a pipe for synchronised inter-task communication.

Max data Max write size (largest block of data that may be written to the pipe) Allocated mem (Task-local or shared memory to hold the data) Block size 0, 1, 512, max write size?

WaitForSpace

Block task until N bytes may be written

SpaceFilled

I've filled this many bytes (wakes any thread blocked in WaitForData)

PassingOver

Another task is going to take over filling this pipe

UnreadData

Useful, in case data can be dropped or consolidated (e.g. mouse movements)

NoMoreData

I'm done filling the pipe

WaitForData

Block task until N bytes may be read

DataConsumed

I don't need the first N bytes written any more (wakes a thread blocked in WaitForSpace)

PassingOff

Another task is going to take over listening at this pipe.

NotListening

I don't want any more data, thanks

This will delete any pipe that has had NoMoreData called on it by the writer.

Errors: If there's outstanding data?

Use Cases

VDU stream

Byte-wise, receiver will wait for, say, 8 bytes after a 23 character.

Sequential File

File that will be opened, read or written, then closed.

Allocate capacity plus one block (sector size, page size), so that writer can always write capacilty bytes and reader can always write whole blocks to storage.

Random access file

Allows for fseek-like actions. There is one file pointer (per file handle).

Needs a WaitUntilEmpty function, which notifies the reader/storage writer that the data in the pipe should be written before the pointer is modified. The fileing system may need to perform a read-modify-write on the first and last blocks.

It should be clear to the reader that it's not the same as no more data (which could delete the pipe, but only if the listener says NotListening, so may not be needed if associated with a file handle)

Whole file read

Create a pipe for the filing system to write to local memory, FS will be given a virtual view on it and fill it up. The reader can simply wait for the whole size to be filled.

Running an App (fe8) file

Same as above, into a new TaskSlot, then jumping to 0x8000 when it's loaded.

Clone this wiki locally