Beta
Round Robin Job Scheduler
Loading description...
Scheduling
Algorithms
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
I would like an explanation/clarification for the DifferentStartTimes test:
After doing task 0 and task 1, it is now startTime + 6 seconds.
However, after running their timeslots, tasks 0 and 1 are at the end of the job list. So task 2 is next on deck.
Since task 2's arrival time is startTime + 4 seconds, which is less than the current time after the first two timeslots, why can't we run it instead of running task 0 again?
New tasks are only put into the queue when they arrive. You cannot predict the future, so this cannot be done before their arrival time.
At
t = 0
: The queue is[]
, runningtask0
At
t = 2
:task1
arrives, the queue is[task1]
At
t = 3
: window finishes buttask0
is not done yet, puttask0
at the end;task1
is now executed, the queue is[task0]
At
t = 4
:task2
arrives, the queue is[task0, task2]
At
t = 6
: window finishes buttask1
is not done yet, puttask1
at the end;task0
is now executed, the queue is[task2, task1]
...
👍
Please update the struct definition in the description:
It appears that
StartTime
is nowArrivalTime
instead.Thanks, I've updated the description.
What happens if a task has just executed till the end of the window (and is scheduled to be moved to the end of the list) when there is another task that arrives at the same time? Which task should be queued first?
Good point, I've added explicit instruction in the description - new task should be added before the one that has just finished. I've also added new test case for this.
Forgot to mark issue as resolved.
Is
ScheduleRecord
not pre-defined?Also, the actual fields in
ScheduleRecord
is different from what is provided in the description:It is actually
Job
also has different fields specified at the top and at the bottom.Actual tests apparently uses
Timeslot
instead, and random tests apparently uses its ownTimeslot
. Note that tworecord struct
defined in different places but with the same fields are not considered equality comparable, soTimeslot
should be defined somewhere else (in a same namespace. Why aren't all the classes namespaced?) and provided to the user.Thanks for pointing this out. I've done some renaming before publishing and forgotten to update the description. Description should be ok now. There is only one
Timeslot
used both by solution and test cases, it's in preloaded classes. I've ommited namespaces as they are not neccessary and only take space in this case. Is there any advantage they provide?Forgot to mark issue as resolved.