Wednesday, August 31, 2022

Process Scheduling Algorithms | Loksewa 2078 Question paper

 Q. Describe various process scheduling algorithms.  10 marks.

answer:
There are various algorithms which are used by the Operating System to schedule the processes on the processor.

The main reasons for scheduling algorithm are:
  1. To Maximize CPU utilization
  2. For Fair allocation of CPU
  3. To Maximize throughput
  4. To Minimize  turnaround time
  5. To Minimize waiting time
  6. To Minimize response time
Process scheduling algorithms consist of six types. Algorithms can either be non-preemptive or preemptive. Typically, non-preemptive algorithms prevent processes from being preempted until they have completed their allotted time, while preemptive scheduling is based on priority, in which a scheduler may preempt a low priority running process at any time when a high priority process becomes ready.

1.First Come First Service(FCFS)
This algorithm is the simplest algorithm. Those processes that arrive first will get the CPU.The faster the arrival time, the sooner the CPU will be available. It is the non-preemptive type of scheduling and is implemented by using FIFO queue.

Advantages:

  • Easy to implement
  • First come, first serve method

  • Disadvantages:
    •  It suffers from Convoy effect.
    •  average waiting time is much higher than the other algorithms
    • not much efficient
    2. Shortest Job First
       First, the process with the shortest burst time at a particular instant of time will be executed. In other words, it is a non-preemptive approach i.e. as soon as a process begins executing, it will be fully completed, and then some other process will take its place.

    Advantages
    • Best approach to minimize waiting time 
    • used for long term scheduling
    Disadvantages:
    • It has starvation
    • Many times it becomes complicated to predict the length of the upcoming CPU request
    3. Shortest Remaining Time
    This is the preemptive approach of the Shortest Job First algorithm. Here, at every instant of time, the CPU will check for some shortest job.

    Advantages:
    • Short processes will be executed first.
    Disadvantages:
    • It may result in starvation if short processes keep on coming.
    4. Priority Based Scheduling
    In this algorithm, the priority will be assigned to each of the processes. The higher the priority, the sooner will the process get the CPU. If the priority of the two processes is same then they will be scheduled according to their arrival time.

    Advantages:
    • The average waiting time is less than FCFS
    • Less complex
    Disadvantages:
    • It has Starvation Problem. This is the problem in which a process has to wait for a longer amount of time to get scheduled into the CPU. This condition is called the starvation problem.
    5. Round Robin
    The  algorithm where each process is cyclically assigned a fixed time slot. It is the preemptive version of First come First Serve CPU Scheduling algorithm. Round Robin CPU Algorithm generally focuses on Time Sharing technique.

    Advantages:
    • No starvation will be there in round-robin because every process will get chance for its execution.
    • Used in time-sharing systems.
    Disadvantages:
    • Need to  perform a lot of context switching here, which will keep the CPU idle

    6.Multilevel Queue Scheduling
    During multilevel queue scheduling, we divide a process into batches or queues, and give each queue a priority. It is thus necessary to maintain multiple queues for processes that share common characteristics, each queue having its own priority, and using some scheduling algorithm.

    Advantages:
    • It has a low scheduling overhead.
    Disadvantages:
    • Starvation problem
    • It is inflexible in nature
    Note:  For further strengthening the answers we can still add some small examples. This can be refer in internet. Take one example and utilize in all the scheduling algorithms, it will save the time and makes the answer precise

    Send us more question, we will provide the solution.

    Thank You! Stay Safe.

    @missionofficer





    No comments:

    Post a Comment

    Featured post

    Major Challenges for economic development of Nepal | Loksewa old Question Paper 2078

    Q. Wha t do you mean by Economic Growth and Economic Development?  What are the main challenges of economic development of Nepal? Give your ...

    Popular Posts