François Trahay
Rôles d’un système d’exploitation:
Cloisonnement entre le mode utilisateur et le mode noyau
User mode
Kernel mode
La commande strace
intercepte et affiche les appels
systèmes d’un programme:
$ strace echo "coucou"
execve("/bin/echo", ["echo", "coucou"], [/* 54 vars */]) = 0
brk(NULL) = 0x25d2000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f619cc01000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[...]
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0
write(1, "coucou\n", 7coucou
) = 7
close(1) = 0
close(2) = 0
exit_group(0) = ?
+++ exited with 0 +++
Sémaphore:
sem_open("/CLE", O_CREAT, S_IRWXU, nb_jetons);
sem_t*
/
sem_open("/CLE", 0);
sem_t
sem_unlink(const char *name)
sem_wait(sem_t* sem)
sem_post(sem_t* sem)
Comment passer en mode noyau ?
2 méthodes: