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

Thursday, June 13, 2013

RTDroid : The onset of research

It was not too long ago when i set my eyes on the US Dream. To pursue Master's in the States, the global leader in Technological Research.
Even at the beginning of my Master's in Fall 2012, I was not very clear whether I would pursue a research career or just join the industry. Industry is always a very enticing prospect with companies like Google, Amazon, Microsoft and others visiting the campus for placements and internship opportunities.
I have always believed that conducting research work and publishing papers was possible only by dedicated people who locked themselves up in labs for hours at a stretch, staring at whiteboards and markers with only one thought of research hovering their genius brains. I respected such people and was inspired by them at the same time i was not fully ready to get into such shoes.
In between all this chaos going on in my head, I was given an invitation by my professor, Steve to attend a research project meeting. That meeting with Steve and Luke was soon going to change my view on how research was conducted and the process of how a researcher gets that unique ability to write those top quality papers and speak with pertinence. After being into the project for 3 months and on the verge of submitting my first workshop paper, i can assure everyone who wants to know, this is truly a great feeling. I've realized over the past few months, it is, for a large factor dependent on your adviser/mentor how you turn out to be as a research student and I am proud of my current advisers and to work with them. I've learnt that asking the right questions isn't developed overnight. It takes years of work to develop as a researcher and I might well be on my way to become one. Thank you Steve and Luke for providing me this opportunity. Finally, The project i am working on is titled RTDroid.