LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 05-12-2004, 01:38 PM   #1
godOfThunder
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:

Code:
  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_init(&realAttributes);
  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!
 
  


Reply



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 10:55 PM
Real Time Equalizer st00 Linux - Software 1 03-20-2004 06:00 PM
real-time OS h/w Programming 11 01-24-2004 08:28 PM
Real-Time programming javpogon Programming 5 09-04-2003 08:25 AM
run real time echox Programming 3 04-03-2003 02:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:26 AM.

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