From 6f0673d5fe28b19510f846d252818a650dc19ae0 Mon Sep 17 00:00:00 2001 From: "iliya.saroukha" <iliya.saroukha@hes-so.ch> Date: Sun, 24 Sep 2023 14:09:05 +0200 Subject: [PATCH] finished ex1 --- serie1/ex1.md | 38 +++++++++++++++++++++++++++++++++++++- serie1/ex2/.gitignore | 2 ++ serie1/ex2/Makefile | 20 ++++++++++++++++++++ serie1/ex2/prog.c | 9 +++++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 serie1/ex2/.gitignore create mode 100644 serie1/ex2/Makefile create mode 100644 serie1/ex2/prog.c diff --git a/serie1/ex1.md b/serie1/ex1.md index 997fac8..579dd63 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 0000000..b6de771 --- /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 0000000..9e2b2e9 --- /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 0000000..7837ac6 --- /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; +} -- GitLab