LinuxQuestions.org
Review your favorite Linux distribution.
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 03-20-2006, 03:41 PM   #1
prcarp
LQ Newbie
 
Registered: Feb 2004
Location: Lynchburg, VA
Distribution: Slackware 9.1/Fedora Core 2
Posts: 17

Rep: Reputation: 0
How do I change scheduling priorities? (2.6 kernel)


I am using FreeBSD on an ARM/XScale processor using 2.6 of the Linux kernel.

I have a C program that has a main thread and a callback function that is driven from a timer interupt. I looked into pthread_mutex but I don't like it for 2 reasons: it does not support recursion (not in Linux), but more importantly, will wait for the mutex to become available (not good in my case).

What I would like to do is up the priority of a small section of code to the highest level (time critical?) and return to the normal state shortly thereafter. Really what I want to implement is a critical section where no other processes or tasks can run. Does anyone know what calls I need to make? I can handle the recursion with some code once I get a handle on the task scheduling. Any code snips would be great.

Thanks!

Last edited by prcarp; 03-21-2006 at 04:32 AM.
 
Old 03-22-2006, 01:16 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
FreeBSD with a Linux kernel ??

I think you can do the scheduling trick with Solaris, an O/S that supports the RT (real-time) scheduling class.
 
Old 03-22-2006, 05:04 AM   #3
prcarp
LQ Newbie
 
Registered: Feb 2004
Location: Lynchburg, VA
Distribution: Slackware 9.1/Fedora Core 2
Posts: 17

Original Poster
Rep: Reputation: 0
not FreeBSD - BusyBox. My bad. Too many hours....

Actually, I am looking at the sched_ functions now which seems to be a step in that direction. I haven't figured out what the performance hit to switch back-and-forth would be.

I am also reading up on the real-time Linux flavors....
 
Old 04-19-2006, 03:24 AM   #4
Softwaremafia
LQ Newbie
 
Registered: Jun 2005
Posts: 1

Rep: Reputation: 0
HI

wel their are different scheduling policies in linux e.g
NORMAL
FIFO
..
which have different priorities
and you can switch between these policies useing system call
sched_setscheduler(..)
refer to man pages for more help on this system call
 
  


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
Kernel Bug: Scheduling while atomic: IRQ 21/245 blindspy Linux - Software 1 02-23-2006 03:23 AM
cron scheduling and time change dsschanze Linux - General 3 11-13-2005 04:22 PM
switching Linux kernel I/O scheduling algorithms irfanhab Slackware 1 03-17-2005 11:53 AM
Can you change thread priorities in Linux? jmyrtle Linux - General 2 03-23-2004 05:57 AM
Kernel Scheduling netkern Linux - General 1 04-14-2001 04:18 PM

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

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