How do threads work?


GNU Smalltalk uses preemptive green (non-native) threads; that is, multiple Smalltalk processes are run by the virtual machine in one operating system thread. The main disadvantage to this approach is that it is impossible to use multiple CPUs even when the machine has them available; for single-processor CPUs, green threads are faster than operating system threads, because they make context switches cheaper.

Threads are not preempted after a given amount of time, but other events could in general cause the current thread to be suspended: a higher priority process being resumed, a timer being fired, or I/O becoming possible.

User login