So, when does a program get turned into threads?
Well, that was kind of the point i was trying to make
A program doesn't "get turned into threads" automatically. Instead the developer has to design the application (upfront) in such a way that it is able to utilize threads (efficiently).
And in some programs that can be or are programmed in a linear fashion, it makes no sense whatsoever to make use of threads. Sure such programs can still make use of threads but it sometimes simply doesn't make any sense (other then being a lazy programmer/developer).
Consider the following simple example (bear with me as the example itself make no sense whatsoever):
x = 0
for n = 1 to 100
x = x + 1
next n
Simple enough: a variable x get increased by one on every iteration of the for next loop. For example sake let say that every loop iteration (and corresponding addition of 1 to the variable x) costs 1 second of time.
That will amount for this program to take at least 100 seconds to finish.
Using threads is about running things in parrallel so that multiple threads/cores can be used to process the code. That way (in theory) you should be able to rewrite the exampe to use (again for argument sake let ay you have that many) 100 threads/cores at the same time. That way it should take 1 second for 100 iterations as all 100 are executed at exactly the same time (and processed by the CPU).
oversimplified example:
// thread code:
x = 0
for n = 1 to 100
StartThread(AddOne)
next
AddOne:
x = x + 1
return
Taking into account that a (single global) variable can not be acccessed by all 100 threads/cores at the same time (that is a design principle of using multiple threads) and that you have to create a 100 different threads, this will add so much overhead that in the end your program will not end up finishing in 1 second, rather in 200 seconds (because of the extra overhead of creation and destruction of the threads).
So, programs like povray are designed in such a way that they (efficiently) make use of threads. It is a bit out of scope to get into detail what exact portions/calculations are eligable to turn into threads but i hope the gist of it is a bit more clear for you now.
Furthermore (in case you wondered), there are different kernels that implement their own threading model, each with their own set of API calls. AROS/Amiga is not 100% compatible to support all thread API used by povray (or any program written for another platform and that makes use of threads for that matter), so that sometimes poses a problem for (easily) making a port for Amiga/AROS.
For instance the initial threading implementation used by Free Pascal was based on the version implemented by Delphi. But alas, Free Pascal supports more platforms than Windows (and Linux) so the threading implementation had to obey certain basic rules that apply for all platforms that supports threads. Therefor a lot of bad design stuff (like stopping and resuming threads) is highly discouraged and isn't officially supported anymore.
And that is ok, because you can always use your platform specific API calls in case you do wish to support functionality that's missing from Free Pascal's native threading implementation/solution (in case you really can't live without)