Flexible Resource Management - A Framework for Self-Optimizing Real-Time Systems