Double scheduler queue to prevent CPU bound threads to lock the kernel #21

Open
opened 2023-01-05 19:26:41 +00:00 by juju · 0 comments
Owner

A malicious or CPU bound thread with never perform syscalls will always be rescheduled when preempted, thus will never allow the scheduler to asynchronously return and stoping the executor from running other tasks.

Add a second thread queue to the scheduler to hold already scheduled threads.

The scheduler will then schedule the threads by batch:
- Schedule a thread from the ready queue
- When preempted, push the threadId to the scheduled queue
- Continue until the ready queue is empty
- Once the ready queue is emptied the executor can schedule other async tasks
- On the next timer interrupt, refill the ready queue with the scheduled queue
- Scheduler can now run user threads again

A malicious or CPU bound thread with never perform syscalls will always be rescheduled when preempted, thus will never allow the scheduler to asynchronously return and stoping the executor from running other tasks. Add a second thread queue to the scheduler to hold already scheduled threads. The scheduler will then schedule the threads by batch: - Schedule a thread from the ready queue - When preempted, push the threadId to the scheduled queue - Continue until the ready queue is empty - Once the ready queue is emptied the executor can schedule other async tasks - On the next timer interrupt, refill the ready queue with the scheduled queue - Scheduler can now run user threads again
juju added the BugFeatureMajor labels 2023-01-05 19:26:41 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: juju/JuliOS#21
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.