Operating System

How a process is created?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

  • The OS is reading program's code and any additional relevant data
  • Program's code is loaded into the memory or more specifically, into the address space of the process.
  • Memory is allocated for program's stack (aka run-time stack). The stack also initialized by the OS with data like argv, argc and parameters to main()
  • Memory is allocated for program's heap which is required for dynamically allocated data like the data structures linked lists and hash tables
  • I/O initialization tasks are performed, like in Unix/Linux based systems, where each process has 3 file descriptors (input, output and error)
  • OS is running the program, starting from main()