Multi-threading on a dual processor.

M

murali

Hi,
Iam using a Dual processor 1.25GHz PowerMac G4

I used hwprefs (from CHUD tools) to switch between single and dual
processor configurations

the program runs with 1 thread in either setting

the program runs fine with 2 threads on a single processor but crashes
when on a dual processor

the error messages are always the same:

java.lang.NullPointerException
at certain points in the program.

the problem seems to affect either one or the other of the 2 threads
without any pattern.

Murali.
 
K

KC Wong

I used hwprefs (from CHUD tools) to switch between single and dual
processor configurations

the program runs with 1 thread in either setting

the program runs fine with 2 threads on a single processor but crashes
when on a dual processor

the error messages are always the same:

java.lang.NullPointerException
at certain points in the program.

the problem seems to affect either one or the other of the 2 threads
without any pattern.

You didn't:
1. Tell us what your program is trying to do
2. Show us relevant part of the code

Do you really think you can get an correct answer like that?
 
T

Thomas G. Marshall

KC Wong said:
You didn't:
1. Tell us what your program is trying to do
2. Show us relevant part of the code

Do you really think you can get an correct answer like that?


I have no problem with how she asked it.

Sure, more information would have provided many more answers, but she may
have been interested in the fundamental rules of multi-threading on
multi-processor systems.

Sometimes you need to start with a general question to see if there is
something simple that everyone needs to know that everyone forgets, like a
"-makeitwork" :) argument to java, before attempting to post a chunk of code
that might be obscenely hard to pare down.

It's not ideal, but it's more or less ok.
 
K

KC Wong

the error messages are always the same:
I have no problem with how she asked it.
Sure, more information would have provided many more answers, but she
may
have been interested in the fundamental rules of multi-threading on
multi-processor systems.

Um, the OP said she gets NullPointerException at some point... I don't think
she's asking about fundamental rules...
Sometimes you need to start with a general question to see if there is
something simple that everyone needs to know that everyone forgets, like a
"-makeitwork" :) argument to java, before attempting to post a chunk of code
that might be obscenely hard to pare down.
It's not ideal, but it's more or less ok.

But at least explain what the threads are doing and when the exception
occurs... just stating you get a NullPointerException at certain point of
some unknown thread will get you nowhere...
 
S

Steve Horsley

KC Wong <[email protected]> horrified us with:
Sometimes you need to start with a general question to see if there is
something simple that everyone needs to know that everyone forgets, like a
"-makeitwork" :) argument to java, before attempting to post a chunk of
code that might be obscenely hard to pare down.

Hey! I NEED that VM.
None of the VMs I have used seem to support the -makeitwork option.
Think of the hours of debugging I could save!

Steve.
 
S

Steve Horsley

Hi,
Iam using a Dual processor 1.25GHz PowerMac G4

I used hwprefs (from CHUD tools) to switch between single and dual
processor configurations

the program runs with 1 thread in either setting

the program runs fine with 2 threads on a single processor but crashes
when on a dual processor

the error messages are always the same:

java.lang.NullPointerException
at certain points in the program.

the problem seems to affect either one or the other of the 2 threads
without any pattern.

Murali.

Read Sun's tutorial on multithreading. It gives some good basics.

A prime feature is that ALL access (read and write) to variables that
might be accessed by both threads should be synchronized. Without
synchronizing, CPU memory caches may not get refreshed - it's more than
just preventing concurrent modification. Setting variables to be volatile
could possibly be used instead.

Also, think about possible race conditions where a thread might use a
value before the other thread has set it up properly.

Steve
 
T

Thomas G. Marshall

Steve Horsley said:
Hey! I NEED that VM.
None of the VMs I have used seem to support the -makeitwork option.

I'm working on one. Problem is, the -makeitwork options has bugs :)
 
T

Thomas G. Marshall

KC Wong said:
Um, the OP said she gets NullPointerException at some point... I
don't think she's asking about fundamental rules...

Um, that can easily /still/ be asking about fundamental rules.

But at least explain what the threads are doing and when the exception
occurs... just stating you get a NullPointerException at certain
point of some unknown thread will get you nowhere...

You're most often right. But it's fine to start off asking generalities as
part of a NNTP conversation.
 
T

Thomas G. Marshall

Thomas G. Marshall <[email protected]>
horrified us with:

....[self snippage]...

me> You're most often right. But it's fine to start off asking
me> generalities as part of a NNTP conversation.

As handled perfectly by Steve Horsley later on.
 

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,733
Messages
2,569,439
Members
44,829
Latest member
PIXThurman

Latest Threads

Top