1: Input: Let { 𝜏 1 , 𝜏 2 , , 𝜏 𝑘 } be the accepted tasks in the
 ready queue, and let 𝐶 𝑖 be the expected execution time of
𝜏 𝑖 . Let current time be 𝑡 and let 𝜏 0 be the task currently
 being executed, expected execution time of 𝜏 0 is 𝐶 0 . Let
 the expected utility density threshold be 𝛿 .
2:
3: if A new task, that is, 𝜏 𝑝 arrives then
4:  Accept 𝜏 𝑝 if 𝜌 𝑝 ( 𝐶 0 ) > 𝛿 ;
5:  Reject 𝜏 𝑝 if 𝜌 𝑝 ( 𝐶 0 ) 𝛿 ;
6:  Remove 𝜏 𝑗 in the ready queue end if 𝜌 𝑗 ( 𝐶 0 ) 𝛿 ;
7: end if
8:
9: If 𝜏 0 is completed then
10:  Choose 𝜏 𝑖 with the largest system utility density, that is,
    ̃ 𝜌 𝑖 ( 𝑡 ) = m a x 𝑘 ̃ 𝜌 𝑘 ( 𝑡 ) .
11:  Remove 𝜏 𝑗 in the ready queue if 𝜌 𝑗 ( 𝐶 𝑖 ) < 𝛿 ;
12: end if
13:
14: If 𝑡 = the critical time of 𝜏 0   then
15:  Abort 𝜏 0 immediately;
16:  Choose 𝜏 𝑖 with the largest system utility density, that is,
̃ 𝜌 𝑖 ( 𝑡 ) = m a x 𝑘 ̃ 𝜌 𝑘 ( 𝑡 ) .
17:  Remove 𝜏 𝑗 in the ready queue if 𝜌 𝑗 ( 𝐶 𝑖 ) < 𝛿 ;
18: end if
Algorithm 1: The scheduling algorithm based on opportunity cost.