Week 5 - Operating System Fundamentals (Part 3) Flashcards
Process Management (78 cards)
What is the difference between a program and a process?
- A program is a passive entity, stored on disk (executable file).
- A process is an active entity that is created when the program is loaded into memory and executed.
Can one program have multiple processes?
Yes, a single program can have multiple processes, especially if multiple users are running the same program.
What triggers the execution of a program as a process?
Execution can be triggered via:
- GUI mouse clicks
- Command line entry of the program’s name
How does the process concept work in terms of program execution?
- A process represents a program in execution.
- Each process has its own address space, memory, and resources.
What are the three basic components of Process Representation?
- Executable Program Code
- Data related to the Program
- Execution Context (includes Process ID, Group ID, User ID, etc.)
What is included in the execution context of a process?
- Process ID, Group ID, User ID
- Stack Pointer, Program Counter, CPU Registers
- File Descriptors, Locks, Network Sockets
Why is the execution context essential for process switching?
The execution context contains crucial data that allows the OS to save and restore the state of a process during a context switch.
What does a process consist of besides the program code (text section)?
- Current activity (program counter, processor’s registers)
- Process stack (temporary data like function parameters, return addresses, local variables)
- Data section (global variables)
- Heap (dynamically allocated memory during runtime)
What is stored in the process stack?
- Temporary data such as function parameters, return addresses, and local variables.
What is stored in the data section of a process?
Global variables.
What is the purpose of the heap in process structure?
The heap is used for memory dynamically allocated during the process’s runtime.
What is the “process image”?
The layout of a process in memory.
What is stored in the Stack Segment of a process?
Function calls and related data (such as local variables and return addresses).
What is stored in the Data Segment of a process?
Static variables, constants, and dynamic memory allocation from the heap.
What is contained in the Text Segment of a process
The program code, which is shared between processes.
What happens when a program is invoked in terms of process creation?
It results in the creation of a separate process, each with its own process image.
How does each process image appear to the system?
Each process image appears to “own” the complete address space.
How does each process image start at address 0?
Virtual to physical address mapping is required to achieve this.
What is a Process Control Block (PCB) also known as?
It is also called a Task Control Block (TCB).
What information is stored in a PCB?
- Process state (running, waiting, etc.)
- Program counter
- CPU registers
- CPU scheduling information
- Memory-management information
- Accounting information
- I/O status information
What is included under CPU scheduling information in a PCB?
- Priorities
- Scheduling queue pointers
What does the accounting information in a PCB include?
- CPU used
- Clock time elapsed since start
- Time limits
What are the different Process States during execution?
The Process States during execution are:
- New: The process is being created.
- Ready: The process is waiting to be assigned to a processor.
- Running: Instructions are being executed.
- Waiting (Blocked): The process is waiting for some event to occur.
- Terminated (Exited): The process has finished execution.
What is the main goal of process scheduling?
Maximize CPU use by quickly switching processes onto the CPU for time-sharing.