Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-12-2004, 02:38 PM   #1
LQ Newbie
Registered: Oct 2003
Location: Los Angeles, CA
Distribution: Fedora Core 2
Posts: 5

Rep: Reputation: 0
LinuxThreads won't schedule real-time

Has anyone been able to get pthreads in Linux to run real-time? I've tried creating a new thread like so:

  pthread_t      real;
  pthread_attr_t realAttributes;
  sched_param    fifoLevel;
  fifoLevel.sched_priority = (sched_get_priority_max(SCHED_FIFO) +
                              sched_get_priority_min(SCHED_FIFO)) / 2;
  pthread_attr_setscope(&realAttributes, PTHREAD_SCOPE_SYSTEM);
  pthread_attr_setinheritsched(&realAttributes, PTHREAD_EXPLICIT_SCHED);
  pthread_attr_setschedpolicy(&realAttributes, SCHED_FIFO);
  pthread_attr_setschedparam(&realAttributes, &fifoLevel);
  pthread_create(&real, &realAttributes, realmain, NULL);
The new thread just sleeps for a small amount (100 usec) of time and then reports the actual time slept. Although I run this app with sudo, it still won't do anything better than the 10-20 ms sleeps you get with standard user scheduling.

I've gotten this to work if you make the whole process real-time, but why can't I just schedule one thread?

I am using 2.4.22-1.2188.nptl (Fedora Core 1). Thanks!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to schedule startup time wolfipa Linux - General 4 09-01-2006 11:55 PM
Real Time Equalizer st00 Linux - Software 1 03-20-2004 07:00 PM
real-time OS h/w Programming 11 01-24-2004 09:28 PM
Real-Time programming javpogon Programming 5 09-04-2003 09:25 AM
run real time echox Programming 3 04-03-2003 03:01 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:21 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration