I have an application (forever running Daemon application) which has to manage communication (request and response) between physical devices (example RS485 devices) and applications inside a system - something like a "communication layer" for many applications to talk to hardware devices.
Applications_Send_Request -> Communication_Layer_Forwards_To_Devices -> Communication_Layer_Gets_Response -> Application_receives_response.
The part where I fwd the request to a device and get response can be an asynchronous job.
I'm planning to create a thread which will do this in the background which the application accepts other requests.
Now, this thread will be short lived - about few milliseconds to a few seconds only.
I might get a few hundreds of requests every second - so the application is creating lots of short lived threads and deleting them - doing it forever continuously.
Concerns: 1 - Creating thousands of threads ( though they are very short lived ). 2 - Run time of application while it does is very long - runs forever.
Is the above design OK and safe when threads are used very heavily like this.