Home-made Thread class

Anyone managed to make his own Thread class? All this talk about java multithreading being slow and unreliable, makes me think if it may be beneficial to simply construct my own Thread class and forget about the java Thread class. Has anyone done this, or is it... crazytalk?

Chris.

[302 byte] By [javaDotDynamicDashSiteDotNet] at [2007-9-26 1:45:43]
# 1

Crazytalk. Or rather, you most certainly will <i>not</i> come up with a faster threading implementation than that provided by the JVM if you intend to write your threading model in Java. And in what manner is Java threading unreliable? I don't think I've ever had a Java thread do something it isn't supposed to. I mean, it's obviously deterministic.

Kirk

kswoll at 2007-6-29 2:42:35 > top of Java-index,Core,Core APIs...
# 2
All what talk about Java threads being slow an unreliable? How would contructing your own Thread class allow you to provide your own multitasking implementation?
schapel at 2007-6-29 2:42:35 > top of Java-index,Core,Core APIs...
# 3

it can be done. I won' t use "synchronized" and I won' t have the other thread-related problems with shared parameters. it won' t be truly parallel operation, but who said java' s Thread is parallel. it is pseudoparallel unless there are 2+ processors.

anyway, i may just implement such thing within my next software' s capability rather than have it instantiate 2 threads.

For some applications java threads are ok, such a networking and so on, but for mathematical applications, probably a better solution must be found.

Chris.

javaDotDynamicDashSiteDotNet at 2007-6-29 2:42:35 > top of Java-index,Core,Core APIs...
# 4
read this, http://www.bookpool.com/.x/atnxpe6gc6/sm/1893115100
mchan0 at 2007-6-29 2:42:35 > top of Java-index,Core,Core APIs...
# 5

> it can be done. I won' t use "synchronized" and I

> won' t have the other thread-related problems with

> shared parameters.

Really? What "thread-related problems with shared parameters"? I'm honestly curious, as I've never run into a problem with threading after I took the time to learn all the issues involved.

> it won' t be truly parallel

> operation, but who said java' s Thread is parallel.

> it is pseudoparallel unless there are 2+ processors.

>

Well, of course, just like every other implementation of threading in any other language on a single-processor machine.

> anyway, i may just implement such thing within my

> next software' s capability rather than have it

> instantiate 2 threads.

>

But what do you hope to accomplish? If you implement it in Java, I guarantee it will be slower than the native implementation, as the native implementation uses multiple-processes to accomplish the task. I just don't see how you intend to improve upon Java's handling of threads--I always thought that popular sentiment towards Java Threads has been rather positive. It certainly has been for me.

> For some applications java threads are ok, such a

> networking and so on, but for mathematical

> applications, probably a better solution must be

> found.

>

Well, perhaps you are correct. But I'd love to see some sample code that you think could be improved by a better threading model.

Kirk

kswoll at 2007-6-29 2:42:35 > top of Java-index,Core,Core APIs...
# 6

> Anyone managed to make his own Thread class? All this

> talk about java multithreading being slow and

> unreliable, makes me think if it may be beneficial to

> simply construct my own Thread class and forget about

> the java Thread class. Has anyone done this, or is

> it... crazytalk?

>

> Chris.

I haven't done this. I wouldn't want to. To me, this is like re-inventing the wheel. Like saying I can make a better tire than Firestone (woops) or Goodyear.

Java's native thread model means that the OS really handles the threads too.

It just requires a solid understanding of the thread game. I have never ever heard once that it is "unreliable" from someone who knew their stuff.

I vote "Crazytalk".

schillj at 2007-6-29 2:42:35 > top of Java-index,Core,Core APIs...