Professional Documents
Culture Documents
Osy Microproject 29
Osy Microproject 29
CHAPTER 1
SYNOPSIS
Project Title
None
Mr.Tannu R.R
CHAPTER 2
ABSTRACT
CHAPTER 3
INTRODUCTION
We will go through some basic information regarding CPU scheduling and some
keywords that are frequently used in CPU scheduling algorithms so that we can understand the
different algorithms better.
When the CPU is free, and its resources are available, then the CPU must
select a process from the ready queue and allocate resources for its execution. Selection is
performed with the help of CPU schedulers where the CPU scheduler selects a process from the
list of available processes (processes which are present in the ready queue).
CHAPTER 4
TYPES OF CPU SCHEDULING
Preemptive Scheduling:
In Preemptive Scheduling, the tasks are mostly assigned with their priorities. Sometimes it is
important to run a task with a higher priority before another lower priority task, even if the lower
priority task is still running. The lower priority task holds for some time and resumes when the
higher priority task finishes its execution.
CHAPTER 5
IMPORTANT CPU SCHEDULING TERMINOLOGIES
Process: It is the reference that is used for both job and user.
CHAPTER 6
CPU SCHEDULING CRITERIA
Maximize:
CPU utilization: CPU utilization is the main task in which the operating system needs to make
sure that CPU remains as busy as possible. It can range from 0 to 100 percent. However, for the
RTOS, it can be range from 40 percent for low-level and 90 percent for the high-level system.
Throughput: The number of processes that finish their execution per unit time is known
Throughput. So, when the CPU is busy executing the process, at that time, work is being done,
and the work completed per unit time is called Throughput.
Minimize:
Waiting time: Waiting time is an amount that specific process needs to wait in the ready queue.
Response time: It is an amount to time in which the request was submitted until the first
response is produced. the memory, waiting in the queue and, executing on the CPU.
CHAPTER 7
TYPES OF CPU SCHEDULING ALGORITHM
As the process enters the ready queue, its PCB (Process Control Block) is linked with the
tail of the queue. So, when CPU becomes free, it should be assigned to the process at the
beginning of the queue.
Analysing the given proccesses, first the process P1 will be executed. Therefore, waiting time of
process P1 will be 0.
As, process P1 takes 8 units of time for completion, so waiting time for process P2 will be 8.
Likewise, waiting time of process P3 will be execution time of process P1 + execution time for
process P2, i.e. (8 + 3) units = 11 units. F
urthermore, for process P4 it will be the sum of execution times of P1, P2 and P3.
Advantages of FCFS :
Simple
As the scheduling is non-preemptive so short processes which are at end of ready queue
have to wait for a larger time making them starve leading to problem of starvation.
PROCESS ARRIVAL TIME BURST TIME WAITING TIME TURN AROUND TIME
P1 1 7 0 7
P2 3 3 7 10
P3 6 2 2 4
P4 7 10 14 24
P5 9 8 4 12
Since arrival time of any process is not 0, there will be no execution or allocation of CPU
from time 0 to 1.
Following the algorithm further, process having the least burst time among the available
processes will be executed. Till now, we have only one process in the ready queue hence the
process will be scheduled no matter what the burst time is The process will be executed till 8
units of time. Till then three more processes have arrived in the ready queue therefore, the
process with the lowest burst time will be choosen. P3 will be executed next as it has lowest
burst time. So that's how the process will go on in shortest job first (SJF) scheduling algorithm.
Advantages of SJF :
Has minimum waiting time in comparison with other Scheduling Algorithms.
Disadvantages of SJF :
Very difficult to predict the burst time of processes.
It is the preemptive mode of SJF CPU scheduling in which resources are allocated to processes
according to the shortest remaining time.
PROCESS ARRIVAL TIME BURST TIME WAITING TIME TURN AROUND TIME
P1 0 8 12 20
P2 1 4 5 9
P3 2 2 0 2
P4 3 1 1 2
P5 4 3 6 9
P6 5 2 0 2
Starting with time t=0, the only available process is P1, as P1 being the only process
available so it is allocated with resources untill next process arrives.
At time t=1, the next process arrives in the ready queue. So, now there are two processes
in the ready queue. The remaining burst time for process P1 is now 7 units as it has been
executed for 1 unit till now. The burst time for P2 is 4,hence process P2 is provided with CPU
resources for the time being.
The next process P3 arrives at time t=2. Now the execution of P2 is stopped and the
processes are checked for least remaining burst time. Since the process P3 has burst time of 2
therefore it will be provided with CPU resources.
Process P4 arrives at t=3. Now the least burst time will be checked among the processes in
ready queue. P1 and P2 have 7 and 3 units as their burst time, also, burst time of both P3 and P4
is 1 unit, as remaining burst time being same, so the scheduling will be done according to their
arrival time. P3 arrives earlier therefore it will be provided with resources.
Process P5 arrives at time t=4. Now the remaining burst time of all the processes will be
compared and the process with least remaining burst time will be executed i.e. P4.
Process P6 arrives at time t=5, till now Process P4 has completed its execution. At last, 4
processes are available, i.e. P1 (7), P2 (3), P5 (3) and P6 (2). The Burst time of P6 is the least,
hence P6 is scheduled.
Now, as all processes have arrived, so the scheduling will continue to be according to SJF
schedule
Priority scheduling also helps OS to involve priority assignments. The processes with higher
priority should be carried out first, whereas jobs with equal priorities are carried out on a round-
robin or FCFS basis. Priority can be decided based on memory requirements, time requirements,
etc.
P1 2 1 0 0 1
P2 6 7 1 14 21
P3 3 3 2 0 3
P4 5 6 3 7 13
P5 4 5 4 1 6
P6 10 15 5 25 40
P7 9 8 6 16 24
At time 0, P1 arrives with the burst time of 1 units and priority 2. As no other process is
available so it will be provided with resources untill it finishes or next process arrives.
At time t=1, P2 arrives. As process P1 is complete and no other process is available so the
process P2 will be scheduled and will be provided with resources.
Process P3 arrives at time t=2, as the priority of P3 is higher, so the execution of P2 will be
stopped and P3 will be allocated with resources.
During the execution of P3, three more processes P4, P5 and P6 becomes available. Since,
all these three have the priority lower to the process in execution so PS can't preempt the process.
Now process P4 will be scheduled and will be assigned resources untill completion. As
process P2 is having highest priority after the process P4 so, P2 will be scheduled next.
P2 is assigned the CPU till the completion. As the remaining burst time is 6 units so
process P7 will be scheduled.
Advantages of PS :
The priority of the process can be selected first based on its memory consumption, etc.
Disadvantages of PS :
Processes with same priority requires second scheduling algorithm.
Starvation may occur as lower priority process keeps waiting for higher priority process.
5.Round-Robin Scheduling
Round robin is the oldest, simplest scheduling algorithm. The name of this algorithm comes from
the round-robin principle, where each person gets an equal share of something in turn. It is
mostly used for scheduling algorithms in multitasking. This algorithm method helps for
starvation free execution of processes.
P1 8 10 18
P2 3 4 7
P3 5 14 19
P4 3 11 14
Select the first process and start executing the process (for quantum time only). Check if any
other process request has arrived.
In case any process arrives during the execution time of first process the process will be added to
circular queue. After execution of the process for the quantum time, check for the availability of
processes.
If no process is in ready queue, then continue for the previous process. If not add current process
to the end of the ready queue.
Samarth Polytechnic, belhe 12 | P a g e
cpu scheduling algorithm
Take next process from ready queue and start executing it(same rules). Repeat all above steps till
all processes are complete.
Advantages of RR :
Priority is same for all processes as they are provided with same resources.
However, this is not an independent scheduling OS algorithm as it needs to use other types of
algorithms in order to schedule the jobs.
Processes are divided according to their type, memory consumption, etc.. in different
queues.
Advantages of Multilevel Queue :
Has low scheduling overhead.
Disadvantages of Multilevel Queue :
Can lead to starvation because running process can be preempted from low priority queue
when there is a new process in high priority queue.
CHAPTER 8
As we end this stage of the project, we would like to recommend other researches in this field or
related to:
1- Add visual effects to the program which will get more attention for the user when
implementing an algorithm.
2- Add sound effects to the program to make it more attractive. 48
3- Use a more powerful programming like visual C++ or VB .NET , which has more modules
and facilities.
4- Use other CPU scheduling algorithms like multilevel queue and others and add it .
CHAPTER 8
REFERENCE
http://www.homelanxtreme.com/wired-vs-wireless.htm
http://www.vicomsoft.com/knowledge/reference/wireless1.html#6
http://www.cert.org/tech_tips/home_networks.html#introduction
http://www.pcstats.com/articleview.cfm?articleID=1489
http://compnetworking.about.com/od/wirelesssecurity/
http://www.microsoft.com/hardware/broadbandnetworking/10_concept_what_is_wireless.mspx
http://www.infotel-systems.com/wireless%20networking%20outline.htm
http://www.homenethelp.com/web/diagram/index.asp