Processes1 Flashcards
What is a process?
When a program is executed and loaded into the memory. It is an active entity. A program may create multiple almost identical processes.
What is a program?
Passive entity (executable file) stored on HDD
What is process context?
A process contains text section (program code), current activity (process number, process state, program counter, value stored in registers, CPU related information, Accounting information and I/O status information), stack (temporary data), data section (global data that is shared between processes), heap (memory allocated).
What is a PCB?
Process Control Block. Each process has its own PCB. PCB contains the context information about a process.
What is a process Identification Number PID?
Process Identifier is the unique ID number to identify a process.
What are the different process states?
A process can be in 5 possible states: new (created), running (executed), waiting, ready (waiting to be assigned to CPU) and terminated (finished).
What is contained in the program counter?
The location of instruction that CPU needs to execute next.
Whats an idle process?
Process waiting for I/O to complete
What is context switching?
When CPU is switching from Process 0 to Process 1, CPU will first save the current state/context of Process 0 to Process 0’s PCB. It will then load the state/context of Process 1 from Process 1’s PCB.
What is a foreground process?
Process that is currently visible to the user and controlled via user interface.
What is a background process?
Process that is currently running in memory but are not on display.
How are processes created?
Process is created because of an execution of a system call, initiation of a batch job, a user request to create a new process and a running process create one or more new child processes.
what does the fork() system call do?
System call to create a new process
What does the exec() system call do?
System call to load a new program to the specified process
What are the resource sharing options for processes?
A child process may share all, subset or none of the parent’s resources. Usually a child process only share subset of the parent to prevent a process overloading the system with too many child processes.
What are the different options for processes to exectue?
A child process may be executed concurrently with the parent, or the parent usually waits until the child process is terminated.
What does the exit()system call do?
System call to indicate OS that the process has finished executing all of its program and OS may delete it from the RAM.
What does the wait()system call do?
Parent process is waiting for child process to send its output.
What does the abort system call do?
A process is terminated before it has finished executing all of its program.
What is an abnormal termination?
A process is terminated abruptly before it has finished executing all of its program. This may happen due to programming error, run-time error, I/O error, parent process kills it, or user intervention.
What is an Interrupt (Error exit)?
If a process is abruptly terminated because it has encountered an error that the program has anticipated. Instead of just exiting the process without any information, the process will provide user with some details about the cause of the abnormal termination and possible ways to solve the error.
What is a fatal error?
If a process is abruptly terminated because it has encountered an error that the program has not anticipated. Generally, the process will exit without providing any information to user.
How can a child process be terminated?
A child process may be terminated by its parent because it has exceeded its usage of some of the allocated resources, the task assigned to child is no longer required or because the parent has been terminated and the OS does not allow a child to continue.
What is a cascading termination?
A child process is terminated because its parent has been terminated.
What is a zombie process?
When a child process is terminated but it has no parent waiting to collect its output.
What is an orphan process?
When a child process is still running even when the parent has been terminated.
What are the different parts of a process?
The program code, called text section
Current activity including Program counter, processor registers
Stack containing temporary data
Data section containing global data (shared between processes)
Heap containing memory allocated during run-time
What is the stack?
Used for static memory allocation
Very fast & local access (local variables), limited size
LIFO order (Last In First Out)
Automatically managed
Know exactly how much data you need to allocate before compiling
What is the heap?
Used for dynamic memory allocation
Global access
Manually managed (malloc(), calloc(), free(), delete() systems calls)
Don’t know exactly how much data you need at runtime
What info is stored in a PCB?
Process number and state
Program counter – location of instruction to next execute
CPU-related information
Memory-management information – memory allocated to the process
Accounting information – CPU used, clock time elapsed since start, time limits
I/O status information – I/O devices allocated to process, list of open files