change prority of pid to change its state

How can I change priority of a pid so it does not sleep.

Thanks
z670193Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
you can run renice(1) to change its prority, but it can still sleep(3)
You can might it a signal(3) to wake it up
0
Brian UtterbackPrinciple Software EngineerCommented:
There is no way to guarantee that a process never sleeps because sometimes it will need resources that
are not immediately available. If it did not sleep ever, then the whole system would essentially lock up.
Having said that, you can make it so a process never gives up the CPU involuntarily. You can place a process
in the real time scheduling class. In that class, it will not be preempted, but if it never gives up the cpu then
the computer is hung.

To place a process in the real time class, use the priocntl command. For the exact syntax, see the priocntl man
page. Of course, you have to be root to do it, or have sufficient privs.
0
omarfaridCommented:
I agree with blu that hardly you will find a process that does not sleep unless it is just looping and does not need any resource like disk IO, etc.

If you have multiple processors on your system, then you may let this process run on a particular CPU.

0
z670193Author Commented:
What is the difference between renice and priocntl?

Which one of them would be a better option?

0
Brian UtterbackPrinciple Software EngineerCommented:
Solaris supports multiple scheduling classes, each with its own characteristics. How each one of those classes
decides which processes to schedule is determined by the class, using some class parameters and characteristics of the processes. One way a class can prioritize the processes is via the "nice" value. A smaller nice number, the
higher priority. So, the renice command will allow you to change the relative priority of a process within a scheduling
class. The priocntl command will allow you to change a process to a whole new scheduling class. This include the
RT, or real time class.  The RT class is the only class that does not preemptively interrupt a process and pull it off the CPU. The process must give up the CPU itself before any other process can run.

Needless to say, any process in the RT class needs to be aware that it owns the machine and nothing else
can get done while it is on the CPU.

Perhaps this isn't really what you want. However, I suggest you read the priocntl man page to get some insight
how to get what you really want.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Unix OS

From novice to tech pro — start learning today.