edwinallenz

edwinallenz

Getting stdio process ID

Inside IEx when I run Process.whereis(:standard_error) I got the PID, but not when I run Process.whereis(:standard_io) . Who knows why should this happen and how to get the PID from : stdio ?

Marked As Solved

rvirding

rvirding

Creator of Erlang

That is because the i/o system and the error handling behave in different ways. For the error handling there is a central server process registered under the name :standard_error but this is not case for the i/o system. The best way to view an erlang/elixir system to think OS with many tasks and each one has its own i/o system.

You will find a description of this in the link in the erlang rationale I wrote many years ago http://rvirding.blogspot.com/2008/11/erlang-rationale.html . Towards the end it describes the i/o system and the “task” structure in erlang. You actually hit when you do a ^G in the shell.

Strangely enough this was the first time much of the rationale for erlang was actually described, about 10-15 years after it was designed. This was because we had so thought about it and discussed it we felt it was self-evident that this was the way it should be done. We found out later that not everyone thought the same way, some had not grasped the beauty of our design. :smile:

In http://erlang.org/doc/apps/stdlib/io_protocol.html you will find a description of the i/o-protocol as it is today.

10
Post #2

Also Liked

rvirding

rvirding

Creator of Erlang

Fred’s blog gives a very good description of how it looks and why it looks like that. We had OS inspired thinking behind the design of the system. That’s why I like to say that Erlang is not a language with concurrency but a OS with a language. Elixir buys straight into this though iex is not quite as concurrent as the Erlang shell.

OvermindDL1

OvermindDL1

Lol, a lot of mathematical equations may be self-evidently beautiful, but that doesn’t mean everyone understands it. :wink:

/me grumbles about pi being the wrong value…

rvirding

rvirding

Creator of Erlang

Not directly that I know of. Stdio doesn’t work through a registered process but uses the default process group leader. This is where it goes when you read/write without giving an i/o device.

josevalim

josevalim

Creator of Elixir

To exemplify @rvirding’s reply, :standard_io translates to Process.group_leader, which can change per process. :standard_error is a local process though. Here is an interesting post on the different things that are done with the group leader: http://ferd.ca/repl-a-bit-more-and-less-than-that.html

bottlenecked

bottlenecked

Just went through the erlang rationale document and I wish there was more where that came from! Thank you very much for sharing this

Where Next?

Popular in Questions Top

jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: https://hexdocs.pm/ecto/Ecto.Schema.html#module-...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
lucidguppy
I have a super simple question about elixir - how would I take a file like this foo bar baz and output a new file that enumerates th...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 27727 240
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

We're in Beta

About us Mission Statement