Processes Flashcards
(15 cards)
What is a process in an operating system?
A process is a program in execution where execution progresses sequentially. It includes the program (text) program counter (PC) stack and data section.
What are the types of programs executed by an operating system?
Batch system programs (jobs) and time-shared system programs (user programs or tasks).
List the states a process can be in during its lifecycle.
- New: The process is being created.
- Running: Instructions are being executed.
- Waiting: The process is waiting for some event to occur.
- Ready: The process is waiting to be assigned to a processor.
- Terminated: The process has finished execution.
What is a Process Control Block (PCB)?
The PCB is a kernel data structure storing information about each process including:
- Process state
- Program counter
- CPU registers
- CPU scheduling information
- Memory-management information
- Accounting information
- I/O status information
How is process information stored in Windows systems?
Using structures like the EPROCESS and PEB (Process Environment Block).
How is process information stored in Linux systems?
Linux uses the task_struct
kernel structure which contains fields like: - state
- stack
- pid
- tasks
(a list of processes) This can be inspected via /proc/pid
.
How are processes created?
Parent processes create children processes forming a tree of processes.
Processes are identified and managed via process identifiers (PIDs).
What are the resource-sharing methods in process creation?
- Parent and children share all resources.
- Children share a subset of the parent’s resources.
- Parent and children share no resources.
How do parent and child processes execute in relation to each other?
Execution can be concurrent or the parent process may wait until children terminate.
Describe the fork
and exec
system calls in UNIX.
-
fork
: Creates a new process. -exec
: Replaces the process’s memory space with a new program after a fork.
How is a process terminated?
A process terminates by: 1. Executing its last statement and requesting an exit
system call
What is context switching?
Context switching occurs when the CPU switches to another process saving the current process state and loading the state of the next process. The process context is represented in the PCB.
Why is context switching considered an overhead?
It is time-consuming and does no useful work. The time taken depends on the hardware support.
Summarize key points about processes in operating systems.
- A process is a program in execution
Where is context switching particularly important?
In multi-tasking systems where the OS needs to manage CPU usage efficiently across processes.