Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocking or Non-Blocking? #1

Open
thejpster opened this issue Dec 2, 2019 · 3 comments
Open

Blocking or Non-Blocking? #1

thejpster opened this issue Dec 2, 2019 · 3 comments

Comments

@thejpster
Copy link
Member

Should the common BIOS API have naive blocking functions? They are easy to use and simple to implement, but they hurt performance (e.g. printing 15 characters when you only have an 8 character FIFO will cause the CPU to spin for the duration of 7 characters - or 608 microseconds at 115,200 bps).

Non-blocking functions are more complicated - you'd have to get some aynchronous object back which represents the transaction which you'd need to poll for completion at some later date (c.f. Windows Overlapped IO).

A compromise might be functions which process as much data as they can without spinning, and return a value indicating how much has been processed. Obviously disk reads block until the entire sector is available, but writing a [u8; 16] to a UART might write half the buffer into a FIFO and then return 8 to indicate some data was left unwritten. The OS can then decide whether to retry immediately or come back later after doing some other work.

@IGBC
Copy link
Member

IGBC commented Dec 6, 2019

Probably both, with blocking implementations working as block!(call)

@thejpster
Copy link
Member Author

So, the OS isn't going to support processes, as we don't have an MMU. But is it going to support threads? Acorn MOS, Commodore Kernal, MS-DOS and CP/M didn't, to the best of my knowledge - they just had basic single-byte routines, or blocking sector-based disk reads/writes. Supporting the writing of multiple bytes at once offers greater performance/efficiency, especially on platforms like the Nordic nRF where all UART access is done via DMA but I'm not yet convinced that making the BIOS API more complicated to gain some efficiency on an uncommon operation on an uncommon platform is a good trade-off.

@IGBC
Copy link
Member

IGBC commented Dec 7, 2019

I expect the BIOS to evolve as applications are written ontop of it. The structure of the BIOS call table, I feel we can add functions as long as we don't remove any.

With this in mind I feel we can add Aync BIOS calls later if/when needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants