| 1 | = Work fetch with max concurrent constraints = |
| 2 | |
| 3 | current: |
| 4 | {{{ |
| 5 | rr sim: (pick_jobs_to_run) if project reaches a MC limit, |
| 6 | stop picking its jobs |
| 7 | (and take it out of the simulation) |
| 8 | Need to do this to avoid starvation. |
| 9 | work fetch: don't fetch from a project at MC limit |
| 10 | }}} |
| 11 | |
| 12 | problem: |
| 13 | we don't buffer work for projects with MC limits |
| 14 | |
| 15 | solution: |
| 16 | {{{ |
| 17 | rr sim: |
| 18 | keep simulating project even if at MC limit |
| 19 | keep track of MI(P,R) = max # instances used by MC projects P |
| 20 | how many instances the project is able to use, given its MC restriction. |
| 21 | It may be all instances. |
| 22 | maintain "MC shortfall" MCS(R,P) for each MC project P |
| 23 | in update_stats() |
| 24 | y = MI(P,R) - #devices in use by P |
| 25 | x = min(y, nidle) |
| 26 | MCS(R,P) += x*dt |
| 27 | }}} |
| 28 | allow work fetch from MC project P, |
| 29 | but use MCS(R,P) instead of shortfall; don't request if it's zero |
| 30 | |
| 31 | examples (suppose min_buf is 3, max_buf is 6) |
| 32 | {{{ |
| 33 | 4 device instances |
| 34 | p = project with max concurrent constraint |
| 35 | x = other projects |
| 36 | . = idle |
| 37 | }}} |
| 38 | example 1: |
| 39 | P has lots of work, and can use only 2 instances |
| 40 | {{{ |
| 41 | 7 pp.. |
| 42 | 6 pp.. |
| 43 | 5 pp.. |
| 44 | 4 pp.. |
| 45 | 3 pp.. |
| 46 | 2 pp.. |
| 47 | 1 pp.. |
| 48 | }}} |
| 49 | In this case shortfall is 6, |
| 50 | but we don't want to request any more work from P |
| 51 | |
| 52 | example 2: |
| 53 | p has limited work. It can use 1 or 2 instances, depending |
| 54 | on which app versions run |
| 55 | {{{ |
| 56 | 7 .... |
| 57 | 6 **.. |
| 58 | 5 p*.. |
| 59 | 4 p*.x |
| 60 | 3 p*xx |
| 61 | 2 pxxx |
| 62 | 1 ppxx |
| 63 | }}} |
| 64 | In this case the MC shortfall for P is 5 (the *'s). |
| 65 | If P had the highest scheduling priority, we'd ask it for 3 units of work. |
| 66 | After that, it wouldn't be eligible for work fetch because |
| 67 | the MC shortfall would be zero. |
| 68 | But we'd be able to ask another project for 4 units. |