Sistemas Operativos 6/9 - Gestión del Núcleo y los Procesos de los Sistemas Operativos
Understanding Process Management in Operating Systems
What is a Process?
- A process is defined as a program in execution, consisting of a sequence of instructions aimed at achieving a specific task. Each process maintains its own program counter and variables, isolated from others.
- Even if the same program runs multiple times, each instance operates with its own set of records while sharing the same memory region for live code. This code remains unchanged unless a different version of the program is executed.
Creation and Lifecycle of Processes
- Processes can be created through four primary methods: system startup, execution from another process via system calls, deliberate requests to create processes, or starting batch jobs.
- The lifecycle of a process includes creation, instruction execution, and termination. During this cycle, processes may experience various states such as normal exit, error exit, fatal error, or being terminated by another process.
States of Processes
- The states that processes can occupy include executing (actively using CPU), blocked (waiting for an external event), ready (available for CPU allocation), and suspended (temporarily inactive). These states help manage the execution flow within the operating system.
- A diagram illustrates how processes transition between these states based on their availability and participation in the system's operations. For example, when blocked due to waiting for resources or events before becoming ready again.
Process Scheduling
Objectives and Types
- Process scheduling aims to distribute CPU time among executable processes effectively. There are three levels of scheduling:
- Short-term: Selects which ready state process will execute next.
- Medium-term: Decides which processes should be suspended or resumed.
- Long-term: Adds new processes from waiting lists into active competition for resources.
Scheduling Methods
- Two main approaches exist for scheduling:
- Without eviction: Processes retain CPU access until they voluntarily release it.
- With eviction: The OS interrupts periodically to reclaim CPU time from running processes to optimize overall system performance.
Process Control Block (PCB)
- The PCB serves as a special register where all necessary information about a particular process is stored by the operating system upon creation; it acts as a runtime descriptor throughout the life cycle of that process. When finished, its PCB is erased for reuse by other processes.
Types of Scheduling Strategies
- Job Scheduling: Determines which jobs compete actively for resources (admission scheduling).
- Intermediate Level Scheduling: Manages short-term fluctuations in load by allowing certain processes to compete for CPU access while performing suspensions/activations.