What is Resource Management with respect to Operating System?
A computer generally has one OS which becomes active whenever the system is turned on. In cases of multi-user or multi-tasking system, resources such as the main memory, CPU cycles, and file storage are to be allocated to each user or job by the OS. The OS uses the scheduling algorithm for Operating System Resource Management.
In a nutshell, resource management is the dynamic allocation and deallocation of the system resources (CPU, Memory pages & various types of bandwidths) to computations that compete for these resources. The main objective of the OS resource management is to optimize responsiveness of the system.
Breakdown of System Resource Management
Memory management: when a program is executing, it resides in the main memory while its instructions are processed sequentially in the fetch-decode-execute cycle. The multiprogramming technique keeps multiple programs in the main memory at the same time. Each program competes for access to the CPU. Now, the OS must perform a memory management function on each program to keep track of each program. Especially where they reside in the memory. The OS uses the function of physical and logical addresses to solve this problem.
Process Management: another very vital function of the OS with respect to resource management is process management. Various processes compete for CPU time but only one process can be run at a given time by the CPU. To fully understand how the OS does process management we must look at the stages that a process undergoes during computation.
The Process State Diagram
The above image describes the various stages of a process execution cycle from start to end. When a process is created and has no barriers to its execution, it is moved to the ready stage. At the ready state, it is not waiting for any event or additional data. Instead, it patiently awaits its turn to access the CPU. Then, when it gets to its turn to execute, it enters the running state and its instructions are processed in the fetch-execute cycle by the CPU. When a process is in the waiting state, it usually needs an additional resource (I/0 or signal from another process) for it to execute. Finally, a process that gets to the terminate state has completed its execution.
The OS uses a scheduling algorithm to assign processes to the CPU at a given time. This is achieved through a timesharing mechanism which allows multiple users to interact with the system at the same time. Remember that multiprogramming allows multiple processes (users) to be active at the same time. But here timesharing creates the avenue for each user to gain exclusive access to the computer. The CPU scheduling determines which process in the ready state of the process execution cycle should be moved to the running state. The three popular CPU scheduling algorithm are; First-come, First-serve algorithm, shortest job next algorithm, and then, the round robin algorithm.