Re: What's the connection between objects and threads?
On 18 mai, 18:22, Szabolcs Ferenczi <szabolcs.feren...@gmail.com>
On May 18, 3:56 pm, James Kanze <james.ka...@gmail.com> wrote:
On 18 mai, 11:43, darren <minof...@gmail.com> wrote:
A couple of things i'm thinking about:
1. As per the reason i created this post, I was thinking about how
objects related to threads.
They don't, necessarily.
As I have pointed out earlier(!) in this discussion thread,
there is no language level notion of a thread in C++ (besides it never
will be, it seems), so in C++ it is true that objects and threads are
not related in any way.
The next version of the standard will definitely support threads
at the language level; that much has been pretty well proven.
(If nothing else, it's fairly certain that a significant number
of the national bodies will reject it if it doesn't.) That
doesn't mean that objects and threads will necessarily be
related, or that even if they are (e.g. as in boost::threads),
that the way that they are related is relevant to his
But it is not necessary that objects and threads are not related.
There are computation models as well with co-called active objects.
Yes, but they're not really relevant to the way threads are used
So it is possible and to an extent it would be natural to
combine objects with threads of computation as he presumed.
Fundamentally, the "thread" object is somewhere in the OS,
not in your code.
There is no "thread" object there since the thread is not an
object but rather an activity.
Within the OS, a thread has state and behavior, so it is an
"object". In some OS's, it may even be implemented as an object
in C++, but regardless of the OS, it's conceptually an object.
(When I wrote a real-time OS, back in 1979, I didn't know what
an "object", in the OO sense was. Never the less, my
processes---which corresponded to what are called threads
today--very definitely were modeled with what we would call an
To be exact we should say "thread of computation" and mentally
one can think about a thread of computation as a virtual
processor with its own program counter. That is it.
And shared memory with the other threads in the same process;
that's what separates threads from processes.
James Kanze (GABI Software) email:email@example.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34