An Efficient Control-driven Period Optimization Algorithm for Distributed Real-time Systems