Group B - Assignment 4 Title: C++ Program To Assign Nice Values To Processes and Dynamically Monitor
Group B - Assignment 4 Title: C++ Program To Assign Nice Values To Processes and Dynamically Monitor
Title : C++ Program to assign nice values to processes and dynamically monitor
them.
Assignment B4
A.
Aim/Problem Statement
Write a C++ Program to assign nice values to processes and dynamically monitor them.
B.
Index Terms
nice, setpriority, process, getpriority
C.
Mathematical Model
Let St be the system and it consists of
St={{I},{o},{S},{F},{Fx}}
I: Set of Inputs
O: Set of outputs
S: Set of success outputs
F: Set of failure conditions
Fx: Set of processing functions
I={PId,NI}
W={PRIO_PROCESS,PRIO_PGRP,PRIO_USER}
F(g)= PRIORITY
=0
if g W
if s W or NI>19 or NI<-20
F(p) =PID
O= {PID, PRIORITY, PRIORITY+NI}
S= {PID, PRIORITY, PRIORITY+NI}
F={0,-1}
D.
State Diagram
E.
Theory
Process: A Process is an instance of running a program. Program in execution is called as
a process. UNIX is a timesharing system, which means that the processes take turns
running.
getpriority ( ) : It is included in sys/resource.h and sys/time.h. The getpriority() call is used to
see the priority of the processes.
renice command:
renice command is used to change the priority of a process that's already running. Nice
values ranges from -20 (high nice value) through 19 (the least nice value). The default
behavior is to increase the niceness by 10.
F.
Conclusion: Hence to assign and to monitor the nice value for a process is done
successfully.