Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why can I open devices (e.g. a serial port) like normal files?

Devices files normal port serial
0
10 Posted

Why can I open devices (e.g. a serial port) like normal files?

0

Short answer: because the erlang runtime system was not designed to do that. The Erlang runtime system’s internal file access system, efile, must avoid blocking, otherwise the whole Erlang system will block. This is not a good thing in a soft real-time system. When accessing regular files, it’s generally a reasonable assumption that operations will not block. Devices, on the other hand, are quite likely to block. Some devices, such as serial ports, may block indefinitely. There are several possible ways to solve this. The Erlang runtime system could be altered, or an external port program could be used to access the device. Two mailing list discussions about the topic can be found here and here.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.