# Dynamic Traffic Scheduling and Congestion Control across Data Centers Based on SDN
## 3 The Design and Implementation of DSCSD
Sub-queue 1 has the time t, sub-queue 2 has the time 2t that is twice the time of sub-queue 1, and sub-queue 3 has the time 3t that is triple the time of sub-queue 1. For the pseudo codes of the algorithm, see Algorithm 1. ```
0:\(G\): topology of data center network; \(F_{active}\): set of active flows; \(F_{suspend}\): set of suspended flows; \(F_{tnew}\): a new flow; \(F_{first}\): a flow from the first of the \(F_{suspend}\). Output: {!e-state, e.path>}: scheduling state and path selection of each flow in G. When a new flow arrives
1 if (e.path = IDLEPATH) then
2\(F_{suspend}\)\(\leftarrow\)\(F_{suspend}\);
3 end if
4 else\(F_{suspend}\)\(+\)\(F_{tnew}\);
5 while\(\left(F_{suspend}\
eq\varnothing\right)\)do
6 if (e.path = IDLEPATH) then
7 if\(\left(F_{suspend}\
eq\varnothing\right)\)then
8 Select the flow at the first of \(F_{suspend1}\);
9\(F_{suspend1}\)\(\leftarrow\)\(F_{suspend1}\);
10\(F_{active}\)\(\leftarrow\)\(F_{active}\)\(+\)\(F_{first}\);
11 Transmission time of the \(F_{first}\) is 2t;
12 end if
13 else
14 Select the flow at the first of \(F_{suspend2}\);
15\(F_{suspend3}\)\(-\)\(F_{suspend3}\)\(-\)\(F_{fit}\);
16\(F_{active}\)\(\leftarrow\)\(F_{active}\)\(+\)\(F_{first}\);
17 Transitssion time of the \(F_{first}\) is 3t;
18 end if
19 return {!e-state, e.path>};
```  
**Algorithm 2**The Algorithm of Multilevel Feedback Queue  
### Congestion Control with Multilevel Feedback Queues  
As part of DSCSD, dynamic traffic scheduling has an obvious effect on the classification and diversion of flow. However, when malicious flows exist, congestion also might occur in the shortest path link due to the long-term occupation of limited link resources and the burst of network instantaneous traffic. The algorithm of congestion control with multilevel feedback queues not only provides a queuing service for congested flows, but also settles the problem of vicious prolonged occupation. The specific description is shown as follows. In the initial phase of the scheme, we define two multilevel feedback queues to store the flows waiting to be scheduled. One is the multilevel feedback queue of low priority and the other is the multilevel feedback queue of high priority. Then, in each feedback queue, we define three sub-queues, and give the highest priority to flow waiting queue 1, the second highest priority to flow waiting queue 2, and the lowest priority to flow waiting queue 3. As is shown in Figure 3, the transmission time of these flow waiting queues are different after being scheduled. Sub-queue 1 has the time t, sub-queue 2 has the time 2t that is twice the time of sub-queue 1, and sub-queue 3 has the time 3t that is triple the time of sub-queue 1. For the pseudo codes of the algorithm, see Algorithm 1. ```
0:\(G\): topology of data center network; \(F_{active}\): set of active flows; \(F_{suspend}\): set of suspended flows; \(F_{tnew}\): a new flow; \(F_{first}\): a flow from the first of the \(F_{suspend}\). Output: {!e-state, e.path>}: scheduling state and path selection of each flow in G. When a new flow arrives
1 if (e.path = IDLEPATH) then
2\(F_{suspend}\)\(\leftarrow\)\(F_{suspend}\);
3 end if
4 else\(F_{suspend}\)\(+\)\(F_{tnew}\);
5 while\(\left(F_{suspend}\
eq\varnothing\right)\)do
6 if (e.path = IDLEPATH) then
7 if\(\left(F_{suspend}\
eq\varnothing\right)\)then
8 Select the flow at the first of \(F_{suspend1}\);
9\(F_{suspend1}\)\(\leftarrow\)\(F_{suspend1}\);
10\(F_{active}\)\(\leftarrow\)\(F_{suspend1}\);
11 Transmission time of the \(F_{first}\) is 3t;
12 end if
13
14 end while
15
16 end while
17
18 end while
19 else
20: Select the flow at the first of \(F_{suspend2}\);
21\(F_{suspend3}\)\(\leftarrow\)\(F_{suspend3}\)\(-\)\(F_{fit}\);
22\(F_{active}\)\(\leftarrow\)\(F_{active}\)\(+\)\(F_{first}\);
23 Transit time of the \(F_{first}\) is 3t;
24 end if
25 return {!e-state, e.path>};
```  
**Algorithm 3**The Algorithm of Multilevel Feedback Queue