Concurrent Prime Generator

后端 未结 10 709
终归单人心
终归单人心 2020-12-20 20:32

I\'m going through the problems on projecteuler.net to learn how to program in Erlang, and I am having the hardest time creating a prime generator that can create all of the

10条回答
  •  再見小時候
    2020-12-20 21:14

    I wrote an Eratosthenesque concurrent prime sieve using the Go and channels.

    Here is the code: http://github.com/aht/gosieve

    I blogged about it here: http://blog.onideas.ws/eratosthenes.go

    The program can sieve out the first million primes (all primes upto 15,485,863) in about 10 seconds. The sieve is concurrent, but the algorithm is mainly synchronous: there are far too many synchronization points required between goroutines ("actors" -- if you like) and thus they can not roam freely in parallel.

提交回复
热议问题