This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parallel for-loop in java

 
Prabhjot Jassal
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am new to concurrency and would be thankful if someone could help.

I wrote the following code which has 2 arrays and in the 3rd array I am storing the answer of corresponding 1st and 2nd array. Can someone please tell me how to make it run in parallel? If possible please tell me 2 methods - 1. Using Threads and 2. Using Java 5 or 6 concurrent library. Thanks

 
Henry Wong
author
Marshal
Pie
Posts: 21115
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Sun tutorial should be a good place to start learning about threads (and the concurrency package)...

http://download.oracle.com/docs/cd/E17409_01/javase/tutorial/essential/concurrency/

This isn't a subject that you can learn from one example, posted in a forum topic.

Henry
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic