diff --git a/Linux-process-management/createchild.cast b/Linux-process-management/createchild.cast new file mode 100644 index 0000000..6c3e842 --- /dev/null +++ b/Linux-process-management/createchild.cast @@ -0,0 +1,283 @@ +{"version": 2, "width": 203, "height": 49, "timestamp": 1614091128, "env": {"SHELL": "/bin/bash", "TERM": "xterm"}} +[0.04346, "o", "\u001b]0;zeus@swarmlab: /tmp\u0007zeus@swarmlab:/tmp$ "] +[3.125338, "o", "v"] +[3.332194, "o", "i"] +[4.609439, "o", "m"] +[5.267309, "o", " "] +[5.831039, "o", "c"] +[6.133437, "o", "r"] +[6.320367, "o", "e"] +[6.672957, "o", "a"] +[7.001473, "o", "t"] +[8.778095, "o", "e"] +[9.55872, "o", "-"] +[9.795684, "o", "c"] +[10.199746, "o", "h"] +[10.720379, "o", "i"] +[11.220026, "o", "l"] +[11.447293, "o", "d"] +[11.928017, "o", "."] +[12.428572, "o", "c"] +[14.556749, "o", "\r\n"] +[14.615258, "o", "\u001b[?2004h\u001b[?1049h\u001b[22;0;0t\u001b[?1h\u001b=\u001b[?2004h"] +[14.615744, "o", "\u001b[1;49r\u001b[?12h\u001b[?12l\u001b[27m\u001b[23m\u001b[29m\u001b[m\u001b[H\u001b[2J\u001b[?25l\u001b[49;1H\"create-child.c\" [New File]"] +[14.620413, "o", "\u001b[2;1Hâ–½\u001b[6n\u001b[2;1H \u001b[1;1H\u001b[>c\u001b]10;?\u0007\u001b]11;?\u0007"] +[14.620817, "o", "\u001b[2;1H\u001b[1m\u001b[34m~ \u001b[3;1H~ \u001b[4;1H~ \u001b[5;1H~ \u001b[6;1H~ "] +[14.620955, "o", " \u001b[7;1H~ \u001b[8;1H~ \u001b[9;1H~ \u001b[10;1H~ \u001b[11;1H~ "] +[14.620987, "o", " \u001b[12;1H~ \u001b[13;1H~ \u001b[14;1H~ \u001b[15;1H~ \u001b[16;1H~ "] +[14.621069, "o", " \u001b[17;1H~ \u001b[18;1H~ \u001b[19;1H~ \u001b[20;1H~ \u001b[21;1H~ "] +[14.621121, "o", " \u001b[22;1H~ \u001b[23;1H~ \u001b[24;1H~ \u001b[25;1H~ \u001b[26;1H~ "] +[14.621171, "o", " \u001b[27;1H~ \u001b[28;1H~ \u001b[29;1H~ \u001b[30;1H~ \u001b[31;1H~ "] +[14.621217, "o", " \u001b[32;1H~ \u001b[33;1H~ \u001b[34;1H~ \u001b[35;1H~ \u001b[36;1H~ "] +[14.621262, "o", " \u001b[37;1H~ \u001b[38;1H~ \u001b[39;1H~ \u001b[40;1H~ \u001b"] +[14.621306, "o", "[41;1H~ \u001b[42;1H~ \u001b[43;1H~ \u001b[44;1H~ \u001b[45;1H~ "] +[14.621351, "o", " \u001b[46;1H~ \u001b[47;1H~ \u001b[48;1H~ \u001b[m\u001b[49;186H0,0-1\u001b[9CAll\u001b[1;1H\u001b[?25h"] +[14.626621, "o", "\u001bP+q436f\u001b\\\u001bP+q6b75\u001b\\\u001bP+q6b64\u001b\\\u001bP+q6b72\u001b\\\u001bP+q6b6c\u001b\\\u001bP+q2332\u001b\\\u001bP+q2334\u001b\\\u001bP+q2569\u001b\\\u001bP+q2a37\u001b\\\u001bP+q6b31\u001b\\"] +[16.280411, "o", "\u001b[?25l\u001b[49;1H\u001b[1m-- INSERT --\u001b[m\u001b[49;13H\u001b[K\u001b[49;186H0,1\u001b[11CAll\u001b[1;1H\u001b[?25h"] +[17.351716, "o", "\u001b[?25l\u001b[35m#include \u001b[m\u001b[31m\u001b[m\r\n\u001b[35m#include \u001b[m\u001b[31m\u001b[m\u001b[2;22H\u001b[K\u001b[3;1H\u001b[35m#include \u001b[m\u001b[31m\u001b[m\u001b[3;19H\u001b[K\u001b[4;1H#\u001b[4;2H\u001b[K\u001b[4;2H\u001b[?25h"] +[17.353068, "o", "\u001b[?25l\b\u001b[35m#include \u001b[m\u001b[31m\u001b[m\u001b[5;1H\u001b[K\u001b[6;1H\u001b[32mvoid\u001b[m childFunction(){\u001b[6;22H\u001b[K\u001b[7;1H printf(\u001b[31m\"\u001b[m\u001b[4m\u001b[31mChild\u001b[m\u001b[31m : \u001b[m\u001b[35m%d\\n\u001b[m\u001b[31m\"\u001b[m,\u001b[7;27H\u001b[K\u001b[7;27H\u001b[?25h"] +[17.356426, "o", "\u001b[?25l getpid());\r\n \u001b[34m// \u001b[m\u001b[4m\u001b[34mdo\u001b[m\u001b[34m \u001b[m\u001b[4m\u001b[34mstuff\u001b[m\u001b[8;16H\u001b[K\u001b[9;1H}\u001b[9;2H\u001b[K\u001b[10;1H\u001b[K\u001b[11;1H\u001b[32mint\u001b[m main(){\u001b[11;12H\u001b[K\u001b[12;1H \u001b[32mint\u001b[m childLimit = \u001b[31m3\u001b[m;\u001b[12;24H\u001b[K\u001b[12;24H\u001b[?25h"] +[17.357862, "o", "\u001b[?25l\u001b[25C\u001b[34m// \u001b[m\u001b[4m\u001b[34mnumber\u001b[m\u001b[34m \u001b[m\u001b[4m\u001b[34mof\u001b[m\u001b[34m \u001b[m\u001b[4m\u001b[34mchildren\u001b[m\u001b[34m \u001b[m\u001b[4m\u001b[34mwanted\u001b[m\r\n \u001b[32mint\u001b[m chi\u001b[13;12H\u001b[K\u001b[13;12H\u001b[?25h"] +[17.358909, "o", "\u001b[?25lldrenPids[childLimit];\u001b[15C\u001b[34m// \u001b[m\u001b[4m\u001b[34marray\u001b[m\u001b[34m \u001b[m\u001b[4m\u001b[34mto\u001b[m\u001b[34m \u001b[m\u001b[4m\u001b[34mstore\u001b[m\u001b[34m \u001b[m\u001b[4m\u001b[34mchildren\u001b[m\u001b[34m's\u001b[?25h"] +[17.360353, "o", "\u001b[?25l\u001b[m\b\u001b[4m\u001b[34ms\u001b[m\u001b[34m \u001b[m\u001b[4m\u001b[34mPIDs\u001b[m\u001b[34m \u001b[m\u001b[4m\u001b[34mif\u001b[m\u001b[34m \u001b[m\u001b[4m\u001b[34mneeded\u001b[m\r\n \u001b[32mint\u001b[m currentPid, i;\u001b[14;23H\u001b[K\u001b[15;1H\u001b[K\u001b[16;1H \u001b[33mfor\u001b[m(i=\u001b[31m0\u001b[m; i\u001b[?25h\u001b[?1049l\u001b[23;0;0t"] +[52.69933, "o", "\u001b]0;zeus@swarmlab: /tmp\u0007zeus@swarmlab:/tmp$ "] +[53.751214, "o", "g"] +[54.514669, "o", "c"] +[54.712521, "o", "c"] +[55.464011, "o", " "] +[57.229873, "o", "."] +[57.410352, "o", "/"] +[57.790238, "o", "c"] +[58.170199, "o", "r"] +[58.370816, "o", "e"] +[58.894001, "o", "\u0007ate-"] +[60.42151, "o", "c"] +[61.149897, "o", "h"] +[61.446666, "o", "ild.c "] +[62.383313, "o", "\r\n"] +[62.451923, "o", "\u001b]0;zeus@swarmlab: /tmp\u0007zeus@swarmlab:/tmp$ "] +[64.559034, "o", "."] +[64.766044, "o", "/"] +[65.588447, "o", "a"] +[65.815407, "o", "o"] +[66.087383, "o", "u"] +[66.270529, "o", "\u0007"] +[67.020993, "o", "\b\u001b[K"] +[67.197903, "o", "\b\u001b[K"] +[67.889326, "o", "."] +[68.009927, "o", "out "] +[68.740013, "o", "\r\n"] +[68.742174, "o", "Child : 10553"] +[68.742933, "o", "\r\nChild : 10554\r\nChild : 10555\r\n"] +[68.743021, "o", "Father : 3 childs created\r\n"] +[68.74444, "o", "\u001b]0;zeus@swarmlab: /tmp\u0007zeus@swarmlab:/tmp$ "] +[71.267712, "o", "./a.out "] +[72.971373, "o", "\r\n"] +[72.973147, "o", "Child : 10596\r\n"] +[72.973377, "o", "Father : 3 childs created\r\nChild : 10598\r\n"] +[72.97348, "o", "Child : 10597"] +[72.973565, "o", "\r\n"] +[72.973888, "o", "\u001b]0;zeus@swarmlab: /tmp\u0007zeus@swarmlab:/tmp$ "] +[74.256402, "o", "./a.out "] +[75.831975, "o", "\r\n"] +[75.83353, "o", "Child : 10600\r\n"] +[75.833764, "o", "Child : 10601\r\nChild : 10602\r\nFather : 3 childs created\r\n"] +[75.834255, "o", "\u001b]0;zeus@swarmlab: /tmp\u0007zeus@swarmlab:/tmp$ "] +[77.939821, "o", "e"] +[78.279416, "o", "x"] +[78.553175, "o", "i"] +[78.780691, "o", "t"] +[79.29144, "o", "\r\nexit\r\n"] diff --git a/Linux-process-management/index.js b/Linux-process-management/index.js index a5bf9d5..296c7fd 100644 --- a/Linux-process-management/index.js +++ b/Linux-process-management/index.js @@ -35,6 +35,14 @@ }, { "chapter": 4, + "title": "Child!", + "subtitle": "Life cycle of a process - child", + "type": "asciinema", + "desc": "Create child", + "file": "createchild.cast" + }, + { + "chapter": 5, "title": "Zombie!", "subtitle": "Life cycle of a process - zombie", "type": "asciinema",