1484244796 by Unknown
Author:Unknown
Language: eng
Format: epub
Published: 2019-04-25T15:38:33+00:00
Chapter 8 Working in Several CoreS
efficiently. A standard approach to this problem is to introduce an intermediate message broker. AMQP is a common protocol for dealing with message queues. There are several implementations; RabbitMQ is a widely used one. The amqp-worker package provides a
simple interface for exchanging messages via this protocol and leverages several Haskell-
specific techniques.
Tip “Concurrency is about dealing with lots of things at once. parallelism is about doing a lot of things at once.” – rob pike
The fields of parallel, concurrent, and distributed programming in Haskell are
much wider than what will be shown in this chapter. The libraries explained here can
be used in many other ways, and many other packages are available in Hackage. For
parallel programming you have the parallel package, which features the strategies
approach. Parallelism is not only available for processors. Accelerate builds code to be
run in a GPU. Haskell’s base package features low-level functionality for concurrency
in the Control.Concurrent module, including mutable memory locations (MVars) and
semaphores. The distributed-process set of packages introduces Erlang-style actors
which can share both code and data. The book Parallel and Concurrent Programming
in Haskell by Simon Marlow describes several of these techniques in much more depth than this chapter.
The Par Monad
This section will focus on the parallel programming package called monad-par. The
functions in that library revolve around the Par monad and the use of IVars for
communication results. As you will see, computation can be modeled in two ways with
this package: as futures or as dataflow programs.
Futures
Let’s start with a simple task that aims to produce the factorization into primes of
several numbers. The algorithm for factorizing one number is simple. You try to divide
by increasing natural numbers. If at some point the division has zero remainder, that
number is a prime factor. Thus, the original number can be divided by that prime factor,
271
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Consumed by Deception: A Dark Marriage Mafia Romance (Deception Trilogy Book 3) by Rina Kent(4879)
Fierce King: A Dark Mafia Forced Marriage Romance (L.A. Ruthless Series Book 1) by Sadie Kincaid(4821)
Steel Princess: A Dark High School Bully Romance (Royal Elite Book 2) by Rina Kent(3608)
One Last Stop by Casey McQuiston(2175)
Vow of Deception: A Dark Marriage Romance (Deception Trilogy Book 1) by Rina Kent(2008)
The Setup by Meghan Quinn(1926)
Rock Paper Scissors by Alice Feeney(1858)
An Offer From a Gentleman: The Epilogue II by Julia Quinn(1693)
Ruthless Creatures: A Billionaire Romance (Queens & Monsters Book 1) by J.T. Geissinger(1519)
The Awakening by Nora Roberts(1466)
The Best of Friends by Lucinda Berry(1303)
Betty by Tiffany McDaniel(1261)
Vanity: Enemies to Lovers Mafia Romance by Savannah Rose(1108)
The Flaw in His Marriage Plan by Tara Pammi(1092)
Black Sheep Heir by Yvonne Lindsay(1040)
The Royal Governess by Wendy Holden(1040)
The Windsor Knot by SJ Bennett(1032)
The Hunting Wives by May Cobb(1019)
Tears Of Betrayal by Michelle Heard(970)
