Skip to content

Instantly share code, notes, and snippets.

@mamaz
Created November 9, 2018 15:47
Show Gist options
  • Save mamaz/3baa2232f9405a392b2059627b45d7ab to your computer and use it in GitHub Desktop.
Save mamaz/3baa2232f9405a392b2059627b45d7ab to your computer and use it in GitHub Desktop.
Main File for Showing Concurrent vs Parallel
package main
import (
c "Exercise/ConcurrencyAndParallel/concurrency"
p "Exercise/ConcurrencyAndParallel/parallel"
"fmt"
)
// This is a demo for showing concurrency and parallelism works in Golang.
// the RunConcurrently() shows how to print a series of numbers and alphabet using single physical processors,
// while RunParallel() shows will print them using 2 physical processors.
//
// Note: more processors doesn't mean it will be faster.
func main() {
fmt.Println(">>> CONCURRENT")
c.RunConcurrently()
fmt.Println("")
fmt.Println("")
fmt.Println(">>>> PARALLEL")
p.RunParallel()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment