Date post: | 16-Feb-2017 |
Category: |
Technology |
Upload: | harish-chetty |
View: | 133 times |
Download: | 1 times |
EDF POLLING SERVER
Harish Chetty
Lots of Problems!• Had to read about 20,000 Lines of Code Spread across 7 unrelated files.
• Had to read through 2000 more lines to interpret Mark’s Sporadic server!
• Understood about 20% code (which I thought was 80% at the beginning).
• Reinstalled Kernel about 500 Times.
• Found out limitations of printk’s!
• Some crash caused Disk(or something to corrupt) forcing use of TTY.
• SMP’s made life hell.
• CBS ensured PS to always fail!
• Finally the last phase was carried out on kernel which took 20 minutes to compile.
• HAD TO FINALLY UNDERSTAND ABOUT 50% TO GET STUFF DONE!
IMAGINE A CLOCK!
Rings Bell Every 60 Seconds Period : 60 sec Must Ring Bell for 5 Seconds Budget: 5 sec Complete Ringing in 10 Second Deadline: 10 sec
Submit Task
Setup Deadline& Budget
EnqueueTask
DequeueTask
Budget Exhausted
Budget Left
When the task must end!
How much time the task should run?
?TaskDead
TASK COMPLETE/KILL
KILL
Wakeup task,Run the task,
Update Runqueues etc.
Schedule task,Block the task,
Push task in wating queue etc.
Submit Task
Setup Deadline (D),
Budget (B)& Replenishment
Timer (RT)
EnqueueTask
DequeueTask
B = Cap
RT TimeoutB = 0
?
TaskDead
TASK COMPLETE/KILL
KILL
INIT Task
Release Replenishment Timer
(RT)
Submit Task
Setup(D), (B)& (RT)
EnqueueTask
DequeueTask
B = (RQ TIME – START TIME)
RT TimeoutB = 0
TaskDead
TASK COMPLETE/KILL
KILL
INIT Task
Task Running
UpdateStatus
B = Cap
B = Cap
B = 0
CPU RUNQUEUE TIME
INITIAL BUDGET
Release (RT)
Submit Task
Setup(D), (B)& (RT)
EnqueueTask
DequeueTask
B = (RQ TIME – START TIME)
RT TimeoutB = 0
TaskDead
TASK COMPLETE/KILL
KILL
INIT Task
Task Running
UpdateStatus
B = 0 / B = Cap
B = Cap
B = 0
Release (RT)
Submit Task
Setup(D), (B)& (RT)
EnqueueTask
DequeueTask
B = (RQ TIME – START TIME)
RT TimeoutB = 0
TaskDead
TASK COMPLETE/KILL
KILL
INIT Task
Task Running
UpdateStatus
B = 0 / B >= Cap
B = Cap
B = (0 + P)
OVERRUN TIME (Penalty (P))
Release (RT)
WHAT IF MORE THAN ONE TASK?
WHAT IF MORE THAN ONE TYPE OF TASK?
SCHED_OTHER (CFS) SCHED_RT SCHED_DEADLINE
BATCH IDLE
NORMAL EDF FIFOROUND ROBIN
IDLE TASK SCHED_POLL
99 to 0132 to 100> 132 -1 -2
Submit Task
Setup(D), (B)& (RT)
EnqueueTask
P = -2
DequeueTask
B = (RQ TIME – START TIME)
RT TimeoutB = 0
TaskDead
TASK COMPLETE/KILL
KILL
INIT Task
Task Running
UpdateStatus
B = 0 / B >= Cap
B = Cap
B = (0 + P)
Release (RT)
Submit Task
Setup(D), (B)& (RT)
EnqueueTask
P = -2
DequeueTask
B = (RQ TIME – START TIME)
RT TimeoutB = 0
TaskDead
TASK COMPLETE/KILL
KILL
INIT Task
Task Running
UpdateStatus
B = 0 / B >= Cap
B = Cap
B = (0 + P)
Release (RT)
Forward
RQ TIME == Deadline!
D = D + D
Why NOT 2D ?? Here comes Periods!
WHAT IF MORE THAN ONE CPU?
Submit Task
Setup(D), (B)& (RT)
EnqueueTask
P = -2
DequeueTask
B = (RQ TIME – START TIME)
RT TimeoutB = 0
TaskDead
TASK COMPLETE/KILL
KILL
INIT Task
Task Running
UpdateStatus
B = 0 / B >= Cap
B = Cap
B = (0 + P)
Release (RT)
Forward
RQ TIME == Deadline!
D = D + D
SMP Enqueue
TaskP = -2
SMPDequeue
Task
RT TimeoutB = 0B = (0 + P)
N(CPU) > 1
Submit Task
Setup(D), (B)& (RT)
EnqueueTask
P = -2
DequeueTask
B = (RQ TIME – START TIME)
RT TimeoutB = 0
TaskDead
TASK COMPLETE/KILL
KILL
INIT Task
Task Running
UpdateStatus
B = 0 / B >= Cap
B = Cap
B = (0 + P)
Release (RT)
Forward
RQ TIME == Deadline!
D = D + D
SMP Enqueue
TaskP = -2
SMPDequeue
Task
RT TimeoutB = 0
B = (0 + P)
N(CPU) > 1
SelectCPU
WHAT IF MORE THAN ONE SCHED_POLL TASK?
Submit Task
Setup(D), (B)& (RT)
EnqueueTask
P = -2
DequeueTask
B = (RQ TIME – START TIME)
RT TimeoutB = 0
TaskDead
TASK COMPLETE/KILL
KILL
INIT Task
Task Running
UpdateStatus
B = 0 / B >= Cap
B = Cap
B = (0 + P)Release (RT)
Forward
RQ TIME == Deadline!
D = D + D
SMP Enqueue
TaskP = -2
SMPDequeue
Task
RT TimeoutB = 0
B = (0 + P)
N(CPU) > 1
SelectCPU
Pick Next Task
Preemptverifier
volatile long long int count =0;while(1){ if(count<1000000){
count++;printf("Printing number %lld \n", count);
} else{
break; }}
I WILL STOP BORING YOU AND END!
EXTRAS
Data Structures• Pick Next Tasks use RB Trees based on Deadlines.
• Leftmost Node is cached (smallest Deadline)
• CPU’s work using Max Heaps based on task deadlines.• Root Node has CPU with a task with the largest Deadline. Preempt this first
if necessary• Must be a Queue for more efficiency??
• Waiting Tasks use RB Trees based on Deadlines.• Leftmost Node is cached (smallest Deadline)
Submit Task
Setup Deadline& Budget
EnqueueTask
DequeueTask
Budget Left = 0
Budget Left != 0
When the task must end!
How much time the task should run?
?
Wakeup task,Run the task,
Update Runqueues etc.
Schedule task,Block the task,
Push task in wating queue etc.
Submit Task
Setup(D), (B)& (RT)
EnqueueTask
P = -2
DequeueTask
B = (RQ TIME – START TIME)
RT TimeoutB = 0
TaskDead
TASK COMPLETE/KILL
KILL
INIT Task
Task Running
UpdateStatus
B = 0 / B >= Cap
B = Cap
B = (0 + P)Release (RT)
Forward
RQ TIME == Deadline!
D = D + D
SMP Enqueue
TaskP = -2
SMPDequeue
Task
RT TimeoutB = 0
B = (0 + P)
N(CPU) > 1
SelectCPU
Pick Next Task