The task switching paradigm was introduced first at the beginning of the last century, but only recently it has been systematically studied. Subjects are asked to rapidly switch between different tasks, giving rise to the "task switching cost". This effect consists of a decrement in performance during the first trial after changing the required task (slower response times and higher error rates). In order to explain its origin, different theories have been proposed. This review considers both theories and empirical evidence on task switching. Besides research on normal subjects, we have taken into account also special populations task switching studies (children, elderly, and neuropsychological patients) and imaging studies to achieve a complete picture of this interesting phenomenon.