Jared |

Another CS411 project finished! This time around we implemented an I/O scheduler for Linux. What is an I/O scheduler you may ask? Well, it simply manages requests usually from a block device (e.g. hard disk, media drive) and not a character device. An I/O scheduler needs to be fair and give a share of the disk bandwidth to each running process.

With SSTF, requests are serviced based on their proximity to the disk head, with requests closest to the disk head being serviced first. Requests are kept in a queue. The SSTF algorithm looks at the current disk head position and iterates through the queue looking for the request that is the shortest physical distance away. That request is the one that gets serviced next, and the process continues.

Is this the best I/O scheduling algorithm? No. I’m afraid not. If there is a request that was physically very far from the disk head it would possibly never get serviced. This dilemma is known as “starvation”.

More efficient algorithms use an “elevator” approach wheras the disk head moves along the disk surface picking up requests (people on different floors) and when it gets to the end of the disk (top floor) it can turn around and pick up more people (more requests).

We used the built-in linked list structure provided by linux. Many helpful functions were found in list.h.

Here is a good article that discusses changes in the 2.6 kernel from linuxjournal.com.

No tags

A recent project I completed in my Operating Systems II class was to improve the existing linux SLOB memory allocator from first-fit to best-fit. The kernel currently gives 3 choices of allocators (SLAB, SLUB, and SLOB). The SLOB (Simple List Of Blocks) allocator, is designed to be a small and efficient allocation framework for use in small systems such as embedded systems. Unfortunately, a major limitation of the SLOB allocator is that it suffers greatly from internal fragmentation.

There is a recent reply from Linus Torvalds himself on a Linux mailing list where he suggested the use of a best-fit algorithm.

The first-fit uses the first available space for memory. The best-fit algorithm my team implemented works by looping through the list of free pages until the first page found with enough free space. Then, we sort the list from smallest to largest free space. In this way the first space encountered by the algorithm will be the smallest space which fits the required amount available. Essentially, we are modifying the input to the algorithm to ensure better fragmentation rates and utilizing space on each page better.

There wasn’t a lot lines of code to add. It was a fairly simple hack, but I’m sure it could be even more efficient.
We compared the fragmentation from both algorithms and there was a definite difference.

The version of Linux we used was 2.6.23.17

No tags

May/08

1

X

X

No tags

Mar/08

26

VirTools Work

I will be showcasing progress of the work I’ve done using the Virtools Development Platform. I had a class that taught this tool at OSU called NMC 487 in Spring 2007.

“The Virtools development platform has been widely used in the video game market (prototyping and rapid development), as well as for other highly interactive 3D experiences, in web marketing, virtual product maintenance.”

No tags

I presented my final project for CS440 last Wednesday. Here are the slides my group used.

Sky Express (pdf)

Final Write-Up

No tags

I had a homework question that asked me to implement left outer join for the Sort-Merge Join algorithm for external sorting.

To compute a left outer join, we use the left relation as the outer loop or single-loop because every tuple in the left relation must appear in the result. If there are matching tuples in the other relation, the joined tuples are produced and saved in the result. However, if no matching tuple is found, the tuple is still included in the result but is padded with NULL values.

sort the tuples in R on attribute A;   ## assume R has n tuples (records)

sort the tuples in S on attribute B;    ## assume S has m tuples (records)

set i <- 1, j <- 1;

while (i <= n) and (j <= m)

## Use the left relation as the outer loop or single-loop because every tuple in the left relation must appear in the result.

do { if R(i)[A] > S(j)[B]  ##…Use the left outer join, because we don’t care about the right side.

                then set j <- j + 1

        elseif R(i)[A] < S(j)[B]

                then set i <- i + 1

else   {  ## If there are matching tuples in the other relation, the joined tuples are produced and     

             ##  saved in the result.

       ## R(i)[A] = S(j)[B], so we output a matched tuple

                       output the combined tuple <R(i), S(j)> to T;

               

                       ## output other tuples that match R(i), if any;

                       set l <- j + 1;

                       while (l <= m) and (R(i)[A] = S(l)[B])

                       do {  output the combined tuple <R(k), S(j)> to T;

                                 set k <- k + 1;

       }

       set i <- k, j <- l

                       ## for every tuple tr from R that does not match any tuple in S

                       output the combined tuplpe <R(i), S(j)> to T PADDED WITH NULLS;

       }

}

 

 

No tags

In a database management system it is essential that a query be optimized as much as possible to eliminate redundant data that could slow down the system. Query Optimization is used to eliminate expensive paths of execution for a query graph (or tree); e.g, find the lowest cost.

Example of Transforming a Query:
Consider the query Q that states “Find the last
names of employees born after 1957 who work
on a project named ‘Aquarius’.”

In SQL, this query can be specified as:
SELECT LNAME
FROM EMPLOYEE, WORKS_ON, PROJECT
WHERE PNAME=‘Aquarius’ AND ESSN=SSN
AND PNUMBER=PNO
AND BDATE > ‘1957-12-31’;

One way the tree can be shown:

You need to use certain heuristics to step through the tree and optimize.

General Summary of the algorithm to achieve this:

Summary of Heuristics for Algebraic Optimization:
- The main heuristic is to apply first the operations that reduce the
size of intermediate results.
- Perform select operations as early as possible to reduce the
number of tuples and perform project operations as early as
possible to reduce the number of attributes. (This is done by
moving select and project operations as far down the tree as
possible.)
- The select and join operations that are most restrictive should be
executed before other similar operations. (This is done by
reordering the leaf nodes of the tree among themselves and
adjusting the rest of the tree appropriately.)

No tags

Vista showed a seemingly large upgrade in file copy improvement, at least technically. The end user may not have thought so though, Perhaps the biggest drawback of the algorithm, and the one that has caused many Vista users to complain, is that for copies involving a large group of files between 256KB and tens of MB in size, the perceived performance of the copy can be significantly worse than on Windows XP”.

Mark Russinovich, a software engineer from Microsoft, explains what the internals of file copying in XP and shows what improvements were made for Vista and Vista Service Pack 1.

http://blogs.technet.com/markrussinovich/archive/2008/02/04/2826167.aspx

No tags

Jan/08

27

MyFireCrew.com

I am building a website for a wildland firefighting company. I’ve worked for this company the past two summers. It’s looking really nice so far.

http://myfirecrew.com 

No tags

Jan/08

27

Checkers is Solved?

Apparently some people have spent a lot of time creating a database of all the possible checkers moves in an 8×8 board. This was previously an unsolved problem. “The program has been improved enough to where it cannot lose a game.”

“This 8×8 variant of draughts (the English name for checkers) was weakly solved on April 29, 2007 by the team of Jonathan Schaeffer, known for Chinook, the “World Man-Machine Checkers Champion”. From the standard starting position, both players can guarantee a draw with perfect play.”

“The game of checkers has roughly 500 billion billion possible positions (5 x 1020). The task of solving the game, determining the final result in a game with no mistakes made by either player, is daunting. Since 1989, almost continuously, dozens of computers have been working on solving checkers, applying state-of-the-art artificial intelligence techniques to the proving process. This paper announces that checkers is now solved: Perfect play by both sides leads to a draw. This is the most challenging popular game to be solved to date, roughly one million times as complex as Connect Four. Artificial intelligence technology has been used to generate strong heuristic-based game-playing programs, such as Deep Blue for chess. Solving a game takes this to the next level by replacing the heuristics with perfection.

Department of Computing Science, University of Alberta, Edmonton, Alberta T6G 2E8, Canada.”

No tags

<< Latest posts

Older posts >>

Theme Design by devolux.nh2.me