#include<stdlib.h>
#include<stdio.h>
#include<sys/resource.h>
#include<unistd.h>
int main()
{
int rc,nc;
int ch;
while(1)
{
system("ps axl");
printf("\nCurrent nice vale can be checked from above table");
printf("\nThe Current priority of the process %d is
%d",getpid(),getpriority(PRIO_PROCESS,0));
printf("\nEnter new nice value(between -20 to 20)");
scanf("%d",&nc);
rc=setpriority(PRIO_PROCESS,0,nc);
if(0!=rc)
{
perror("setpriority");
}
sleep(2);
printf("Modified nice value of the process%d
is:%d",getpid(),getpriority(PRIO_PROCESS,0));
printf("Do you want to continue(1 continue or 0 stop):");
scanf("%d",&ch);
if(ch==0)
exit(0);
}
return 0;
}
No comments:
Post a Comment