Wednesday, June 26, 2013

Google Summer of Code '13 - Exploring Schedulers

I have been accpeted into the RTEMS Project for the Google Summer of Code 2013 and i will be developing a GlobalEDF Scheduler.

In this post i will put down my thoughts and also keep up-to date with the tasks i completed and will be completing.
At the end of the summer, the post should be self explanatory in terms of adding a scheduler into the RTEMS Code Base.

Files i added are "schedulerglobaledf.h" and "schedulerglobaledf.c".

"schedulerglobaledf.h" defines the entry points for the G-EDF Scheduler and the data structures used.

Whenever new header files are added into the code base we will need to re-run "bootstrap -p" to re build the preinstall.am files and also run "./bootstrap" to regenerate all the auto files.
The toolset needs to be built with --enable-maintainer-mode.

Files modified are
$r/cpukit/score/Makefile.am
$r/cpukit/sapi/include/confdefs.h

The G-EDF Scheduler can be configured using the CONFIGURE_SCHEDULER_GLOBALEDF.

Entry Points:
The entry points define the functionality of the scheduler and various tasks that govern the scheduler.

The Entry Points i defined for G_EDF are :

    _Scheduler_global_EDF_Initialize :
    _Scheduler_global_EDF_Schedule :
    _Scheduler_global_EDF_Yield :
    _Scheduler_global_EDF_Extract :
    _Scheduler_global_EDF_Enqueue_priority_fifo :
    _Scheduler_global_EDF_Allocate :
    _Scheduler_global_EDF_Enqueue_priority_fifo :
    _Scheduler_global_EDF_Enqueue_priority_lifo :
    _Scheduler_global_EDF_Extract :
    _Scheduler_global_EDF_Start_idle :

The G-EDF Scheduler uses a Chain-structure and a Red-Black Tree data-structure.
The priorities are proportional to deadlines in the G-EDF Scheduler.The threads are placed into the RB-Tree structure and are ordered based on the deadlines.  The Scheduled Chain contains "m" tasks proportional to "m" cores available in the system. Each node in the chain is allocated to a core/processor. Whenever a task completes execution or a core is available, the highest_ready task is pushed into the scheduled chain.

The entry points for my scheduler can be found at https://docs.google.com/a/buffalo.edu/document/d/1r_a7pFp_250ZoHq6mvnWOL6QXv5IQMyQMk0chRp43pU/edit?usp=sharing



Creating a Patch and Emailing the Patch to the rtems-devel list:

Clone the master using,
 git clone git://git.rtems.org/rtems.git rtems

and then create a local branch and make that branch your working copy using,

 git branch temporary
 git checkout temporary

Make your desired changes in that working copy and make sure it is working.

Commit the changes in your local copy.

 git add path/to/file
 git commit -m "Commit Message"

Now the files are commited to a local head.

To apply a patch you will be using the git format-patch

 git format-patch master -o /path/to/save/the/patch

using the -o is optional but lets you decide where you want to save the patch.

The next step is to email the patch,
for that on a debian distro you will need

 sudo apt-get git-send-email

or on a rpm based distro

 yum install git-email

and then you will need to configure your git smtp server and user names.

 git config --global sendemail.smtpserver smtp.gmail.com
 git config --global sendemail.smtpserverport 587
 git config --global sendemail.smtpencryption tls
 git config --global sendemail.smtpuser your_email@gmail.com

You can optionally save your password in the ~/.gitconfig file to eliminate the need of entering your password everytime.
 git config --global sendemail.smtppass your_password

You will also need to config your username and email using

 git config --global user.name "Your Name"
 git config --global user.email name@domain.com


Then the patch can be emailed using,

git send-email /path/to/patch --to rtems-devel@rtems.org

No comments:

Post a Comment