0

I have an application that is currently using three threads, all set for real-time scheduling, for receiving data over a udp socket connection. I use three threads to try and speed up the data pipeline, i.e. one polls for data and pulls it from the recv buffer, another copies the data into a Queue, and another writes to file.

Will having multiple real-time threads cause problems in the udp connection, for example if the thread trying to copy data takes contention over the thread trying to grab data from the buffer?

Rob
  • 1
  • 1

1 Answers1

1

Yes, increasing the priority of the thread to real-time seems like a bad idea, see this post for some details.

Have you considered the opposite approach? Have two or more copies of the same thread, doing read and copy operations. Now synchronize them so that as soon as the first thread is done reading and starts copying the data to the queue, the second thread already starts reading. Saving the data from the queue to file is probably best done in a single thread (unless you have multiple disks, etc.).

Community
  • 1
  • 1
Krzysztof Kozielczyk
  • 5,887
  • 37
  • 28