LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-12-2009, 05:45 PM   #1
bastl
Member
 
Registered: Sep 2003
Location: Germany/BW
Distribution: My own
Posts: 237

Rep: Reputation: 22
Give up execution to the next process / scheduler


I can't find any function to give up the execution to the scheduler that the other processes can get that compute time.
I programm a realtime thread that have to be executed very smooth. So the breaks have to have the same delay. Linux scheduler isn't ready for such a task, because linux system calls and IRQ modules don't get their compute time by the scheduler. Also I have problems with the QT-Event scheduler and very short delays (usleep()) between port accesses of my thread.
I can't write a module for a HPET timer because of event interactions with my app.
Now I thought that I get less trouble if I can give up the execution directly to the scheduler and calculate the loop time of the scheduler and so the count of executions to give up for a delay.
Any hints or experiences are welcome.

The thread have to write one byte to the port 0x37A in most precise and short intervals as possible while the mouse button is pressed. If the mouse button is released the thread stops writing to the port and here it would be nice to have a system call to give up the execution, too.
With short sleeps (< 5000 usec) the QT mouse event brakes. So I think QT needs more compute time. Linux dosn't schedule at short sleep times.
 
Old 09-14-2009, 08:48 AM   #2
orgcandman
Member
 
Registered: May 2002
Location: new hampshire
Distribution: Fedora, RHEL
Posts: 600

Rep: Reputation: 110Reputation: 110
I usually have no problem yielding time by using an empty select and a timeout specified. I'm not sure about sleeps for sub 5ms, and certainly RT on an intel x86 board is probably not going to be very response (see the rt wiki for reasons why).

Also, I'm not sure why people keep using usleep(). It is obsoleted and scheduled for removal from libc implementations at their own leisure. From the man page:

Quote:
This function is obsolete. Use nanosleep(2) or setitimer(2) instead.
-Aaron
 
Old 09-14-2009, 11:48 AM   #3
bastl
Member
 
Registered: Sep 2003
Location: Germany/BW
Distribution: My own
Posts: 237

Original Poster
Rep: Reputation: 22
Quote:
Originally Posted by orgcandman View Post
Also, I'm not sure why people keep using usleep(). It is obsoleted and scheduled for removal from libc implementations at their own leisure. From the man page:
-Aaron
Yes, I first used nanosleep, but during all that trouble I tested all and at last usleep. It's just easier to use with one int value.
And I did now get, that it could also be a multicore bug in the scheduler with any short sleep, because on a monocore board it works fine, but very slow so not fast enough, not as fast as I need it.
Maybe I put those issues to the kernel mailing list and will have a look what they mean. It will be a very deep cut to the scheduler and modules. So that changes can be done for kernel 2.8.x or maybe kernel 3.x.x if Linus and the others think it will be a big advantage and if I want to wait so long.
 
Old 09-14-2009, 11:52 AM   #4
orgcandman
Member
 
Registered: May 2002
Location: new hampshire
Distribution: Fedora, RHEL
Posts: 600

Rep: Reputation: 110Reputation: 110
Ohh, actually technically sched_yield will invoke the scheduler without blocking.

I'm still not sure this will solve your problem.

Can you also point me to the bug id / discussion where you found this information on a multicore bug? I wouldn't post that you've found a bug with linux unless you're absolutely certain (otherwise your head will be chewed off).
 
  


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
scheduler invocation, process selected, process entry and exit linuxdoniv Programming 1 03-14-2008 08:37 AM
scheduler invocation, process selected, process entry and exit linuxdoniv Programming 1 03-14-2008 03:48 AM
scheduler -a process??? mojozoox Linux - General 1 08-25-2003 12:53 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:54 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