# Analysis: CPU Load Analysis

## CPU Load Analysis

For D < T , the biggest period during which the CPU is permanently used (i.e. without interruption, idle time) corresponds to the scenario in which all tasks are activated synchronously. This period is called **synchronous busy period** and has duration L.

L can be computed by the following iterative method, which returns the first instant since the synchronous activation in which the CPU completes all the submitted jobs.

{% hint style="info" %}

#### Computation of L

![](https://3011170443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxBNeQZTqLnbb3C3JTlRu%2Fuploads%2FmSaJ0qT7R0wccxyCuWOW%2F2022-11-09_22-58.png?alt=media\&token=a05a8d8b-1fd2-4e20-a38f-b96b35852ac9)
{% endhint %}

Knowing L, we have to guarantee the **Load Condition** , i.e.

<figure><img src="https://3011170443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxBNeQZTqLnbb3C3JTlRu%2Fuploads%2FvPvQcsxn8ct0qPiOX1aT%2F2022-11-09_22-58.png?alt=media&#x26;token=308bb41a-cccb-4caf-99cc-f47f9cdaa262" alt=""><figcaption></figcaption></figure>

The Load Condition refers to all the work that must be **completed by t**.

### How to compute h(t)?

Example:

* Task set Γ = {(2, 4), (2, 8), (3, 16)}.
* Draw the Gantt chart and mark the points where tasks must complete.
* Write a suitable equation.

Knowing L we have to guarantee the load condition, i.e.

<figure><img src="https://3011170443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxBNeQZTqLnbb3C3JTlRu%2Fuploads%2F0FROu5gCxJlCuznSrBl9%2F2022-11-09_22-58.png?alt=media&#x26;token=25330eff-d2a2-46c6-b009-f35a1bb98dbe" alt=""><figcaption></figcaption></figure>

And h(t) can be computed as follows:

<figure><img src="https://3011170443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxBNeQZTqLnbb3C3JTlRu%2Fuploads%2FI2Q5RDUufe084k6B20Yy%2F2022-11-09_22-58.png?alt=media&#x26;token=90bd1179-0ea3-4263-a6e3-28a670c5e774" alt=""><figcaption></figcaption></figure>

The computation of h(t) for all values of t ∈ \[0, L\[ is unfeasible.

* However it is enough computing the load condition for the instants in which the load function varies, i.e.

<figure><img src="https://3011170443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxBNeQZTqLnbb3C3JTlRu%2Fuploads%2Fsb1wTPyFUu1HCKTpYERX%2F2022-11-09_22-58.png?alt=media&#x26;token=56804705-b6e5-44a7-86b1-b6fbb12812be" alt=""><figcaption></figcaption></figure>

Note: there are other, possibly shorter, values for L.

## EDF Scheduling

<figure><img src="https://3011170443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxBNeQZTqLnbb3C3JTlRu%2Fuploads%2FlI7fKzKq4aaHVikVRlsC%2F2022-11-09_22-58.png?alt=media&#x26;token=356469fb-6471-40ef-88c8-445fd2de9efd" alt=""><figcaption></figcaption></figure>

![](https://3011170443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxBNeQZTqLnbb3C3JTlRu%2Fuploads%2FxZ34TRrgarn0s9EG6QHE%2F2022-11-09_22-58.png?alt=media\&token=dc53b7c0-0d0b-4fa7-ab70-4d5abecb8802) -> Schedulability not guaranteed.

But the CPU load analysis indicates that the task set is schedulable!
