diff --git a/serie1/ex1.md b/serie1/ex1.md index 997fac8ea3599cd7dc61352c809b1e318c97e9b0..579dd632f6ba14f7afac885450b6933e594c9a3d 100644 --- a/serie1/ex1.md +++ b/serie1/ex1.md @@ -31,6 +31,42 @@ PID TTY TIME CMD 1 ? 00:00:02 systemd ``` -# Identifiez au moins 4 groupes de processus contenant chacun au moins 5 processus et pour chacu, déterminez le _group leader_ +Par contre, si l'on utilise les flags `-ef` pour la commande `ps`, le nom du +processus portant le `PID` 1 est `init` provenant de `/sbin/init splash`. En +réalité `init` est aussi `systemd` mais ce nom sera régi par la distribution +utilisée. +# Identifiez au moins 4 groupes de processus contenant chacun au moins 5 processus et pour chacun, déterminez le _group leader_ +## Format + +- Process(PID, PGID) + - Child process(PIDs range, PGID) + +$\Rightarrow$ Group leader + + +## Réponses + +- `Xorg`(2298, 2296) + - `{Xorg}`(2299 -- 2331, 2296) + +$\Rightarrow$ `gdm-x-session`(2296, 2296) + + +- `evolution-alarm`(3060, 2650) + - `{evolution-alarm}`([3182 -- 3183; 3190; 3217 -- 3218; 3254], 2296) + +$\Rightarrow$ `gnome-session-b`(2650, 2650) + + +- `fwupd`(3403, 3403) + - `{fwupd}`([3412 -- 3415; 3417], 3403) + +$\Rightarrow$ `fwupd`(3403, 3403) + + +- `xdg-document-po`(2213, 2213) + - `{xdg-document-po}`([2214 -- 2216; 2223; 2225; 2226], 2213) + +$\Rightarrow$ `xdg-document-po`(2213, 2213) diff --git a/serie1/ex2/.gitignore b/serie1/ex2/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..b6de771d2fff3a218dbc1b3de5b6b6cc1dc54e08 --- /dev/null +++ b/serie1/ex2/.gitignore @@ -0,0 +1,2 @@ +*.o +prog diff --git a/serie1/ex2/Makefile b/serie1/ex2/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..9e2b2e935845f12b4781d51b91bfcd65826b4a64 --- /dev/null +++ b/serie1/ex2/Makefile @@ -0,0 +1,20 @@ +CC := clang +CFLAGS := -g -pedantic -Wall -Wextra -std=c2x +LDFLAGS := -fsanitize=address -fsanitize=leak -fsanitize=undefined -lm +TARGET := prog + +all: $(TARGET) + +$(TARGET): prog.o + @printf "=================== Building executable ===================\n" + $(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS) + @printf "\n" + +%.o: %.c + @printf "================== Building object files ==================\n" + $(CC) $(CFLAGS) -c $< + @printf "\n" + +clean: + rm -f *.o $(TARGET) + diff --git a/serie1/ex2/prog.c b/serie1/ex2/prog.c new file mode 100644 index 0000000000000000000000000000000000000000..7837ac637f751beb7e74d8fd4f5096bbc386451e --- /dev/null +++ b/serie1/ex2/prog.c @@ -0,0 +1,9 @@ +#include <stdio.h> +#include <unistd.h> + +int main(void) { + printf("Voilà un mystère digne de Sherlock Holmes !"); + fork(); + printf("\n"); + return 0; +}