I have implemented a small IO class, which can read from multiple and same files on different disks (e.g two hard disks containing the same file). In sequential case, both disks ... |
How can I make use of parallel in Java? Or do I use normal threads?
|
Here is a simple server application using Bonjour and written in Java. The main part of the code is given here:
public class ServiceAnnouncer implements IServiceAnnouncer, RegisterListener {
...
|
There are certain algorithms whose running time can decrease significantly when one divides up a task and gets each part done in parallel. One of these algorithms is merge sort, where ... |
I'm writing an application which processes a lot of xml files (>1000) with deep node structures. It takes about six seconds with with woodstox (Event API) to parse a ... |
Ok, so I'm trying to find the maximum element of a 2D array. I will have a method that accepts the 2darray as a parameter and finds the maximum. ... |
I want to process a large number of independant lines in parallel. In the following code I'm creating a pool of NUM_THREAD Theads containing POOL_SIZE lines.
Each thread is started and I ... |
|
I have a program that performs lots of calculations and reports them to a file frequently, I know that frequent write operations can slow a program down a lot, so to ... |
Faced this question in my interview.
What I answerred is that:
- divide 1b numbers into 10 group
- Use threadpool to create one thread for each group, 10 totally
- each thread sum up the result ...
|
I want a more C++/Linux oriented book. I do have some basics of multithreading/parallel programming under my belt, but I want to both brush my skills and improve them further.
|
Hi, all Could any one help me to run a group of thread in the same time ? I've tried to made 50 thread at the same time, use "for (50 times){new threads}", but when I try to run them at the same with the runflag from false to true, it seems all the threads runs one by one. Who could ... |
JDK 5 introduced a lot of cool new stuff for concurrency. It's based on Doug Lea's work; google for his name to find his site, books etc for a good background. I found the JavaDoc more accessible than his writing, but that might only be me. I've had an idea for years for a project that requires multiple pipelines with all ... |
|
Hello Friends, I need some help. I am working on a project where there is a requirement to perform tasks periodically every 1 sec. I gave a lot thought and read thru lots of articles on the net. I came to one conclusion to use the java.util.concurrent api to solve my problem.. Steps are:: 1. Create the tasks 2. Create Worker ... |
Ranchers, we have a application where Jobs are running concurrently and which is updating the database column in a table. Hence we are noticing that it is not updating the database column with proper value. How do we handle this scenario of parallel processing/updating of values in database in java ?? Example : Job 1 triggers and runs a update query ... |
I myself mostly do it the old-fashionable way: gdb, debugging printfs, and as a more recent thing valgrind. :-) Some debugging techniques are mentioned in the book, such as the versions of libraries with deadlock detections, lock hierarchies and such. Another technique that I've found useful when the debugging printouts are too slow and alter the program execution logic a lot ... |
|
Thankyou both for your answers, I appreciate your time on this. If I understand your answer Sergey, correctly, then the task(s) itself really is the determining factor in deciding how to approach the method of parallelization. There is no one-size-fits-all approach in that respect. That makes a lot of sense. You mentioned that the cost / hardware is a point of ... |
Yes, the examples are mostly C++. There are small Java snippets used to show some concepts unique to Java. I've tried to keep almost all the examples in the same language, only mentioning in the discussion the differences of the other languages. Java is a nice language in the sense that it has much support for the parallel programming in the ... |
The biggest problem with unit tests is that writing and maintaining the detailed unit tests require about as much time as the program in the first place. Lots of work. Sometines you change one line that changes the results of 100 tests, and then you have to go through all of them and figure out, if it changed them in the ... |
Sure, why not? The creation of the threads might be more expensive, but once they start running, they get just as much benefit. Java has some very developed data structures to make th ethread usage easier. A downside might be that making your own custom structures moight not be that easy, becasue they might be slower than the built-in ones written ... |
|
Hi I'm still very new to multithreaded programming. I want to have my quicksort to run parallel I have most of it working but when I run it, the result is not really as expected. It basically sorts perfect but result would end up being something like 0,0,0,1,2,3,4,5,5,6,2,2,3,3,4,5,6,6,8,9,9. Im comparing the results between sequential and parallel. Thank you This is my ... |
Hello, I am newbie to multi-threading, I have a use case where I need to do 2 search tasks, so created ThreadA which is first priority and THreadB which is second priority. The goal is Thread B needs to start after ThreadA is complete and application execution should not stop for ThreadB. Later client will polll server to get ThreadB results ... |
Thread thread = new Thread(){ public void run(){ try { SwingUtilities.invokeAndWait( new Runnable(){ public void run(){ // execute query for getting inserted record count and set result to JLabel countLbl.setText(result); }}} }); } catch (InterruptedException e) { } catch (InvocationTargetException e) { } } }; thread.start(); Thread t = new Thread(new myInsertRecords()); t.start(); |