From 990b724df5a76bcfcbd582b45cbd8057831bdd89 Mon Sep 17 00:00:00 2001 From: Denis Monnerat Date: Wed, 3 Sep 2025 12:18:38 +0200 Subject: [PATCH] typo --- tp/tp1/README.md | 12 ++++++------ tp/tp1/src/{ex3 => ex2}/Makefile | 0 tp/tp1/src/ex2/buf.c | 9 +++++++++ tp/tp1/src/{ex3 => ex2}/data/256k | Bin tp/tp1/src/{ex3 => ex2}/heap.c | 0 tp/tp1/src/{ex3 => ex2}/helpers.c | 0 tp/tp1/src/{ex3 => ex2}/helpers.h | 0 tp/tp1/src/{ex3 => ex2}/huge.c | 0 tp/tp1/src/{ex3 => ex2}/mmap.c | 0 tp/tp1/src/{ex3 => ex2}/null.c | 0 tp/tp1/src/{ex3 => ex2}/stack.c | 0 tp/tp1/src/ex3/buf.c | 15 --------------- 12 files changed, 15 insertions(+), 21 deletions(-) rename tp/tp1/src/{ex3 => ex2}/Makefile (100%) create mode 100644 tp/tp1/src/ex2/buf.c rename tp/tp1/src/{ex3 => ex2}/data/256k (100%) rename tp/tp1/src/{ex3 => ex2}/heap.c (100%) rename tp/tp1/src/{ex3 => ex2}/helpers.c (100%) rename tp/tp1/src/{ex3 => ex2}/helpers.h (100%) rename tp/tp1/src/{ex3 => ex2}/huge.c (100%) rename tp/tp1/src/{ex3 => ex2}/mmap.c (100%) rename tp/tp1/src/{ex3 => ex2}/null.c (100%) rename tp/tp1/src/{ex3 => ex2}/stack.c (100%) delete mode 100644 tp/tp1/src/ex3/buf.c diff --git a/tp/tp1/README.md b/tp/tp1/README.md index d6183cd..b587e70 100644 --- a/tp/tp1/README.md +++ b/tp/tp1/README.md @@ -50,17 +50,17 @@ man proc_pid_maps #### Ex2 L'interface (pseudo-fichier) `proc/pid/smaps` montre la consommation mémoire -d'un processus. On peut le formater avec la commande `pmap -X` ou avec le script +d'un processus. On peut le formater avec la commande `pmap -x|X` ou avec le script python [parse_smaps.py](./src/scripts/parse_smaps.py). Le but de l'exercice est de voir ce qui se passe au niveau de la mémoire d'un processus suivant les différents mode d'allocation. Le programme `null.c` permet d'avoir un point de comparaison. Vérifiez la consommation mémoire dans les cas suivants : -1. Allocation statique [buf.c](./src/ex3/buf.c). -2. Allocation sur la pile [stack.c](./src/ex3/stack.c), -3. Allocation sur le tas [heap.c](./src/ex3/heap.c), -4. Allocation (grande quantité) sur le tas [huge.c](./src/ex3/huge.c). -5. Allocation par mapping [mmap.c](./src/ex3/mmap.c). +1. Allocation statique [buf.c](./src/ex2/buf.c). +2. Allocation sur la pile [stack.c](./src/ex2/stack.c), +3. Allocation sur le tas [heap.c](./src/ex2/heap.c), +4. Allocation (grande quantité) sur le tas [huge.c](./src/ex2/huge.c). +5. Allocation par mapping [mmap.c](./src/ex2/mmap.c). #### Ex3 diff --git a/tp/tp1/src/ex3/Makefile b/tp/tp1/src/ex2/Makefile similarity index 100% rename from tp/tp1/src/ex3/Makefile rename to tp/tp1/src/ex2/Makefile diff --git a/tp/tp1/src/ex2/buf.c b/tp/tp1/src/ex2/buf.c new file mode 100644 index 0000000..4dbf387 --- /dev/null +++ b/tp/tp1/src/ex2/buf.c @@ -0,0 +1,9 @@ +#include "helpers.h" + +static char buffer[16 MB] = {0}; + +int main(int argc, char **argv) +{ + randomize(buffer, 16 MB); + return interlude(); +} diff --git a/tp/tp1/src/ex3/data/256k b/tp/tp1/src/ex2/data/256k similarity index 100% rename from tp/tp1/src/ex3/data/256k rename to tp/tp1/src/ex2/data/256k diff --git a/tp/tp1/src/ex3/heap.c b/tp/tp1/src/ex2/heap.c similarity index 100% rename from tp/tp1/src/ex3/heap.c rename to tp/tp1/src/ex2/heap.c diff --git a/tp/tp1/src/ex3/helpers.c b/tp/tp1/src/ex2/helpers.c similarity index 100% rename from tp/tp1/src/ex3/helpers.c rename to tp/tp1/src/ex2/helpers.c diff --git a/tp/tp1/src/ex3/helpers.h b/tp/tp1/src/ex2/helpers.h similarity index 100% rename from tp/tp1/src/ex3/helpers.h rename to tp/tp1/src/ex2/helpers.h diff --git a/tp/tp1/src/ex3/huge.c b/tp/tp1/src/ex2/huge.c similarity index 100% rename from tp/tp1/src/ex3/huge.c rename to tp/tp1/src/ex2/huge.c diff --git a/tp/tp1/src/ex3/mmap.c b/tp/tp1/src/ex2/mmap.c similarity index 100% rename from tp/tp1/src/ex3/mmap.c rename to tp/tp1/src/ex2/mmap.c diff --git a/tp/tp1/src/ex3/null.c b/tp/tp1/src/ex2/null.c similarity index 100% rename from tp/tp1/src/ex3/null.c rename to tp/tp1/src/ex2/null.c diff --git a/tp/tp1/src/ex3/stack.c b/tp/tp1/src/ex2/stack.c similarity index 100% rename from tp/tp1/src/ex3/stack.c rename to tp/tp1/src/ex2/stack.c diff --git a/tp/tp1/src/ex3/buf.c b/tp/tp1/src/ex3/buf.c deleted file mode 100644 index 04c17f0..0000000 --- a/tp/tp1/src/ex3/buf.c +++ /dev/null @@ -1,15 +0,0 @@ -#include "helpers.h" -#include -static char buf[16 MB] = {0}; - -int main(int argc, char **argv) -{ - buf[0] = 12; - long int ad; - printf("buf = %p\n",buf); - ad = (long int)buf; - ad = (ad & 0xfffffffff000) + 0x1000 - ad ; - buf[ad - 1] = 13; - //randomize(buf, 16 MB); - return interlude(); -}