Tuesday, August 20, 2013

Resource utilization in Unix like operating system

The uptime shell command is used to get the system overall performence. It will display report in one line that how long system has been started, how many users are currently logged in and system load avarage during last 1, 5, 15 minutes.

Figure 1.Output of uptime

SAR(System Activity Report):
The sar command displays more information of CPU utilization. It displays CPU utilization for specified time. In Ubuntu sar package is not installed. We can install it by using: “root:\sudo apt-get install sar”. The sar command basically looks like “root:\sar seconds time”. Here seconds is used to display CPU utilization in specified time and time is for display report specified number of time. There are some other options available to display other system statistics, are as A, B, b, C, d, e, f, H, h, I, i, m, n, o, P, p, q, r, R, S, s, t, u, V, v, w, y.
Figure 2 Output of sar

ps command is used to examine the the running the processes. The most useful options is ps -el. Here e specifies every running processes and l options is for generating long list. The output of ps -el looks like as:

meaning of fields in output of ps -el given bellow:
  • S: Shows the process’s current state (running, sleeping, and so forth) . S field takes one of the following values:

1. O— The process is currently executing on a CPU.
2.   S — The process is sleeping, waiting for another event to complete.
3. R — The process is in the run queue (runnable) and is waiting to run.
4. Z — The process is a zombie (it terminated, but its parent has not reaped its exit status).
5.  T — The process is stopped.

  • UID: Lists the numeric user ID (UID) of the user who owns the process
  • PID:  Lists the process’s process ID (PID) .
  • PPID:Lists the PID of the parent process.       
  • C: Shows the CPU utilization of the process.
  • PRI:States the process’s priority (higher numbers mean higher priority) .
  • NI:Shows the process’s nice value (higher numbers mean lower priority) .
  • SZ:Lists how much swap space (virtual memory) the process requires .
  • TTY:Names the terminal on which the process started (also known as the controlling terminal).
  • TIME:Summarizes the total CPU time (in hours and minutes) that the
  • process has consumed .
  • CMD:Displays the command that initiated the process .
 There are some other commands available to check resource utilization.

Figure 3. Output of ps -el