Process Scheduling & Energy Attribution

1. CPU Activity Timeline: Time Slicing & Context Switching

A CPU rapidly switches between processes, giving each a small "time slice" to execute. The brief pauses between slices are "context switches," where the CPU saves one process's state and loads another's. Time slices vary and are determined by the OS scheduler.

Process A
Process B
Process C
Idle Process
Context Switch

2. Accumulated CPU Time & CPU Utilization (%)

Each process accumulates "CPU time". This, relative to the total time, determines its CPU utilization.

Process A:
Process B:
Process C:
Idle Process:
System Overhead:

3. Proportional Energy Attribution

EMT attributes energy consumption by normalizing the CPU utilization of active processes and then proportionally distributing the total measured energy (e.g., 500 Joules).

3a. Relative CPU Utilization Among Active Processes

CPU time of active processes (A, B, C) is normalized relative to their combined total. This excludes Idle time and System Overhead for this specific energy attribution step.

Process A
Process B
Process C

$$ \text{Norm. Util. (P)} = \left(\frac{\text{P's CPU Time}}{\sum \text{CPU Time of Active Ps}}\right) \times 100\% $$

3b. Proportional Energy Attribution to Active Processes

Using normalized utilization, total energy (e.g., 500 Joules) is attributed to active processes A, B, and C.

Process A:
Process B:
Process C:

$$ \text{Energy}^\text{P} =\text{Norm. Util. (P)} \times \text{Total Energy} $$