Proses PDF (en)
Transcript of Proses PDF (en)
-
8/9/2019 Proses PDF (en)
1/15
Process Management
Processor, memory and kernel informations
Monitoring process
Killing process
Foreground and background process
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
2/15
Processor informations
Checking our processor clock:$ cat /proc/cpuinfoprocessor : 0vendor_id : GenuineIntel
cpu family : 15model : 2model name : Intel(R) Pentium(R) 4 CPU 1.80GHz...
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
3/15
Memory informations
Displaying our memory informations:
$ cat /proc/meminfoMemTotal: 483100 kBMemFree: 25352 kB
...More detailed informations:
$ free -mtotal used free shared buffers cached
Mem: 471 445 26 0 3 119
-/+ buffers/cache: 322 149
Swap: 996 230 765
GUI based informations:
$ gnome-system-monitor Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
4/15
Kernel and hardware info
Check our kernel:$ uname -aLinux linuxmint 2.6.24-16-generic ...
$ dmesg | grep Linux[ 0.000000] Linux version 2.6.24-16-generic ...
Displaying hardware informations:
$ dmesg | less
Displaying PCI hardware info (vga, sound card, etc):
$ lspci
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
5/15
Monitoring process
Displaying active processes:$ psPID TTY TIME CMD9861 pts/0 00:00:00 bash
10157 pts/0 00:00:00 ps
PID: Process identity
TTY: Terminal where the process is running
TIME: Time needed by CPU to complete the process
CMD: The command which is executed
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
6/15
Monitoring process
Displaying all active processes:$ ps aPID TTY STAT TIME COMMAND4471 tty3 Ss+ 0:00 /sbin/getty 38400 tty3
4473 tty6 Ss+ 0:00 /sbin/getty 38400 tty68408 tty1 Ss+ 0:00 /sbin/getty 38400 tty19861 pts/0 Ss 0:00 bash10158 pts/0 R+ 0:00 ps a
STAT is the status of the process, which are: Uninterruptible
sleep, Running, Interruptible sleep, Stopped, session leader,
foreground, etc. Further info see chapter PROCESS STATE
CODES in ps manual.
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
7/15
Monitoring process
Displaying all active processes from all user:$ ps auUSER PID %CPU %MEM VSZ RSS TTY STAT START ...root 4471 0.0 0.0 716 424 tty3 Ss+ 08:14
root 4473 0.0 0.0 716 424 tty6 Ss+ 08:14root 8408 0.0 0.0 716 424 tty1 Ss+ 08:14joni 9861 0.0 0.0 716 424 pts/0 Ss 11:07joni 10158 0.0 0.0 716 424 pts/0 R+ 11:07
USER : user name who run the process
%CPU/MEM: percentage CPU/MEM used by process
VSZ : virtual memory size of the process in KB
RSS : resident set size, RAM used in KB
START : the time process start Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
8/15
Monitoring process
Displaying allactive processes from all user including non-tty:$ ps auxUSER PID %CPU %MEM VSZ RSS TTY STAT START ...root 4471 0.0 0.0 716 424 tty3 Ss+ 08:14
root 4473 0.0 0.0 716 424 tty6 Ss+ 08:14root 8408 0.0 0.0 716 424 tty1 Ss+ 08:14root 8438 0.0 0.0 716 424 ? Ss 08:14root 8439 0.0 0.0 716 424 ? Ss 08:14root 8440 0.0 0.0 716 424 ? Ss 08:14
joni 9861 0.0 0.0 716 424 pts/0 Ss 11:07joni 10158 0.0 0.0 716 424 pts/0 R+ 11:07
Displaying process which is not associated or executed from a
terminal, such as init process, daemon, etc. Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
9/15
Display a tree of processes
$ pstree -p | lessinit(1)NetworkManager(4864){NetworkManager}(5045)
NetworkManagerD(4878)acpid(4646)
apache2(8271)apache2(8321) apache2(8323) apache2(8324)
Process tree often needed when we have to terminate a parent
process, because the child process is unable to kill.
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
10/15
Monitoring process real time
$ top
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
11/15
Terminating (kill) process
Use the PID to kill a process:
$ kill $ kill 8710
If command above failed, use option -9:
$ kill -9 8710
LAB:
Open new terminal in Desktop and type gedit command. Try to findthe terminal's PID (not gedit PID) and kill. Make sure the terminal
and gedit terminated properly.
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
12/15
Foreground process
Process 1 Process 2 Process 3
Background process
Process 1
Process 2
Process 3
Foreground process run
sequentially, whenbackground process runsimultaneously.
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
13/15
Foreground and background
Sample of foreground process:
$ find / -name xyz > result.txt 2>&1
We have to wait until process above finished, then we can run
another process:
$ ls -l
Sample of background process:
$ find / -name xyz > result.txt 2>&1 &
At the same time, we can run another process directly:
$ ls -l
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
14/15
Change foreground to background
Changing foreground process to background:$ find / -name xyz > result.txt 2>&1Ctrl+Z[1]+ Stopped find / -name xyz > result.txt 2>&1
To see pending/paused process:
$ jobs[1]+ Stopped find / -name xyz > result.txt 2>&1
Change process number 1 to background:
$ bg 1Check again with jobs:
$ jobs
Version 1.0 linuxslides.blogspot.com
-
8/9/2019 Proses PDF (en)
15/15
Change background to foreground
Changing background process to foreground:$ find / -name xyz > result.txt 2>&1 &
To see background process:
$ jobs[1]+ Running find / -name xyz > result.txt 2>&1 &
Change process number 1 to foreground:
$ fg 1Or if it the only one:
$ fg
Version 1.0 linuxslides.blogspot.com