0
0
Operating Systemsknowledge~5 mins

Process creation (fork and exec) in Operating Systems - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the fork() system call do in process creation?

The fork() system call creates a new process by duplicating the calling process. The new process is called the child process, and it is almost an exact copy of the parent process.

Click to reveal answer
beginner
What is the purpose of the exec() family of functions?

The exec() functions replace the current process's memory and code with a new program. This means the process starts running a different program without creating a new process.

Click to reveal answer
intermediate
How do fork() and exec() work together in creating a new process?

First, fork() creates a copy of the current process. Then, the child process uses exec() to replace its code with a new program. This way, a new process runs a different program.

Click to reveal answer
intermediate
What is the difference between the parent and child process after a fork() call?

After fork(), both processes run independently. The parent gets the child's process ID as the return value, while the child gets zero. They have separate memory spaces but start as copies.

Click to reveal answer
advanced
Why is fork() considered a cheap operation in modern operating systems?

Because modern OS use 'copy-on-write', which means the actual copying of memory happens only if either process changes it. This saves time and memory when creating new processes.

Click to reveal answer
What does the fork() system call return to the child process?
A-1
BChild's process ID
CParent's process ID
D0
Which system call replaces the current process's program with a new one?
Aexec()
Bexit()
Cwait()
Dfork()
What happens if fork() fails?
AReturns -1
BReturns child's PID
CReturns 0
DCreates a zombie process
Why do operating systems use copy-on-write with fork()?
ATo speed up process termination
BTo share memory permanently
CTo avoid copying memory until necessary
DTo prevent process creation
Which of these is true about the child process after fork()?
AIt immediately runs a different program
BIt runs the same program as the parent initially
CIt shares the same memory space as the parent
DIt cannot execute <code>exec()</code>
Explain how fork() and exec() work together to create a new process running a different program.
Think about copying first, then replacing the program.
You got /4 concepts.
    Describe what happens in the system when fork() is called and why copy-on-write is important.
    Focus on memory handling after fork.
    You got /4 concepts.