1 | package de.uka.ipd.sdq.scheduler.loaddistribution.selectors.process; |
2 | |
3 | import de.uka.ipd.sdq.scheduler.loaddistribution.IProcessSelector; |
4 | import de.uka.ipd.sdq.scheduler.processes.IActiveProcess; |
5 | import de.uka.ipd.sdq.scheduler.queueing.IProcessQueue; |
6 | import de.uka.ipd.sdq.scheduler.queueing.IRunQueue; |
7 | import de.uka.ipd.sdq.scheduler.resources.IResourceInstance; |
8 | |
9 | public class NextRunnableProcessSelector implements IProcessSelector { |
10 | |
11 | public IActiveProcess select(IRunQueue runQueue, IResourceInstance instance) { |
12 | IProcessQueue queue = runQueue.getBestRunnableQueue(instance); |
13 | if (queue != null) { |
14 | for (IActiveProcess process : queue.ascending()) { |
15 | if (process.checkAffinity(instance)) { |
16 | return process; |
17 | } |
18 | } |
19 | } |
20 | return null; |
21 | } |
22 | } |