Thread won't switch from real time scheduling policy to 'other'

Thread won't switch from real time scheduling policy to 'other'

Post by Felix Morley Fin » Thu, 26 Feb 1998 04:00:00



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_init (&sigAttr);
  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

 
 
 

Thread won't switch from real time scheduling policy to 'other'

Post by Larry Blanchar » Thu, 26 Feb 1998 04:00:00


<snip>

Quote:> 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.

Wouldn't this be because scheduling policies are set for a process, and
all threads are considered part of the same process?

I have used setscheduler after a fork and before an exec and it works
fine in that environment - which is what it was designed to do.
--
Larry Blanchard - Old roses, old motorcycles, and old trains
Homo Sapiens is a goal, not a description.

 
 
 

Thread won't switch from real time scheduling policy to 'other'

Post by Meelis Roo » Thu, 26 Feb 1998 04:00:00


Quote:> It looks to me like the sched policy for the thread is not being
> changed to OTHER.

Do you check the return values of the set_*** functions? Any
error there?

--

                        www:    http://www.cs.ut.ee/~mroos/

 
 
 

1. Parent thread user id is not switching to 'nobody'

Hi,
   I am new to Apache. My apologizes for a basic question.
   I configured in httpd.conf user as nobody
   For port 80, when I start as root, it gets started, But the parent
thread is running as
   root, and others are switched to nobody.
   As per the documentation in httpd.conf, This should also switch to
nobody.
   Where am I doing wrong.

2. ???? Why not latex2html ??????????????????

3. enhanced real time clock support; how to say 'y'

4. TAPEWARE to backup SCO box via NFS?

5. Redhat 7.1 'eepro100' and 'e100' drivers won't see 10BaseT network

6. Microsoft Stocks and your sanity...

7. dosemu053pl36 won't switch VC's

8. NIS Client and Server Requirement

9. How to switch from 'GNOME' to 'KDE'?

10. Q: Viewing a file 'Real Time'

11. Need FTP '% done' real-time gauge

12. 'make' won't work w/o '-f Makefile', which sucks.

13. How to switch from 'GNOME' to 'KDE'?