# Assessing the Cloud-RAN in the Linux Kernel: Sharing Computing and Network Resources
## 3 System Model: Instantiating the vBBU within the Linux Kernel
### Enhancing RT Performance for vBBU Processes with CPU Affinity  
The RT-Kernel's Scheduler is designed to maximize the allocation of CPU time across numerous tasks, accomplished by frequently shuffling tasks among available CPUs [44]. However, this dynamic task allocation strategy can introduce processing jitter, causing variability in the wait time for a process before it receives CPU time. Notably, the variability that processing jitter brings about may lead to missed deadlines or unforeseen delays in executing RT functions, potentially compromising the vBBU's overall performance and, consequently, the quality of service in the mobile network. CPU affinity provides a mechanism to designate which CPUs a particular process can utilize, providing a potential solution to minimize processing jitter [58; 59]. By binding RT tasks--such as those within vBBU--to a specific group of CPUs, CPU affinity ensures that the Kernel Scheduler restricts CPU-time allocation to these assigned CPUs [60]. This strategy leverages the principle of processor cache locality, maintaining frequently used data in the cache of the specific CPUs, resulting in a more predictable and deterministic execution of RT tasks [61; 62]. For the purposes of our study, we explored three distinct implementations of CPU affinity, each representing a different level of CPU allocation strictness, which confines tasks to specific CPUs, as depicted in Figure 4. Let \(C=\{C0,\ldots,C7\}\) be the set of available CPUs in this specific network scenario. Furthermore, let \(T=\{\tau_{1},\ldots,\tau_{9}\}\) be the set of vBBU threads shown in Table 1. Assuming CPU affinity allocation to the vBBU on the CPUs \(\{C4,C5,C6,C7\}\) of \(C\), the CPU affinity allocation scenarios for the vBBU threads in \(T\) are defined as follows:  
In the first scenario, named Wide Affinity (_WA_), static CPU affinity is assigned to the vBBU on a predetermined subset of CPUs, denoted as \(C_{W}\subset C\). Specifically, \(C_{W}=\{C4,C5,C6,C7\}\). In the second scenario, denoted Thread Affinity (TA), static CPU affinity is assigned per process thread (i.e., per child process) on a predetermined subset of CPUs, denoted as \(C_{T}\subset C\). The CPU affinity allocation for each vBBU's thread \(\tau_{i}\in T\) is defined as \(C_{\tau_{i}}\in C_{T}\) for each \(\tau_{i}\in T\). Specifically, the TA scenario involves grouping related RT threads to run on the same CPU. Given that ru_thread (\(\tau_{1}\)) is the most CPU-intensive thread handling time domain IQ signal samples to the RRU, \(\tau_{1}\) is assigned the CPU affinity \(C_{\tau_{1}}=C4\) with no other thread on that CPU. Similarly, as lte-softmodem (\(\tau_{2}\)) is the second-most CPU-intensive thread dealing with L1 and L2 functions, \(\tau_{2}\) is given the CPU affinity \(C_{\tau_{2}}=C5\) without any other thread on that CPU. Notably, fep_processing (\(\tau_{3}\)) and feptk_thread (\(\tau_{4}\)) are related, both performing front-end processing for RX and TX, respectively. Hence, \(\tau_{3}\) and \(\tau_{4}\) share the CPU affinity \(C_{\tau_{3}}=C_{\tau_{4}}=C6\). Allocating CPU affinity to all non-RT threads on a different CPU than the RT threads helps avoid unpredictable waiting times for the non-RT threads. Therefore, \(\{\tau_{5},\tau_{6},\tau_{7},\tau_{8},\tau_{9}\}\) are given by the CPU affinity \(C_{\tau_{3}}=C_{\tau_{6}}=C_{\tau_{7}}=C_{\tau_{8}}=C_{\tau_{9}}=C7\). These initial two CPU affinity scenarios aim to explore the benefits of assigning latency-sensitive vBBU threads to dedicated CPUs compared to the alternative approach, where the RT-Kernel dynamically schedules these threads across a predefined set of CPUs. Figure 4: CPU affinity allocation strategies (_WA_, _TA_, and _IA_) for the vBBU. The third scenario, called Hard-IRQ CPU-affinity (IA), consists of hard-IRQs being assigned specific CPU affinities in order to optimize interrupt handling. Most modern NICs support multi-queue RX/TX. By default, an NIC's driver instantiates as many RX/TX queues as CPUs in the system.