What Is CPU Scheduling?
What Is CPU Scheduling?
Round Robin (RR) is one of the simplest and most widely used CPU scheduling
algorithms. In Round Robin scheduling:
Example:
Binary Semaphore (Mutex): Can only have two values, 0 or 1. It's used for
mutual exclusion, ensuring that only one process accesses a resource at a time.
Counting Semaphore: Can have any non-negative integer value. It's used to
manage access to a resource that has a limited number of instances.
Applications:
4. What is Deadlock?
Deadlock occurs when the following four conditions are met simultaneously:
Deadlock can happen in various real-life scenarios. Here are a few examples:
Traffic Gridlock: At an intersection, cars from all directions enter the intersection
and block each other, resulting in no car being able to move.
Dining Philosophers Problem: Philosophers sitting around a table with a fork
between each pair. Each philosopher needs two forks to eat but picks up one fork
at a time, potentially leading to a situation where each philosopher has one fork
and is waiting for the other, causing a deadlock.
Resource Allocation in Offices: Multiple employees needing to use a printer
(resource A) and a scanner (resource B) might each hold one and wait for the
other, causing a standstill.
7. What is Virtual Memory?
Key concepts:
Paging: The process of dividing the virtual memory into fixed-size blocks called
pages, and physical memory into blocks called frames. Pages are mapped to
frames, allowing non-contiguous storage.
Swapping: The process of moving pages between physical memory and disk
storage to manage space and ensure that the most frequently accessed data
stays in RAM for quicker access.
Benefits:
Isolation: Each process has its own virtual address space, providing isolation and
protection.
Efficient use of memory: Not all parts of a program need to be in physical
memory simultaneously, allowing more programs to run concurrently.
Larger address space: Programs can use more memory than what is physically
available on the system.