Professional Documents
Culture Documents
By Juan M. Banda
CS518 Advanced Operating Systems
Presentation Outline
Introduction
Project Description / Challenges
Background Information
Project Steps
Achievements
References
Introduction
What is Linux?
Operating system for computers, comparable to Windows or Mac OS X
Created starting in 1991 by Finnish programmer Linus Torvalds with the
assistance of developers from around the globe
Runs on a wide variety of hardware platforms, from huge mainframes to
desktop PCs to cell phones
Licensed under the Free Software Foundation's GNU Project's GNU
General Public License, version 2, which lets users modify and
redistribute the software
You can think of Linux as having two parts -- a kernel, which is the basic
interface between the hardware and other system software, and the
functions that run on top of it, such as a graphical user interface (GUI)
and application programs
Project Description / Challenges
Idea: Implement a new scheduling policy
An O(n) scheduler - Goes through the entire “ global runqueue” to determine the
next task to be run. This is an O(n) algorithm where 'n' is the number of
processes. The time taken was proportional to the number of active processes in
the system
A Global runqueue - All CPUs had to wait for other CPUs to finish execution.
When the scheduler assigns the CPU to the process, it leaves the process
descriptor in its current position in the runqueue list. If no other higher-
priority realtime process is runnable, the process will continue to use the
CPU as long as it wishes, even if other real-time processes having the
same priority are runnable
Background Information
SCHED_RR - A Round Robin real-time process
When the scheduler assigns the CPU to the process, it puts the process
descriptor at the end of the runqueue list. This policy ensures a fair
assignment of CPU time to all SCHED_RR real-time processes that have
the same priority
Checks the CPU to see whether an imbalance exists, and attempts to move tasks if not
load_balance
balanced.
Returns the effective priority of a task (based on the static priority, but includes any rewards or
effective_prio
penalties).
source_load Conservatively calculates the load of the source CPU (from which a task could be migrated).
target_load Liberally calculates the load of a target CPU (where a task has the potential to be migrated).
SCHED_ISO - To be implemented!!
Background Information
Interactivity estimator
Dynamically scales a tasks priority based on it's interactivity
Interactive tasks receive a prio bonus [ -5 ]
Hence a larger timeslice
Data
struct runqueue()
The main per-CPU runqueue data structure
struct task_struct()
The main per-process data structure
Background Information
Process Control methods
void set_user_nice ( ... )
Sets the nice value of task p to given value
rt_task( pid )
o Returns true if pid is real-time, false if not
yield()
Place the current process at the end of the runqueue and call
schedule()
Background Information
Benchmark
Each individual test runs a multiple of 25 processes, increments to the next
multiple and reruns the benchmark. This continues until a max level, set by the
tester, is achieved
Background Information
Now that we know all of this…..
$ uname -r
2.6.24-3-generic
Now we need to Install the Linux source for your kernel, you can substitute the kernel
number for whatever you are running. We also need to install the curses library and
some other tools to help us compile
If you are curious where the Linux source gets installed to, you can use the dpkg
command to tell you the files within a package
$ dpkg -L linux-source-2.6.17
Project Steps
To make things easier, we'll put ourselves in root mode by using sudo to open
a new shell. There's other ways to do this, but I prefer this way
$ sudo /bin/bash
$ cd /usr/src
$ bunzip2 linux-source-2.6.24.tar.bz2
$ tar xvf linux-source-2.6.24.tar
$ ln -s linux-source-2.6.24 linux
Project Steps
Make a copy of your existing kernel configuration to use for the custom
compile process
$ cp /boot/config-`uname -r` /usr/src/linux/.config
First we'll do a make clean, just to make sure everything is ready for the
compile
$ make-kpkg clean
Next we'll actually compile the kernel. This will take a LONG FREAKING
TIME, so go find something interesting to do
$ fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers
This process will create two .deb files in /usr/src that contain the kernel
Project Steps
Please note that when you run these next commands, this will set the new kernel as the
new default kernel. This could break things! If your machine doesn't boot, you can hit
Esc at the GRUB loading menu, and select your old kernel. You can then disable the
kernel in /boot/grub/menu.lst or try and compile again
$ dpkg -i linux-image-2.6.24.3-custom_2.6.24.3-custom-
10.00.Custom_i386.deb
$ dpkg -i linux-headers-2.6.24.3-custom_2.6.24.3-custom-
10.00.Custom_i386.deb
Now reboot your machine. If everything works, you should be running your
new custom kernel. You can check this by using uname. Note that the exact
number will be different on your machine
$ uname -r
2.6.17.14-ubuntu1-custom
Project Steps
Actual Kernel Files Modified:
sched.h
sched.c
Project Demo
Project Steps
Improvements ?
Questions ?
References
Kernel Design
http://aplawrence.com/Linux/linux26_features.html
http://www.linux.com/whatislinux/119700
http://www.ibm.com/developerworks/linux/library/l-scheduler/
http://lxr.linux.no/linux+v2.6.24/Documentation/sched-design.txt
SCHED_IDLE Reference:
https://kerneltrap.org/mailarchive/linux-kernel/2008/3/3/1051054
Chrt
http://www.cyberciti.biz/faq/howto-set-real-time-scheduling-priority-process/
Benchmark
http://devresources.linux-foundation.org/craiger/hackbench/