Skip to content

Commit 3fce35a

Browse files
author
mgroot
committed
Merge branch 'main' of github.com:PP189B/Multithreaded-programming-practice into main
2 parents 5826885 + f1cad4f commit 3fce35a

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

5_Processes_Signals_Files_Pipes/README.md

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44
Some simple tasks from the course + additional practice with my own examples:
55
|||
66
|-------------------|-----------------------------------------------------------|
7-
|1. `Processes/exec_cat.cpp` | Just execute cat in forked proccess with error checks |
7+
|1. `Processes/1_exec-cat.cpp` | Just execute cat in forked proccess with error checks |
8+
|2. `Processes/2_Zombie-checker.cpp` | Checking zombie child processes in non-blocking mode |
9+
|2. `Signals/1_Immortal.cpp` | Just making immortal (ignoring `SIGINT` and `SIGTERM`) child process |
810

911

1012

1113

1214
## Result
1315

14-
### `Processes/exec_cat.cpp`
16+
### `Processes/1_exec-cat.cpp`
1517

1618
Simple exec in forked process (after 1 sec sleep) with reusing argv parameters with.
1719

@@ -20,7 +22,27 @@ Simple exec in forked process (after 1 sec sleep) with reusing argv parameters w
2022
![Screen Recording 2022-03-17 at 12 09 31 PM](https://user-images.githubusercontent.com/44144647/158776572-3c0f3b56-28a8-492b-af01-83faa5a3a80b.gif)
2123

2224

25+
### `Processes/2_Zombie-checker.cpp`
2326

27+
Fork `CHILDS_NUMBER` processes (with 1 seconds delay between) and make them sleep for `5 + std::rand() % 20` seconds (each process has own random seed).
2428

25-
## Learned new
29+
After fork main process doing `some hard work` and each `WORK_DELAY` seconds calls `zombie_check()` in non-blocking mode.
30+
31+
##### runtime
32+
33+
![Screen Recording 2022-03-17 at 1 52 17 PM](https://user-images.githubusercontent.com/44144647/158794971-b93aeb31-de99-4868-b71f-34829766ef27.gif)
34+
35+
36+
### `Signals/1_Immortal.cpp`
37+
38+
Just making immortal (ignoring `SIGINT` and `SIGTERM`) child process.
2639

40+
##### runtime
41+
42+
![Screen Recording 2022-03-17 at 12 29 11 PM](https://user-images.githubusercontent.com/44144647/158795441-6ad4b09a-ec8f-40c1-8f65-493f366bc1bf.gif)
43+
44+
45+
46+
## Learned new
47+
* Non-blocking `waitpid`'s flag (`WNOHANG`)
48+
* ANSI, POSIX and Real Time signals

0 commit comments

Comments
 (0)