Introduction

The difficulty of rapidly switching between two different tasks was first reported by Jersild in 1927, but it was not until the mid-1990s that the task-switching paradigm became popular with cognitive psychologists and neuroscientists. The paradigm’s popularity has probably to do with the fact that task-switching paradigms are so surprisingly difficult.

Jersild had people doing one task at the time and compared that to people doing two tasks in rapid alternation. He found that people perform more slowly when they are alternating between tasks. Apparently, the act of switching requires special mental operations, and the task-switching paradigm is designed to investigate the nature of these operations.

Robert Rogers' and Stephen Monsell’s 1995 paper has contributed massively to the popularity of task-switching paradigms. Their alternative runs approach (demonstrated below) was different from Jersild’s paradigm.

In this task, participants carry out two trials of task A, followed by two trails of task B, and then back to task A. Hence, a task switch occurs every two trials. The difficulty to switch between tasks is expressed as the slow down immediately following a task switch. That said, this paradigm also allows to express the cost Jersild measures. In Jersild’s time (before computers), the task-switch cost was practically difficult to measure.

Today, we know that people cannot overcome the difficulty of switching even with fairly long training (Stoet and Snyder, 2007). Surprisingly, though, Stoet and Snyder (2003) showed that monkeys can (given sufficient training).

About this implementation

This example is very close to Roger and Monsell’s paradigm. In this example, you need to respond to number and letter combinations. Follow the detailed instructions on screen. At the end of the tasks, you will get feedback about exactly how fast you are when you do just one task at the time ("pure blocks"), and how fast you are when you are doing two tasks mixed. In the mixed block, we distinguish between "task-repeat trials", namely the trials in which you do the same task as in the trial before. And then there are "task-switch trials", trials in which you switch from doing one task to doing another task.

This demo takes less than 5 minutes to complete. In the laboratory, these tasks last longer to get a more reliable estimate of one’s speed, though.

  • Note, you can show your response times and copy and paste them to a local file for your own data analysis.

Run the demo

In this experiment, you respond with the keys b and n to letters (in the consonant/vowel task) and numbers (in the odd/even task). The instructions are all on screen and require some concentrated reading.
This is a very difficult task! You need to remember the rules of two different tasks and you need to frequently switch between them. In the cognitive laboratory, this is one of the more difficult tasks. Are you up to it?

Data output file

TODO

In PsyToolkit, the data output file is simply a textfile. The save line of the PsyToolkit experiment script determines what is being saved in the data output file. Typically, for each experimental trial, you would have exactly one line in your text file, and each number/word on that line gives you the information you need for your data analysis, such as the condition, response speed, and whether an error was made.

Meaning of the columns in the output datafile. You need this information for your data analysis.

Colum Meaning

1

blockname

2

position of stimulus 1,2,3,4 (top left, top right, bottom right, bottom left

3

tasktype (1 or 2)

4

the letter stimulus

5

the number stimulus

6

type of block (1=just task 1; 2=just task 2; 0=both tasks mixed)

7

1=task switch , 0=task repeat

8

status (1=correct, 2=error, 3=too slow)

9

response time (ms)

10

total time (response time + button release time)

The response time is when people press down the button. But it also takes some time to "release" the button again (to go up). For analysis, I recommend to use the response time.

PsyToolkit code

Click to expand the PsyToolkit script code (part of zip file below)
# A slightly modified version of the alternate runs task switching
# paradigm: Rogers and Monsell, Journal of Experimental Psychology:
# General, 124, 207-231 (2003).

# grid position 1 is top left, and then clockwise
# task 1 is in top quadrants
# task 2 in bottom quadrants

#### this code does not use a table, but the conditions are calculated
#### with helper variables. The code looks a bit more complicated, but
#### the reason is that neither letters nor numbers should repeat
#### themselves in consecutive trials. This seems the most efficient
#### way of coding it.

options
  bitmapdir stimuli

##
# G K M R  A E I U
# 3 5 7 9  2 4 6 8
# L L L L  R R R R

bitmaps
  ############### stimuli used in tasks
  pg
  pk
  pm
  pr
  pa
  pe
  pi
  pu
  p3
  p5
  p7
  p9
  p2
  p4
  p6
  p8
  ## other stimuli
  grid
  task1
  task2
  ready
  instructions1
  instructions2
  instructions3
  instructions4
  instructions5
  readyletters
  readynumbers
  readylettersnumbers
  thankyou

fonts
  arial 18

######################################################################
# TASK SWITCHING BASED ON ROGERS/MONSELL 1995

# letters 1-8 and numbers 1-8.
# G K M R  A E I U     bitmaps 1-8
# 3 5 7 9  2 4 6 8     bitmaps 9-16 (i.e. 1-8 +8)
# L L L L  R R R R     response

task lettersnumbers
  keys b n
  ## instead of table, determine stimulus/response here #########
  set $letter random 1 8 # select a random letter
  set $number random 1 8 # select a random number
  # keep selecting until letter and number are different from previous trial
  while $letter == &previousletter or $number == &previousnumber
    set $letter random 1 8
    set $number random 1 8
  while-end
  set &previousletter $letter # keep for the next trial
  set &previousnumber $number # keep for the next trial
  set $numberbitmap expression $number + 8 # number bitmaps run from 9-16
  # associate responses for both possible tasks #################
  set $lettertaskresponse 1   # left button
  if $letter > 4
    set $lettertaskresponse 2 # right button
  fi
  set $numbertaskresponse 1   # left button
  if $number > 4
    set $numbertaskresponse 2 # right button
  fi
  ###############################################################
  show bitmap grid
  delay 150 # ITI (RS = 150)
  # which quadrant is being used? this goes clockwise
  # top left is 1, up to four
  set &pos increase 1
  if &pos > 4
    set &pos 1
  fi
  ########## you can also do just one task then you use only 2 quadrants
  if &justtask == 1
    if &pos > 2
      set &pos increase -2
    fi
  fi
  if &justtask == 2
    if &pos < 3
      set &pos increase 2
    fi
  fi
  # determine position 1 and 2 of stimuli (letter is left or number)
  if &pos == 1           # letter task
    set $xpos1 -50
    set $xpos2 -25
    set $ypos  -33
    set $key $lettertaskresponse
    set $tasktype 1
  fi
  if &pos == 2           # letter task
    set $xpos1 25
    set $xpos2 50
    set $ypos  -33
    set $key $lettertaskresponse
    set $tasktype 1
  fi
  if &pos == 3           # number task
    set $xpos1 25
    set $xpos2 50
    set $ypos  33
    set $key $numbertaskresponse
    set $tasktype 2
  fi
  if &pos == 4           # number task
    set $xpos1 -50
    set $xpos2 -25
    set $ypos  33
    set $key $numbertaskresponse
    set $tasktype 2
  fi
  # set up screen
  show bitmap $letter $xpos1 $ypos
  show bitmap $numberbitmap $xpos2 $ypos
  readkey $key 5000
  if STATUS != CORRECT
    if $tasktype == 1
      show bitmap task1 210 -50
    fi
    if $tasktype == 2
      show bitmap task2 210 40
    fi
    delay 3000
    clear -1
  fi
  clear 2 3
  # code if this trial was a task switch or task repeat trial
  if &previoustask == $tasktype
    set &taskswitch 0
  fi
  if &previoustask != $tasktype
    set &taskswitch 1
  fi
  set &previoustask $tasktype
  # save data
  save BLOCKNAME &pos $tasktype $letter $number &justtask &taskswitch STATUS RT TT

######################################################################
#			   BLOCKS START HERE                         #
######################################################################

block letters
  pager instructions1 instructions2 instructions3 instructions4 instructions5
  message readyletters
  set &previoustask -1
  set &taskswitch 0 # 1 if a trial is a task switch trial
  set &justtask 1 # this makes that only the letter task is being selected
  tasklist
    lettersnumbers 40
  end

block numbers
  set &justtask 2 # this makes that only the number task is being selected
  message readynumbers
  tasklist
    lettersnumbers 40
  end

block mixed
  set &justtask 0 # this makes that both tasks are in alternative run sequence
  message readylettersnumbers
  tasklist
    lettersnumbers 40
  end
  feedback
    text align left
    set &RTpure      mean c9 ; select c8 == 1 && c6 != 0 && c7 == 0
    set &RTmixRepeat mean c9 ; select c8 == 1 && c6 == 0 && c7 == 0
    set &RTmixSwitch mean c9 ; select c8 == 1 && c6 == 0 && c7 == 1
    set &RTMixCost    expression &RTmixRepeat - &RTpure
    set &RTSwitchCost expression &RTmixSwitch - &RTmixRepeat
    text -200 -150 "Response times (RT in ms):"
    text -200 -50  &RTpure       ; prefix "RTs in single-task blocks: " ; postfix " ms"
    text -200   0  &RTmixRepeat  ; prefix "RTs in mixed block, task-repeat trials: " ; postfix "ms"
    text -200  50  &RTmixSwitch  ; prefix "RTs in mixed block, task-switch trials: " ; postfix "ms"
    text -200 100  &RTSwitchCost ; prefix "Task switch cost in RTs: " ; postfix "ms"
    text -200 150  "Press space bar to continue"
  end

Download

If you have a PsyToolkit account, you can upload the zipfile directly to your PsyToolkit account. Watch a video on how to do that. If you want to upload the zipfile into your PsyToolkit account, make sure the file is not automatically uncompressed (some browsers, especially Mac Safari, by default uncompress zip files). Read here how to easily deal with this.

Further reading

  • Jersild, A.T. (1927). Mental set and shift. Archives of Psychology, 89, 5–82.

  • Monsell, S. (2003). Task switching. Trends in Cognitive Sciences, 7, 134-140.

  • Stoet, G. & Snyder, L.H. (2003). Executive control and task-switching in monkeys. )Neuropsychologia, 41_, 1357-1364.

  • Stoet, G. & Snyder, L.H. (2007). Extensive practice does not eliminate human switch costs. Cognitive, Affective, & Behavioral Neuroscience, 7, 192-197.

  • Vandierendonck, A, Liefooghe, B, & Verbruggen,F. (2010). Task Switching: Interplay of Reconfiguration and Interference Control. Psychological Bulletin, 136, 601-626.