Advantages Cooperative Threading

time to read 2 min | 218 words

James has a post about SQL Server & Cincom Smalltalk both using application level threading for scalability, but I think that the comparision he makes is flawed. While I admit that I don't know how you manage the threads in smalltalk, I'm well aware of the differences between threads and fibers (app-threads, in windows).

Cooperative threads relies on programmers' disipline to yield often enough to make sure that other threads are not starved. I can see several cases for doing this in SQL Server, since this can ensure that you'll not be pre-empted before you finished. I would guess that this is a good way to reduce locks in certain situation, since in this scenario you know that you will not be interrupted until you are ready. Windows 3.1 and Mac OS before X proved that this just doesn't work in the general case. A single ruoge application can take hold on the whole system.

Doing any kind of thread management myself is just adding more overhead to the stuff that I need to remember. Offhand, I can't think of many applications that recieve the amount of testing that SQL Server does. I don't relish trying to test thread starvation scenarios with cooperative threading models in my applications.