Save
This commit is contained in:
parent
2126e4455b
commit
78b1633710
BIN
bash/rest.zip
Normal file
BIN
bash/rest.zip
Normal file
Binary file not shown.
0
c/task.c → bash/train_bash/concurrente.sh
Normal file → Executable file
0
c/task.c → bash/train_bash/concurrente.sh
Normal file → Executable file
6
c/pause.c
Normal file
6
c/pause.c
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
pause();
|
||||||
|
return 0;
|
||||||
|
}
|
14
python/fork.py
Executable file
14
python/fork.py
Executable file
@ -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)
|
6
python/spawn.py
Executable file
6
python/spawn.py
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
os.posix_spawn("/bin/echo", ["echo", "echo", "created by posix_spawn()"], {})
|
||||||
|
print("created echo command")
|
Loading…
Reference in New Issue
Block a user