Energy and performance-optimized scheduling of tasks in distributed cloud and edge computing systems