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

Add Scheduler tutorial #1250

Open
afaq-optimtec opened this issue Oct 27, 2023 · 3 comments
Open

Add Scheduler tutorial #1250

afaq-optimtec opened this issue Oct 27, 2023 · 3 comments

Comments

@afaq-optimtec
Copy link

Scheduler is an integral part of an OS, can you make a tutorial for that?

Also make some small tutorials for raspberry pi, Os Wiki has rust bare metal tutorial, can you do something like that?

Regards

@kennystrawnmusic
Copy link
Contributor

kennystrawnmusic commented Oct 27, 2023

The generator/coroutine based method (untested) that I use in my kernel would make a great starting point for a preemptive multitasking tutorial. Would need to completely rewrite the blog from scratch in the RPi case however given how different ARM is from x86 at the assembly level.

@bjorn3
Copy link
Contributor

bjorn3 commented Oct 28, 2023

The generator/coroutine based method (untested) that I use in my kernel would make a great starting point for a preemptive multitasking tutorial.

The last post of blog os is about async/await: https://os.phil-opp.com/async-await/

Would need to completely rewrite the blog from scratch in the RPi case however given how different ARM is from x86 at the assembly level.

True, there are quite some differences between ARM and x86 in terms of how many low level things that OSes require are implemented. For example page tables have a different format, the interrupt controller is different (and even differs between different soc's for arm although somewhat recently arm made a standard interrupt controller. not everyone uses it yet.), there is no vga text mode in arm (instead you have to write a display controller driver for the specific display controller of the soc to set up a framebuffer, or a serial port driver), there is no BIOS emulation of a PS/2 keyboard with dedicated interrupts (instead you likely have to write a full USB driver, or a serial port driver) and much more. For display output and keyboard input you may be able to use UEFI instead, but not every arm system has the option to run UEFI and in the case of keyboard input you must not exit boot services, which means that you can't do a lot of things expected from an OS like running usermode programs. Before exitting boot services you are effectively a program running under the UEFI "OS".

@kennystrawnmusic
Copy link
Contributor

kennystrawnmusic commented Oct 28, 2023

The generator/coroutine based method (untested) that I use in my kernel would make a great starting point for a preemptive multitasking tutorial.

The last post of blog os is about async/await: https://os.phil-opp.com/async-await/

That's cooperative, not preemptive. This unstable Rust feature (which is actually the raw underpinning that async/await uses behind the scenes) makes it possible to use combination of an enum, match within the coroutine closure, and yield within the coroutine closure if certain enum variants are matched to block execution from an interrupt handler.

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

3 participants