I am trying to port a linux(2.6)(posix compliant) software based on ARM9 to VxWorks(6.5)(Posix Compliant) running on ARM9. The software deals with lot of thread(posix) creation and intertask communications. It also deals with shared memory. I am worried that the scheduler of linux and vxworks might be different and hence will have its impact on this porting activitiy. I am eager to know the differences between the scheduler of linux kernel 2.6 and Vxworks 6.5 so that i can take that into consideration ? Has anyone analysed this or come across such a situation ? Any links/ideas ?
Maybe you should study the application and figure out exactly what operating system features are being used, and see if you can form an idea of how sensitive the program is to the detailed behavior of those features.
At the very least you should make some charts of the different threads / processes and how they interact.
A lot of time it won't be very sensitive at all - but if the processor is running flat out, differences in the scheduler or even the base system load could break it.
VxWorks 6.5 (or possibly 6.6) supports full POSIX compliant scheduling algorithms IFF you are running your code as an RTP (i.e. a process)
I'd recommend you review the documentation in the Applications Programmers' Guide on this area. Check out the POSIX chapter.
The only additional characteristic you need to be aware of is that threads in VxWorks are globally scheduled; by that I mean that if you have multiple RTPs executing, each RTP doesn't get a slice of time... it will still be the thread with the overall highest priority in the complete system that will be scheduled to run.
If process P1 has 5 runnable threads and process P2 has
3 runnable threads, assuming all the 8 threads are at same priority, then each thread would receive one-eighth of the CPU time. And this will get adjusted whenever a new thread gets created. And so, if process P1 has 7 threads and process P2 has
3 runnable threads, assuming all the 10 threads are at the same priority, then each thread would receive one-tenth of the CPU time.
Can you pls tell me if VxWorks behave as stated above with respect to threading ?
And, does VxWorks support NPTL ? How far is VxWorks compatible with NPTL ?
Is the VxWorks scheduler similar to that of CFS scheduler in linux ? Or Does it use O(1) Scheduler ?
I got the below info for the above from internet ->
In VxWorks, Round-robin scheduling Like preemptive priority-based scheduling but it also attempts the share the CPU fairly among all tasks of the same priority using the so called time-slicing technique. In time-slicing each task can run freely until its preempted by a higher priority task or its time-slice has ended. In the latter case another equal priority task is scheduled to run. Thus the equal-priority task rotate, each executing for an equal interval of time. In vxworks one can activate round-robin scheduling with the function kernelTimeSlice() with the specified timeslice.
I find that the below link has good info w.r.t porting between vxworks and linux.
formatting link
Further from the man page of pthreads i find the below info ->
LinuxThreads- This is the original (now obsolete) Pthreads implementation.
NPTL (Native POSIX Threads Library)- This is the modern Pthreads implementation. By comparison with LinuxThreads, NPTL provides closer conformance to the requirements of the POSIX.1 specification and better performance when creating large numbers of threads. NPTL requires features that are present in the Linux 2.6 kernel.
Both of these are so-called 1:1 implementations, meaning that each thread maps to a kernel scheduling entity.
Modern GNU C libraries provide both LinuxThreads and NPTL, with the latter being the default (if supported by the underlying kernel).
But, i am unable fo find info for the below queries ->
And, does VxWorks support NPTL ? How far is VxWorks compatible with NPTL ?
How to make the VxWorks scheduler to act similar to that of CFS scheduler and O(1) scheduler of linux ?
The default scheduler is a priority based scheduler; in the example you gave, the various threads in the two processes at the same thread priority will not necessarily get equal processing time.
For example, if one of the threads did
for (;;) {}
it would continue to hold the CPU indefinitely unless a higher priority event caused a reschedule, and even then it would regain the CPU because it is still at the top of the ready to run list.
If the thread blocked (because it yielded, or waited on a resource such as a semaphore), another thread at the same priority could run.
As you noted, you can turn on time base "round-robin" scheduling which will limit the amount of time any thing within a particularly priority level gets to run.
VxWorks 6.2 (might be 6.3, I'm not sure), added full POSIX thread scheduling capabilities within an RTP ("real time process"), although I'm not familiar enough with this algorithm to know how it works if you have multiple processes running.
There's detailed documentation on the scheduling algorithms in the Application' Programmer's Guide
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.