Fog computing introduces a distributedprocessing capability close to end-users. The proximity of computing toend-users leads to lower service time and bandwidth requirements. Energyconsumption is a matter of concern in such a system with a large number ofcomputing nodes. Renewable energy sources can be utilized to lessen the burdenon the main power grid and reduce the carbon footprint, but due tofluctuations, effective utilization of renewable energy sources needs properresource management. In this thesis, we deal with properly managing the resourcesin a fog environment where the fog nodes are equipped with on-site renewableenergy. This thesis aims to design an efficient mechanism to dynamicallydispatch requests among computing nodes and scale frequency and modulation level,based on current workload and the availability of renewable energy sources, tominimize the service time while keeping the renewable energy utilization andstability at a satisfactory level. We state the problem as the design of acontroller for a system with time-varying nonlinear state equations.Accordingly, we borrow the Lyapunov optimization technique from the control theoryto design the request dispatching mechanisms and prove its asymptoticoptimality. We perform extensive simulations to evaluate the effectiveness ofthe proposed method. Simulation results demonstrate that our proposed methodoutperforms the state-of-the-art alternatives up to 23% and 50%, respectively, interms of service time and renewable energy utilization.