As aforementioned, an RSU delivers downlink packets to OBUs based on a service list. The first task for the SDS algorithm to do is to generate or update the service list, so that the RSU can use it to deliver packets in SCH intervals.
To clarify the problem and the proposed algorithm, we give the following definitions. OBU
requests to playback a packetized video stream
.
consists of a sequence of packets
, where
is the
th packet, and
is the total number of video packets. Each packet
is defined by a tuple
where
is the size of the packet,
is the playback deadline, and
is the priority of the packet,
. The sequences of packets are fed into the
queue, and they are stored in OBUs' high and low subqueues based on their destined OBUs and
(refer to Figure 4). In each subqueue, the packets with the same playback deadline are further grouped into a group of packets (GP). Let
and
represent the
th high-and low-priority GPs in OBU
. They are defined by
and
, respectively. We have
The sizes of
and
are
Let
represents the current time on the absolute time axis. We use
to denote the unallocated time in the current SCH interval for the
queue,
, before running the algorithm.
As aforementioned, the RSU keeps each OBU's out-of-cell time,
, and transmission rate
. The possible (maximum) transmission time can be allocated to OBU
is
that is, either the service interval is entirely allocated to OBU
or the RSU allocates the OBU's with its remaining dwelling time
. Based on a GP's playback deadline, we can calculate a tolerable playback delay of this GP. For example, the tolerable playback delay of a high-priority GP
is
. The RSU also keeps the time that each GP already waited in the queue, that is, queuing delay. For example, the queuing delay of a high-priority GP
is
. Based on the total size of a GP and the transmission rate to OBU
, the total time needed to transmit a GP to OBU
can be calculated, for example, for GP
it is
or
, for high-and low-priority GPs, respectively.
The objective of the scheduling algorithm is to generate or update a service list and then schedule packets based on this service list (see Algorithm 1). The service list indicates the order of the OBUs to be served and the packets in each OBU queue to be delivered. Let
be the number OBUs connected to the RSU. We sort the OBUs by using a scheduling weight factor
which is defined as
where
is the time needed to send the first high-priority GPs to OBU
, and
is the tolerable playback deadline of the first high-priority GPs. The equation implies that the OBUs with small dwelling time, small tolerable playback delay, larger queuing delay, and larger amount of high-priority packets will be scheduled first.
Algorithm 1: Service list generation and updating algorithm.
-
(1)
Initialize the service list: remove an OBU from the list if it is no longer connected to the RSU;
add an OBU into the list if it is newly connected to the RSU.
-
(2)
In each sub-queue, discard the packets if their playback deadlines are reached.
-
(3)
Calculate
for each OBU by using (4).
-
(4)
Sort the service list (indexed by OBUs ID) by weight factor
, the weightiest the first.
-
(5)
for all
, calculate
and
for all GP
that
and
.
-
(6)
Calculate
and
.
-
(7)
.
-
(8)
if
then
-
(9)
Grant all the high priority GPs with deadlines in current
.
-
(10)
Update
.
-
(11)
if
then
-
(12)
Grant all the low priority packets with deadlines in current
.
-
(13)
Update
.
(14): else only part of low priority GPs can be sent
-
(15)
Grant low priority GPs in the sorted OBU order and update
once a GP is granted, until
.
-
(16)
algorithm ends
-
(17)
endif
-
(18)
else
-
(19)
Grant high priority GPs in the sorted OBU order and update
once a GP is granted, until
.
-
(20)
algorithm ends
-
(21)
endif
-
(22)
if
then still some time left
-
(23)
Grant the packets in all high priority sub-queues and then all low priority sub-queues in a round-robin
manner and in the sorted OBU order, update
once a packets is granted, until
.
-
(24)
endif
-
(25)
algorithm ends
The algorithm first initializes the service list by removing disconnected OBUs and adding newly connected OBUs (line 1). It then discards the packets with playback deadlines are reached (line 2). The algorithm calculates the scheduling weight factors (line 3) and sorts the OBUs by their factors (line 4). After that, for each OBU, all the transmission time required for transmitting high- and low-priority GPs with deadlines within current WAVE sync interval
is calculated (line 5). This step is to find the packets which will be expired if they are not transmitted within current sync interval. Line 6 calculates the total time required to transmit all high- and low-priority GPs. Line 7 initializes
to
. If the unallocated time is enough for transmitting the high-priority GPs (line 8), all high-priority GPs will be granted (line 9). Line 10 updates the unallocated time
. If there is still enough time for low-priority GPs (line 11), all packets in the low-priority GPs will be granted (line 12). If the unallocated time
is not enough to transmit all low-priority GPs (line 15),
will be used for allocating the GPs according to the order yielded in line 4, until the TXOP is fully allocated, that is,
. It is the same if
is not enough for all high-priority GPs (line 19), and only part of high-priority GPs can be granted according to the order yielded in line 4. If there is still some time left after all the high- and low-priority GPs with the playback deadlines within current
are granted (line 22), the remaining time will be used to grant the packets in all high-priority subqueues and then all low-priority subqueues in a round-robin manner in the sorted OBU order. The reason to use round-robin here is for computational simplicity, since these packets' playback deadlines are not reached until next SCH interval and they can be transmitted in next sync interval if they are not scheduled in current
.
Figure 6 shows an example of video packet grouping. There are four OBUs currently connected to an RSU, and there are four playback deadlines
,
,
and
as marked in the figure, where
. Assume that we have
, that is, the packets with playback deadlines as
and
have to be transmitted in this TXOP. The video packets with the same playback deadlines are grouped together to form GPs. Assume that the order of the OBUs in the service list is OBU 3, OBU 1, OBU 4, and OBU 2, which is decided by their scheduling weight factors (4). According to the algorithm, the granting sequence of the GPs will be
,
,
,
,
, and
for the high-priority GPs. If there is still some time left, the low-priority GPs will be granted in the sequence of
,
,
,
,
, and
. After that, if there is still some time left, the rest GPs can be scheduled in the order of
,
,
,
,
,
,
, and
.