diff --git a/bash/rest.zip b/bash/rest.zip new file mode 100644 index 0000000..2070a6d Binary files /dev/null and b/bash/rest.zip differ diff --git a/c/task.c b/bash/train_bash/concurrente.sh old mode 100644 new mode 100755 similarity index 100% rename from c/task.c rename to bash/train_bash/concurrente.sh diff --git a/c/pause b/c/pause new file mode 100755 index 0000000..63bfa99 Binary files /dev/null and b/c/pause differ diff --git a/c/pause.c b/c/pause.c new file mode 100644 index 0000000..186cb20 --- /dev/null +++ b/c/pause.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + pause(); + return 0; +} diff --git a/c/task.h b/c/task.h deleted file mode 100644 index e69de29..0000000 diff --git a/python/fork.py b/python/fork.py new file mode 100755 index 0000000..afa1e9d --- /dev/null +++ b/python/fork.py @@ -0,0 +1,14 @@ +#!/usr/bin/python3 + +import os, sys + +ret = os.fork() +if ret == 0: + print("child process: pid={}, parent process's pid={}".format(os.getpid(), os.getppid())) + os.execve("/bin/echo", ["echo", "hello from pid={} ".format(os.getpid())], {}) + exit() +elif ret > 0: + print("parent process: pid={}, child process's pid={}".format(os.getpid(), ret)) + exit() + +sys.exit(1) diff --git a/python/spawn.py b/python/spawn.py new file mode 100755 index 0000000..e5bfe18 --- /dev/null +++ b/python/spawn.py @@ -0,0 +1,6 @@ +#!/usr/bin/python3 + +import os + +os.posix_spawn("/bin/echo", ["echo", "echo", "created by posix_spawn()"], {}) +print("created echo command")