Algorithms

Shortest Job First Scheduling Algorithm

Shortest Job First (SJF) scheduling algorithm is a non-preemptive scheduling algorithm used in operating systems and CPU scheduling. The main idea behind SJF is to execute the process with the shortest burst time first. In SJF scheduling, the scheduler selects the process with the smallest burst time from the ready queue for execution. Burst time refers to the time required by a process to complete its execution on the CPU. Once a process starts its execution, it continues until it finishes. SJF scheduling algorithm is optimal in terms of minimizing average waiting time for a given set of processes, assuming that all processes are available at the start.

Dining Philosopher's Problem with Semaphore

The Dining Philosophers Problem is a classic synchronization problem used to illustrate the challenges of resource allocation and deadlock avoidance in concurrent systems. In this problem, a number of philosophers sit around a circular table with a plate of spaghetti in front of each. Between each pair of adjacent philosophers, there is a single fork. The philosophers alternate between thinking and eating, and to eat, they need two forks. However, they must avoid deadlock, where each philosopher holds one fork and waits indefinitely for the other.

C-Look Disc Scheduling Algorithm

The C-Look Disk Scheduling Algorithm is a variation of the traditional disk scheduling method, designed to optimize seek time when accessing data on a disk. Unlike the C-Scan algorithm, which always scans to the end of the disk regardless of the location of pending requests, C-Look scans only to the last request in the current direction before reversing direction. By eliminating unnecessary scanning to the end of the disk, C-Look reduces overhead and improves disk access efficiency. This algorithm prioritizes pending requests based on the current direction of the disk arm, resulting in more efficient movement and reduced average response time.

First-in-First-Out(FIFO) page Replacement Algorithm

The First-in-First-Out (FIFO) page replacement algorithm is one of the simplest and most intuitive methods used in operating systems to manage memory. In FIFO, pages are evicted from memory in the order they were brought in, akin to a queue structure. When a page fault occurs and there is no space left in memory, the oldest page (the one that entered memory first) is replaced with the new incoming page. FIFO operates on the principle that the pages that have been in memory the longest are less likely to be needed in the near future, making them good candidates for replacement.