Top Banner
EDF POLLING SERVER Harish Chetty
26

Polling server

Feb 16, 2017

Download

Technology

Harish Chetty
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Polling server

EDF POLLING SERVER

Harish Chetty

Page 2: Polling server

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!

Page 3: Polling server

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

Page 4: Polling server

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.

Page 5: Polling server

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)

Page 6: Polling server

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)

Page 7: Polling server

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)

Page 8: Polling server

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)

Page 9: Polling server

WHAT IF MORE THAN ONE TASK?

WHAT IF MORE THAN ONE TYPE OF TASK?

Page 10: Polling server

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

Page 11: Polling server

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)

Page 12: Polling server

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!

Page 13: Polling server

WHAT IF MORE THAN ONE CPU?

Page 14: Polling server

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

Page 15: Polling server

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

Page 16: Polling server

WHAT IF MORE THAN ONE SCHED_POLL TASK?

Page 17: Polling server

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

Page 18: Polling server

volatile long long int count =0;while(1){ if(count<1000000){

count++;printf("Printing number %lld \n", count);

} else{

break; }}

Page 19: Polling server
Page 20: Polling server
Page 21: Polling server
Page 22: Polling server

I WILL STOP BORING YOU AND END!

Page 23: Polling server

EXTRAS

Page 24: Polling server

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)

Page 25: Polling server

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.

Page 26: Polling server

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