1. Thread won't switch from real time scheduling policy to 'other'
I have been experimenting with LinuxThreads 0.7 and glibc 2.0.6 on a
Linux 2.0.33 kernel (with a mindset 0.0.1 :-). I have run into a
sceduling policy / priority problem.
main itself runs in real time mode --
sched_setscheduler (0, SCHED_FIFO, &p);
main initializes the thread attrs once --
pthread_attr_setdetachstate (&sigAttr, PTHREAD_CREATE_DETACHED);
pthread_attr_setscope (&sigAttr, PTHREAD_SCOPE_SYSTEM);
pthread_attr_setinheritsched (&sigAttr, PTHREAD_EXPLICIT_SCHED);
pthread_attr_setschedpolicy (&sigAttr, SCHED_OTHER);
It needs the thread for a specific time consuming operation only. It
creates the thread only when needed --
pthread_create (&sigThread, &sigAttr, &threadCalc, NULL);
The thread runs for several seconds. The schedpolicy was set to
SCHED_OTHER above, and the thread nices itself --
setpriority (PRIO_PROCESS, 0, 5);
The threads calls pthread_exit when it is done.
The problem is that the thread blocks every other process on the
system for the duration (there are some file opens which let others
run very briefly). Adding more files to its process list to extend
its duration, and adding sleeps between each file, lets me see status.
There are three copies of the command; I presume these are the main
thread, file processing thread, and thread manager.
pid ppid nice policy
14580 - 0 F
14582 14580 0 F
14586 14582 5 F
It looks to me like the sched policy for the thread is not being
changed to OTHER. I am glad to see that only one process has priority
5; at least something is working! Well, that's not fair. The threads
package works fine, mutexes and all. I just can't get it out of real
time sceduling policy.
If main does not put itself in real time mode, the only change I see
is that the process display doesn't show policy F and the processes
don't block while the thread is running.
... _._. ._ ._. . _._. ._. ___ .__ ._. . .__. ._ .. ._.
PGP = 91 B3 94 7C E9 E8 76 2D E1 63 51 AA A0 48 89 2F
I've found a solution to Fermat's Last Theorem but I see I've run out of room o
2. A Toolbar for OpenWindows
3. Fun fun fun! :)
4. Why doesn't this work?
5. fun, fun fun
6. mod player tracker for linux
7. KIllustrator: fun, fun, fun.
8. cdda.h? cdrom.h?
9. Time flies and it's not Fun.
10. thread timing info, suspending threads
11. It Works, It's Legal, It's Easy, and It's Fun
12. Timing info from 'time'
13. 'top' output -> High CPU consumption when thread is in 'sleep' state