multithreading - events.static.linuxfound.org · multithreading an extensive study on linux,...

30
Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne http://dalmocirne.blogspot.com

Upload: doananh

Post on 27-Jan-2019

233 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

MultithreadingAn Extensive Study on Linux, OpenSolaris, and Windows

Dalmo Cirne

http://dalmocirne.blogspot.com

Page 2: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Choice

Page 3: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

The Experiment•Operations with Integers

temp counter

temp temp+ 37temp temp� 36counter temp

Page 4: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

The Experiment•Operations with Floating Points

2

4z

x

y

3

5=

2

4exp (cos (

px

2+ y

2))

i/1.1

i⇥ 1.1

3

5

Page 5: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

The Experiment•Operations with I/O

100x

Page 6: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

HardwareConfiguration

Processor

RAM

Video Card

Hard Disk

Main Board

Intel Core 2 Quad 2.5 GHz

2x2GB DDR2 1066 PC2-8500

NVidia 8600GT 512MB

Western Digital WD5000AAKS - 500GB - 7200 RPM - SATA2

ASUS P5K-E P35 775

Page 7: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

SoftwareLinux OpenSolaris Windows

O.S. Version

Disk Partition

Java

C

Filesystem

Fedora 122009.06

(20091230)Windows 7 Professional

/dev/sda3 /dev/sda2 /dev/sda1

OpenJDK - 64bit - 1.6.0_0 build

14.0_b16

SUN JDK - 64bit - 1.6.0_17-b04

SUN JDK - 64bit - 1.6.0_17-b04

gcc 4.4.2 gcc 4.4.2Visual C++ 2008 Express Edition 9.0.30729.1SP

ext4 ZFS NTFS

Page 8: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Installing all OSs on the same machine

Page 9: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Source Code

svn co https://multithreading.svn.sourceforge.net/svnroot/multithreading multithreading

or

git clone [email protected]:dcirne/Multithreading.git

Page 10: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Running the Experiment(Linux and OpenSolaris)

Page 11: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Running the Experiment(Windows)

Page 12: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Analyzing the Data• Average Running Time

• Standard Deviation (Volatility)

•Maximum and Minimum Running Times

•Margin of Error (99% confidence level)

• Histograms

• Algebra of Sets

• Chi-Square Goodness-of-Fit Test

Page 13: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

First Experiment: Linear C

012,50025,00037,50050,000

Linux OpenSolaris Windows

48,719

4,0024,388

Total Running Time

Time MeasurementsTime MeasurementsTime MeasurementsTime MeasurementsTime MeasurementsTime Measurements

Iteration Time

Counter Increment

Equation Calculation

File Replication

Average Linux

OpenSolaris

Windows

Standard Deviation Linux

OpenSolaris

Windows

Maximum Linux

OpenSolaris

Windows

Minimum Linux

OpenSolaris

Windows

Margin of Error Linux

OpenSolaris

Windows

43.86 7.55 23.35 12.51

39.74 7.23 23.64 8.84

461.43 42.68 22.52 372.04

3.87 0.23 0.00 0.02

0.89 0.19 0.08 0.83

467.69 6.92 7.85 459.72

82.10 9.29 23.36 12.58

46.94 8.92 24.41 16.06

2,340.00 47.00 32.00 2,275.00

43.03 7.09 23.34 12.46

39.34 7.11 23.62 8.52

125.00 31.00 15.00 47.00

0.996 0.059 0.001 0.005

0.229 0.048 0.021 0.214

120.478 1.784 2.023 118.423

Page 14: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

First Experiment: Linear C

0

10

20

30

40

50

Linux OpenSolaris Windows

Average Running Time

Counter Increment Equation Calculation

0

2

3

5

6

8

Linux OpenSolaris Windows

Standard Deviation

Counter Increment Equation Calculation

0

80.00

160.00

240.00

320.00

400.00

File Replication

Average Running Time

Linux OpenSolaris Windows

0

100.00

200.00

300.00

400.00

500.00

File Replication

Standard Deviation

Linux OpenSolaris Windows

Page 15: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

First Experiment: Linear C

P W

E = P \W S = W � P \WF = P � P \W

Equation CalculationEquation Calculation

Bin IndexTime

Ranges

Equation CalculationEquation CalculationEquation CalculationLinux

FrequencyOpenSolaris

FrequencyWindows

Frequency1 15.002 16.803 18.604 20.405 22.206 24.007 25.808 27.609 29.4010 33.00

0 0 220 0 340 0 00 0 00 0 0

100 99 00 1 00 0 00 0 00 0 44

0

20

40

60

80

100

15.00 16.80 18.60 20.40 22.20 24.00 25.80 27.60 29.40 33.00

Equation Calculation

Linux OpenSolaris Windows

Ej = min (Pj ,Wj)

Sj =

8><

>:

Wj � Pj if (Pj < Wj) ^ (

Pji=1 Pi < 100)

0 if (Pj > Wj) ^ (

Pji=1 Pi > 0) ^ (

Pji=1 Wi < 100)

Pj � (Pj \Wj) otherwise

Fj =

8><

>:

Pj �Wj if Pj > Wj

0 if ((Pj > Wj) ^ (

Pji=1 Pi = 100)) _ (Pj = Wj) _ (

Pji=1 Pi < 100)

Wj � Pj otherwise

Page 16: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

First Experiment: Linear C

P W

E = P \W S = W � P \WF = P � P \W

Ej = min (Pj ,Wj)

Sj =

8><

>:

Wj � Pj if (Pj < Wj) ^ (

Pji=1 Pi < 100)

0 if (Pj > Wj) ^ (

Pji=1 Pi > 0) ^ (

Pji=1 Wi < 100)

Pj � (Pj \Wj) otherwise

Fj =

8><

>:

Pj �Wj if Pj > Wj

0 if ((Pj > Wj) ^ (

Pji=1 Pi = 100)) _ (Pj = Wj) _ (

Pji=1 Pi < 100)

Wj � Pj otherwise

Equation CalculationEquation CalculationEquation CalculationEquation Calculation

Time Ranges

Linux Faster than Windows

Linux Equal to Windows

Linux Slower than Windows

15.00 0 0 22

16.80 0 0 34

18.60 0 0 0

20.40 0 0 0

22.20 0 0 0

24.00 100 0 0

25.80 0 0 0

27.60 0 0 0

29.40 0 0 0

33.00 44 0 0

Totals 144 0 56

72.00% 0.00% 28.00%

Page 17: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Space Used on DiskLinux (ext4)

OpenSolaris(ZFS)

Windows(NTFS)

Space Used on Disk (MB)

335 335 351

Consistent Across All Experiments

Total Overhead = 351 MB� 335 MB = 16MB (16, 777, 216 bytes)

Average Overhead per Item =16, 777, 216 bytes

10, 100 items⇡ 1, 661 bytes per item

Page 18: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Linear Java

240,000

252,500

265,000

277,500

290,000

Linux OpenSolaris Windows

280,363

245,548257,836

Total Running Time

0

18

36

54

72

90

2,430.00 2,481.90 2,533.80 2,585.70 2,637.60 2,689.50 2,741.40 2,793.30 2,845.20 2,949.00

Iteration Time

Linux OpenSolaris Windows

Standard Deviation Linux

OpenSolaris

Windows

16.51

1.61

5.78

Page 19: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Linear JavaEquation CalculationEquation Calculation

Bin Index Time Ranges

Equation CalculationEquation CalculationEquation Calculation

Linux Frequency

OpenSolaris Frequency

Windows Frequency

1 87.00

2 96.80

3 106.60

4 116.40

5 126.20

6 136.00

7 145.80

8 155.60

9 165.40

10 185.00

0 31 0

0 68 0

0 1 0

0 0 0

0 0 0

0 0 0

54 0 0

2 0 0

8 0 16

36 0 84

↵ = 0.05

H0 : P = W

H1 : P 6= W

Q =10X

i=1

2X

j=1

(Fij � npij)2

npij

Q = 77.867

Q = 77.867 > 9.488 = �20.05(4)

Time Range Comparison - Equation Calculation

Range

Time Range Comparison - Equation CalculationTime Range Comparison - Equation CalculationTime Range Comparison - Equation Calculation

Linux OpenSolaris Windows

<= 96.80

> 96.80 and <= 145.80

> 145.80

0% 99% 0%

54% 1% 0%

46% 0% 100%

Page 20: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Threads

Page 21: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Threads

Page 22: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Threads

C Java

0

12,500

25,000

37,500

50,000

Linux OpenSolaris Windows

Total Running Time

230,000

235,000

240,000

245,000

250,000

Linux OpenSolaris Windows

Total Running Time

Number of Iterations

Concurrent Threads

Total Running Time (milliseconds)Total Running Time (milliseconds)Total Running Time (milliseconds)Number of Iterations

Concurrent Threads Linux OpenSolaris Windows

100 3 244,511 231,800 244,905

Number of Iterations

Concurrent Threads

Total Running Time (milliseconds)Total Running Time (milliseconds)Total Running Time (milliseconds)Number of Iterations

Concurrent Threads Linux OpenSolaris Windows

100 3 3,339 2,388 42,167

Page 23: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Stress

Page 24: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Stress

Page 25: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Stress

Page 26: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Stress

Page 27: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Stress

Page 28: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Stress

C Java

0

100,000

200,000

300,000

400,000

Linux OpenSolaris Windows

Total Running Time

0

250,000

500,000

750,000

1,000,000

Linux OpenSolaris Windows

Total Running Time

Number of Iterations

Concurrent Threads

Total Running Time (milliseconds)Total Running Time (milliseconds)Total Running Time (milliseconds)Number of Iterations

Concurrent Threads Linux OpenSolaris Windows

100 103 169,660 388,446 230,991

Number of Iterations

Concurrent Threads

Total Running Time (milliseconds)Total Running Time (milliseconds)Total Running Time (milliseconds)Number of Iterations

Concurrent Threads Linux OpenSolaris Windows

100 103 770,474 937,646 981,864

Page 29: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

The Economics of OSs

2,300

2,500

2,700

2,900

3,100

Linux OpenSolaris Windows

Avg Running Time

10,000,000

10,875,000

11,750,000

12,625,000

13,500,000

Linux OpenSolaris Windows

# of Interations/Year

Cost per Iteration

Windows

=

$403.66

10, 366, 784= $0.0000389379

Cost per IterationOpenSolaris =$400.22

10, 455, 963= $0.0000382765

Cost per Iteration

Linux

=

$320.53

13, 055, 531= $0.0000245511

Page 30: Multithreading - events.static.linuxfound.org · Multithreading An Extensive Study on Linux, OpenSolaris, and Windows Dalmo Cirne

Q&A