From d2c53af403ce1035d4f7715e2533077b77bb92cb Mon Sep 17 00:00:00 2001 From: waldek Date: Mon, 5 Jul 2021 15:49:07 +0200 Subject: [PATCH] completes the processes md and adds the exercises --- modules/qualifying/learning_processes.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/modules/qualifying/learning_processes.md b/modules/qualifying/learning_processes.md index efcfb3f..27f048b 100644 --- a/modules/qualifying/learning_processes.md +++ b/modules/qualifying/learning_processes.md @@ -376,11 +376,27 @@ Why do you think this is? ### Renice +Nice values are that practical if we need to set them before we start a process no? +That's where the `renice` program comes into play. +It allows us to change the nice value of a running process with a very simple syntax. +I would advise you to use `sudo` when changing the nice values because otherwise you'll constantly run into either `operation not permitted` or `permission denied` errors. +``` +➜ ~ git:(master) ✗ ping 8.8.8.8 > /dev/null & +[1] 16877 +➜ ~ git:(master) ✗ ps o nice,pid,args -p 16877 + NI PID COMMAND + 5 16877 ping 8.8.8.8 +➜ ~ git:(master) ✗ sudo renice -n 20 -p 16877 +16877 (process ID) old priority 5, new priority 19 +➜ ~ git:(master) ✗ +``` ## Exercises -Download the following files: +To help you understand what happens to running and stopped processes I made a few python scripts you can download below. +Run them either with `python3 $SCRIPT_NAME` or `./$SCRIPT_NAME` -* f -* f +* [simple timer](./assets/processes_ex_01.py) +* [timer with random keyboard prompt](./assets/processes_ex_02.py) +* [custom callback function for SIGALRM](./assets/processes_ex_03.py)