11-12-2006
nice command and nice() system call
Hi I want to implement the nice command in the shell that I am building. I came to know that there is a corresponding nice() system call for the same. But since I will be forking different processes to run different commands typed on the command prompt, is there any way I can make a command execution call nice() first to adjust its priority?
eg nice 5 cp x y
makes cp increment its priority by 5
how can I make the execution of cp call nice() ?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Can someone tell me .. how to find a user & process who has executed nice (scheduled priority) to one of his process. .Tks.. (5 Replies)
Discussion started by: sivan
5 Replies
2. UNIX for Advanced & Expert Users
Under, Solaris 10 I have the following problem:
A script executed at command line runs with nice level 0, as expected.
Same script started under (user) crontab runs with nice level 2.
I would prefer it run at 0. Is this possible? If so, how?
Thanks. (0 Replies)
Discussion started by: henrydark
0 Replies
3. UNIX for Dummies Questions & Answers
Can someone tell me this. thanks (1 Reply)
Discussion started by: xoxouu
1 Replies
4. UNIX for Dummies Questions & Answers
hello everybody:
I have some job running on tru64 system and Im the root, due to limited resources I end up with my job ( vdump) for example taking the lowest share, I researched the nice command on the net, but couldnt get enough info, can I use it to already running process or I only use it... (1 Reply)
Discussion started by: aladdin
1 Replies
5. UNIX for Dummies Questions & Answers
Hi there, i'm trying to find the implementation code for the system call nice().
Since it's a system call i'm having problems finding where it would be? is it in the linux kernel directory somewhere?
I would assume it would be a file called nice.c or something like this.
Thanks in advance! (2 Replies)
Discussion started by: sport23
2 Replies
6. UNIX for Advanced & Expert Users
Hello,
Some guy said to me that using the nice command to decrease the priority of a process is a myth, that the operating system corrects the priorities as the processes need cpu. Is this true? (4 Replies)
Discussion started by: psimoes79
4 Replies
7. Shell Programming and Scripting
Hello,
I am just starting with shell scripting, as everyone will soon see from my question. What I'm trying to do is call the Nice command to set the script process priority from /bin/ksh. The difference is I'm running it not directly through the shell, but through Bigfix (very similar to... (3 Replies)
Discussion started by: solly119
3 Replies
8. Shell Programming and Scripting
Dear Friends,
I have a directory when i take du of that directory it takes alot of memory and cpu and I/O, i want to use nice to run my script that have du command slowly so it won't take I/O and cpu, please suggest. (6 Replies)
Discussion started by: learnbash
6 Replies
9. BSD
Hello Folks,
Recently our FreeBSD 7.1 i386 system became very sluggish.
Nothing much is happening over there & whatever is running takes eternity to complete.
All the troubleshooting hinted towards a very high nice percentage.
Can that be the culprit?
Pasting snippets of top command,... (7 Replies)
Discussion started by: vibhor_agarwali
7 Replies
10. Shell Programming and Scripting
with using wall command, how can i have a carriage return in my broadcast message. i try to broadcast from a file, i were to use "cat myfile | wall" for broadcasting. but when the message broadcast somehow the format run away.
this the text in my file:
line 1
line 2
line 3
when broadcast
... (3 Replies)
Discussion started by: lsy
3 Replies
LEARN ABOUT DEBIAN
explain_nice_or_die
explain_nice_or_die(3) Library Functions Manual explain_nice_or_die(3)
NAME
explain_nice_or_die - change process priority and report errors
SYNOPSIS
#include <libexplain/nice.h>
int explain_nice_or_die(int inc);
int explain_nice_on_error(int inc);
DESCRIPTION
The explain_nice_or_die function is used to call the nice(2) system call. On failure an explanation will be printed to stderr, obtained
from the explain_nice(3) function, and then the process terminates by calling exit(EXIT_FAILURE).
The explain_nice_on_error function is used to call the nice(2) system call. On failure an explanation will be printed to stderr, obtained
from the explain_nice(3) function, but still returns to the caller.
inc The inc, exactly as to be passed to the nice(2) system call.
RETURN VALUE
The explain_nice_or_die function only returns on success, see nice(2) for more information. On failure, prints an explanation and exits, it
does not return.
The explain_nice_on_error function always returns the value return by the wrapped nice(2) system call.
EXAMPLE
The explain_nice_or_die function is intended to be used in a fashion similar to the following example:
int result = explain_nice_or_die(inc);
SEE ALSO
nice(2) change process priority
explain_nice(3)
explain nice(2) errors
exit(2) terminate the calling process
COPYRIGHT
libexplain version 0.52
Copyright (C) 2009 Peter Miller
explain_nice_or_die(3)