fork() implementation