Multicore+java? Plz help..Thank You !

Hi Friends,

I have my first project review before the end of this month.I have problem in choosing the topic for my project.I am mostly interested in java,but my guide wants me to do the project in multicore.

i need guidance on this.Please tell me some AIEE,ACE paper or other Research papers,which have to do with both java and multicoreI mean doing something in multicore with java.I Really need help.I tried myself to find such papers in AIEE and ACM but couldn't able to find one.so please help me.

Thank You!

[539 byte] By [pravintha] at [2007-10-3 4:30:35]
# 1
I doubt you'll find anything that's not basic multi-threading anyway.
CeciNEstPasUnProgrammeura at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 2
You should probably just search for papers on traditional mutliprocessors (SMP), as multicore processors are basically the same thing, the only difference beeing, that the two cores are on a single chip.From a software point of view, it's nothing new.
JoachimSauera at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 3
Yes i have to search there but i have little hope in that topic-related to java. But some papers suggest -some implementations in c-kernel level code-i have to check them. Thank You for your valuable suggestions.Thank you guys!
pravintha at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 4
Your guide is an idiot. I suggest getting a new guide/advisor/whatever as your first step.
cotton.ma at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 5

No its not fair.He is an experienced person and he has his P.hd.in that area-he wants me to do my project in that area-bcoz then only he can guide me well and also that core-processor field is also good.The reason for my hesitation is-i like java very much-i have some experience and good knowledge and i don't want to give it up so easily.

Please don't comment about others like this-it might hurt them!

pravintha at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 6

I found this thread that seems to be related to what your looking for.

http://www.artima.com/forums/flat.jsp?forum=276&thread=170444

I hope this helps. Maybe it will point you to more information to see how the future releases of the JVM will handle the future multicore procesors.

JJ

Java_Jaya at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 7

> No its not fair.He is an experienced person and he

> has his P.hd

Cripes!

> he wants me to do my

> project in that area-bcoz

If he wants your project to multicore and Java he's an idiot. End of story.

Multicore anything is pretty stupid as noted.

Unless you are going to be writing a compiler perhaps for a multicore processor.

If you are going to the same school as this guy got his PHD from I suggest going to a new school where they don't hand them out as soon as you spell your own name correctly.

cotton.ma at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 8

> I found this thread that seems to be related to what

> your looking for.

> http://www.artima.com/forums/flat.jsp?forum=276&thread

> =170444

>

> I hope this helps. Maybe it will point you to more

> information to see how the future releases of the JVM

> will handle the future multicore procesors.

>

That article is a big pantload as well. If you have multithreaded code then you'll make use of a multicored processor (maybe).

Is pravinth planning on writing a VM? I don't think so.

cotton.ma at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 9

I thought he was looking to do research for a thesis paper, not an actual program.

I use a dual core processor on my laptop, but I believe the JVM still only uses one process on one of the cores. I'm not a JVM guru though.

Does the JVM talk directly to the hardware or does the JVM access the hardware through the underlying OS? If it's the latter, I would guess as the n-procesors grow, the offloading of threads for a multithreaded program would be handled by the JVM via the OS.

For eaxmple, if you have a program that creates 100,000 threads, for whatever reason, would the JVM be responsible for distribution across n-cores or would it continue to allocate threads in the same way and rely on the OS to distribute the added workload across n-cores?

Just my questions and thoughts. :-)

JJ

Java_Jaya at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 10

First I'd like to apologize for being pissy earlier. I find it discouraging when I see people embarking on projects that have very little to not merit. Also this discussion has been had before and I dunno... Mostly though I had just come from a bad meeting and was in a bad mood and that really didn't help.

Now on to the constructive bits.

The two newish processor advances that people like to talk about are hyperthreading and multicore. As discussed previously these two are not related (although in marketing materials they often are which leads to some confusion). I do think though that some understanding of both can clear up some of other doubts people have regarding how "good" Java will be with these technologies.

Hyperthreading

Personally I think this one is very cool. The best way I can think to describe it is that it is like a hotspot optimizing compiler for the processor.

What happens with hyperthreading is that the processor has more stuff on the go. The basic idea is this. In a normal processor you might have (simplified greatly here) the following steps to execute an instruction)

1 Bits come in -> 2 bits are put into proper places -> 3 execution (the magic step -> 4 bits are put into proper places to go -> 5 bits go out

Again simplfied but to get the idea. Each step takes a cycle of processor time to do it. In a non hyperthreading model each execution therefore takes 5 cycles. In hyperthreading it loads things up so that different instructions are at different life cycles in the processor at the same time. So maybe you have instructions at steps 1,3 and 5 all at the same time.

This means that in theory things can go much faster. It's also interesting to note though that hyperthreading falls apart with code that has been prematurely optimized for a processor that didn't support hyperthreading. For example if the code tries to force things into processor registers.

Multicore

As mentioned multicore is just putting two or more core processing units on one die. This means actual parallel execution can happen.

This is pretty simple. So what do you need in Java to take advantage of this? Well for starters you need multithreaded code. If your program has only one thread then it won't matter one bit.

Beyond that? It's a combination of the VM and OS yes. There are already computers that have multiple processors of course so there is already existing VM's and OS's that can take advantage of this. There are a number of configuration options for Sun VM's to fiddle with how code should work on such systems.

Perhaps surprisingly, or perhaps not, programs with multiple threads are often better off on one processor than multiple. Depends on load of course but you have to think of steps like synchronization. There is more complexity synchronizing across multiple processors than there is multiple threads on one processor. (Note not more complexity in your code but more complexity in how it is implemented by the VM and/or OS)

Summary

Both of these processor advancements mean good things for Java IMO. Hyperthreading in particular lends itself well to development in a language where runtime optimizations are performed. Why? Because in Java it is prefferred to gain performance by good design rather than resorting to hackery to squeeze performance from the processor directly.

As systems grow more complex it is less and less likely that a specfic program can best judge how to tune it's own environment. Better to let a VM and/or OS and/or hardware to handle the optimization at runtime because it has the full picture of what is going on.

It's like the same reason you really shouldn't call gc in your Java program. The VM knows at runtime far better than you at pre-compile time when it is a good idea to run a garbage collection.

For multicore the same basic rules apply. Write good and well designed Java code and use existing and well established frameworks and it will work well on a multicore system. Write single threaded GUI apps or threading programs that have a tendency to deadlock and the outcome of multicore will be no better performance and possibly bugs that display themseleves with greater frequency.

Further Resources

http://blogs.sun.com/jag/entry/mpi_meets_multicore

http://en.wikipedia.org/wiki/Hyper-threading

http://en.wikipedia.org/wiki/Dual-core

cotton.ma at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 11

Thank You Mr.Cotton.m and Mr.java_jay,

I will go through these resources and reply you later,now have to do some assignments..... Thank You guys. It looks like both of you have more experience in the field.Thanks for your valuable guidance.

Please help guys like me in the future also. Thank You!

pravintha at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 12

>>Perhaps surprisingly, or perhaps not, programs with multiple threads are often better off on one processor than multiple.

Yes its really surprising!

so JVM is not communicating directly with the hardware?NoWay?

But what about kernel level programming -like in linux c?-they are doing..(?)..

What do you think about "Real-time scheduling on multicore platform"?

Thank You!

Message was edited by:

pravinth

pravintha at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 13

> >>Perhaps surprisingly, or perhaps not, programs with

> multiple threads are often better off on one

> processor than multiple.

>Yes its really surprising!

Not really when you think about it. Resources shared between processors requires more complexity.

Dual processor machines are often configured to have some processes execute on one processor and some on another. For example your OS and it's various bits and a web server might be running on the first processor. A database server on the second processor.

> VM is not communicating directly with the

> hardware?NoWay?

Not really no. It depends. But largely there are other levels between the VM and hardware, such as the OS.

> But what about kernel level programming -like in

> linux c?-there are doing..(?)..

I hope that one of the points I made clear before will sink in at some point. Yes you can do some hardware things in some languages but I have many doubts that you actually want to do that.

Again the gc analogy. It is better to let the VM control gc than you almost all the time.

Similarly it is better to let the OS and hardware decide what to do with the hardware rather than just a specific process.

> What do you think about "Real-time scheduling on

> multicore platform"?

What do you think about it?

cotton.ma at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 14
Good Thank You!>>What do you think about it? wait i reply you after two hour.one urgent work.[A...top..er]..sorry please wait.
pravintha at 2007-7-14 22:33:51 > top of Java-index,Java Essentials,Java Programming...
# 15

> Dual processor machines are often configured to have some

> processes execute on one processor and some on another. For

> example your OS and it's various bits and a web server might be

> running on the first processor. A database server on the second

> processor.

That would be very coarse grained. 'Switch on stall' algorithms manage

to have a process run on the first, second, first processor repeatedly.

The process itself wouldn't know about the switch.

Underneath that nice little trick hyperthreading can come in too: two

processors executing a sequence of instructions fetched from one

queue whereever possible.

All in all I think that 'multi core' techniques are just a 'bridge technique'

between the old processor dissipating too much heat and something

else that still needs to be invented. Putting 'multi core' techniques' on

top of those can also prepare for the next hop to still faster thingies ;-)

kind regards,

Jos (my dual core 1.7 GHz laptop isn't any faster than my old 3 GHz

single core laptop)

JosAHa at 2007-7-21 10:33:16 > top of Java-index,Java Essentials,Java Programming...
# 16
Good!>>my dual core 1.7 GHz laptop isn't any faster than my old 3 GHzsingle core laptopHere (1.7+1.7)<3 Thank You!
pravintha at 2007-7-21 10:33:16 > top of Java-index,Java Essentials,Java Programming...
# 17

> >>my dual core 1.7 GHz laptop isn't any faster than my old 3 GHz single core laptop

>Here (1.7+1.7)<3

> Thank You!

Don't forget though that the heat dissipation is supposed to be far less

than from a single core processor. Besides that IMHO that entire dual

core stuff is still in its infancy; it may get better in the near future.

Also IMHO those AMD processors (either single or dual core) rock and

run circles around those Intel thingies ;-)

kind regards,

Jos

JosAHa at 2007-7-21 10:33:16 > top of Java-index,Java Essentials,Java Programming...
# 18

>This is pretty simple. So what do you need in Java to take advantage of this?

>Well for starters you need multithreaded code. If your program has only one

>thread then it won't matter one bit.

I think this depends on the OS. One of our dev servers is a 4 cpu HP running RHEL. If I fire off a single-threaded java app, I see load being shared by all four processors.

bckrispia at 2007-7-21 10:33:16 > top of Java-index,Java Essentials,Java Programming...
# 19

Hi all, Thanks for your guidance!

Mr.cotton.m?<<

>>What do you think about it?

I haven't gone through enough materials yet.

But some increased support for real-time task are:

Improved execution time,more computing power,...

some important task in real-Time scheduling is also- we have to reduce the cache miss rate on Level2 cache(s).And we must reduce traffic from memory-to-level2 cache.The current task-set request size mustnot exceed the size of the available resources[cache memory,processor utilization,etc.,].In real-time its better to group tasks which may induce in significant memory(/processor or other cpu resources)usage and schedule based on the group.The most important here is also we have to finish all tasks before their deadline.

I noticed one thing-:

In most of the research papers(also the paper which i refer), in multicore architecture,they show :-

All the core processors, share L2 cache(Level 2 cache).I mean they are using shared L2 cache.Check the link you specified:

http://en.wikipedia.org/wiki/Dual-core

But neither AMD or INTEl is using shared L2 cache[atleast in my knowledge]

Just check this AMD's multicore demo[AMD 64 Opteron]:

http://multicore.amd.com/en/WhatIsMC/en/Default.aspx

AMD 64 opteron uses seperate 1MB L2 cache for each processor[internally]

Then Intel also:Check this link[intel Magazine about its dual core]:

http://www.intel.com/technology/magazine/computing/dual-core-0505.pdf >>at page 5 starting

Intel Dual core is also using seperate 1MB L2cache for each of this processors[internally?]

??Any idea?

pravintha at 2007-7-21 10:33:16 > top of Java-index,Java Essentials,Java Programming...
# 20

>>Jos (my dual core 1.7 GHz laptop isn't any faster than my old 3 GHz

single core laptop)

Hi jos, Defenitely- the performance of 1.7 GHZ dual core processor is not equal to 3 GHz single core.

There are some sample benefits about dual core in intel website-you check it.

Its not always guaranteed that using dual core will reduce the execution time by 50%(may be rarely). In the sample benefits you can find -that-dual core reduces execution time by only 23% to 43%. so in your machine also it could reduce less than 43%(mostly),which is less than your old 3GHZ processor. So next time onwards when you by a dual core give weightage-only for the average amount of 30%- improvement than its single core.[I think its right?]

?please post your suggestions. Thank you!

pravintha at 2007-7-21 10:33:16 > top of Java-index,Java Essentials,Java Programming...