Fog computing can improve the IoT quality of service/experience by bringing cloud resources closer to the terminal devices (TD.) With this paradigm, some tasks are offloaded to nearby fogs for fast processing, with the remaining tasks retained for processing locally. The challenge, however, is which tasks to offload and which to retain. We propose a novel scheme that bases the offloading decision on the task compu-tational needs. Specifically, the TD offloads only time consuming tasks, which saves TD energy and guar-antees fast responses. We develop a queueing theoretic model for the scheme, where tasks are generated at the TD as a Poisson process, with each task requiring an exponential processing time. If this time exceeds a user defined threshold, the task is offloaded; otherwise, it is retained. This leads to two queue -ing systems with general service times: M/G/1 at the TD and M/G/c at the fog. The model incorporates six operational parameters, two of them making it unique: the offloading threshold and a fog virtual machine (VM) speedup factor. The model culminates in three equations for the task response times, revealing insights that can be used to enhance the offloading performance. The equations have been validated by extensive simulations.(c) 2021 The Authors. Published by Elsevier B.V. on behalf of King Saud University. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/4.0/).