Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Reasons why --enable-threads shouldn't be on by default
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
George Peter Staplin  
View profile  
 More options Dec 10 2007, 3:25 am
Newsgroups: comp.lang.tcl
From: George Peter Staplin <georgepsSPAMME...@xmission.com>
Date: Mon, 10 Dec 2007 08:25:06 +0000 (UTC)
Local: Mon, Dec 10 2007 3:25 am
Subject: Reasons why --enable-threads shouldn't be on by default
After much research I want to share my concerns over the ideas and
conflicting goals some of the core team has with threads, and why I am
against having --enable-threads by default.

We have the following goals/constraints:

1. The core team wants extensions that use fork() like Expect, TclX,
etc. to work in a threaded core.

2. The core team wants the ability to work with existing libraries that
don't necessarily use the Tcl pthread interfaces (based on what I
understood KBK to say).

3. QNX and possibly others, disable fork() syscalls when pthreads are
used.  According to the documentation for QNX if you use fork() and have
more than 1 thread created, an ENOSYS will result.  The alternative to
fork() + exec*() is spawn().  This means that QNX would be an
odd-one-out in the Tcl world, and TclX and Expect wouldn't work anyway,
unless a user built with --disable-threads.

Constraint 1 is possible with some platforms using pthread_atfork(), but
it requires keeping a record for every mutex, spinlock, etc. used by
Tcl.  However, constraint 2 eliminates this possibility.

I now suggest you read what David Butenhof has to say about
pthread_atfork().  He is a recognized expert with pthreads, an author of
a pthread book, and helped form the pthread standard.
http://groups.google.com/group/comp.programming.threads/msg/3a4312282...

He has also written other articles about how to possibly implement the
solution to 1.  But given what he has written, "threads by default" may
not be as appealing as some have thought.

I believe the following:
  A) threaded builds should be specifically marked, and use a
library/executable suffix.
  B) package distributors should probably shy away from threaded builds
of Tcl, unless absolutely needed.

In a somewhat related chain of thoughts, I'm concerned about the
implementation of Tcl's threading.  In particular it bothers me that
thread-specific data (TSD) is stored in a bunch of hash tables, so
everytime a C function needs TSD, it has to find the hash table, do a
hash table lookup, and return the result.  This is not ideal.  The
reason I believe this was chosen is that many threading implementations,
such as pthreads, and Win32, have a limited, fixed number of TSD slots.  
A proper fix in my opinion is to use one or 2 structures per-thread, and
restructure Tcl to keep its data in those structures.  This should
result in better performance, and not be detrimental in the general case
where you have 1 thread.

What are your thoughts on all of this?

George


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.