From: | |
Date: | 20 Feb 2001 at 17:43:21 |
Subject: | Re: Tasks vs. Threads |
On 20-Feb-01, Stephen Illingworth wrote:
>> First of all what are the differences between tasks and threads? I
>> suppose that the more 'portable' approach is by using threads (since
>> unix clones seem to use that), what are the other advantages of a
>> method over the other? Can someone shed a little of light on this
>> poor single-task coder? ;-) Thanx in advance guys
[snip]
> I personally don't see the point of them on the Amiga, as the AmigaOSs
> scheduler works just great. The reason pthreads exists at all is
> because many UNIX implementations have "inefficient" schedulers (they
> do more work than they need to) and certain types of process benefit
> greatly from the reduced overhead of threads.
I think memory protection is the difference you are looking for between
the Amiga and the other guys. Threads run in the memory space of the
parent process and almost always offer no memory protection (hence the
term "lightweight"). Processes do have memory protection and are
prevented from clobbering each other. Memory protection adds even more
complexity when you need to share memory between two processes and
usually requires the use of "handles" instead of pointers. Threads
can simply pass a pointer to access their shared memory space.
Needless to say, the topic of memory protection is much more complex
than you'd initially believe so let's not go there.
Given that the AmigaOS lacks memory protection you can think of AmigaOS
Tasks as Threads. You can even share the same memory space and pass
pointers around without any restrictions just like "real" threads.
The more 'portable' approach is to use POSIX threads (pthreads) but
even they are no guarantee that you won't have porting problems.
There is a port of the pthreads package for the Amiga available
somewhere from http://www.geekgadgets.org but I've never tried it so I
can't say anything more about it.
Can anyone say whether the new AmigaDE supports pthreads or not?
Cheers,
------------------------ Yahoo! Groups Sponsor ---------------------~-~>
eGroups is now Yahoo! Groups
Click here for more details
http://click.egroups.com/1/11231/0/_/451227/_/982687406/
---------------------------------------------------------------------_->