Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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 04-24-2007, 03:12 AM   #1
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Rep: Reputation: 41
Question How to set priority of sched_param?

Hello everyone! I can't seem to set the realtime priority of a certain task using via the sched_param struct. I need to do it that way so that when my sched_param struct has a priority, I can now place it as argument in the sched_setscheduler() function. My assignment statement to increase the priority by 10 is:

struct sched_param param;
param.sched_priority = sched_get_priority_max(SCHED_FIFO) - 10;

but this has no effect, like when I try to print the priority using this:
static int prio;
prio = getpriority(PRIO_PROCESS, 2174);

The value of prio is 0. 2174 is the pid of the process. Is there other way to initialize the value of sched_param?


Last edited by archieval; 04-24-2007 at 03:32 AM.
Old 04-24-2007, 03:36 AM   #2
LQ Newbie
Registered: May 2006
Posts: 7

Rep: Reputation: 0
man setpriority
Old 04-24-2007, 05:13 AM   #3
Registered: Apr 2007
Location: Philippines
Distribution: Kubuntu, Ubuntu, CentOS
Posts: 289

Original Poster
Rep: Reputation: 41
I need to place the value in the sched_setscheduler(), which needs an argument sched_param. So I need to know how to set sched_param.


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
process priority,nice -- small question regarding high/low priority values beeblequix Linux - Newbie 1 10-11-2006 10:22 AM
Allow User to Set Priority 321 Linux - General 4 07-24-2006 01:16 AM
How to set IRQ 4(Serial Modem) as top priority in Linux? Balarabay1 Programming 0 05-03-2006 08:45 AM
priority alaios Linux - General 3 10-12-2004 06:55 AM
how do i set processor priority? Chooco Linux - General 2 06-11-2002 10:46 PM > Forums > Non-*NIX Forums > Programming

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