privatestaticLinkedList<Task>tasks=newLinkedList<>();//stores all the tasks in ascending order regarding start times
privatestaticLinkedList<Task>runningTasks=newLinkedList<>();//stores a backup pointer of all task because we delete them from tasks when giving to the scheduler; used only for determining waiting times
staticbooleanschedulersEmpty=true;//signals if the schedulers emptied out
if(waitingQueue.size()>0&&(runningFor==timeSlice||activeTask==null)){//we swap if we can and if we need to; we need to when the running period is over or the current task is not running anymore