Results 1 to 5 of 5
- 04-02-2011, 06:48 PM #1
Member
- Join Date
- Apr 2011
- Posts
- 3
- Rep Power
- 0
about System: currentTimeMillis()
hello,
i am new in java,
i wrote a java program, my program is multiplication of two big matrixes and i used 10, 50 ,200, 1000 treads in it to execute. but when i computed the endtime-starttime of my program for each number of threads, i had increasing numbers according to the increasing number of threads.
i used "currentTimeMillis()".
for example:
10 threads==> 266
200 threads ==> 2484
1000 threads ==> 12549
why did i meet this result,
my computer in not multicore and i was expecting decreasing numbers according to increasing number of threads?
-
Why do you think that multiple threads decrease time? And how are you measuring time?
- 04-02-2011, 07:27 PM #3
Member
- Join Date
- Apr 2011
- Posts
- 3
- Rep Power
- 0
first, thank you for you interested my problem,
i dont know if it is true, but i had an expectation that if we used multiple threats, the computation would finished earier because we divided the jop to parts, and
i used:
Java Code:" long startTime = System.currentTimeMillis(); mainclass ext=new mainclass(); ext.islemler(); long endTime = System.currentTimeMillis(); System.out.println(endTime-startTime); "
in detail,
islemler is:
Java Code:public void islemler(){ "for(int x=1;x<=1000 ;x++) /* 1,10,50,100,200,500,1000==> thread number, we can change it if we want to do it by 1,10,50,100,200,500,1000 threads by replacing these numbers, here now there is "1000".*/ { ThreadClass t;Thread a; t=new ThreadClass(x,1000); a=new Thread(t); a.start(); }Last edited by Fubarable; 04-02-2011 at 07:32 PM. Reason: code tags added
-
Multi-threading per se cannot speed up computer processing, since each thread shares a bit of processor time and will slow the other down. The exception to this is with a multiple processor environment if the problem can be split into parallel non-dependent processes, and even then, there's no guarantee that Java and the OS will run things on different processors.
- 04-02-2011, 07:58 PM #5
Member
- Join Date
- Apr 2011
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
What is the hiring system
By ruchira_sandanayaka in forum Java AppletsReplies: 1Last Post: 04-03-2010, 03:25 AM -
Convert Cartesian coordinate system into java coordinate system?
By 123 in forum Java 2DReplies: 3Last Post: 02-07-2010, 08:34 PM -
Password System help
By quickfingers in forum New To JavaReplies: 1Last Post: 06-23-2008, 06:18 PM -
System.out.println
By sunjavaboy in forum Advanced JavaReplies: 3Last Post: 03-22-2008, 01:30 AM -
System.getProperties(key)
By diRisig in forum New To JavaReplies: 1Last Post: 02-06-2008, 12:11 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks