Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-04-2008, 05:12 AM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 386
Zosden is on a distinguished road
Nqueens with threads
If your not familiar with nqueens then wiki it. What if you made a class that implmented runnable and had a thread in it then us used that class to work as a layer of the nqueens problem this class would in turn call another class that would work on the next level. Would this make the solution even faster or what. If yes then why not use such solutions in advanced algorithms today. If not then why isn't it faster.
__________________
My IP address is 127.0.0.1
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 06-13-2008, 10:15 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 421
Nicholas Jordan is on a distinguished road
This is called parallelization, to do that - you have to be able to split the problem in divisional aspects such that no two threads are trying to "work on the same part of the problem" .. trying to dissect exactly what that means is how one would parallelize N-Queens or Ant Colony Optomization or any of a broad class of problems that can be sifted on the single factor of the ability to compartmetnalize the logic.

Java has built in synchronization primitives, and in general they are implemented well except that the HotSpot has one or two misplaced register stores that cross subtle boundaries because of the wording in the Spec.

Google for Java Real Time Specification, your work would be welcome.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 06-14-2008, 01:26 AM
Senior Member
 
Join Date: Jun 2008
Posts: 194
Fubarable is on a distinguished road
Wouldn't this also depend upon whether or not the computer running the code had multiple processors, and whether or not the JVM would split the different threads amongst the different processors. If all done on one processor, I don't see how multiple threads would give you any gain at all.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 06-20-2008, 09:29 PM
Nicholas Jordan's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Southwest
Posts: 421
Nicholas Jordan is on a distinguished road
Threading on uniprocessor machines has proven gains in io, otherwise it is as you state. Technically, due to L-2 writebacks there may be minor gains avaliable, in a core loop for a heavy load, the gain may be measurable ~ but it would depend totally on a JVM implementation on a paticular hardware and OS and ( not to dismiss the depth of your observation ) also depend on weather patterns, operator luck and so on.

If the N-Queens has a layerable aspect, I would naturally have a Threading solution as a goal, but making a single class Runnable then getting layers out of it does not sound to me like an effective approach. We could consider making a class that takes an OrderedPair then doing a foreach{new Runnable();} as todays machines have ablilities to do deep branch prediction and speculative instruction execution that could outrun L-2.

Mind Boggling to say the least. I like to have my mind boggled.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with networking and threads byuu Networking 10 05-21-2008 06:03 AM
Threads! rameshraj Advanced Java 1 05-04-2008 05:11 PM
How to use Java threads Java Tip java.lang 0 04-09-2008 07:30 PM
Using threads Java Tip Java Tips 0 12-11-2007 11:25 AM
Threads one198 Threads and Synchronization 1 11-20-2007 07:15 PM


All times are GMT +3. The time now is 02:13 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org