Implementing a simple Round Robin Fair Queue scheduling algorithm for data packets considering 3 data streams
22 views (last 30 days)
Show older comments
Hello Team,
We are trying to implement the Round Robin Fair queue scheduling algorithm using simulink and further have to generate C++ code from this model. Here we are using
Here in this algorithm data packets are sorted based on the priority of each packet and then further added into the respective queues (FIFO), for simplicity we have considered 3 queues (data streams). Then data outgoing from these queues have to scheduled in fair round robin fashion. To define fairness here we are considering that for non empty queue with high priority 3 packets are serviced first, then 2 packets from Mid priority queue and 1 packet from low priority queue.
If any of the queue is empty then next queue has to be considered for scheduling.
My current approach:
Sorted the data into different priority queues, for the queue I am using queue block from messages & events however I am finding it difficult to track number packets in the queue and number of packets departed.
I am sharing the file here, kindly request you to help me in this regard.
Many thanks in advance.
Best Regards,
Srikar
0 Comments
Answers (1)
Githin George
on 3 Nov 2023
Hello,
I understand you are trying to implement a Round Robin Fair Queue Scheduling algorithm for data streams of 3 different priorities and you are facing difficulty in tracking the number of packets in the queue and number of packets departed.
I would suggest modelling a control logic to identify which queue to select data from after every scheduling event. I’ve attached a Simulink model here that does the exact same.
The subsystem basically takes in as input the ‘current state’ of the scheduler and ‘queue state’ values and outputs the ‘next state’ of the scheduler based on the following logic. The states of the scheduler are as follows. State 0 – entry state. State 1 – High priority queue, 1 packet sent. State 2 – High priority queue, 2 packets sent. Similarly, till state 6. The logic models how the state change occurs, and based on the output state of the subsystem, the correct message can be retrieved from the queue.
I hope this helps.
See Also
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!