Preview lessons, content and tests

Computer Science & Programming solved. All in one platform.

1. To trial the platform and take tests, please take a few seconds to SIGN UP and SET UP FREE.

2. Searching for something specific? See our text overview of all tests. Scroll right for levels, and lists.

3. Student and Teacher User Guides |  Schemes of Work |   Real Teacher use Videos |


Join 36000+ teachers and students using TTIO.

Scheduling

In computing, scheduling is the method by which work is assigned to resources that complete the work. The work may be virtual computation elements such as threads, processes or data flows, which are in turn scheduled onto hardware resources such as processors, network links or expansion cards.

Suggested Video

First in, first out (FIFO), also known as first come, first served (FCFS), is the simplest scheduling algorithm. FIFO simply queues processes in the order that they arrive in the ready queue. This is commonly used for a task queue, for example as illustrated below.

(Above) A sample thread pool (green boxes) with a queue (FIFO) of waiting tasks (blue) and a queue of completed tasks (yellow)

There are several different scheduling algorithms, which all have certain similarities:

  • they all use a queue to hold waiting processes
  • they all use the clock cycle to time the execution of processes
  • they all switch between processes

First come, first serve (FCFS)

In this algorithm, processes run on a first come, first serve (FCFS) basis. It is based on a first in, first out (FIFO) queue, where the processes arrive, are executed, then leave the queue in order. This is a slow algorithm because all the processes have to wait for the previous one to finish.

Round robin

Round robin is a much more efficient algorithm. Each process is given a fixed amount of time, then it is switched out and sent to the back of the queue. The next process then has its turn, and so on.

Priority based

In a priority-based algorithm, each process is given a priority based on several things, including how much time it needs and how much memory it will use. A process with a higher priority will be executed before a process with a lower priority. This is ‘fairer’ than either FCFS or round robin. If there is more than one process with the same priority, then FCFS is employed as well.

www.teachyourselfpython.com