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
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