processes Flashcards
What is a process and what resources does it require during execution?
A process is a program in execution and requires resources such as CPU time memory and file I/O which are allocated during execution.
How does a process differ from a program?
A program is a passive entity stored on disk while a process is an active entity with a program counter and associated resources in memory.
Explain the concept of a system process and a user process?
System processes execute the OS’s code while user processes execute user code.
Describe the memory layout of a process?
A process has a memory layout with sections for code data stack and heap.
What is the role of the program counter register in representing the state of a process?
The program counter register represents the address of the next instruction to be executed in the process.
Explain the growth direction of the stack and heap?
The stack and heap grow towards each other and the OS ensures they never overlap.
What is the activation record?
Each time a function is called an activation record containing function parameters local variables and the return address is pushed onto the stack.
List and explain the possible states a process can be in?
New Ready Running Waiting Terminated. New: The process is being created. Ready: The process is waiting to be assigned to a processor. Running: Instructions are being executed. Waiting: The process is waiting for some event to occur. Terminated: The process has finished execution.
In what situations does a process transition from one state to another?
Processes transition states based on events like creation waiting for I/O completion of execution etc.
What information is stored in the Process Control Block (PCB)?
The PCB stores information such as process state process number program counter CPU registers CPU-scheduling information memory-management information accounting information and I/O status information.
How does the PCB contribute to process management?
The PCB serves as the repository for all the data needed to start or restart a process along with some accounting data.
Why is the PCB necessary for restarting a process?
The PCB contains crucial information about the process and it’s necessary for restarting or resuming the process after it has been stopped or interrupted.
What is the objective of multiprogramming and time sharing in process scheduling?
The objective of multiprogramming is to maximize CPU utilization by having some process running at all times. Time sharing aims to switch a CPU core among processes frequently to allow users to interact with each program while it’s running.
Explain the concept of scheduling queues?
Scheduling queues are data structures used by the process scheduler to organize processes based on their states and priority levels.
What is the purpose of context switching in process scheduling?
Context switching is necessary when switching the CPU core from one process to another. It involves saving the current context of the running process and restoring the context of the process to be scheduled.