Differences

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

Link to this comparison view

uso:laboratoare:new:02-process:need-to-know [2019/10/05 20:40]
cristiana.stan [Foreground & Background (&, fg, bg, jobs)]
uso:laboratoare:new:02-process:need-to-know [2019/10/07 11:10] (current)
liza_elena.babu [Comunicare interprocese, folosind |]
Line 1: Line 1:
 ===== Need to Know ===== ===== Need to Know =====
 +
 +Pentru această secțiune trebuie să vă asigurați că sunteți în directorul potrivit. Rulați comanda
 +<​code>​
 +cd ~/​uso-lab/​02-process/​support/​
 +</​code>​
  
 ==== Foreground & Background (&, fg, bg, jobs) ==== ==== Foreground & Background (&, fg, bg, jobs) ====
Line 18: Line 23:
  
 <code bash> <code bash>
-student@uso:​~/​uso/lab04$ ./​bg-proc.sh ​+student@uso:​~/​.../02-process/​support$ ./​bg-proc.sh ​
 Tick! Tick!
 Tock! Tock!
Line 29: Line 34:
  
 <code bash> <code bash>
-student@uso:~/uso/lab04$ ps aux+student@uso~/​.../02-process/​support$ ps aux
 USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
 root         ​1 ​ 0.0  0.3 160140 ​ 7152 ?        Ss   ​oct08 ​  0:03 /sbin/init splash root         ​1 ​ 0.0  0.3 160140 ​ 7152 ?        Ss   ​oct08 ​  0:03 /sbin/init splash
Line 44: Line 49:
  
 <code bash> <code bash>
-student@uso:​~/​uso/lab04$ ./​bg-proc.sh+student@uso:​~/​.../02-process/​support$ ./​bg-proc.sh
 Tick! Tick!
 Tock! Tock!
  
 [1]+  Stopped ​                ​./​bg-proc.sh [1]+  Stopped ​                ​./​bg-proc.sh
-student@uso:​~/​uso/lab04$ bg+student@uso:​~/​.../02-process/​support$ bg
 [1]+ ./​bg-proc.sh & [1]+ ./​bg-proc.sh &
-student@uso:​~/​uso/lab04$ Tick!+student@uso:​~/​.../02-process/​support$ Tick!
 Tock! Tock!
 lsTick! lsTick!
  
 batman.sh ​ bg-proc.sh ​ it-s-a-trap.sh batman.sh ​ bg-proc.sh ​ it-s-a-trap.sh
-student@uso:​~/​uso/lab04$ Tock!+student@uso:​~/​.../02-process/​support$ Tock!
 Tick! Tick!
 Tock! Tock!
 ^C ^C
-student@uso:​~/​uso/lab04$ Tick!+student@uso:​~/​.../02-process/​support$ Tick!
 Tock! Tock!
 </​code>​ </​code>​
Line 83: Line 88:
  
 <code bash> <code bash>
-student@uso:​~/​uso/lab04$ echo "prima linie din fisier"​ > fis.txt +student@uso:​~/​.../​02-process/support$ echo "prima linie din fisier"​ > fis.txt 
-student@uso:​~/​uso/lab04$ cat fis.txt ​+student@uso:​~/​.../​02-process/support$ cat fis.txt ​
 prima linie din fisier prima linie din fisier
-student@uso:​~/​uso/lab04$ echo "a2a linie din fisier"​ >> fis.txt  +student@uso:​~/​.../​02-process/support$ echo "a2a linie din fisier"​ >> fis.txt  
-student@uso:​~/​uso/lab04$ cat fis.txt ​+student@uso:​~/​.../​02-process/support$ cat fis.txt ​
 prima linie din fisier prima linie din fisier
 a2a linie din fisier a2a linie din fisier
-student@uso:​~/​uso/lab04$ echo "a3a linie din fisier"​ > fis.txt  +student@uso:​~/​.../​02-process/support$ echo "a3a linie din fisier"​ > fis.txt  
-student@uso:​~/​uso/lab04$ cat fis.txt ​+student@uso:​~/​.../​02-process/support$ cat fis.txt ​
 a3a linie din fisier a3a linie din fisier
 </​code>​ </​code>​
Line 109: Line 114:
 Care este logica din spatele comenzii? În loc să ne afișeze nouă pe ecran rezultatul comenzii **ps aux**, acesta a fost transmis către următoarea comandă **grep**. Comanda din urmă a căutat cuvântul ''​sleep''​ în rezultatul comenzi ''​ps aux''​. Care este logica din spatele comenzii? În loc să ne afișeze nouă pe ecran rezultatul comenzii **ps aux**, acesta a fost transmis către următoarea comandă **grep**. Comanda din urmă a căutat cuvântul ''​sleep''​ în rezultatul comenzi ''​ps aux''​.
  
-Un alt exemplu: 
- 
-<code bash> 
-student@uso:​~/​uso$ ls -lR | grep "​hello"​ 
--rw-r--r-- 1 student student ​  72 sep 10 12:25 hello.c 
--rw-r--r-- 1 student student ​ 72 sep 10 12:25 hello.c 
--rw-r--r-- 1 student student 154 sep 10 12:25 hello.c 
--rw-r--r-- 1 student student ​ 95 sep 10 12:25 simple_hello.c 
--rw-r--r-- 1 student student 580 sep 10 12:25 hello.s 
--rw-r--r-- 1 student student 1192 sep 10 12:25 hello.o 
--rw-r--r-- 1 student student ​  15 sep 10 12:25 hello.h 
--rw-r--r-- 1 student student ​  64 sep 10 12:25 hello_0.c 
--rw-r--r-- 1 student student ​  82 sep 10 12:25 hello_1.c 
--rw-r--r-- 1 student student ​ 111 sep 10 12:25 hello_2.c 
--rw-r--r-- 1 student student ​  83 sep 10 12:25 hello_3.c 
--rw-r--r-- 1 student student ​ 142 sep 10 12:25 hello_4.c 
--rw-r--r-- 1 student student ​ 145 sep 10 12:25 hello_5.c 
--rw-r--r-- 1 student student ​ 150 sep 10 12:25 hello_6.c 
--rw-r--r-- 1 student student ​ 162 sep 10 12:25 hello_7.c 
--rw-r--r-- 1 student student 16 sep 10 12:25 hello.h 
-lrwxrwxrwx 1 student student ​ 7 sep 10 12:25 hello_from_the_other_side.h -> hello.h 
-</​code>​ 
- 
-Am afișat recursiv (-R) directorul **uso** și am transmis rezultatul către utilitarul **grep** pentru a căuta fișierele ce conțin cuvântul ''​hello''​. 
  
 **Exerciții** **Exerciții**
uso/laboratoare/new/02-process/need-to-know.1570297209.txt.gz · Last modified: 2019/10/05 20:40 by cristiana.stan
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