On Sat, 02 Mar 2019 14:36:12 -0500, Jeffrey Walton said:
I feel like I am missing something... Does Linux consider the modem a shared resource instead of an exclusive resource? What use cases support two different programs sending commands to the modem at the same time?
The Linux kernel has exactly zero clue what a "modem" is. It's talking to a serial port, and doesn't care where the other end of the serial cable is. If you have a onboard modem, that cable may be all of 2 mm long and consist of a bunch of traces between two chips on a PCB, or even internal connections between two sides of a chip, but it's still there. So the correct question is "what use cases have two programs talking to the same serial port"? And the answer is: A lot. For a long time, there were these things called "terminals", that the younger folk may not have encountered. And a very common use case was to login via a terminal. At that point, you usually had a login shell like bash or similar running and often doing I/O to the terminal - and if you ran any sub-processes, they also would do I/O to the terminal. So consider the following bash one-liner: % for i in `seq 1 10`; do echo "Loop number $i"; date; sleep 1; done How and why does this work? (Hint 1: 'echo' is a bash builtin, Hint 2: think about how a shell handles stdin/out for child processes)