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 (39): [1] 2 3 4 5 » ... Last »   Last Thread   Next Thread
Author
Thread    Post New Thread    Post A Reply
Bennyk
.amico.

User info:
Registered: Oct 2003
Posts: 38 (0.01 al dì)
Location: Milano
Corso: Informatica
Anno: ...
Time Online: 1 Day, 1:36:08: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Esame di laboratorio (Giugno 2007) - Domande

Ciao a tutti,
elenco alcune domande raccolte oggi durante la prova.

Shell:

- trovare il file più "grosso" sul sistema
- archiviare i files più grandi di 5k e più piccoli di 100k
- copiare files da una cartella all'altra mantenendo inalterati permessi
- trovare tutti i files eseguibili > 5k e evidenziando i 5 più grandi
- archiviare i files modificati nell'ultima settimana
- spostare tutti i files che iniziano per m da una directory (e sottodirectory) ad un'altra
- trovare i tre files più grossi per ogni utente
- trovare il processo che occcupa più memoria ram
- archiviare tutti i files che contengono la parola "login"
- calcolare lo spazio occupato da un utente (dai suoi files)
- trovare il file più "grosso" per ogni utente


Kernel:

- modificare il kernel in modo che alla pressione di F8 appaia una scritta sulla shell
- stampare un messaggio ogni volta che si esce da un processo, in qualsiasi modo (eg: kill, term, ...)


Sul kernel sono un pò pochine perchè pochi ci sono arrivati, chiunque abbia altre informazioni o dritte aggiunga...

Non sarebbe male anche avere qualche soluzione fatta con MINIX 3.

19-06-2007 16:05
Click Here to See the Profile for Bennyk Click here to Send Bennyk a Private Message Find more posts by Bennyk Add Bennyk to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
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
darkman13
.arcimaestro.

User info:
Registered: Feb 2004
Posts: 272 (0.04 al dì)
Location:
Corso:
Anno:
Time Online: 3 Days, 14:00:17 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Grandi ragazzi, grazie 10000000000 ;-)

19-06-2007 20:16
Click Here to See the Profile for darkman13 Click here to Send darkman13 a Private Message Find more posts by darkman13 Add darkman13 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
maxj8
.primate.

User info:
Registered: Aug 2004
Posts: 76 (0.01 al dì)
Location: Pavia
Corso: Informatica
Anno: ehm...
Time Online: 13:34:36 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

La domanda di Shell di copiare tutti i file da una cartella ad una nuova mantenendo inalterati gli attributi prevede anche di prendere file che iniziano per una lettera specifica (banale) e di copiare anche tutto il path dei file nella nuova cartella (meno banale).

Per il Kernel io avevo da far comparire 'chiuso' ogni volta che un file viene chiuso. Ho preso da stdio il riferimento alla funzione fclose.c e l'ho modificata.
A dire la verità non ha funzionato alla fine ma perchè la macchina anche dopo la ricompilazione continuava a partire col vecchio kernel. Cmq alla fine al docente andava bene lo stesso perchè la cosa importante è far vedere di sapere dove mettere mano e ragionarci sopra, anche se poi il risultato non è esatto non fa nulla.

E ora...speriamo che all'orale non succedano follie...

20-06-2007 14:13
Click Here to See the Profile for maxj8 Click here to Send maxj8 a Private Message Find more posts by maxj8 Add maxj8 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
drakess81
.precettore.

User info:
Registered: Oct 2005
Posts: 83 (0.01 al dì)
Location: Saronno
Corso: Informatica
Anno: 2005
Time Online: 1 Day, 12:05:51 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Usciti i risultati di laboratorio... che strage!!! Ora restano solo l'appello di luglio e settembre... poi chi non passa ripete tutto??? Mi sembr assurdo... Ho fatto i due compitini prendendo B e 2 punti, magari faccio un buon orale e se sbaglio l'appello LAB di settembre perdo tutto? Mi sembra assurdo... Sono ignorante sui comandi scell di Minix, non ho potuto seguire il LAB e sulle slide c'è poco... videolezioni niente... non è giusto...datemi un buon libro che me lo studio!!!

20-06-2007 15:08
Click Here to See the Profile for drakess81 Click here to Send drakess81 a Private Message Visit drakess81's homepage! Find more posts by drakess81 Add drakess81 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
darkman13
.arcimaestro.

User info:
Registered: Feb 2004
Posts: 272 (0.04 al dì)
Location:
Corso:
Anno:
Time Online: 3 Days, 14:00:17 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

a chi lo dici

20-06-2007 15:09
Click Here to See the Profile for darkman13 Click here to Send darkman13 a Private Message Find more posts by darkman13 Add darkman13 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
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

Originally posted by drakess81
Sono ignorante sui comandi scell di Minix, non ho potuto seguire il LAB e sulle slide c'è poco... videolezioni niente... non è giusto...datemi un buon libro che me lo studio!!!

Per l'esercizio del partizionamento trovi un thread apposta.
Esercizi sulla shell ne trovi sulla wiki di sis lab con anche delle spiegazioni sui comandi base.
Per la parte kernel c'è una spiegazione di un esercizio sempre nelle pagine della wiki di sis lab.
C'è poi questo thread che spero sia ampliato...

Non è molto ma per chi non ha seguito il corso credo non ci sia altro.

PS: puoi leggerti "advanced bash scripting" che lo trovi su google controllando però quello che fai su Minix perchè la guida è fatta per bash+linux non sh+minix

PS2: per conoscere meglio i comandi in Minix batti:
man <comando> e ti dice tutte le varie opzioni che non sei tenuto a sapere
La lista dei comandi dispinibili la trovi facendo
ls /usr/bin

__________________
The answer is blowing in the wind...

Last edited by n3o on 20-06-2007 at 15:29

20-06-2007 15:23
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
bog86
.consigliere.

User info:
Registered: Jan 2006
Posts: 117 (0.02 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 1 Day, 23:03:56 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Esempio la prima: - trovare il file più "grosso" sul sistema
Potrebbe andare bene così?
find / -name "*.*" | xargs du -s | sort -n | tail -n 1

20-06-2007 16:59
Click Here to See the Profile for bog86 Click here to Send bog86 a Private Message Find more posts by bog86 Add bog86 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
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

Io userei:
find / -type f | xargs du | sort -n | tail -1

__________________
The answer is blowing in the wind...

20-06-2007 18:59
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
amari
.consigliere.

User info:
Registered: Aug 2006
Posts: 136 (0.02 al dì)
Location: Milano
Corso: Informatica
Anno: 3
Time Online: 21:56:15 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Modifica al kernel richiesta:

impedire che vengano creati file il cui nome cominci con la lettera m.

Intervento individuato: nei sorgenti del pm, nel file open.c c'è una funzione do_creat() (sì senza la e :)).

Uno dei parametri sembra essere il nome. Basterebbe quindi inserire un if alla inizio della funzione che controlla il nome e se quest'ultimo comincia con m, terminare con errore. In realtà il Prof. Monga ha detto che quello non è proprio il nome del file ma una stringa che lo rappresenta (una specie di codifica interna di Minix). Ma la risposta andava bene ugualmente.

Ciao a tutti
A.

20-06-2007 21:41
Click Here to See the Profile for amari Click here to Send amari a Private Message Find more posts by amari Add amari to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
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

Ricordo che la tua domanda è stata fatta a lezione...
Il nome di un file lo si trovava passando per:
/usr/src/servers/fs/open.c -> do_creat() -> common_open() -> new_node()
In questa funzione nella variabile string c'è il nome del file e basta aggiungere dopo la riga:
*ldirp = parse_path(path, string, opaque ? LAST_DIR : LAST_DIR_EATSYM);
Il seguente pezzo di codice:

code:
if (*string == 'M' || *string == 'm') { printf ("Niente nomi che iniziano con emme!!!\n"); return (NIL_INODE); }

Il side-effect è che il sistema non è ovviamente più in grado di aprire file che inizino con emme!!!

Ottimo che il thread si allarga!!!
è possibile chiedere di evidenziare il post mettendolo in sticky?

__________________
The answer is blowing in the wind...

Last edited by n3o on 19-07-2007 at 16:56

21-06-2007 00:45
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
amari
.consigliere.

User info:
Registered: Aug 2006
Posts: 136 (0.02 al dì)
Location: Milano
Corso: Informatica
Anno: 3
Time Online: 21:56:15 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ciao,

in effetti avevo scritto male... ovviamente il server in questione era il fs e non il pm.

Tieni conto però della nota di Monga... io non ho provato ma mi fido :)

Ciao
A.

21-06-2007 09:18
Click Here to See the Profile for amari Click here to Send amari a Private Message Find more posts by amari Add amari to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
bog86
.consigliere.

User info:
Registered: Jan 2006
Posts: 117 (0.02 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 1 Day, 23:03:56 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Altra domanda: - archiviare i files più grandi di 5k e più piccoli di 100k?
con "find / -type f -size -100 | xargs tar cvf archivio.tar" archivio solo i file piu piccoli di 100k, ma come faccio a fare entrambi contemporaneamente?

21-06-2007 14:31
Click Here to See the Profile for bog86 Click here to Send bog86 a Private Message Find more posts by bog86 Add bog86 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
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

Prova con
find / -type f -size +5 -a -size -100 | xargs tar cvf archivio.tar

__________________
The answer is blowing in the wind...

21-06-2007 15:15
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
bog86
.consigliere.

User info:
Registered: Jan 2006
Posts: 117 (0.02 al dì)
Location:
Corso: Informatica
Anno: 3
Time Online: 1 Day, 23:03:56 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Grazie n30...
poi ho provato a far girare il tuo script x trovare il file maggiore di ogni utente ma mi stampa sempre nessun file trovato fino a UID 9999.
Altra cosa x risp alla domanda -spostare(ho copiato...) tutti i files che iniziano per m da una directory (e sottodirectory) ad un'altra. ho usato "cp -r $(find / -name "m*.*") cartella"

21-06-2007 16:14
Click Here to See the Profile for bog86 Click here to Send bog86 a Private Message Find more posts by bog86 Add bog86 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 11:58.    Post New Thread    Post A Reply
Pages (39): [1] 2 3 4 5 » ... 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.069 seconds (76.21% PHP - 23.79% MySQL) con 23 query.