Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
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.


  Search this Thread
Old 10-27-2008, 03:13 PM   #1
Registered: Sep 2003
Location: Waltham MA
Distribution: Mandriva 2007 w/ KDE
Posts: 87

Rep: Reputation: 15
Driver IO Busywait Kernel Driver Question

I have a driver that does the following:

// Kind of like a serial driver with no interrupt

for (c in buff){
while(statusreg & BUSY_MASK); // busy wait for operation to complete

Naturally, this causes a lot of busy waiting, and the CPU usage goes up. Is there a good way to reduce the CPU usage in this circumstance?

Old 10-27-2008, 03:19 PM   #2
Registered: Aug 2008
Distribution: opensuse, RHEL
Posts: 374
Blog Entries: 1

Rep: Reputation: 32
This is just off the top of my head but I think you could put a 'sleep' call inside your loop and the process would go to sleep for a bit before it tried the while statement again. Granted the smallest sleep increment is a second I think so that is quite long in computer terms, but it may solve your problem
Old 10-27-2008, 07:19 PM   #3
Registered: Sep 2003
Location: Waltham MA
Distribution: Mandriva 2007 w/ KDE
Posts: 87

Original Poster
Rep: Reputation: 15
This is all being done in an ioctl call. Anyone else have any ideas?


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
kernel driver question 2.6.12 marcm Programming 1 10-10-2008 05:24 AM
Linux kernel driver question niteshg Programming 11 08-06-2008 12:21 AM
Wireless driver/kernel question Scrapnon Linux - Hardware 1 08-20-2007 10:55 PM
Merging driver w/ kernel question Palamides Slackware 4 05-20-2005 03:02 AM
kernel question - IDE-chipset driver bailmann Debian 1 01-14-2005 08:22 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:28 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration