Goals of OS

 1. Maximum CPU utilization

The task of an operating system (OS) is to ensure that CPU utilization is maximized at all times. For example, consider processes P1, P2, and P3, with the CPU currently processing P1. If P1 needs to perform an input/output (I/O) operation, such as a copy-paste task, the CPU shouldn't remain idle during this time. Idle CPU not only consumes power unnecessarily but also reduces efficiency and speed by making other processes wait. Instead, the OS can switch the CPU to process P2 while P1 is handling its I/O operations, thereby maintaining continuous CPU utilization.

2. It ensures there is no process starvation

For example, if a CPU is executing a very large process like P1, it could cause other processes to wait indefinitely for their turn. If someone writes an infinite loop (e.g., while(1)), it could run endlessly, preventing other processes from executing. This situation is known as process starvation.

3. Ensures the execution of high-priority 

Imagine we have three processes running, and suddenly a high-priority task, like an anti-virus scan, needs to be executed. In this case, we want this high-priority task to run immediately, halting the other processes so it can be executed first.










Comments

Popular posts from this blog

Indexed allocation

Thrashing

Basics of paging