aspose file tools*
The moose likes Threads and Synchronization and the fly likes how to make sure the program is time consuming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "how to make sure the program is time consuming" Watch "how to make sure the program is time consuming" New topic
Author

how to make sure the program is time consuming

Sara Brown
Ranch Hand

Joined: Feb 22, 2012
Posts: 55
Hi,

im making a program that do the sorting using the quicksort technique in a concurrent way. I also put the time and memory usage in the program to identified how much will it take performing the task. I also take note on the CPU performance and the memory usage in the CPU (so far i used the windows task manager taking the result of the CPU performance and the memory).

i have try several test using different number of threads.

Results:
Time performance in the program: 1 thread takes longer than 5 threads to execute. but 10 threads takes longer and almost the same as thread 1 and thread 15 and so on takes the most time to execute
Memory usage in the program: more threads use LESS memory
CPU usage: more threads give HIGHER percentage of CPU usage
memory usage in the CPU: more threads use LESS memory

Questions:
Why does my time performance give results like that? Is there something wrong in my coding that might lead that way? perhaps because of the deadlock? Is there a way to make sure that this program will be time consuming?
Is there a way to get the CPU performance and the memory usage of the CPU while running the task? perhaps by using codes or any software that would be help? I believe snipping the task manager's performance is not accurate and effective.

Below is my code



Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2409
    
  28

Your code is very convoluted. The way I see it your threads are basically useless and based on how the stars are aligned, your entire collection will be most probably sorted only once or might be sorted twice or so, but will probably be never sorted in parallel.

Tell me one thing, How many times do you see "Proceed" in the output.. what exactly are you trying to accomplish here?
Sara Brown
Ranch Hand

Joined: Feb 22, 2012
Posts: 55
The proceed output is only a test for me that it read that portion. There is no function in it.

can you guide me little bit to make the program can run in concurrent way? i thought just by adding the executor, it will work out.

Thank you so much for the help.
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2409
    
  28

The "procede" output will come up only when the lists are sorted. If it comes up only once it means that your lists are only sorted once

It's hard to help without knowing exactly what you are trying to do. Just throwing an Executor on a single threaded sort will not work. A multi threaded sort will have to be algorthimically much differrent than a single threaded sort.
Sara Brown
Ranch Hand

Joined: Feb 22, 2012
Posts: 55
thank you Jayesh A Lalwani. now i understand why you asked about the procede.

the procede only appears one time. so it means this program is definitely sorted once.

about the algorithmic, how should i do?im still blur. can you help perhaps by showing some example on this algorithmic multithreading. different between the sequential and multithreaded algorithmic would be the best.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to make sure the program is time consuming