Solid Ground

Solid Ground

ElixirDaze 2017

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

78d85ea26770975ea8c497d7bd722d55?s=128

Saša Jurić

March 06, 2017
Tweet

Transcript

  1. 2.
  2. 4.
  3. 7.
  4. 10.

    thread 1 thread n … long running task long running

    task blocked cooperative scheduler
  5. 11.

    thread 1 thread n … long running task long running

    task not blocked :-) BEAM scheduler
  6. 15.

    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
  7. 16.

    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
  8. 23.

    supervisor foundations frequent context switching activities as runtime citizens observable

    process termination stoppable processes shared-nothing concurrency