L-1.5: Process States in Operating System| Schedulers(Long term,Short term,Medium term)
Table of Contents
Introduction
This tutorial provides a comprehensive overview of process states in operating systems, focusing on the roles of various schedulers—long-term, short-term, and medium-term. Understanding these concepts is crucial for students preparing for exams like GATE and UGC NET, as well as for anyone seeking to deepen their knowledge in operating systems.
Step 1: Understanding Process States
Processes in an operating system can exist in several states throughout their lifecycle. The main states include:
- New: This is the initial state when a process is created.
- Ready: The process is ready to run and waiting for CPU time.
- Running: The process is currently being executed by the CPU.
- Terminate: The process has completed execution and is being removed from the system.
Step 2: Exploring the New State
- The "New" state occurs when a process is first initiated.
- The operating system allocates resources and prepares the process for execution.
- Upon initialization, the process transitions to the "Ready" state.
Step 3: Transition to the Ready State
- In the "Ready" state, multiple processes are waiting for CPU allocation.
- The operating system maintains a queue of these processes.
- Ready processes can move to the "Running" state when the CPU becomes available.
Step 4: The Role of the Long-Term Scheduler
- Also known as the job scheduler, the long-term scheduler controls the admission of processes into the system.
- It decides which processes are moved from the disk to main memory.
- The main goal is to maintain a balanced mix of I/O-bound and CPU-bound processes to optimize performance.
Step 5: Transition to the Running State
- When a process is selected by the short-term scheduler from the "Ready" queue, it transitions to the "Running" state.
- Here, the process is actively using the CPU to execute its instructions.
- The scheduler decides which process to run based on specific algorithms (e.g., FIFO, Round Robin).
Step 6: Moving to the Terminate State
- After completing its execution, a process enters the "Terminate" state.
- The operating system deallocates resources such as memory and handles any cleanup tasks.
- This transition frees up system resources for other processes.
Step 7: Understanding the Short-Term Scheduler
- The short-term scheduler, or CPU scheduler, determines which of the ready processes gets CPU time.
- It makes fast decisions, often based on priority or time-slicing.
- Key scheduling algorithms include:
- First-Come, First-Served (FCFS)
- Shortest Job Next (SJN)
- Round Robin (RR)
Step 8: The Role of the Medium-Term Scheduler
- The medium-term scheduler handles the swapping of processes in and out of memory.
- This is crucial for managing memory efficiently, especially in systems with limited resources.
- It allows the system to maintain a balance between active and inactive processes.
Step 9: Understanding Backing Store
- The backing store is a storage area (usually on disk) where processes are held when they are not in main memory.
- The medium-term scheduler decides which processes should be swapped in or out of the backing store based on their need for CPU time and resource usage.
Conclusion
Understanding the different process states and the role of each scheduler is essential for optimizing operating system performance. Key takeaways include the importance of balancing process types and managing resources effectively. For further exploration, consider studying specific scheduling algorithms and their real-world applications in operating systems.