Δευτέρα, 6 Οκτωβρίου 2008

Running a threadless application on a Intel Core2 CPU

My processor:

$cat /proc/cpuinfo
ventrix@bytemobile:~$ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Core(TM)2 CPU 6300 @ 1.86GHz
stepping : 6
cpu MHz : 1875.766
cache size : 2048 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2



I created a java app to test if a number is prime or not. It isn't very special, except the fact that you can check REALLY big numbers...

The result is this:


As you can see with htop, only one of the cores is executing the application.
Also, if you take a careful look at the xfce's cpu meter, the total use of the CPU counts a 50% percent.

After 25 minutes I guess 170141183460469231731687303715884105727 IS a big number to test:)
[BTW 170141183460469231731687303715884105727 is a prime, according to http://en.wikipedia.org/wiki/List_of_prime_numbers)

Edit: I resulted that 170141183460469231731687303715884105727 is NOT a prime... Bad work wikipedia!

You can check the code here: http://ventrix.nsdc.gr/code_folds/2008/10/07/java-prime-number/

5 σχόλια:

WikipediaLover είπε...

Show me the code.

Ventrix είπε...

Κάνω κάποιες ψιλοδιορθώσεις στον κώδικα ώστε να βελτιώσω την ταχύτητα κατα περιπτώσεις και θα τον δημοσιεύσω!

Ventrix είπε...

Ο κώδικας βρίσκεται εδώ: http://ventrix.nsdc.gr/code_folds/2008/10/07/java-prime-number/

Ανώνυμος είπε...

170141183460469231731687303715884105727

einai prime. an to programa sou ton ebgale oti den einai exei lathos.

auto pou kaneis einai mathimatika tekmiriomeno? oti pidas mia 2 kai mia 4 i apla to ebales epeidi paratirises auti ti diadoxi stous 100-200 protous arithmous?

i euresi proton arithmon basizetai pano sta mathimatika opote prepei na isxiei oti kaneis.

shortmanikos είπε...

Κι εγώ που το δοκίμασα στο Sage (http://www.sagemath.org/) με έβγαλε ότι είναι πρώτος (σε 0.004 sec...)