# Adaptive Virtual RSU Scheduling for Scalable Coverage under Bidirectional Vehicle Traffic Flow
## 5 Cache Replication
### Online Implementation
#### 5.2.2 A General Case Scenario  
In order to deal with a general case scenario with dynamic traffic flow in global urban areas, we present a distributed online scheduling strategy for a general case scenario in Figure 7, in which the vehicle may enter or leave the road at anytime and anywhere as a traffic-in or traffic-out. Each RSU can monitor the traffic flow and request demand in its local coverage areas, and the statistic information is only shared among neighbor RSUs for cooperation. Accordingly, the distributed online scheduling strategy includes a request scheduling mechanism for the transmission layer mapping, and a replication scheduling mechanism for the replication layer mapping, respectively.  
**Replication Layer Mapping.** The replication scheduling mechanism refers to determining the mapping relationship between the RSU and replication content. Given a road segment, the RSUs are allocated in sequence along the road, and the vehicles can pass by the coverage areas of these RSUs in order. Thus, for every RSU at any time, the traffic flow under its coverage areas consists of either the vehicles from previous RSUs, or the newly joint vehicles in this distance. Without the global popularity of each replica, the replication scheduling mechanism can be designed according to the local popularity prediction, which is influenced by the statistics of vehicles from previous neighbor RSUs and newly joint vehicles. We can have a comprehensive consideration of the replication scheduling with the estimation of the two factors as follows:  
\[P_{k}(t+1)=\sigma_{k-1}(t)\cdot P_{k-1}(t)+P^{\prime}_{k-1}(t),\]  
where \(P_{k}(t+1)\) and \(P_{k-1}(t)\) represent popularity distribution of RSU \(k\) at time \(t+1\) and popularity distribution of RSU \(k-1\) at time \(t\), respectively. Furthermore, we have \(P^{\prime}_{k-1}(t)\) as the popularity distribution of newly joint vehicles in the distance between the RSU \(k-1\) and RSU \(k\). In addition, we denote \(0\leq\sigma_{k-1}(t)\leq 1\) as the popularity distribution influence of the previous neighbor RSU. Larger \(\sigma_{k-1}(t)\) indicates a lesser fraction of traffic flow, which leaves the road after passing by previous RSUs. Generally, we consider \(\sigma_{k-1}(t)\) as a time-varying coefficiency according to the dynamic traffic flow.  
**Transmission Layer Mapping.** The request scheduling mechanism refers to determining the mapping relationship between the RSUs and moving vehicles. Ideally, each vehicle can request its demand from the passing-by RSUs with requested content replication. Nevertheless, for each RSU, there usually exists a connection limitation to serve the request demands in its coverage area at the same time. Then, the number of connections can be a bottleneck for the transmission between the RSUs and vehicles. Generally, we utilize the request scheduling to arrange these subsequent request demands as follows: (1) New Requester First: the RSUs will serve the newly-joint vehicles in priority; (2) Old Requester First: the RSUs will serve the vehicles who drive a long distance in priority; (3) First-in First-out: the RSUs will serve the requester in a regular order.  
Whenever a vehicle joins the traffic flow of a road, it will send a request demand to the coherent RSU. After receiving these requests, the RSU will update its local replication and complete the request scheduling. Accordingly, we can consider the practical issues of online implementation from the vehicle side and RSU side, respectively. From the viewpoint of vehicles, the passing-by RSU will be recorded in a sequence of labels. For example, <r1, s1, t1> and < r1, s2, t2> represent the fact that this vehicle sends a request to RSU s1 and s2 at time t1 and t2 for replica r1. From the viewpoint of RSUs, the labels will be received online with the request demand, and the statistics of the dynamic traffic flow can be reflected from these labels. Correspondingly, the replication scheduling and request scheduling will be implemented at the RSUs in a distributed manner.