Having a network of lets say 10 devices in RS-485, connected to the linux PC with a RS-485 to USB Converter.

Already there is a C program interacting with the serial converter at /dev/ttyUSB0.

My question is, What would happen if 2 or more programs interact with the same /dev/ttyUSB0?

Will Linux automatically lock /dev/ttyUSB so only one program uses it?

  • I guess, these devices are exclusive. Means, only one application/process can use it at a time
    – SHW
    Oct 23, 2013 at 13:15
  • Is there any serial converter that supports multiple process?
    – jacktrades
    Oct 23, 2013 at 13:16
  • 1
    Cool question. +1
    – Tim
    Oct 23, 2013 at 13:31
  • @jacktrades: How would you expect multiple processes working with a single serial port? How is that supposed to behave? Oct 24, 2013 at 4:02
  • @jacktrades RS-485 only specifies electrical connection layer. In order to have some sort of multiplexing like that, you need to layer a protocol on top of it.
    – kurtm
    Oct 24, 2013 at 14:10

1 Answer 1


In short: none of the two programs will work correctly. The output from the two programs will be merged and sent out the serial port. The input coming in through the serial port will be seen by only one of the programs (some input will end up at one of the programs, some input will end up at the other, randomly).

Because of this, programs normally using serial ports (uucp traditionally, pppd & terminal emulators lately) have implemented some kind of locking. It is an advisory locking (it is non-enforced), using lock files in some preconfigured global directory (/var/lock, for example).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .