Attempting to Implement Round Robin Schuelder Via LTN
Posted: Thu May 16, 2024 1:16 am
I am trying to achieve balance of services to starvation via a CPU scheduler called Round Robin. In the future I might see about implementing others like HRRN, but you will see why I'm starting with Round Robin first.
A simple example: https://youtu.be/aWlQYllBZDs?si=mV_2gr9VaAX088Hg
But I learned the LTN Mod has most of what I need to do already not found in Vanilla:
This is a FIFO queue, which is close to RR, but not quite. RR has preemption, I need after let's say ~2500 ticks to preempt the train, and set it to the depot to be rescheduled.
I see there a central issue in LTN, however:
Trains are meant to be used across resource types. For example, a train carrying iron plates, can be used for copper plates. So, a train would have many iron plates leftover. But, given RR will distribute resources within a fraction of a train's cargo. These leftovers I want to be carried to other iron stations. I want trains not bounded to stations, but to types, so trains A,B,C only delivery iron plates, and trains X, Y, Z only deliver green circuits.
This can be solved with LTN I believe, through encoded network IDs.
However, there is a limit in LTN of 32 unique networks, which is just not enough for the setup I aim for. Any help is appreciated.
A simple example: https://youtu.be/aWlQYllBZDs?si=mV_2gr9VaAX088Hg
But I learned the LTN Mod has most of what I need to do already not found in Vanilla:
- A class of jobs organized in a queue, based on request age.
- The ability to set a tick (not time) limit for trained parked at request stations (this is the quantum value)
- LTN Automatically computes delta of resources needed (Resources Requested vs had) and sends out the signal to the network (the equivalent to BT)
Code: Select all
-- sort requests by priority and age
sort(global.Dispatcher.Requests, function(a, b)
if a.priority ~= b.priority then
return a.priority > b.priority
else
return a.age < b.age
end
end)
I see there a central issue in LTN, however:
Trains are meant to be used across resource types. For example, a train carrying iron plates, can be used for copper plates. So, a train would have many iron plates leftover. But, given RR will distribute resources within a fraction of a train's cargo. These leftovers I want to be carried to other iron stations. I want trains not bounded to stations, but to types, so trains A,B,C only delivery iron plates, and trains X, Y, Z only deliver green circuits.
This can be solved with LTN I believe, through encoded network IDs.
However, there is a limit in LTN of 32 unique networks, which is just not enough for the setup I aim for. Any help is appreciated.