I have a serial port which gives me a lot of different data from different pieces of hardware. I need to send different commands to the serial port to receive different kinds of data from it. So, I need to write and read data simultaneously from the port in different functions. Sometimes, I might need to read and write simultaneously from the serial port  in 10 different threads. What is the best way of writing code in this situation for simultaneously reading/writing data from a single port? Threads, sub processes, etc.
There can be different approaches based on the type of architecture and driver. One of them can be as below :
As soon as you receive data via receive interrupt, post the data to the main receive buffer queue. There can be a single thread called Rx dispatcher/Rx Manager that always reads the main receive buffer queue and post/dispatch to respective receive queue of reader threads based on msg type/id for further processing.
On the transmission side, respective thread can post the data along with msg type/id to the main transmit buffer queue which shall be sent out by Tx thread via transmit interrupt.
Reading and writing from a single serial port simultaneously from multiple threads