3. Background
VM1
vcpu0 vcpu1
VM2
vcpu0 vcpu1
runqueue
Real clock
runqueue
Real clock
pcpu0 pcpu1
Context Switch
pick vcpu
Context Switch
pick vcpu
IORR/BVT scheduler
In ACRN scheduler framework:
1.Each vCPU in VM is pinned to a
unique pCPU.
2.Two vCPUs in one VM cannot
share one pCPU.
3.Migration is currently not support,
so, load balance is not implemented.
4. IORR
• IORR is an I/O sensitive Round-Robin Scheduler. vCPU with I/O request has
highest priority, thus can achieve high I/O performance (throughput and
latency).
• A period tick timer is created for each pCPU, a vCPU can run for at most a
period of time, (default 10ms) and the next vCPU in RUNQ can be
scheduled.
I/O CPUI/O I/O CPU CPURUNQ
Defects:
• Unfair
• I/O attack: Use I/O to maliciously preempt pCPU resources
• vCPU with CPU bound workload will suffer starvation when
sharing pCPU with vCPU with I/O bound workload.
5. BVT
borrowed-virtual-time (BVT) : a general-purpose scheduling algorithm that allows a single
operating system to support the diverse range of applications, and thus a candidate “universal”
processor scheduler.
•Virtual time thread with earliest effective virtual time (EVT) is dispatched first.
•Warp a latency-sensitive thread is allowed to warp back in virtual time to make it appear earlier.
It borrows virtual time from its future CPU allocation and thus does not disrupt long-term CPU
sharing.
•MCU minimum charging unit, the scheduler account for running time in units of mcu.
•Weighted fair sharing Each runnable thread receives a share of the processor in proportion to
its weight wi over a scheduling window of some number of mcu.
•C context switch allowance. Real time by which the current thread is allowed to advance
beyond another runnable thread with equal claim on the CPU. C is similar to the quantum in
conventional timesharing.
* Paper: Borrowed-Virtual-Time (BVT) scheduling: supporting latency-
sensitive threads in a general-purpose scheduler
6. BVT-- Weighted fair sharing
C is 2mcu
Weight for gcc: bigsim is 2:1
Gcc: 2 + 6 + 6 + 4 = 18
Bigsim: 3 + 3 + 3 = 9
AVT: actual virtual time
EVT: effective virtual time
AVT for current running thread is
incremented by its running time
divides by weight.
Context switch occur when the
running thread passes the waiting
thread by one C.
Rules:
52 11 14 20 23
A
B
C
7. BVT – sleep/wakeup
When thread i becomes runnable after sleeping
where scheduler virtual time (SVT) is a scheduler
variable indicating the minimum AVT of any runnable
thread. This adjustment prevents a thread from claiming
an excessive share of the CPU after sleeping for a long
time as might happen if there was no adjustment.
8. BVT – low latency dispatch
A thread is created with a non-zero warp Wi to
give it dispatch preference. Larger warp values
provide lower latency dispatch than smaller values.
evt = avt - 50
9. Test data (20s)
* As the warp is disabled, evt = avt
BVT – run data from ACRN
10. Evaluation
• Env:
• RAM/VM: 1G
• Network: virtio-net LAN
• Disk: virtio-block file
• Platform: NUC7i7DNH1E
• CPU: turbo off, CPU freq fixed (1.9Ghz)
• 1 Core (offline 1-3)
• Tools:
• I/O
• Iperf
• ping
• CPU
• sysbench
Case Target Methods Run VM
1 I/O throughput Iperf3 -c $serverip -t 60 -i 1
iperf3 -c $serverip -t 60 -i 1 -u -b 1G -P 10
• Native (only start sos)
• VM1-VM3 together
2 I/O latency ping $ip -c 60 -i 1 • Native (only start sos)
• VM1-VM3 together
3 CPU throughput sysbench cpu --cpu-max-prime=20000 --
threads=1 --time=30 run
• Native (only start sos)
• VM1-VM3 together