[kernel] Give scheduler better history tracking
The scheduler again tracks remaining timeslice. Timeslices are bigger, but once a process uses all of its timeslice, it's demoted and replenished at the next priority. The scheduler also tracks the last time a process ran, and promotes it if it's been starved for twice its full timeslice. TODO: replenish a small amount of timeslice each time a process is run, so that more interactive processes keep their priorities.
This commit is contained in:
@@ -18,12 +18,20 @@ extern "C" void task_fork(process *child);
|
||||
class scheduler
|
||||
{
|
||||
public:
|
||||
/// Total number of priority levels
|
||||
static const uint8_t num_priorities = 8;
|
||||
|
||||
/// Maximum (least urgent/interactive) priority
|
||||
static const uint8_t max_priority = num_priorities - 1;
|
||||
static const uint8_t default_priority = num_priorities / 2;
|
||||
|
||||
/// Default priority on process creation
|
||||
static const uint8_t default_priority = 1;
|
||||
|
||||
/// Loest (most urgent) priority achieved via promotion
|
||||
static const uint8_t promote_limit = 1;
|
||||
|
||||
/// How long the base timer quantum is, in us
|
||||
static const uint64_t quantum_micros = 5000;
|
||||
static const uint64_t quantum_micros = 500;
|
||||
|
||||
/// How many quanta a process gets before being rescheduled
|
||||
static const uint16_t process_quanta = 10;
|
||||
|
||||
Reference in New Issue
Block a user