LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 07-20-2004, 08:53 PM   #1
sptchamp
LQ Newbie
 
Registered: Jul 2004
Posts: 9

Rep: Reputation: 0
Question Changing Process Priority in Linux w/ System Call


I'm trying to get the Linux scheduler to change the priority of a process for a certain number of timeslices by adding a system call to sched.c. I want to then later be able to pass a process pid parameter to that sys call in another *.c and change its priority for a certain # of timeslices. So given a struct task_struct with my process in it, can anyone show me any concrete example code on how I can actually change the priority of that process and only for a certain # of timeslices? I've looked on the 'net and can only find abstract ideas and procedures but nothing to aid me in actual coding.
 
Old 07-21-2004, 05:23 AM   #2
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
In what way is it different from calling nice(2) or setpriority(2) for a certain amount of time?
 
Old 07-21-2004, 09:58 AM   #3
jim mcnamara
Member
 
Registered: May 2002
Posts: 964

Rep: Reputation: 36
Hko is saying there are two system calls nice() and setpriority()

I have no idea how to figure out the size of quanta (time slices) or how many have elapsed for a process without getting into the kernel.

Plus, if you want to use nice to make priority lower, you have to run privileged.

Unless you are in a realtime system, you are better off letting the scheduler figure it out for you. If you do something dumb in code and have the priority set, you can make the system unusable.
 
  


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 write a system call to display the process information? balasquare@yahoo.com Programming 3 09-30-2005 01:05 AM
When does process swap happen in a system call? oldfogie Programming 3 05-03-2005 07:35 PM
Changing the fork system call seshuch Programming 0 10-02-2004 05:18 AM
is there a system call to send process to run in the background? feetyouwell Programming 4 10-01-2004 04:58 AM
Changing priority of Dual Boot System LinuxVirgIan Linux - Newbie 5 07-02-2004 05:45 PM

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

All times are GMT -5. The time now is 01:59 PM.

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