|
|
|
|
|
|
|
|
Flow 1: FLow 2: Arrival Time Packet length Arrival Time Packet length Packet 1: 1 1 0 3 Packet 2: 2 1 5 2 Packet 3: 3 2 9 2 Packet 4: 11 2 - - |
Flow 1: FLow 2: Arr Time Fin Time length | Arr Time Fin Time length Packet 1: 1 3 1 | 0 5 3 Packet 2: 2 5 1 | 5 9 2 Packet 3: 3 9 2 | 9 11 2 Packet 4: 11 13 2 | - - |
(When a packet arrives at time t, we assume that it arrives a little later - at t + ε)
Time | Event: Arrival (length) | Event: Departure
(real finish time) |
Packets in queue
(FFS finish time) (packet length) |
Transmitting packet
(real finish time) |
---|---|---|---|---|
0 | [flow 2, packet 1 (3)] | ... | ... | [flow 2, packet 1 (3)] |
1 | [flow 1, packet 1 (1)] | ... | [flow 1, packet 1 (3) (1)] | ... |
2 | [flow 1, packet 2 (1)] | ... |
[flow 1, packet 1 (3) (1)]
[flow 1, packet 2 (5) (1)] |
... |
3 | [flow 1, packet 3 (2)] | [flow 2, packet 1 (3)] |
[flow 1, packet 2 (5) (1)]
[flow 1, packet 3 (9) (2)] |
[flow 1, packet 1 (4)] |
4 | ... | [flow 1, packet 1 (4)] | [flow 1, packet 3 (9) (2)] | [flow 1, packet 2 (5)] |
5 | [flow 2, packet 2 (2)] | [flow 1, packet 2 (5)] | [flow 2, packet 2 (9) (2)] | [flow 1, packet 3 (7)] |
7 | ... | [flow 1, packet 3 (7)] | (empty) | [flow 2, packet 2 (9)] |
9 | [flow 2, packet 3 (2)] | [flow 2, packet 2 (9)] | ... | [flow 2, packet 3 (11)] |
11 | [flow 1, packet 4 (2)] | [flow 2, packet 3 (11)] | ... | [flow 1, packet 4 (13)] |
13 | ... | [flow 1, packet 4 (13)] | ... | ... |
Packet | FFS Finish Time | WFS Finish Time | Difference (WFS - FFS) |
---|---|---|---|
Flow 1, Packet 1 | 3 | 4 | 1 |
Flow 1, Packet 2 | 5 | 5 | 0 |
Flow 1, Packet 3 | 9 | 7 | -2 |
Flow 1, Packet 4 | 13 | 13 | 0 |
Flow 2, Packet 1 | 5 | 3 | -2 |
Flow 2, Packet 2 | 9 | 9 | 0 |
Flow 2, Packet 3 | 11 | 11 | 0 |
Flow 1: FLow 2: Arrival Time Packet length Arrival Time Packet length Packet 1: 1 1 0 3 Packet 2: 2 1 5 2 Packet 3: 3 2 9 2 Packet 4: 11 2 - - |
Flow 1: FLow 2: Arrival Time Finish Time Arrival Time Finish Time Packet 1: 1 4 0 4 Packet 2: 2 5 5 8 Packet 3: 3 9 9 11 Packet 4: 11 13 - - |
Time | Arrival (length) | Departure
(real finish time) |
Queued Packets
(FFS finish time) (packet length) |
Scheduled packet
(real finish time) |
---|---|---|---|---|
0 | [flow 2, packet 1 (3)] | ... | [flow 2, packet 1 (4) (3)] | [flow 2, packet 1 (3)] |
1 | [flow 1, packet 1 (1)] | ... |
[flow 2, packet 1 (4) (3)]
[flow 1, packet 1 (4) (1)] |
... |
2 | [flow 1, packet 2 (1)] | ... |
[flow 2, packet 1 (4) (3)]
[flow 1, packet 1 (4) (1)] [flow 1, packet 2 (5) (1)] |
... |
3 | [flow 1, packet 3 (2)] | [flow 2, packet 1 (3)] |
[flow 1, packet 1 (4) (1)]
[flow 1, packet 2 (5) (1)] [flow 1, packet 3 (9) (2)] |
[flow 1, packet 1 (4)] |
4 | ... | [flow 1, packet 1 (4)] |
[flow 1, packet 2 (5) (1)]
[flow 1, packet 3 (9) (2)] |
[flow 1, packet 2 (5)] |
5 | [flow 2, packet 2 (2)] | [flow 1, packet 2 (5)] |
[flow 2, packet 2 (8) (2)]
[flow 1, packet 3 (9) (2)] |
[flow 2, packet 2 (7)] |
7 | ... | [flow 2, packet 2 (7)] | [flow 1, packet 3 (9) (2)] | [flow 1, packet 3 (9)] |
9 | [flow 2, packet 3 (2)] | [flow 1, packet 3 (9)] | [flow 2, packet 3 (11) (2)] | [flow 2, packet 3 (11)] |
11 | [flow 1, packet 4 (2)] | [flow 2, packet 3 (11)] | [flow 1, packet 4 (13) (2)] | [flow 1, packet 4 (13)] |
13 | ... | [flow 1, packet 4 (13)] | ... | ... |
Packet | FFS Finish Time | WFS Finish Time | Difference (WFS - FFS) |
---|---|---|---|
Flow 1, Packet 1 | 4 | 4 | 0 |
Flow 1, Packet 2 | 5 | 5 | 0 |
Flow 1, Packet 3 | 9 | 9 | 0 |
Flow 1, Packet 4 | 13 | 13 | 0 |
Flow 2, Packet 1 | 4 | 3 | -1 |
Flow 2, Packet 2 | 8 | 7 | -1 |
Flow 2, Packet 3 | 11 | 11 | 0 |
|
Note:
|
|
It is very complex to compute the finish times in FFS
|
(This simpler scheme is still quite computational intensive. )
|
|
|
Example:
|
|
|
|
We will discuss the time stamp calculation soon...
|
We will first look at an example that help us understand Parekh's Virtual CLock scheme.
|
I.e.: virtual time run at the same rate (speed) as real time
Example:
speed of virtual clock = 1 -------------------------------> V(t) = 1 × t |-----------|-----------|----- ..... ----> virtual time (VT(t)) 0 1 2 ^ ^ ^ | | | | | | |-----------|-----------|----- ..... ----> real time (t) t=0 t=1 t=2 |
|
|
|
Note:
|
Service by a FFS server:
speed of virtual clock = 1 -------------------------------> V(t) = 1 × t |-----------|-----------|----- ..... ------> virtual time 0 1 2 p11 finished |<--------------------->| virtual packet length(p11) = 2 p21 finished |<--------------------->| virtual packet length(p21) = 2 |-----------|-----------|----- ..... ------> real time 0 1 2 |
|
Packet length L Virtual Packet length = ---------------- = --- Weight of flow w |
Meaning of "virtual packet length":
|
|
|
Service by a FFS server:
Virtual packet length of p11 = 1/0.5 = 2 | V p11 finished |<--------->| V |-----------|-----------|----- ..... 0 1 2 |
|
|
|
We will soon see that: the the virtual clock function is:
t VT(t) = --------------- ∑ wf f is backlogged |
|
We will look at the time stamp assignment algorithm first
Then we will look at how to set the speed of the virtual clock....
|
|
Problem:
|
Note:
|
|
Graphically depicted:
pji departs | | pji+1 arrives | | | | len( pji+1)/wj | |<----------------------->| V V virtual length(pji+1) -------------+-----------+----------------------------> time Aji+1 -------------+-----------+----------------------------> virtual time VT(Aji+1) ^ | len(pji+1) V(pji) = VT(Aji+1) + ---------- wj |
Notes:
|
Graphically depicted:
pji+1 arrives | pji finishes | pji+1 begins service | | | | len( pji+1)/wj | |<----------------------->| V V virtual length(pji+1) -------------+-----------+----------------------------> virtual time ^ V(pji) | | = Virtual time when pji finish !! Now | | len(pji+1) V(pji) = V(pji+1) + ---------- wj |
Notes:
|
len( pji+1) V(pji+1) = max( V(Aji+1), V(pji) ) + ------------- ............ (3) wj |
|
|
p11 finishes, virtual len(p11) = 3 p21 finishes, virtual len(p21) = 3 p31 finishes, virtual len(p31) = 3 V(3)=3 |-----------------------------------|---------------> virtual time |-----------+-----------+-----------+---------------> real time t=0 t=1 t=2 t=3 |
Notes:
|
|
|
p11 finishes, virtual len(p11) = 3 p21 finishes, virtual len(p21) = 3 V(2)=3 |-----------------------|---------------------------> virtual time |-----------+-----------+-----------+---------------> real time t=0 t=1 t=2 t=3 |
Notes:
|
|
|
p11 finishes, virtual len(p11) = 3 V(1)=3 |-----------|---------------------------------------> virtual time |-----------+-----------+-----------+---------------> real time t=0 t=1 t=2 t=3 |
Notes:
|
|
|
t=0 t=1 t=2 2.5 t=3 | | | | | V V V V V |-----------+-----------+-----+-----+---------------> real time |<--------->|<--------------->|<--->| 1/2 P1+P2 1/2 P1+P2+P3 1/2 P3 ^ ^ ^ |<--------->| | | 1/2 P1 | | | 1/2 P1 P1 fin | VT=3/2 VT=3 | =1.5 | | | |<--------------->| | | 1/2 P1 | | | | | P3 starts P3 fin VT=1.5+3=4.5 |<--------------------->| P3: 3 virtual sec |-----------+-----------+-----+-----+---------------> Virtual time 0 1.5 3 4.5 |<--------->|<--------------->|<--->| vt = 1.5 t vt = 1 * t vt=3t = t/(2/3) = t/(3/3) =t/(1/3) |
Notes:
|
|
t VT(t) = ------ S(t) where ---- \ 1 S(t) = > --- / wj ---- All backlogged flows j at time real time t in a FFS system |
|
|
|
So we must also monitor these types of events in real time:
|
|
Notation:
|
|
|
prev_t = t = 0; // Clock prev_vt = vt = 0; // Virtual clcok for ( j = 0; j < nFlows; j++ ) { lastTimeStamp[j] = 0; RemainingVirLength[j] = 0; } |
/* -------------------------------------------------------- Help function: Computing the rate of the virtual clock -------------------------------------------------------- */ double compute_VT_Rate() { double r = 0.0; for (int i = 0; i < nFlows; i++) if ( Flow[i].size() > 0 ) r += w[i]; if ( r > 0 ) return(1/r); else return(0.0); } |
|
Initialization: prev_t = 0 prev_vt = 0 t = 0 vt = 0 FFS server WFQ server ---------- ----------- 1: PacketQ: 2: 3: vt_rate = ? |
Done
|
(I need to clean up the code for this implementation... It works, but the code is ugly)
|
|
In this worst case scenario, your service will be tMAX behind schedule...