Differences

This shows you the differences between two versions of the page.

Link to this comparison view

saisp:labs:07:contents:03 [2014/04/13 21:57]
alexandru.carp [02. Spatiul de procese]
saisp:labs:07:contents:03 [2014/04/14 11:42] (current)
alexandru.carp
Line 1: Line 1:
-==== 02. Spatiul de procese ====+==== 03[10p] Spatiul de procese ====
  
 Folositi comanda ''​lxc-info''​ pentru a afla PID-ul containerului ''​ct1''​. Acest PID este al procesului ''​init''​ corespunzator containerului. Restul proceselor din container vor fi copii ai acestui proces ''​init''​. Folositi comanda ''​lxc-info''​ pentru a afla PID-ul containerului ''​ct1''​. Acest PID este al procesului ''​init''​ corespunzator containerului. Restul proceselor din container vor fi copii ai acestui proces ''​init''​.
Line 35: Line 35:
 </​code>​ </​code>​
  
 +Observati ca procesul ''​init''​ corespunzator containerului este copil al procesului ''​lxc-start''​.
 +
 +Putem afisa ierarhia de procese pentru un container si folosind comanda ''​lxc-ps'':​
 +<code bash>
 +root@saisp-vm-1:​~#​ lxc-ps -n ct1 --forest
 +CONTAINER ​  PID TTY          TIME CMD
 +ct1        8269 ?        00:​00:​00 ​ \_ init
 +ct1        8478 ?        00:​00:​00 ​     \_ sshd
 +ct1        8508 pts/5    00:​00:​00 ​     \_ getty
 +ct1        8509 pts/1    00:​00:​00 ​     \_ login
 +ct1        8751 pts/1    00:​00:​00 ​     |   \_ bash
 +ct1        8510 pts/2    00:​00:​00 ​     \_ getty
 +ct1        8511 pts/3    00:​00:​00 ​     \_ getty
 +ct1        8512 pts/4    00:​00:​00 ​     \_ getty
 +</​code>​
 +
 +Apoi, conectati-va la consola containerului si afisati procesele din **interiorul** acestuia:
 +<code bash>
 +root@ct1:~# ps -ef     
 +UID        PID  PPID  C STIME TTY          TIME CMD
 +root         ​1 ​    ​0 ​ 0 18:34 ?        00:00:00 init [3]  ​
 +root       ​182 ​    ​1 ​ 0 18:34 ?        00:00:00 /​usr/​sbin/​sshd
 +root       ​212 ​    ​1 ​ 0 18:34 console ​ 00:00:00 /sbin/getty 38400 console
 +root       ​213 ​    ​1 ​ 0 18:34 tty1     ​00:​00:​00 /bin/login --     
 +root       ​214 ​    ​1 ​ 0 18:34 tty2     ​00:​00:​00 /sbin/getty 38400 tty2 linux
 +root       ​215 ​    ​1 ​ 0 18:34 tty3     ​00:​00:​00 /sbin/getty 38400 tty3 linux
 +root       ​216 ​    ​1 ​ 0 18:34 tty4     ​00:​00:​00 /sbin/getty 38400 tty4 linux
 +root       ​217 ​  ​213 ​ 0 18:53 tty1     ​00:​00:​00 -bash
 +root       ​228 ​  ​217 ​ 0 19:00 tty1     ​00:​00:​00 ps -ef
 +</​code>​
 +
 +Observati ca desi apar aceleasi procese, valorile PID-urilor difera in interiorul containerului si in exteriorul acestuia. Practic, se produce o translatie la nivelul spatiului de procese.
saisp/labs/07/contents/03.1397415456.txt.gz ยท Last modified: 2014/04/13 21:57 by alexandru.carp
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0