Processes and Threads Flashcards
What is a process?
A program in execution
What is a thread?
A basic unit of execution within a process.
What is a control block?
A data structure that contains information about a process or thread in an operating system. Whenever a process or thread is created the OS creates a CB and releases it when it is terminated.
True of False: Two or more separate processes cannot run the same program independently at the same time
False
Name three differences between a process and a program.
- A process has ashorter lifetime than a program.
- A process requires resources such as memory, CPU, Input-Output devices while a Program is stored by hard-disk and does not require any resources.
- A process has a dynamic instance of code and data while a program has static code and static data.
Name three differences between processes and threads.
- A process is heavy weight, a thread is light weight
- Process switching needs interaction with OS, thread switching does not need interaction with OS.
- Each process has its own memory space, while threads use the memory of the process they belong to.
- In multiple processor each process operates independently while one thread can read, write or change another threads data.
List six pieces of information you might find in a control block.
- State
- Identifier
- Counter
- Context data
- CPU-scheduling info
- memory pointers
- accounting information
- I/O status info
Name the four common events that can lead to the creation of a process
New batch job
Interactive log-on
Created by OS to provide a service
Spawned by existing process
Define process spawning
the action where OS creates a process at the explicit request of another process.
Name the steps that occur AFTER a new process is created.
Assign a unique process identifier to the new process.
Allocate space for the process.
Initialize the process control block.
Set the appropriate linkages.
Create or expand other data structures.
Process termination is normally due to:
Normal exit (voluntary).
Error exit (voluntary).
Fatal error (involuntary).
Killed by another process (involuntary).
Name three reasons a parent process might terminate a child process
The child has exceeded its usage of some of allotted resources
The task assigned to the child is no longer required
The parent is exiting, and the OS does not allow a child to continue
What is process switching?
the act of swapping out one process for another
Threads are divided into:
User level threads and kernel level threads
What is a User Level Thread?
These threads are created, managed and scheduled, and managed by a thread library operating at the user level, independent of the operating system’s kernel.