fork, exec & wait
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
Te Unix, një program i ri niset në tre hapa: fork() krijon një kopje të procesit, exec() e zëvendëson kopjen me programin e ri, dhe prindi pret me wait() derisa të mbarojë. Kështu punon terminali.
EnglishEN
On Unix, a new program starts in three steps: fork() makes a copy of the process, exec() replaces the copy with the new program, and the parent waits with wait() until it finishes. That's how the terminal works.
Si ta mendosh
Si të bësh një kopje të vetes, t'i japësh një punë tjetër, dhe ta presësh të kthehet.
Lexoje në anglisht
Like making a copy of yourself, giving it another job, and waiting for it to come back.
Shembull kodic
pid_t pid = fork();
if (pid == 0) { execlp("ls", "ls", "-l", NULL); _exit(1); }
waitpid(pid, NULL, 0);