Changes

Jump to: navigation, search

GPU621/Go Kimchi

53 bytes removed, 12:03, 11 August 2021
Parallel Programming in Go & Java
{{GPU621/DPS921 Index | 20207}}
=Parallel Programming in Go & Java= == Group Members ==
[mailto:astinziani@myseneca.ca?subject=GPU621 Yuseok Won]
[mailto:astinziani@myseneca.ca?subject=GPU621 Minsu Kim]
== Project Description ==
This project will look at the performance difference between Go and Java for Parallel/Multithread program using the matrix multiplication algorithm.
The project will present parallel program codes written in each language and .sh script to run the codes.
It will also briefly cover key terms & concepts of parallel programming to help readers' understanding and the historical/fundamental difference of each language to determine what may have caused the performance difference.
=Programming Language Introduction=== What's GO Language? === ----
[[File:Golang.png|400px|left]] Go Language is a open source programming language that is designed at Google by [https://en.wikipedia.org/wiki/Robert_Griesemer Robert Griesemer], [https://en.wikipedia.org/wiki/Ken_Thompson Ken Thompson], and [https://en.wikipedia.org/wiki/Rob_Pike Rob Pike]. <br>
Go lang is a '''Fast''' and '''Pretty''' language.
=== What's Java Language? ===----
[[File:what-is-java-5b4bda1cc9e77c0037171617.jpg|400px|left]]
<br>
=== Parallel Programming in GO & Java ===----
'''Parallelism and Concurrency'''
Java language can implement thread in three different methods. The first method is to create a class which extends the "Thread" class that gives the user to have control of the lifecycle of the thread. But Java language only allows single inheritance which prevents the thread from extending other base class. The second method is using "Runnable" interface. This method allows to user to extend other base class while still being run as a new thread. However, this method does not give user to control lifecycle of thread. The third, Java version 5.0 and later provides "concurrency" to simplify thread creation and processing. The "[https://docs.oracle.com/javase/tutorial/essential/concurrency/executors.html Executor]" that implement by java.util.concurrent provides APIs for creating and processing new threads.
=Implementation===General Implementation Info===----
''Before diving into the code, here are some things to know.''
- Create & Download Matrix here [https://onlinenumbertools.com/random-number-matrix https://onlinenumbertools.com/random-number-matrix]
===Implementation for Go===----'''===Installation of Go''' <br>===
Go to [https://golang.org/dl/ https://golang.org/dl/] & Download Go accordingly to your OS.
'''===Multi-Thread Program in Go'''===
package main
runtime.GC()
}
''' === .sh Code to Run Go Program ''' <br>===
''Above Go code will run in terminal using .sh script.''
#! /bin/sh
echo "Done";
===Implementation for Java===----'''===Installation of Java''' <br>===
Go to [https://www.java.com/ko/download/manual.jsp https://www.java.com/ko/download/manual.jsp] & Download Java accordingly to your OS. <br>
'''===Multi-Thread Program in Java'''===
import java.io.BufferedReader;
import java.io.FileReader;
}
}
''' ===.sh Code to Run Go Program ''' <br>===
''Above Java code will run in terminal using .sh script.''
''' .sh Code to Run Java Program '''
echo "Done";
===Result===----
==Charts==
{| <!-- The nested table must be on a new line -->
| style="border: 2px" |
|}
===Analysis===----
The results of matrix multiplication implementation on Go language has remarkable superiority in main thread. However, the both language shows the tendency that execution time gradually decreases as the number of threads increase. The curve of execution time on the graph become flatten for both Go and Java when the number of threads become 8 and 16. We infer the Go has a reduction tendency when the number of threads reach 8 and 16 but Java shows the promotion tendency as number of threads reach 8 and 16. The best performance has been shown that the 8 threads for Go and 16 threads on Java. The percentage difference of implementation time between GO and Java shows minimum 12% when 16 threads being used and maximum 102% when main thread being used.
There is a few possible reason that Go and Java shows difference performance despite using same calculating matrix multiplication algorithm. First, the code for Go and Java is not exactly matched. second, Java uses JVM(Java Virtual Machine) to calculate the algorithm which may take more time to implement.
58
edits

Navigation menu