A)First in First out (FIFO)
Definition
•In computer programming, FIFO (first-in, first-out) is an approach to handling program work requests from queues or stacks so that the oldest request is handled next.•An abstraction in ways of organizing and manipulation of data relative to time and prioritization.
•This expression describes the principle of a queue processing technique or servicing conflicting demands by ordering process by first-come, first-served (FCFS) behaviour: what comes in first is handled first,
•Gives every process CPU time in the order the come
•The way data stored in a queue is processed
•Each item in the queue is stored in a queue (simpliciter) data structure
•The first data to be added to the queue will be the first data to be removed, then processing proceeds sequentially in the same order.
B)Round Robin Scheduling
Definition
•Round Robin is the simplest algorithm for a preemptive scheduler. Only a single queue of processes is used. When the system timer fires, the next process in the queue is switched to, and the preempted process is put back into the queue.Process
•Round-robin job scheduling may not be desirable if the size of the jobs or tasks are strongly varying.•A process that produces large jobs would be favoured over other processes.
•Each process is assigned a time slice or "quantum". This quantum dictates the number of system timer ticks the process may run for before being preempted. For example, if the timer runs at 100Hz, and a process' quantum is 10 ticks, it may run for 100 milliseconds (10/100 of a second). To achieve this, the running process is given a variable that starts at its quantum, and is then decremented each tick until it reaches zero. The process may also relinquish its quantum by doing a blocking system call (i.e. I/O), like in other preemptive algorithms.
•In the Round Robin algorithm, each process is given an equal quantum; the big question is how to choose the time quantum.
•Here are some considerations: The smaller the quantum, the larger the proportion of the time used in context switches.
Interactive processes should do I/O before being preempted, so that unnecessary preemptions are avoided.
The larger the quantum, the "laggier" the user experience - quanta above 100ms should be avoided.
•A frequently chosen compromise for the quantum is between 20ms and 50ms.
•Advantages of Round Robin include its simplicity and strict "first come, first served" nature. Disadvantages include the absence of a priority system: lots of low privilege processes may starve one high privilege one.
•Example ,by giving each job a time slot or quantum (its allowance of CPU time) ,and interrupt the job if it is not completed by then
Comments
Post a Comment