Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Solid Ground

Solid Ground

ElixirDaze 2017

Video available at https://www.youtube.com/watch?v=5SbWapbXhKo

Saša Jurić

March 06, 2017
Tweet

More Decks by Saša Jurić

Other Decks in Programming

Transcript

  1. thread 1 thread n … long running task long running

    task blocked cooperative scheduler
  2. thread 1 thread n … long running task long running

    task not blocked :-) BEAM scheduler
  3. mref = Process.monitor(pid) send(pid, :please_stop) receive do {:DOWN, ^mref, :process,

    ^pid, _reason} -> :ok after :timer.seconds(5) -> Process.exit(pid, :kill) receive do {:DOWN, ^mref, :process, ^pid, _reason} -> :ok end end
  4. task = Task.async(fn -> ... end) case Task.yield(task, :timer.seconds(5)) do

    {:ok, result} -> do_something(result) nil -> Task.shutdown(task, :brutal_kill) end
  5. supervisor foundations frequent context switching activities as runtime citizens observable

    process termination stoppable processes shared-nothing concurrency