In this type of system , a certain method is used to switch between tasks or threads based on a timer interrupt . In this type of system , a low-level piece of code switches between tasks or threads based on a timer ( connected to an interrupt ) .