Discussing the criticisms

J

jacob navia

Ian said:
So threads aren't bad after all.

No. Threads as used commonly in C and C++ leave the complexity
of managing a global context in parallel to the programmer. He/she
has to figure out all the synchronization, randezvous, etc etc
needed to keep sanity. This is just impossible and will result always
in systems that have synchronization bugs.

It is just not scalable, because people can't be perfect at all times,
and this is a constant in my argumentation here. You can have a good
programmer that will be good most of the time. You will have a
bad programmer that will be good only sometimes. But NOBODY will
be perfect, and that is what is required: perfection.

It is a similar discussion as the malloc/free discussion. You can get
away with it when the system is small, but in a BIG system you are bound
to make a mistake.
 
I

Ian Collins

jacob said:
No. Threads as used commonly in C and C++ leave the complexity
of managing a global context in parallel to the programmer. He/she
has to figure out all the synchronization, randezvous, etc etc
needed to keep sanity. This is just impossible and will result always
in systems that have synchronization bugs.
Your example of parallel data structures is one use for threads that
doesn't require synchronisation and there are others.
It is just not scalable, because people can't be perfect at all times,
and this is a constant in my argumentation here. You can have a good
programmer that will be good most of the time. You will have a
bad programmer that will be good only sometimes. But NOBODY will
be perfect, and that is what is required: perfection.

It is a similar discussion as the malloc/free discussion. You can get
away with it when the system is small, but in a BIG system you are bound
to make a mistake.
So how do modern operating systems scale over multiple cores? They tend
to be big systems and they depend on threads.
 
U

user923005

Your example of parallel data structures is one use for threads that
doesn't require synchronisation and there are others.



So how do modern operating systems scale over multiple cores? They tend
to be big systems and they depend on threads.

With modern systems, the slowdowns as the problem scales in size have
little do to with threading and much to do with semaphores and mutexes
(traditional locking schemes).
A solution that scales better than lock based exclusion is software
transactions:
http://en.wikipedia.org/wiki/Software_transactional_memory

There is an experimental C compiler that performs software
transactions:
http://softwarecommunity.intel.com/articles/eng/1460.htm

There are also kits on sourceforge to accomplish similar goals.
Here is one example:
http://softwarecommunity.intel.com/articles/eng/1460.htm

The paper at the above site is a good read.
 
I

Ian Collins

user923005 said:
With modern systems, the slowdowns as the problem scales in size have
little do to with threading and much to do with semaphores and mutexes
(traditional locking schemes).

All true, but a decent OS will scale to hundreds of cores.

Don't forget my original post was a response to "since threads are a
mistake".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top