#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char **argv) {
  printf("Hello from the parent process!\n");
  pid_t pid = fork();
  if (pid == -1) {
    perror("fork failed");
    exit(-1);
  } else if (pid == 0) {
    printf("Hello from the child process! Going to sleep...\n");
    sleep(60);
    _exit(0);
  } else {
    sleep(10);
    // printf("Waiting for the child process to terminate...\n");
    // int status;
    // waitpid(pid, &status, 0);
    printf("The wait is over. Bye.\n");
  }
  return 0;
}