Adaptive CPU Resource Allocation for Pervasive Computing Devices Based on Optimal Control