Timeslice.md (1249B)
1 # Timeslice 2 3 **Source:** CS 6200 4 5 **Chapter:** P3L1 6 7 **Definition:** A timeslice is the maximum amount of uninterrupted time that can be given to a task. 8 9 Also referred to as a "time quantum". 10 11 ## Selection 12 13 For I/O bound tasks smaller timeslices are generally better because CPU bound tasks will more frequently yield for I/O bound tasks which in turn yield once they initiate an I/O request. 14 15 For CPU bound tasks larger timeslices are generally better because they reduce the rate of context switches. 16 17 ## Multi-Timeslices 18 19 Since I/O bound tasks prefer smaller timeslices and CPU bound tasks prefer larger timeslices it can make sense to have different collection data structures for different degrees of I/O or CPU boundedness. 20 21 ### Single Queue 22 23 One approach to support multi-timeslices is for the scheduler to check if a task is more I/O or CPU bound and preempt it accordingly. 24 25 ### Multi-Queue 26 27 When using multiple queues, we generally push tasks down to lower levels (meaning they are more CPU bound) when they use the entirety of their timeslice. Conversely, if a task consistently yields prior to reaching the timeslice it should be pushed up to a higher collection. 28 29 The scheduler will generally prioritize the most I/O intensive tasks.