Can applet use dual/ Quad Cores?

S

Sanny

I want to use Java applet on 4/8 cores Processors. Will Browser allow
the applet to access all 4 Cores to an Applet if it has 4-5 Threads in
it? Does a webpage only get one core or it can ask more cores if the
applet is using multiple threads?

I have a code like this.

for (int i=0;i<12;i++){

callfunction1(i)
}

I want to convert it into 12 threads to be used by 4/8 Cores.

for (int i=0;i<12;i++){
Thread thread1;
thread1.start()
}

run{

if (this.thread=="thread1") callfunction1(i)

}

Is the above code bring multiple threads for the for loop each running
in paeallel?

What will be the correct code to implement above for loop into
multiple thread.

Will Browser allot 4 / 8 processors to the applet or only 1 core will
be given to the web page.

Bye
Sanny
 
A

Arne Vajhøj

Sanny said:
I want to use Java applet on 4/8 cores Processors. Will Browser allow
the applet to access all 4 Cores to an Applet if it has 4-5 Threads in
it? Does a webpage only get one core or it can ask more cores if the
applet is using multiple threads?

The Java standards does not specify anything about that.

But on common platforms I would expect an applet to be
able to utilize multiple cores.

Arne
 
M

Mark Space

Sanny said:
if (this.thread=="thread1") callfunction1(i)

This is a pretty horrible hack, in my opinion. But yes it should run
and do more or less what you want.

Try doing something with interfaces and inheritance. You can do much
better than the code above.
 
C

Christian

Mark said:
This is a pretty horrible hack, in my opinion. But yes it should run
and do more or less what you want.

Try doing something with interfaces and inheritance. You can do much
better than the code above.
I would at least use equals instead of ==
..Net overloads == with equals for string .. java doesn't
 
M

Mark Space

Christian said:
I would at least use equals instead of ==
.Net overloads == with equals for string .. java doesn't

Good point. I had assumed everything was psudeo code, but I guess I
shouldn't've. == won't work at all, it will compare references, not
strings. I won't give a hint on the best way to do this with a thread,
the idea by the OP I quoted is just too horrible.
 

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

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,201
Latest member
KourtneyBe

Latest Threads

Top