hyperthreading and stuff

It seems the lots of people are scared to have more than one thread, wonder why?

Actually I’m curious if anyone have hyperthreading computer, or dual processor one? And how looks JVM on it? Stop the world as always :wink: or some nice smooth… well you get the idea.

My experience of multiple processor machines and Java has been great. The multi-threading splits out great by the VM on Windows2000.

Dual processor NT systems running Java are really nice. You only get about 5-10% performance increase by splitting rendering and logic up into two threads but the garbage collection pauses completely vanish if you use parallel incremental collection.

In fact I’m about to do some more live TV graphics, and we run our rendering server on a Win2k dual 1GHz box so we don’t get any dropped frames.

Cas :slight_smile:

Multi-threading Java applications do work very well on multi-processor systems, in case you removed all deadlocks and that like. :slight_smile:
This I mean generally for “normal” applications; I can’t comment on Java games (but basically they’re applications, too.)
The IBM OS/390 mainframe we worked at did have about a dozen CPUs and each of our JDBC database queries got its own Java thread and therefore its own CPU - wow. :slight_smile:

[quote]The IBM OS/390 mainframe we worked at did have about a dozen CPUs and each of our JDBC database queries got its own Java thread and therefore its own CPU - wow. :slight_smile:
[/quote]
… all synchronized to access one single disc/network adapter :slight_smile:

That seems kind of silly. Processors are expensive. Disk and network cards are cheap. I seriously doubt you’d have a machine with a dozen processors that doesn’t use at least two to three network adapters + an array of disks. Quite common to have hundreds of gigs of storage spread across 30 or so disk drives. If the database is worth its salt, it’s probably trying to spread its data across as many of those disks as possible.

Now if everyone wanted to update the exact same record of a given table, then you might have a problem.

It’s nice. I like hyperthreaded games. Actually I would need to get multiprocessor computer somewhere.
No stop the world GC is wonderfull thing.

BTW how many threads is possible create on Win 2000 and on XP? Threads are somehow limited on 98SE.

I can see it now:

System Requirements

Intel Pentium IV or AMD Athlon 2100+
TWO OR MORE PROCESSORS REQUIRED
Windows XP
blah blah blah blah blah…

Then again, compared to the hardware 20 years ago, maybe in 20 years dual or quad proc machines are standard.

The last 3 windows computers I’ve had have been dual processor (gotta love it when work supplies you with a home computer), and from the looks of it dual processor Macs are quite common too.

We do Windows 2k/XP device drivers at work and dual processors are required for proper testing of the kernel mode code.

If you want to be really fancy, detect the number of processors at runtime and have two different versions of the main loop… a single thread version and a multithreaded version…ooooh.

Tried that; wasn’t worth the effort in the end really. Just let the other processor do the garbage collection and take care of OS functions and other processes.

Cas :slight_smile:

Cas,

Did you have to do anything specific to achieve that division of labor, or does the JVM decide for itself how to use the processors?

[quote]If you want to be really fancy, detect the number of processors at runtime and have two different versions of the main loop… a single thread version and a multithreaded version…ooooh.
[/quote]
This would be overkill. I think much better is let OS decide thread sheduling and stuff with just some hints. This way you could benefit from improved OS when user would update his Linux kernel :wink:
Dual hyperthread has 4 logical processors at least on the Win XP pro and on the Linux. So I would say this should be a low end platform.

It wouldn’t be overkill - it would be required!

Without multiple threads there won’t be a lot off work for the other processor to do, other than as PrinceC said, hidden OS threads and GC stuff… what I would call ‘incidental threads’… you need a multithreaded program to really give the extra CPUs some serious work to do.

You are always at the mercy of the OS in terms of thread scheduling… that wasn’t the point. The point was to give it some threads to schedule. I hate waiting for a computationally intensive task to complete while I sit and watch my CPU usage at 50% (maxing out 1 of 2 CPUs) because the program wasn’t multithreaded.

But I agree for games it is rarely worth it…maybe if you were making a chess engine or something and had some parallelism in your move search algorithm.

I’m dubious whether multiple CPUs will ever become mainstream.
Additional, more specialised processors will ofcourse become more common (a Generic AI chip? :o), but until we reach the speed limitations of silicon I can’t see parrellel CPUs becoming the norm.

thoughts?

I thought we WERE reaching the limits of silicon?

Well like I said, for me they are already the norm. I haven’t seen any number with respect to Macs, I suspect the ration of multiprocessor machines in the Mac world is higher than the Windows world… but of course the Mac world is already so small :frowning:

I just looked around me and I see 3 dual processor machines on my desk (2 windows, 1 linux). My laptop is one of the few single processor machines I can see in the room. (I’m at work)

For a multi-tasking OS they rock.

[quote]It wouldn’t be overkill - it would be required!

Without multiple threads there won’t be a lot off work for the other processor to do, other than as PrinceC said, hidden OS threads and GC stuff.
[/quote]
I ment, there is no reason to do a single threaded version. What for?

I used halfcript and there wasn’t any idea of single threaded aplications in halfscript, except for processor killers. For halfcript programer is doing single thread aplication something like writing single object aplication for OO programer. It might be doable, that second part, but why. EECK.

[quote] I haven’t seen any number with respect to Macs, I suspect the ration of multiprocessor machines in the Mac world is higher than the Windows world…
[/quote]
Apple’s top of the line PowerMac has been a dual processor machine for some time now. Motorola initially had some issues pushing the powerpc over 1ghz, so this was Apple’s answer to the problem (I believe dual 800mhz g4 was the first one).

But even so, top of the line Macs cost about the same as a sedan or small house, so I doubt many are actually out in the wild.

[quote]I ment, there is no reason to do a single threaded version. What for?
[/quote]
It’s usually easier. No need to mess around with synchronization or debug deadlocks.

Well, more often you waste that 5-10% speed increase with syncronization, which is too bad. Hyperthreading, hyper syncing.