diff --git a/doc/sched.php b/doc/sched.php index 361c3ae759..6ef6967e9f 100644 --- a/doc/sched.php +++ b/doc/sched.php @@ -80,11 +80,9 @@ Why not use actual CPU time instead?
-The scheduler starts by doing a simulation of round-robin scheduling +The scheduler starts by doing a simulation of weighted round-robin scheduling applied to the current work queue. This produces the following outputs:
+In the example below, projects A and B have resource shares +2 and 1 respectively. +A has results A1 and A2, and B has result B1. +The computer has two CPUs. +From time 0 to 4 all three results run with equal weighting. +At time 4 result A2 finishes. +From time 4 to 8, project A gets only a 0.5 share +because it has only one result. +At time 8, result A1 finishes. +
+In this case, shortfall(A) is 4,
+and total_shortfall is 2.
+
+
+
+
The scheduling policy is:
-When a result runs in EDF mode, -its project may get more than its share of CPU time. -The work-fetch policy is responsible for -ensuring that this doesn't happen repeatedly. -It does this by suppressing work fetch for the project.
A project P is overworked if
The work-fetch policy uses the functions @@ -267,16 +278,6 @@ frs(project P) P's fractional resource share among fetchable projects. -
-work_to_fill_buf(P) --The amount of work needed to keep P busy for the next min_queue seconds, -namely: -
- y = min_queue*ncpus - work_before_minq(P) - if (y <= 0) return 0 - return y/frs(P) -
The work-fetch policy function is called every few minutes (or as needed) by the scheduler RPC polling function. @@ -289,9 +290,9 @@ for each project P if P is suspended, deferred, overworked, or no-new-work P.work_request_size = 0 else - P.work_request_size = work_to_fill_buf(P) + P.work_request_size = shortfall(P) -if min_queue*ncpus > total_work_before_minq +if total_shortfall > 0 if P.work_request_size==0 for all P for each project P if P is suspended, deferred, overworked, or no-new-work @@ -305,8 +306,7 @@ if min_queue*ncpus > total_work_before_minq P.work_request_size = 1 if P.work_request_size>0 for some P - Normalize P.work_request_size so that they - sum to min_queue*ncpus - total_work_before_minq + Normalize P.work_request_size so that they sum to total_shortfall and are proportional to P.resource_share @@ -318,7 +318,7 @@ If it does so, it will also request work from that project. Otherwise, the RPC mechanism chooses the project P for which
P.work_request_size>0 and -P.long_term_debt + work_to_fill_buf(P) is greatest +P.long_term_debt + shortfall(P) is greatestand gets work from that project.