Processes and threads Flashcards
How are threads and processes created?
Via system calls
What do Processes and Threads cause a need for in a system?
Virtual memory and protection
How does the OS deal with processes and threads?
OS schedules and concurrently executes them. kernel manages processes.
What is a process?
A unit of work being executed on a computer
Program in execution
What functions does the OS have for processes?
- Creation and deletion of processes
- Scheduling processes on the CPU
- Communication between processes
- Synchronisation of >= 2 processes.
Process structure
- Stack
- Heap
- Data
- Text
What is a process control block?
OS representation of a process, held in a table or list. Allows OS to suspend and continue processes.
What does the scheduler include that allows for the extraction on information on a process?
struct task_struct
pid, state, open files contained.
What is context and how do we switch it?
Process state.
Save state of old process, load state of new process.
What are the disadvantages of context switching?
Pure overhead as no useful work can be done while switch is in progress.
How are processes created?
Create process system call (fork()). Calling process is parent and new processes are children.
How does the parent/child process affect child nodes
Program: Same as parent or different
Resource sharing: Shared, partially shared or not shared.
Execution: Concurrently or waiting to finish
Address space: Copy of parent’s or completely new.
How are processes terminated?
Exit system call by process itself or parent can kill child process.
What is cascading termination?
When parent process terminates, so to do all children.
What is an orphan process?
On parent crash, process is adopted by the init process or terminated.