3 ms·
What is the cost of parallelism of C though?
by InvOfSmallC 7y ago
What is the cost of parallelism of C though?
- rootw0rm 7y agospinning up threads and context switching, just like the cost for everyone else?
- chii 7y agoThe Haskell version is provably going to work without issue when parrellelized (due to monoid laws), but I doubt the concurrency primitives in C is as trivially usable, and I expect no sane person would want to write that version.
- keldaris 7y agoWhy? This is not a hard problem and there's nothing wrong with parallelism in C. I'd much rather work on parallelizing the C code than deal with any amount of Haskell. I suspect there are more people who would agree with me than the total amount of people happy to write Haskell.
- sasasassy 7y agoOpenMP IS trivially usable.
- cormacrelf 7y agoThere's nothing stopping you from following the monoid laws in C. There is also nothing stopping you from breaking the monoid laws in Haskell.
- raverbashing 7y agoWhatever the cost in C, Haskell is incurring the same cost, unless it is using green threads. (You could use green threads in C - or something similar, though to be honest counting words in a file is a bit of an annoying problem for parallelism)
- pcstl 7y agoHaskell does use green threads. The thing is, Haskell code is managed by a Haskell runtime, and each runtime manages a single (processor) thread. So the usual parallelism model for Haskell is to spawn a runtime for each processor core and then let each runtime manage its own green threads.