* Note: We can compute the total CPU request (or load factor), as Ltot = sum(L(T)), T being the set of tasks.
*/
fntotal_load_factor(tasks:&Tasks)->f32{
letmutltot:f32=0.0;
fortintasks{
ltot+=cpu_load(t);
}
returnltot;
}
/*
* Calculates the cpu load of a task(L(t) where t is a task).
* L(t)
*
* Note: Each task t has a WCET C(t) and given (assumed) inter-arrival time A(t). The CPU request (or load) inferred by a task is L(t) = C(t)/A(t). Ask yourself, what is the consequence of C(t) > A(t)?
* Answer: If C(t) > A(t) then the cpu load of task t is more then the available cpu power in the
* worst case. And the task t will not be able to finish in time in the worst case.
* Note: We can compute the total CPU request (or load factor), as Ltot = sum(L(T)), T being the set of tasks.
*/
pubfntotal_load_factor(tasks:&Tasks)->f32{
letmutltot:f32=0.0;
fortintasks{
ltot+=cpu_load(t);
}
returnltot;
}
/*
* Calculates the cpu load of a task(L(t) where t is a task).
* L(t)
*
* Note: Each task t has a WCET C(t) and given (assumed) inter-arrival time A(t). The CPU request (or load) inferred by a task is L(t) = C(t)/A(t). Ask yourself, what is the consequence of C(t) > A(t)?
* Answer: If C(t) > A(t) then the cpu load of task t is more then the available cpu power in the
* worst case. And the task t will not be able to finish in time in the worst case.