Lecture 4 Flashcards
What’s special about Fork()’s return?
It returns twice (0 to child, PID of new process to parent)
execlp() command ____ current program
Overwrites
What is exit()
Process executes last statement and asks OS to delete it
What happens when a process terminates?
Process’ resources are de-allocated by OS and outputs data from child to parent via wait()
What is abort()
Parent terminating execution of child processes
Why is abort() called?
- Child has exceeded allocated resources
- Task assigned to child is no longer required
- If parent is exiting, some OS do not allow children to continue (causes cascade termination)
Zombie Process
Process terminated but parent hasn’t called wait() yet
Where is the return value of a zombie process kept?
Held in memory
Orphan Process
Process is running but parent exited without calling wait()
What is adoption?
An orphan process being assigned a new parent (init process in Linux)
Thread
A sequence of instructions in a function that a CPU can execute as a unit
Thread is comprised of (from OS perspective):
- Program Counter
- Register Set
- Stack
Process is composed of…
…one or more threads
Threads belonging to the same process share:
- Code section
- Data section
- OS resources such as open files and signals
Why multithreading?
- Responsiveness
- Resource Sharing
- Economy
- Stability