[Tutor] multi processes or threads?

Alan Gauld alan.gauld at btinternet.com
Tue Sep 4 10:05:49 CEST 2012


On 04/09/12 01:19, Dwight Hutto wrote:

>     I have no idea what all that means!
>     Nor how it relates to the OPs question.
>  From the OP:
>
>   I'm working on AI for a robot and because I'm not sure what direction

OK, I see that connection now.

> Tell me Alan, what is threading within a CPU, coming from a higher level
> language, that passes through a processor executing one instruction at
> time from the instruction pointer, unless otherwise designed from
> multiple instructions through separate cpu's(i.e. real thread commands)?

I'm still not certain what you mean here but I think you are referring 
to the time-slicing technique used by the OS to run multiple 
processes/threads on a single CPU?  The CPU (or core) doesn't understand 
the concept of threading that's a higher level concept
usually managed by the OS (although with multi-core CPUs increasingly 
done at hardware too).

The point of threading is to avoid programs blocking while still having 
valid work to do. In effect taking advantage of the multi-processing 
features of the OS to allow parts of a program to keep running when it 
would otherwise block while waiting for input or output to complete.
As such it will make the application more responsive and for bulk data 
processing run faster (with fewer wait states).

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list