Skip to content

Commit 2b94625

Browse files
committed
docs on preemptive scheduling
1 parent e7ecfea commit 2b94625

File tree

4 files changed

+36
-23
lines changed

4 files changed

+36
-23
lines changed
-24 Bytes
Binary file not shown.
-40 Bytes
Binary file not shown.
-32 Bytes
Binary file not shown.

docs/Features/server_schedules.rst

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,30 @@ Server Schedules
77
Ciw allows users to assign cyclic work schedules to servers at each service centre.
88
An example cyclic work schedule may look like this:
99

10-
+-------------------+---------+---------+---------+---------+---------+---------+
11-
| Shift Times | 0-40 | 40-100 | 100-120 | 120-180 | 180-220 | 220-250 |
12-
+-------------------+---------+---------+---------+---------+---------+---------+
13-
| Number of Servers | 2 | 3 | 1 | 2 | 4 | 0 |
14-
+-------------------+---------+---------+---------+---------+---------+---------+
10+
+-------------------+---------+---------+---------+---------+---------+---------+
11+
| Shift Times | 0-40 | 40-100 | 100-120 | 120-180 | 180-220 | 220-250 |
12+
+-------------------+---------+---------+---------+---------+---------+---------+
13+
| Number of Servers | 2 | 3 | 1 | 2 | 4 | 0 |
14+
+-------------------+---------+---------+---------+---------+---------+---------+
1515

16-
This schedule is cyclic, therefore after the last shift (220-250), schedule begins again with the shift (0-40). The cycle length for this schedule is 250.
16+
This schedule is cyclic, therefore after the last shift (220-250), schedule begins again with the shift (0-40). The cycle length for this schedule is 250. Let's call this schedule :code:`my_special_schedule_01`. We define this schedule in the parameters dictionary as follows::
1717

18-
In order to define this work schedule, it must be given a name.
19-
Let's call it :code:`my_special_schedule_01`.
18+
'my_special_schedule_01': [[40, 2], [100, 3], [120, 1], [180, 2], [220, 4], [250, 0]]
2019

21-
In the :code:`parameters.yml` file, under :code:`Number_of_servers`, for the given node enter the name of the schedule.
22-
An example is shown::
20+
Here we are saying that there will be 2 servers scheduled between times 0 and 40, 3 between 40 and 100, etc.
21+
This fully defines the cyclic work schedule.
2322

24-
Number_of_servers:
25-
- 'my_special_schedule_01'
26-
- 3
23+
We then need to tell Ciw which node is using this schedule. This come under the :code:`Number_of_servers` part of the parameters dictionary. Simply add the name of the schedule instead of the usual integer value. The example below shows a two node network, the first node using the above schedule, and the second node with 3 static servers::
2724

28-
The equivalent way to add this to the parameters dictionary::
25+
'Number_of_servers': ['my_special_schedule_01', 3]
2926

30-
'Number_of_servers':['my_special_schedule_01', 3]
27+
**Note that currently server schedules are incompatible with infinite servers**, and so a schedule cannot include infinite servers.
3128

32-
This tells Ciw that at Node 1 the number of servers will vary over time according to the work schedule :code:`my_special_schedule_01`.
33-
This schedule hasn't been defined yet.
34-
To define the work schedule, add the following lines to the end of the :code:`parameters.yml` file::
29+
The equivalent way of inputting schedules into a parameters file is as follows::
3530

31+
Number_of_servers:
32+
- 'my_special_schedule_01'
33+
- 3
3634
my_special_schedule_01:
3735
- - 40
3836
- 2
@@ -47,11 +45,26 @@ To define the work schedule, add the following lines to the end of the :code:`pa
4745
- - 250
4846
- 0
4947

50-
And equivalently, adding the following to the parameters dictionary::
5148

52-
'my_special_schedule_01':[[40, 2], [100, 3], [120, 1], [180, 2], [220, 4], [250, 0]]
5349

54-
Here we are saying that there will be 2 servers scheduled between times 0 and 40, 3 between 40 and 100, etc.
55-
This fully defines the cyclic work schedule.
50+
Pre-emption
51+
-----------
52+
53+
When a server is due to go off duty during a customer's service, there are two option of what may happen.
54+
55+
+ During a pre-emptive schedule, that server will immediately stop service and leave. Whenever more servers come on duty, they will prioritise the interrupted customers and continue their service. However those customers' service times are re-sampled. Therefore, a customer beginning service at time 5 who is meant to have a service time of 4, should finish service at time 9. However the server goes off duty at time 7. Another server restarts this customer's service at time 10, and re-samples the service time, this time service should last for 8 time units. Therefore the customer will finish service at time 18. In the records, this will be recorded as a total service time of 13, as service began at 5 and finished at 18.
56+
57+
+ During a non-pre-emptive schedule, customers cannot be interrupted. Therefore servers finish the current customer's service before disappearing. This of course may mean that when new servers arrive the old servers are still there, finishing up their original customers, resulting in a brief time where there are more servers on duty that was scheduled.
58+
59+
In order to implement pre-emptive or non-pre-emptive schedules, put the schedule in a tuple with a True or a False as the second term, indicating pre-emptive or non-pre-emptive interruptions. For example::
60+
61+
'my_preemptive_schedule': ([[40, 2], [100, 3], [120, 1], [180, 2], [220, 4], [250, 0]], True)
62+
63+
And::
64+
65+
'my_nonpreemptive_schedule': ([[40, 2], [100, 3], [120, 1], [180, 2], [220, 4], [250, 0]], False)
66+
67+
Ciw defaults to non-pre-emptive schedules, and so the following code implies a non-pre-emptive schedule::
68+
69+
'my_special_schedule_01': [[40, 2], [100, 3], [120, 1], [180, 2], [220, 4], [250, 0]]
5670

57-
Note that currently server schedules are incompatible with infinite servers, and so a schedule cannot include infinite servers.

0 commit comments

Comments
 (0)