Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi N - Z > Sistemi operativi I > Esame di laboratorio (Giugno 2007) - Domande Thread Rating: 3 votes, 5.00 average.
Pages (571): « 1 [2] 3 4 5 6 » ... Last »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
n3o
tanto c'è SPASS...

User info:
Registered: Oct 2005
Posts: 134 (0.02 al dì)
Location: Brescia
Corso: Informatica Magistrale
Anno:
Time Online: 1 Day, 19:26:05: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

1) Specificare l'occupazione totale di un utente in un sistema (somma delle dimensioni dei suoi file...)

code:
#!/bin/sh if [ $# -ne 1 ]; then echo "syntax: user_size <user_name>" exit 1 fi ID="$(grep "^$1" /etc/passwd | cut -f 3 -d :)" if [ "$ID" = "" ]; then echo "User "${1}" not found" exit 1 fi echo "calculating..." SUM=0 for ITEM in $(find / -user "$ID" -type f | xargs du | cut -f 1); do SUM=$(expr ${SUM} + ${ITEM}) done echo "User "${1}" takes ${SUM} KB into the system" exit 0

Molte righe di codice sono controlli che potete saltare all'esame...

2) Per ogni utente del sistema specificare qual è il suo file di dimensioni maggiori
code:
#!/bin/sh # Per ogni utente trovare il suo file di dimensione maggiore for UID in $(cut /etc/passwd -d : -f 3 | sort -n | uniq); do FILE=$(find / -type f -user $UID | xargs du | sort -nr | head -1) if [ "$FILE" != "" ]; then DIM=$(echo "$FILE" | cut -f 1) NOME=$(echo "$FILE" | cut -f 2) echo "UID: $UID => File: $NOME ($DIM KB)" else echo "UID: $UID => Nessun file trovato" fi done

Anche qui i controlli e le chicche per stampare meglio l'output sono opzionali

3) Stampare "MUOIO!" ogni volta che un processo termina
Personalmente ho solo aggiunto questa riga:

kprintf ("MUOIO!\n");

Nei file:

/usr/src/kernel/system/do_exit.c
/usr/src/kernel/system/do_kill.c

nelle funzioni con il rispettivo nome [do_exit() e do_kill()]

C'era una postilla ovvero di far stampare ance il PID del processo.
Era un problema perchè all'interno del kernel il proc_nr non è il PID della tabella dei processi di PM ma il numero del processo della tabella del Kernel che non sono lo stesso numero quindi pescare quello giusto era comlicato e l'ora si faceva tarda...
quindi il prof mi ha detto che se non lo facevo non era importante e non mi ha penalizzato. (ma questo rimanga tra me e voi...)

__________________
The answer is blowing in the wind...

19-06-2007 19:55
Click Here to See the Profile for n3o Click here to Send n3o a Private Message Find more posts by n3o Add n3o to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 14:36.    Post New Thread    Post A Reply
Pages (571): « 1 [2] 3 4 5 6 » ... Last »   Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.108 seconds (31.28% PHP - 68.72% MySQL) con 24 query.