On Saturday 25 September 2004 14:34, Jerry Feldman wrote:
On Sat, 25 Sep 2004 06:38:56 -0400
"Steven T. Hatton"
wrote: I can't speak with unquestionable authority on this, but I believe you might find Java has it's own hidden legacies. Namely Small Talk and Lisp (spelled Emacs).
It certainly has some history. The Java language is very C-ish by design. A few things were changed: integer sizes are explicit floating point size is explicit. char is not an integer. Dynamic memory allocation is controlled in that you can only allocate an object, and there is no explicit free as this is done automatically. The language is object oriented by design. I see absolutely no Lisp in this at all.
Garbage collection, byte compiling, running on a VM, no explicit pointers, and I'm confident other features have their origins in Emacs Lisp. If you look closely you may even discover that an object is pretty much just a specialized list.
The problem with this approach is that the per-thread context must be globally visible to all other threads, and a misbehaving thread can cause problems. Normally I create an array (or other data structure) containing the thread id, thread number (locally defined), and possibly some other information used by the thread.
I was under the impression that that's pretty much what's going on with the TLS model discussed in Drepper's paper. There is a global set of indexes mapped to the running threads. The only thing preventing threads from stepping on eachother's storage is good behavior. I believe the main emphasis of the TLS model is to provide a way to maintaining per-thread 'static' storage for each function that uses static variables.
--- standards issues The problem that a language has by specifying a paradigm like threads, is that there is an independent standards committee working on threads. C++ has the additional problem in that there needs to be a certain amount of C compatibility, and they need to coordinate with the C committee also to some extent. By Java stating its own thread paradigm, it forces its threading standard to be implemented on all platforms. Whether it uses the POSIX or other model underneath is not really an issue. You are also guaranteed that the standard classes are threadsafe.
Not everything in Java is thread safe. I know some of the collection objects need to be wrapped in some kind of thready synchronizing class in order for them to be used safely in concurrent programming. -- Regards, Steven