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

Reprogram timer on dispatch_next() #167

Open
perlun opened this issue Aug 27, 2019 · 0 comments
Open

Reprogram timer on dispatch_next() #167

perlun opened this issue Aug 27, 2019 · 0 comments

Comments

@perlun
Copy link
Contributor

perlun commented Aug 27, 2019

If a thread is performing a blocking operation, typically waiting on a mailbox_receive() or similar, it calls dispatch_next() which yields the remainder of the timeslice to another thread.

However, this means that the other thread will not receive a full timeslice (which is normally 1000/32=~31 ms since we program the PIT to 32 Hz). It could be worthwhile to reprogram the PIT every time dispatch_next() is being called, so that each thread gets a fair share of CPU time when needed.

This does have a disadvantage though; we can no longer rely on the PIT interrupts to keep track of wall clock time and system uptime, since we will deliberately make some timeslices longer in these cases. So, if we go this route, we must make sure to adjust these measurements accordingly.

/cc @doverhill

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

No branches or pull requests

1 participant