Borrowed Virtual Time Scheduling
Borrowed Virtual Time Scheduling
SCHEDULING
PRESENTED BY:
SAGAR S TALAGATTI – 2GI23SCS08
OUTLINE
• Introduction To Borrowed Virtual Time Scheduling
• Example
• Conclusion
• References
INTRODUCTION TO BORROWED VIRTUAL TIME
SCHEDULING
• Objective: To support low-latency dispatching of real-time applications as well as a weighted
sharing of the CPU among several classes of applications.
• Supports scheduling of a mix of applications, some with hard, some with soft real-time constraints,
and applications demanding only a best effort.
• Each thread i has:
1. Effective virtual time Ei
2. Actual virtual time Ai
3. Virtual time warp Wi
• The scheduler thread maintains its own scheduler virtual time (SVT), defined as the minimum
actual virtual time Aj of any thread.
• The threads are dispatched in the order of their effective virtual time, Ei, using a policy called the
earliest virtual time (EVT).
INTRODUCTION TO BORROWED VIRTUAL TIME
SCHEDULING
• The virtual time warp allows a thread to acquire an earlier effective virtual time.
• That is, to borrow virtual time from its future CPU allocation.
• The virtual warp time is enabled when the variable warpBack is set.
• In this case a latency-sensitive thread gains dispatching preference as:
• The algorithm measures the time in minimum charging units (mcu) and uses a time
quantum called context switch allowance (C).
• C measures the real time a thread is allowed to run when competing with other threads,
measured in multiples of mcu.
INTRODUCTION TO BORROWED VIRTUAL TIME
SCHEDULING
• Typical values for the two quantities are mcu = 100 μsec and C = 100 msec.
• A thread is charged an integer number of mcu.
• Context switches are triggered by traditional events:
• the running thread is blocked waiting for an event to occur
• the time quantum expires
• an interrupt occurs
• a thread becomes runnable after sleeping
• Thread τi becomes runnable after sleeping, its actual virtual time is updated as
follows:
INTRODUCTION TO BORROWED VIRTUAL TIME
SCHEDULING
• If there are no interrupts, threads are allowed to run for the same amount of virtual
time.
• Threads have weights, a thread with a larger weight consumes its virtual time more
slowly.
• Each thread τi maintains a constant ki and uses its weight wi to compute the amount
used to advance its actual virtual time upon completion of a run:
Ai ← Ai + ∆
• Given two threads a and b: ∆ = ka / wa = kb / wb
• The EVT policy requires that every time the actual virtual time is updated, a context
switch from the current running thread τi to a thread τj occurs if:
EXAMPLE
EXAMPLE
EXAMPLE
EXAMPLE
• Table 6.5 shows the effective virtual time of the two threads at the time of each context switch.
• At that moment, its actual virtual time is incremented by an amount equal to ∆ if the thread
was allowed to run for its time allocation.
• The scheduler compares the effective virtual time of the threads and first runs the one with the
minimum effective virtual time.
• When a thread is running, its effective virtual time increases as the real time increases; a
running thread appears as a diagonal line.
• When a thread is runnable but not running, its effective virtual time is constant. A runnable
period is displayed as a horizontal line.
• We see that the two threads are allocated equal amounts of virtual time, but thread a, with a
larger weight, consumes its real time more slowly.
CONCLUSION
• BVT is an efficient algorithm for low-latency dispatching of real-time applications.
• It allows for weighted sharing of the CPU among several classes of applications.
• It allows each thread to borrow its own future CPU allocation and hence doesn’t
disrupt long-term CPU sharing.
REFERENCES
• Cloud Computing Theory and Practice by Dan C. Marinescu, Morgan Kaufmann
Publications
THANK YOU