CONCURRENCY MODEL
Crystal uses green threads, called fibers, to achieve concurrency. Fibers communicate with each other using channels, as in Go or Clojure, without having to turn to shared memory or locks.
channel = Channel(Int32).new
total_lines = 0
files = Dir.glob("*.txt")
files.each do |f|
spawn do
lines = File.read(f).lines.size
channel.send lines
end
end
files.size.times do
total_lines += channel.receive
end
puts total_lines
갓언어
얼랑이 원조입니다
코딩조무사/ 찾아보니 erlang은 actor model이고 golang은 csp라 좀 다른 것 같던데요
크게보면 shared memory 방식이 아닌 message passing 방식이라는 점에서는 비슷한데 그 정도로 원조를 따지기는 좀