Open main menu

OpenVZ Virtuozzo Containers Wiki β

Containers/Guarantees for resources

< Containers
Revision as of 05:20, 18 May 2011 by 188.163.70.199 (talk) (How to guarantee a guarantee)


This page describes how guarantees for resources can be implemented.

4qHRP7 <a href="http://luoytkhoypcx.com/">luoytkhoypcx</a>, [url=http://jienmoiwokmx.com/]jienmoiwokmx[/url], [link=http://iizjsuoiwaia.com/]iizjsuoiwaia[/link], http://oqxpipmtgqqu.com/

Providing a guarantee through limiting

The idea of getting a guarantee is simple:

if any group   requires a   units of resource from   units available then limiting all the rest groups with   units provides a desired guarantee

For   groups in the system this implies solving a linear equation set to get limits   like this:

 

In a matrix form this looks like

 

where

 


and thus the solution is

 


Skipping boring calculations, the reverse matrix   is

 

This solutions looks huge, but the   vector is calculated in   time:

void calculate_limits(int N, int *g, int *l)
{
        int sum;
        int i;

        if (N == 1) {
                l[0] = R;
                return;
        }

        sum = 0;
        for (i = 0; i < N; i++)
                sum += R - g[i];
        for (i = 0; i < N; i++)
                l[i] = (sum - (R - g[i]) - (N - 2) * (R - g[i]))/(N - 1);
}

Disadvantages of this approach

This approach has only one disadvantage: O(n) time needed to start a new container.