I have a host NB that talks to some other NB platforms that locally collect, parse and log sensor data. Upon UDP request from the host, the sensor NBs transmit processed data for approx three different sensors to the host via UDP over one or more fds created with CreateTxRxSocket(). Each of the three sensors, reads, parses and logs data in independent tasks. The data for each sensor is stored in OSCriticalSection protected structs. Here are my first two questions:
On the sensor end, does it make better sense to have one task listening for requests for sensor data over one fd, or three tasks listening for requests that are sensor specific on three fds?
On the host end, the data for the different sensors is needed asyncronously in different tasks. Once again, any thoughts of whether it makes better sense to have one or three fds?
I'm leaning towards multiple fds, but is there a downside in too many fds? I think the host will have about a dozen fds to different sensors this way, along with the typical web, ftp, and 3-4 serial port fds.
Here's my last question. What will provide better throughput: One task that uses a select statement to handle multiple fds, or several tasks that each use a select statement to process a single fd?
3 related design questions: UDP fds, tasks, and select.
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: 3 related design questions: UDP fds, tasks, and select.
I think the best throughput would be one task with a select. I also think it would be easier to manage the code since everything is in one place. The select function seems like a perfect fit for this, on both ends. Plus you don't have to manage task priorities, and it will be more of an even flow for all 3 connections.