I was perusing through the standard include files and I found one of my old friends the pthread.h file. Now I know that vxworks is POSIX compliant. But does any one know if it is possible to create a multi threaded program to run on the crio? Has anyone else noticed this? Is any one looking to use this functionality to their advantage?
vxWorks 6.3 is fairly POSIX compliant, and does support pthreads.
Whether or not can use them depends on how the kernel was configured.
Since the configuration of the kernel we’re stuck with is largely unknown and must be guessed at, I can’t say.
Beware looking for symbols that might indicate this or that is configured into the kernel though.
Object files are sometimes linked in the kernel even if the kernel features that module supports are not configured.
So, using nm or some such, you might find that pthread_create is ‘in’ the kernel yet it won’t work right because the kernel is not properly configured.
I do wish the good folks at WPI would give us a way to know the kernel configuration – even better, give us the BSP so we can build our own kernels.
I’m not sure why you would ever want to be using multiple threads for this type of project - there’s just no need for them (that I can think of). Threads are for when you need to be doing multiple things concurrently - what two things (or more) would you need to be doing concurrently in this robotics application? An easy example of thread use in other applications is when you want to add music to your videogame that you just wrote. The two things you want to be doing concurrently are:
- Keeping up with the game (resolving collisions of spaceships with lasers, etc)
- Loading and playing the next byte of sound data.
So, no, can’t really see how anyone would use threads to do anything other than confuse themselves - but interested to hear others’ ideas.
Every Labview and C++ programmer in this year’s game will be be doing whatever they do thanks to the benefits of multi-tasking (same as threading).
Most won’t even know it – some will and will exploit it to good advantage.
Even if we can’t do POSIX threads, we can do multiple tasks.
Students who care about software should definitely understand concurrency.
Concurrency is very useful for vision processing in this competition. We are using a completely separate thread for finding our targets, with great success. We will post our code when we’ve gotten more of the functionality down.
I’m pretty sure that LV internally is using posix threads for its execution. And as stated, every time a loop is drawn in parallel, it will execute that way because of the thread support of vxworks. I know that WPI has something called a task for spawning independent operations. Not sure what it is built upon, but it will hopefully be all you need for most tasks.