The process has up until the value of ctimemax (a config block variable) to finish its task. As the task is working away, the scheduler counts down ctimemax units. When it gets to the value of ctimemax - 1, if it gets stuck and for some reason cannot be taken off the CPU, then a timeslice error gets generated and the process gets infected.
On the other hand, SQL Server will allow a Server process to run as long as it needs to. It will not swap the process out for another process to run. The process will decide when it is "done" with the Server CPU. If, however, a process goes on and on and never relinquishes the Server CPU, then Server will timeslice the process.