Search code examples
erlangelixirerlang-otp

Process.whereis(:user) returns a pid. What is this pid?


In Elixir's repl iex when I enter Process.whereis(:user) it returns a pid. What is this :user process? What does it do? What is it's state?

It seems to be permanently blocked or sleeping as I have not been able to get a response with :user |> Process.whereis() |> :sys.get_state().


Solution

  • That is the standard I/O server in Erlang/OTP, the process that does the I/O for the user interface(s).

    The (somewhat brief) documentation is here: http://erlang.org/doc/man/user.html

    If you would like to verify that this is in fact where the user process is registered, look here: https://github.com/erlang/otp/blob/master/lib/kernel/src/user.erl#L45