  Fog computing, which provides low-latency computing services at the network
edge, is an enabler for the emerging Internet of Things (IoT) systems. In this
paper, we study the allocation of fog computing resources to the IoT users in a
hierarchical computing paradigm including fog and remote cloud computing
services. We formulate a computation offloading game to model the competition
between IoT users and allocate the limited processing power of fog nodes
efficiently. Each user aims to maximize its own quality of experience (QoE),
which reflects its satisfaction of using computing services in terms of the
reduction in computation energy and delay. Utilizing a potential game approach,
we prove the existence of a pure Nash equilibrium and provide an upper bound
for the price of anarchy. Since the time complexity to reach the equilibrium
increases exponentially in the number of users, we further propose a
near-optimal resource allocation mechanism and prove that in a system with $N$
IoT users, it can achieve an $\epsilon$-Nash equilibrium in $O(N/\epsilon)$
time. Through numerical studies, we evaluate the users' QoE as well as the
equilibrium efficiency. Our results reveal that by utilizing the proposed
mechanism, more users benefit from computing services in comparison to an
existing offloading mechanism. We further show that our proposed mechanism
significantly reduces the computation delay and enables low-latency fog
computing services for delay-sensitive IoT applications.
