28.11.2014 Views

System call - Processi, thread

System call - Processi, thread

System call - Processi, thread

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

kill: esempio:<br />

#include <br />

#include <br />

int cont=0;<br />

void handler(int signo)<br />

{ printf ("Proc. %d: ricevuti n. %d segnali %d\n",<br />

getpid(),cont++, signo);<br />

}<br />

main ()<br />

{int pid;<br />

pid = fork();<br />

if (pid == 0) /* figlio */<br />

{ signal(SIGUSR1, handler);<br />

for (;;);<br />

}<br />

else /* padre */<br />

for(;;) kill(pid, SIGUSR1);<br />

}<br />

M-fosset - Sistemi Operativi 2004-2005

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!