The potential offered by the abundance of sensors, actuators and communications in IoT era is hindered by the limited computational capacity of local nodes, making the distribution of computing in time and space a necessity. Several key challenges need to be addressed in order to optimally and jointly exploit the network, computing, and storage resources, guaranteeing at the same time feasibility for time-critical and mission-critical tasks. Our research takes upon these challenges by dynamically distributing resources when the demand is rapidly time varying. We first propose an analytic mathematical dynamical modelling of the resources, offered workload, and networking environment, that incorporates phenomena met in wireless communications, mobile edge computing data centres, and network topologies. We also propose a new set of estimators for the workload and resources time-varying profiles that continuously update the model parameters. Building on this framework, we aim to develop novel resource allocation mechanisms that take explicitly into account service differentiation and context-awareness, and most importantly, provide formal guarantees for well-defined QoS/QoE metrics. Our research goes well beyond the state of the art also in the design of control algorithms for cyber-physical systems (CPS), by incorporating resource allocation mechanisms to the decision strategy itself. We propose a new generation of controllers, driven by a co-design philosophy both in the network and computing resources utilization. This paradigm has the potential to cause a quantum leap in crucial fields in engineering, e.g., Industry 4.0, collaborative robotics, logistics, multi-agent systems etc. To achieve these breakthroughs, we utilize and combine tools from Automata and Graph theory, Machine Learning, Modern Control Theory and Network Theory, fields where the consortium has internationally leading expertise. Although researchers from Computer and Network Science, Control Engineering and Applied Mathematics have proposed various approaches to tackle the above challenges, our research constitutes the first truly holistic, multidisciplinary approach that combines and extends recent, albeit fragmented results from all aforementioned fields, thus bridging the gap between efforts of different communities. Our developed theory will be extensively tested on available experimental testbed infrastructures of the participating entities. The efficiency of the overall proposed framework will be tested and evaluated under three complex use cases involving mobile autonomous agents in IoT environments: (i) distributed remote path planning of a group of mobile robots with complex specifications, (ii) rapid deployment of mobile agents for distributed computing purposes in disaster scenarios and (iii) mobility-aware resource allocation for crowded areas with pre-defined performance indicators to reach.