Sunteți pe pagina 1din 11

LOVELY PROFESSIONAL UNIVESITY

COMPARE CPU
SCHEDULING IN LINUX
AND UNIX
TERM PAPER OF OPERATING SYSTEM
Nitin Ranjan
11/16/2010
ROLL:-C2802B35
REGN NO:-10805970

[ In the below project there is the explanation of the process algorithms used in UNIX and
LINUX and there comparison..]
INDEX

1. Introduction

2. Introduction to unix

3. Unix scheduling algorithms

4. Problems in Unix scheduling

5. Introduction to linux

6. Linux process scheduling

7. Conclusion

8. Acknowledgement

9. References
ACKNOWLEDGEMENT
I wish to express my deepest gratitude and warmest appreciation to the
following people, who, in any way have contributed and inspired me to the
overall success of the undertaking term paper:
KAVITA CHOUDHARY MADAM who had assigned me this job to
enhance my knowledge, my parents who had been the continuous source of
financial aid and moral support and then my roommates who helped me to
complete my work on time.
NITIN
RANJAN
INTRODUCTION a) CPU utilization - to keep
the CPU as busy as
1. WHAT IS PROCESS possible.
SCHEDULING? b) Throughput - number of
processes that complete
To manage all the processes in their execution per time
unit.
ready queue for the maximum c) Turnaround - total time
utilization of CPU, this job is between submission of a
done by process scheduler on process and its
completion.
the basis of scheduling d) Waiting time - amount of
algorithms. Scheduling is a key time a process has been
concept in computer waiting in the ready
queue.
multitasking, multiprocessing ope
e) Response time - amount
rating system and real-time of time it takes from when
operating a request was submitted
until the first response is
system designs. Scheduling refers
produced.
to the way processes are assigned f) Fairness - Equal CPU
to run on the available CPUs, time to each thread.
since there are typically many 3. WHAT IS
SCHEDULING
more processes running than
ALGORITHMS?
there are available CPUs. This
assignment is carried out by These are the sum of
softwares known as instructions or system
a scheduler and dispatcher. calls the are followed by
scheduler to take job to
CPU.
2. WHAT IS PROCESS
TYPES OF
SCHEDULER?
SCHDULING
It takes the job from the ready ALGORITHMS:
queue and dispatch it to CPU
Primitive: these are those jobs in
according to scheduling
which we can take CPU back
algorithms
from the running process and
Scheduler is mainly reassign it after some time.
concerned with:
Primitive algos:

5 | Page
a. Round Robin “Unix” trademark. Only systems
b. Priority based fully compliant with and certified
according to the Single UNIX
c. Shortest remaining
Specification are qualified to use
time
the trademark; others might be
Non-Primitive : these are those called "Unix system-like" or
jobs in which we can’t take CPU "Unix-like" (though the Open
back from the running process. Group disapproves of this term).
Non-Primitive algos: However, the term "Unix" is
often used informally to denote
a. First come First serve
any operating system that closely
b. Priority based resembles the trademarked
system.During the late 1970s and
c. Shortest job first
early 1980s, the influence of
INTRODUCTION ABOUT Unix in academic circles led to
UNIX large-scale adoption of Unix
(particularly of the BSD variant,
Unix (officially trademarked originating from the University
as UNIX, sometimes also written of California, Berkeley) by
as UNIX with small caps) is a commercial startups, the most
computer operating notable of which are Solaris, HP-
system originally developed in UX and AIX. Today, in addition
1969 by a group to certified Unix systems such as
of AT&T employees at Bell those already mentioned, Unix-
Labs, including Ken like operating systems such
Thompson, Dennis Ritchie, Brian as Linux and BSD descendants
Kernighan, Douglas McIlroy, (FreeBSD, NetBSD,
and Joe Ossanna. Today's Unix andOpenBSD) are commonly
systems are split into various encountered. The term
branches, developed over time by "traditional Unix" may be used to
AT&T as well as various describe a Unix or an operating
commercial vendors and non- system that has the characteristics
profit organizations. of either Version 7
The Open Group, an industry Unix or UNIX System V.
standards consortium, owns the

6 | Page
UNIX scheduling
algorithms
UNIX uses MULTIFEED
BACK QUEUE.

Runnable processes are assigned


to run queues on their priority.

TIME SLICED FOR THE


PROCESSES IS IN
FOLLOWING MANNER:
SCHEDULING PRIORITIES
• run queues
IN THE PROCESSING
are scanned from top to
bottom
• first process on non- Scheduling priorities are
empty queue is run dynamically adjusted to reflect
• processes on a queue are
run round robin with • requirements for
equal time slices resources
• blocking processes are • recent CPU usage
removed from run queue
• processes using up and processes shuffled between
their time slice are queues accordingly.
scheduled at end of queue
Users express requirements for
processes via nice factors that

• improve process priority


the lower they are
• lie between -20 (high) and
20 (low) (default 0)
• user may only set
between 0 and 20 unless
superuser

NOTE: UNIX doesn't preempt


or context switch processes in
kernel mode.

7 | Page
world. Desktop use of Linux has
increased in recent years, partly
owing to the
Problems In Unix popular Ubuntu, Fedora,
Scheduling and openSUSE distributions and
the emergence
A) They do not provide of netbooks and smartphones run
adequate support for SMP
ning an embedded Linux.
systems
B) They do not scale well as The development of Linux is one
the number of tasks on the
of the most prominent examples
system grows.
of free and open source
software collaboration; typically
all the underlying source codecan
be used, freely modified, and
INTRODUCTION TO LINUX
redistributed, both commercially
and non-commercially, by
Linux (commonly pronounced /
anyone under licenses such as
ˈlɪnəks/ LIN-əks in American
the GNU General Public License.
English, also pronounced /
Typically Linux is packaged in a
ˈlɪnʊks/ LIN-ooks in Europe and
format known as a Linux
Canada) refers to the family
distribution for desktop and
ofUnix-like computer operating
server use. Linux distributions
systems using the Linux kernel.
include the Linux kernel and all
Linux can be installed on a wide
of the supporting software
variety of computer hardware,
required to run a complete
ranging from mobile
system, such
phones,tablet
as utilities and libraries, the X
computers and video game
Window System,
consoles,
the GNOME and KDE desktop
to mainframes and supercompute
environments, and the Apache
rs. Linux is the
HTTP Server. Commonly used
leading server OS, accounting for
applications with desktop Linux
more than 50% of installations
systems include the Mozilla
and runs the top 10
Firefox web-browser,
fastest supercomputers in the
theOpenOffice.org office
8 | Page
application suite and threads. Process scheduling and
the GIMP image editor. application prioritization is a
must to know specially on
The name "Linux" comes from
thousand server farms and/or
the Linux kernel, originally
enteprise world of linux
written in 1991 by Linus
computing.
Torvalds. The main
supporting user space system
tools and libraries from the GNU
Project (announced in 1983
Linux process Scheduling
by Richard Stallman) are the
basis for the Free Software The Linux kernel ran a variation
Foundation's preferred of the traditional UNIX
scheduling algorithm.
name GNU/Linux. In linux, all Linux scheduler uses
process runs with their own PREEMITIVE PRIORITY
respective scheduling priorities BASED SCHEDULING
ALGORITHM
and process attributes on every
Linux assigns higher-priority
CPU cycle that simply affects tasks longer time quanta and
how linux kernel sets CPU lower-priority tasks shorter time
quanta. The relationship between
resources and process priorities
priorities and time-slice length is
to a particular PIDS. There are shown in Figure
three categories of linux
scheduling policies namely:
a. SCHED_OTHER - this is the
default linux scheduling policy.
b. SCHED_FIFO - stands for
FIFO, first in first out policy
scheme.
c. SCHED_RR, or
SCHED_BATCH - stand for
linux round-robin schedule
policy.
This linux blog entry covers an Figure
5.13
alternative approach,besides from
The relationship between
using nice and renice, on priority priorities and time-slice length
scheduling of linux process and
9 | Page
A runnable task is considered other tasks have dynamic
eligible for execution on the CPU priorities that are based on their
as long as it has time remaining nice values plus or minus the
in its time slice. When a task has value 5. The interactivity of a
exhausted its time slice, it is task determines whether the
considered expired and is not value 5 will be added to or
eligible for execution again until subtracted from the nice value. A
all other tasks have also task's interactivity is determined
exhausted their time quanta. The by how long it has been sleeping
kernel maintains a list while waiting for I/O.
of all runnable tasks in a
runqueue data structure. Because
of its support for SMP, each
processor maintains its own
runqueue and schedules itself
independently. Each runqueue
contains two priority arrays—
active and expired. The active
array contains all tasks with time
remaining in their time slices,
and the expired array contains all
expired tasks. Each of these
priority arrays contains a list of
Tasks that are more interactive
tasks indexed according to
typically have longer sleep times
priority (Figure 5.14). The
and therefore are more likely to
scheduler chooses the task with
have adjustments closer to -5, as
the highest priority from the
the scheduler favors interactive
active array for execution on the
tasks. The result of such
CPU. On multiprocessor
adjtistments will be higher
machines, this means that each
priorities for these tasks.
processor is scheduling the
Conversely, tasks with shorter
highest-priority task from its own
sleep times are often more CPU-
runqueue structure. When all
bound and thus will have their
tasks have
priorities lowered. The
exhausted their time slices (that
recalculation of a task's dynamic
is, the active array is empty), the
priority occurs when the task has
two priority arrays are
exhausted its time quantum and is
exchanged; the expired array
to be moved to the expired array.
becomes the active array, and
Thus, when the two arrays are
vice versa.
exchanged, all tasks in the new
active array have been assigned
new priorities and corresponding
Linux implements real-
time slices.
time scheduling as defined by
POSIX.lb. Real-time tasks are
assigned static priorities. All
10 | P a g e
level-for-algorithm-for-
buffer-allocation-780994/
CONCLUSION
g. operating system by
LINUX uses much better galvin
algorithm than UNIX because in
UNIX uses MULTIFEEDBACK
BACK QUEUE there actually
we use 3 algorithms different for Bibliography
different stage so that they do not
provide adequate support for • book-operating system
SMP systems concepts by silberschatz
They do not scale well as the galvin gagne.
number of tasks on the system • google
grows but in ROUND ROBIN
large queues are also managed
well

REFERENCES
a. www.cs.gsu.edu/~cscbecx
/.../process_scheduling.pp
t

b. www.informit.com › ...
› Linux/UNIX/Open
Source

c. www.geekinterview.com
› ... › Windows & Unix

d. oreilly.com/catalog/linux
kernel/chapter/ch10.html

e. www.informit.com
› Articles › Operating
Systems, Server

f. www.linuxquestions.org/.
../processor-priority-

11 | P a g e

S-ar putea să vă placă și