diff --git a/scheduler/interval-generator.h b/scheduler/interval-generator.h
new file mode 100644
index 0000000..e480ecc
--- /dev/null
+++ b/scheduler/interval-generator.h
@@ -0,0 +1,33 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef INTERVAL_GENERATOR_H
+#define INTERVAL_GENERATOR_H
+
+#include <boost/shared_ptr.hpp>
+
+using namespace std;
+
+class IntervalGenerator;
+typedef boost::shared_ptr<IntervalGenerator> IntervalGeneratorPtr;
+
+class IntervalGenerator
+{
+public:
+  virtual ~IntervalGenerator () { }
+  
+  virtual double
+  nextInterval() = 0;
+};
+
+
+#endif // INTERVAL_GENERATOR_H
diff --git a/scheduler/one-time-task.cc b/scheduler/one-time-task.cc
new file mode 100644
index 0000000..b3082af
--- /dev/null
+++ b/scheduler/one-time-task.cc
@@ -0,0 +1,43 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "one-time-task.h"
+#include "scheduler.h"
+
+OneTimeTask::OneTimeTask(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler, double delay)
+            : Task(callback, tag, scheduler)
+{
+  setTv(delay);
+}
+
+void
+OneTimeTask::run()
+{
+  if (!m_invoked)
+  {
+    m_callback();
+    m_invoked = true;
+    deregisterSelf();
+  }
+}
+
+void
+OneTimeTask::deregisterSelf()
+{
+  m_scheduler->deleteTask(m_tag);
+}
+
+void
+OneTimeTask::reset()
+{
+  m_invoked = false;
+}
diff --git a/scheduler/one-time-task.h b/scheduler/one-time-task.h
new file mode 100644
index 0000000..744ca90
--- /dev/null
+++ b/scheduler/one-time-task.h
@@ -0,0 +1,40 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef ONE_TIME_TASK_H
+#define ONE_TIME_TASK_H
+
+#include "task.h"
+
+class OneTimeTask : public Task
+{
+public:
+  OneTimeTask(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler, double delay);
+  virtual ~OneTimeTask(){}
+
+  // invoke callback and mark self as invoked and deregister self from scheduler
+  virtual void
+  run() _OVERRIDE;
+
+  // after reset, the task is marked as un-invoked and can be add to scheduler again, with same delay
+  // if not invoked yet, no effect
+  virtual void
+  reset() _OVERRIDE;
+
+private:
+  // this is to deregister itself from scheduler automatically after invoke
+  void
+  deregisterSelf();
+};
+
+
+#endif // EVENT_SCHEDULER_H
diff --git a/scheduler/periodic-task.cc b/scheduler/periodic-task.cc
new file mode 100644
index 0000000..110c4df
--- /dev/null
+++ b/scheduler/periodic-task.cc
@@ -0,0 +1,48 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "periodic-task.h"
+#include "logging.h"
+#include <utility>
+
+INIT_LOGGER ("Scheduler.PeriodicTask");
+
+PeriodicTask::PeriodicTask(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler,
+                           IntervalGeneratorPtr generator)
+  : Task(callback, tag, scheduler)
+  , m_generator(generator)
+{
+}
+
+void
+PeriodicTask::run()
+{
+  if (!m_invoked)
+  {
+    m_invoked = true;
+    m_callback();
+
+    if (m_invoked)
+      {
+        // m_invoked getting back if it is rescheduled inside the callback
+        m_scheduler->rescheduleTask(m_tag);
+      }
+  }
+}
+
+void
+PeriodicTask::reset()
+{
+  m_invoked = false;
+  double interval = m_generator->nextInterval();
+  setTv(interval);
+}
diff --git a/scheduler/periodic-task.h b/scheduler/periodic-task.h
new file mode 100644
index 0000000..303dca4
--- /dev/null
+++ b/scheduler/periodic-task.h
@@ -0,0 +1,41 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef PERIODIC_TASK_H
+#define PERIODIC_TASK_H
+
+#include "task.h"
+#include "scheduler.h"
+#include "interval-generator.h"
+
+class PeriodicTask : public Task
+{
+public:
+  // generator is needed only when this is a periodic task
+  // two simple generators implementation (SimpleIntervalGenerator and RandomIntervalGenerator) are provided;
+  // if user needs more complex pattern in the intervals between calls, extend class IntervalGenerator
+  PeriodicTask(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler, IntervalGeneratorPtr generator);
+  virtual ~PeriodicTask(){}
+
+  // invoke callback, reset self and ask scheduler to schedule self with the next delay interval
+  virtual void
+  run() _OVERRIDE;
+
+  // set the next delay and mark as un-invoke
+  virtual void
+  reset() _OVERRIDE;
+
+private:
+  IntervalGeneratorPtr m_generator;
+};
+
+#endif // PERIODIC_TASK_H
diff --git a/scheduler/random-interval-generator.h b/scheduler/random-interval-generator.h
new file mode 100644
index 0000000..476578c
--- /dev/null
+++ b/scheduler/random-interval-generator.h
@@ -0,0 +1,80 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef RANDOM_INTERVAL_GENERATOR_H
+#define RANDOM_INTERVAL_GENERATOR_H
+
+#include "interval-generator.h"
+
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/random/uniform_real.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
+
+// generates intervals with uniform distribution
+class RandomIntervalGenerator : public IntervalGenerator
+{
+public:
+  typedef enum
+  {
+    UP = 1,
+    DOWN = 2,
+    EVEN = 3
+  } Direction;
+
+public:
+  // percent is random-range/interval; e.g. if interval is 10 and you wish the random-range to be 2
+  // e.g. 9 ~ 11, percent = 0.2
+  // direction shifts the random range; e.g. in the above example, UP would produce a range of
+  // 10 ~ 12, DOWN of 8 ~ 10, and EVEN of 9 ~ 11
+  RandomIntervalGenerator(double interval, double percent, Direction direction = EVEN)
+  // : m_rng(time(NULL))
+    : m_rng (static_cast<int> (boost::posix_time::microsec_clock::local_time().time_of_day ().total_nanoseconds ()))
+  , m_dist(0.0, fractional(percent))
+  , m_random(m_rng, m_dist)
+  , m_direction(direction)
+  , m_percent(percent)
+  , m_interval(interval)
+  { }
+
+  virtual ~RandomIntervalGenerator(){}
+
+  virtual double
+  nextInterval() _OVERRIDE
+  {
+    double percent = m_random();
+    double interval = m_interval;
+    switch (m_direction)
+      {
+      case UP: interval = m_interval * (1.0 + percent); break;
+      case DOWN: interval = m_interval * (1.0 - percent); break;
+      case EVEN: interval = m_interval * (1.0 - m_percent/2.0 + percent); break;
+      default: break;
+      }
+
+    return interval;
+  }
+
+private:
+  inline double fractional(double x) { double dummy; return abs(modf(x, &dummy)); }
+
+private:
+  typedef boost::mt19937 RNG_TYPE;
+  RNG_TYPE m_rng;
+  boost::uniform_real<> m_dist;
+  boost::variate_generator<RNG_TYPE &, boost::uniform_real<> > m_random;
+  Direction m_direction;
+  double m_percent;
+  double m_interval;
+
+};
+#endif // RANDOM_INTERVAL_GENERATOR_H
diff --git a/scheduler/scheduler-all.h b/scheduler/scheduler-all.h
new file mode 100644
index 0000000..388a74c
--- /dev/null
+++ b/scheduler/scheduler-all.h
@@ -0,0 +1,24 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef SCHEDULE_ALL_H
+#define SCHEDULE_ALL_H
+
+#include "scheduler/interval-generator.h"
+#include "scheduler/one-time-task.h"
+#include "scheduler/periodic-task.h"
+#include "scheduler/random-interval-generator.h"
+#include "scheduler/scheduler.h"
+#include "scheduler/simple-interval-generator.h"
+#include "scheduler/task.h"
+
+#endif
diff --git a/scheduler/scheduler.cc b/scheduler/scheduler.cc
new file mode 100644
index 0000000..02ac0c0
--- /dev/null
+++ b/scheduler/scheduler.cc
@@ -0,0 +1,338 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "scheduler.h"
+#include "one-time-task.h"
+#include "periodic-task.h"
+#include "logging.h"
+
+#include <utility>
+#include <boost/make_shared.hpp>
+
+INIT_LOGGER ("Scheduler");
+
+using namespace std;
+using namespace boost;
+
+#define EVLOOP_NO_EXIT_ON_EMPTY 0x04
+
+static void
+dummyCallback(evutil_socket_t fd, short what, void *arg)
+{
+  // 1 year later, that was a long run for the app
+  // let's wait for another year
+  timeval tv;
+  tv.tv_sec = 365 * 24 * 3600;
+  tv.tv_usec = 0;
+  event *ev = *(event **)arg;
+  int res = evtimer_add(ev, &tv);
+}
+
+// IntervalGeneratorPtr
+// IntervalGenerator:: Null;
+
+void errorCallback(int err)
+{
+  _LOG_ERROR ("Fatal error: " << err);
+}
+
+Scheduler::Scheduler()
+  : m_running(false)
+  , m_executor(1)
+{
+  event_set_fatal_callback(errorCallback);
+  evthread_use_pthreads();
+  m_base = event_base_new();
+
+  // This is a hack to prevent event_base_loop from exiting;
+  // the flag EVLOOP_NO_EXIT_ON_EMPTY is somehow ignored, at least on Mac OS X
+  // it's going to be scheduled to 10 years later
+  timeval tv;
+  tv.tv_sec = 365 * 24 * 3600;
+  tv.tv_usec = 0;
+  m_ev = evtimer_new(m_base, dummyCallback, &m_ev);
+  int res = evtimer_add(m_ev, &tv);
+  if (res < 0)
+  {
+    _LOG_ERROR("heck");
+  }
+}
+
+Scheduler::~Scheduler()
+{
+  shutdown ();
+  evtimer_del(m_ev);
+  event_free(m_ev);
+  event_base_free(m_base);
+}
+
+void
+Scheduler::eventLoop()
+{
+  while(true)
+  {
+    if (event_base_loop(m_base, EVLOOP_NO_EXIT_ON_EMPTY) < 0)
+    {
+      _LOG_DEBUG ("scheduler loop break error");
+    }
+    else
+    {
+      _LOG_DEBUG ("scheduler loop break normal");
+    }
+
+    {
+      ScopedLock lock(m_mutex);
+      if (!m_running)
+        {
+          _LOG_DEBUG ("scheduler loop break normal");
+          break;
+        }
+    }
+
+    // just to prevent craziness in CPU usage which supposedly should not happen
+    // after adding the dummy event
+    usleep(1000);
+  }
+}
+
+void
+Scheduler::execute(Executor::Job job)
+{
+  m_executor.execute(job);
+}
+
+void
+Scheduler::start()
+{
+  ScopedLock lock(m_mutex);
+  if (!m_running)
+  {
+    m_thread = boost::thread(&Scheduler::eventLoop, this);
+    m_executor.start();
+    m_running = true;
+  }
+}
+
+void
+Scheduler::shutdown()
+{
+  bool breakAndWait = false;
+  {
+    ScopedLock lock (m_mutex);
+    if (m_running)
+      {
+        m_running = false;
+        breakAndWait = true;
+      }
+  }
+
+  if (breakAndWait)
+    {
+      event_base_loopbreak(m_base);
+      m_executor.shutdown();
+      m_thread.join();
+    }
+}
+
+TaskPtr
+Scheduler::scheduleOneTimeTask (SchedulerPtr scheduler, double delay,
+                                const Task::Callback &callback, const Task::Tag &tag)
+{
+  TaskPtr task = make_shared<OneTimeTask> (callback, tag, scheduler, delay);
+  if (scheduler->addTask (task))
+    return task;
+  else
+    return TaskPtr ();
+}
+
+TaskPtr
+Scheduler::schedulePeriodicTask (SchedulerPtr scheduler, IntervalGeneratorPtr delayGenerator,
+                                 const Task::Callback &callback, const Task::Tag &tag)
+{
+  TaskPtr task = make_shared<PeriodicTask> (callback, tag, scheduler, delayGenerator);
+
+  if (scheduler->addTask (task))
+    return task;
+  else
+    return TaskPtr ();
+}
+
+bool
+Scheduler::addTask(TaskPtr newTask, bool reset/* = true*/)
+{
+  if (addToMap(newTask))
+  {
+    if (reset)
+      {
+        newTask->reset();
+      }
+    int res = evtimer_add(newTask->ev(), newTask->tv());
+    if (res < 0)
+    {
+      _LOG_ERROR ("evtimer_add failed for " << newTask->tag());
+    }
+    return true;
+  }
+  else
+  {
+    _LOG_ERROR ("fail to add task: " << newTask->tag());
+  }
+
+  return false;
+}
+
+void
+Scheduler::deleteTask(TaskPtr task)
+{
+  deleteTask (task->tag ());
+}
+
+void
+Scheduler::rescheduleTask(TaskPtr task)
+{
+  ScopedLock lock(m_mutex);
+  TaskMapIt it = m_taskMap.find(task->tag());
+  if (it != m_taskMap.end())
+  {
+    TaskPtr task = it->second;
+    task->reset();
+    int res = evtimer_add(task->ev(), task->tv());
+    if (res < 0)
+    {
+      _LOG_ERROR ("evtimer_add failed for " << task->tag());
+    }
+  }
+  else
+  {
+    addTask(task);
+  }
+}
+
+void
+Scheduler::rescheduleTask(const Task::Tag &tag)
+{
+  ScopedLock lock(m_mutex);
+  TaskMapIt it = m_taskMap.find(tag);
+  if (it != m_taskMap.end())
+  {
+    TaskPtr task = it->second;
+    task->reset();
+    int res = evtimer_add(task->ev(), task->tv());
+    if (res < 0)
+    {
+      cout << "evtimer_add failed for " << task->tag() << endl;
+    }
+  }
+}
+
+void
+Scheduler::rescheduleTaskAt (const Task::Tag &tag, double time)
+{
+  ScopedLock lock(m_mutex);
+  TaskMapIt it = m_taskMap.find (tag);
+  if (it != m_taskMap.end())
+  {
+    TaskPtr task = it->second;
+    task->reset();
+    task->setTv (time);
+
+    int res = evtimer_add(task->ev(), task->tv());
+    if (res < 0)
+    {
+      _LOG_ERROR ("evtimer_add failed for " << task->tag());
+    }
+  }
+  else
+    {
+      _LOG_ERROR ("Task for tag " << tag << " not found");
+    }
+}
+
+void
+Scheduler::rescheduleTaskAt (TaskPtr task, double time)
+{
+  ScopedLock lock(m_mutex);
+  TaskMapIt it = m_taskMap.find(task->tag());
+  if (it != m_taskMap.end())
+  {
+    TaskPtr task = it->second;
+    task->reset();
+    task->setTv (time);
+
+    int res = evtimer_add(task->ev(), task->tv());
+    if (res < 0)
+    {
+      _LOG_ERROR ("evtimer_add failed for " << task->tag());
+    }
+  }
+  else
+  {
+    task->setTv (time); // force different time
+    addTask (task, false);
+  }
+}
+
+
+bool
+Scheduler::addToMap(TaskPtr task)
+{
+  ScopedLock lock(m_mutex);
+  if (m_taskMap.find(task->tag()) == m_taskMap.end())
+  {
+    m_taskMap.insert(make_pair(task->tag(), task));
+    return true;
+  }
+  return false;
+}
+
+void
+Scheduler::deleteTask(const Task::Tag &tag)
+{
+  ScopedLock lock(m_mutex);
+  TaskMapIt it = m_taskMap.find(tag);
+  if (it != m_taskMap.end())
+  {
+    TaskPtr task = it->second;
+    evtimer_del(task->ev());
+    m_taskMap.erase(it);
+  }
+}
+
+void
+Scheduler::deleteTask(const Task::TaskMatcher &matcher)
+{
+  ScopedLock lock(m_mutex);
+  TaskMapIt it = m_taskMap.begin();
+  while(it != m_taskMap.end())
+  {
+    TaskPtr task = it->second;
+    if (matcher(task))
+    {
+      evtimer_del(task->ev());
+      // Use post increment; map.erase invalidate the iterator that is beening erased,
+      // but does not invalidate other iterators. This seems to be the convention to
+      // erase something from C++ STL map while traversing.
+      m_taskMap.erase(it++);
+    }
+    else
+    {
+      ++it;
+    }
+  }
+}
+
+int
+Scheduler::size()
+{
+  ScopedLock lock(m_mutex);
+  return m_taskMap.size();
+}
diff --git a/scheduler/scheduler.h b/scheduler/scheduler.h
new file mode 100644
index 0000000..ffac5d2
--- /dev/null
+++ b/scheduler/scheduler.h
@@ -0,0 +1,138 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef SCHEDULER_H
+#define SCHEDULER_H
+
+#include <event2/event.h>
+#include <event2/thread.h>
+#include <event2/event-config.h>
+#include <event2/util.h>
+
+#include <boost/function.hpp>
+#include <boost/shared_ptr.hpp>
+
+#include <boost/exception/all.hpp>
+#include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/thread.hpp>
+#include <math.h>
+#include <map>
+#include <sys/time.h>
+
+#include "scheduler/task.h"
+#include "scheduler/interval-generator.h"
+#include "executor/executor.h"
+
+class Scheduler;
+typedef boost::shared_ptr<Scheduler> SchedulerPtr;
+
+/**
+ * @brief Scheduler class
+ */
+class Scheduler
+{
+public:
+  Scheduler();
+  virtual ~Scheduler();
+
+  // start event scheduling
+  virtual void
+  start();
+
+  // stop event scheduling
+  virtual void
+  shutdown();
+
+  // helper method to schedule one-time task
+  static TaskPtr
+  scheduleOneTimeTask (SchedulerPtr scheduler, double delay, const Task::Callback &callback, const Task::Tag &tag);
+
+  // helper method to schedule periodic task
+  static TaskPtr
+  schedulePeriodicTask (SchedulerPtr scheduler, IntervalGeneratorPtr delayGenerator,
+                        const Task::Callback &callback, const Task::Tag &tag);
+
+  // if task with the same tag exists, the task is not added and return false
+  virtual bool
+  addTask(TaskPtr task, bool reset = true);
+
+  // delete task by task->tag, regardless of whether it's invoked or not
+  virtual void
+  deleteTask(TaskPtr task);
+
+  // delete task by tag, regardless of whether it's invoked or not
+  // if no task is found, no effect
+  virtual void
+  deleteTask(const Task::Tag &tag);
+
+  // delete tasks by matcher, regardless of whether it's invoked or not
+  // this is flexiable in that you can use any form of criteria in finding tasks to delete
+  // but keep in mind this is a linear scan
+
+  // if no task is found, no effect
+  virtual void
+  deleteTask(const Task::TaskMatcher &matcher);
+
+  // task must already have been added to the scheduler, otherwise this method has no effect
+  // this is usually used by PeriodicTask
+  virtual void
+  rescheduleTask(const Task::Tag &tag);
+
+  // if the task is not pending, it will be added to the schedule queue
+  // if the task is pending, the delay is changed to the passed in delay
+  // e.g. if at second 0 task A with delay 5 is originally going to run at second 5 and
+  // rescheduleTask(A) is called at second 4, A will be reschedule to run
+  // at second 9
+  virtual void
+  rescheduleTask(TaskPtr task);
+
+  virtual void
+  rescheduleTaskAt (const Task::Tag &tag, double time);
+
+  virtual void
+  rescheduleTaskAt (TaskPtr task, double time);
+
+  void
+  execute(Executor::Job);
+
+  void
+  eventLoop();
+
+  event_base *
+  base() { return m_base; }
+
+  // used in test
+  int
+  size();
+
+protected:
+  bool
+  addToMap(TaskPtr task);
+
+protected:
+  typedef std::map<Task::Tag, TaskPtr> TaskMap;
+  typedef std::map<Task::Tag, TaskPtr>::iterator TaskMapIt;
+  typedef boost::recursive_mutex Mutex;
+  typedef boost::unique_lock<Mutex> ScopedLock;
+
+  TaskMap m_taskMap;
+  Mutex m_mutex;
+  volatile bool m_running;
+  event_base *m_base;
+  event *m_ev;
+  boost::thread m_thread;
+  Executor m_executor;
+};
+
+struct SchedulerException : virtual boost::exception, virtual std::exception { };
+
+#endif // SCHEDULER_H
diff --git a/scheduler/simple-interval-generator.h b/scheduler/simple-interval-generator.h
new file mode 100644
index 0000000..c7a9e77
--- /dev/null
+++ b/scheduler/simple-interval-generator.h
@@ -0,0 +1,31 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef SIMPLE_INTERVAL_GENERATOR_H
+#define SIMPLE_INTERVAL_GENERATOR_H
+
+#include "interval-generator.h"
+
+class SimpleIntervalGenerator : public IntervalGenerator
+{
+public:
+  SimpleIntervalGenerator(double interval) : m_interval (interval) {}
+  virtual ~SimpleIntervalGenerator() {}
+  
+  virtual double
+  nextInterval() _OVERRIDE { return m_interval; }
+
+private:
+  double m_interval;
+};
+
+#endif // SIMPLE_INTERVAL_GENERATOR_H
diff --git a/scheduler/task.cc b/scheduler/task.cc
new file mode 100644
index 0000000..fa73490
--- /dev/null
+++ b/scheduler/task.cc
@@ -0,0 +1,74 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#include "task.h"
+#include "scheduler.h"
+
+static void
+eventCallback(evutil_socket_t fd, short what, void *arg)
+{
+  Task *task = static_cast<Task *>(arg);
+  task->execute();
+  task = NULL;
+}
+
+Task::Task(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler)
+     : m_callback(callback)
+     , m_tag(tag)
+     , m_scheduler(scheduler)
+     , m_invoked(false)
+     , m_event(NULL)
+     , m_tv(NULL)
+{
+  m_event = evtimer_new(scheduler->base(), eventCallback, this);
+  m_tv = new timeval;
+}
+
+Task::~Task()
+{
+  if (m_event != NULL)
+  {
+    event_free(m_event);
+    m_event = NULL;
+  }
+
+  if (m_tv != NULL)
+  {
+    delete m_tv;
+    m_tv = NULL;
+  }
+}
+
+void
+Task::setTv(double delay)
+{
+  // Alex: when using abs function, i would recommend use it with std:: prefix, otherwise
+  // the standard one may be used, which converts everything to INT, making a lot of problems
+  double intPart, fraction;
+  fraction = modf(std::abs(delay), &intPart);
+
+  m_tv->tv_sec = static_cast<int>(intPart);
+  m_tv->tv_usec = static_cast<int>((fraction * 1000000));
+}
+
+void
+Task::execute()
+{
+  // m_scheduler->execute(boost::bind(&Task::run, this));
+
+  // using a shared_ptr of this to ensure that when invoked from executor
+  // the task object still exists
+  // otherwise, it could be the case that the run() is to be executed, but before it
+  // could finish, the TaskPtr gets deleted from scheduler and the task object
+  // gets destroyed, causing crash
+  m_scheduler->execute(boost::bind(&Task::run, shared_from_this()));
+}
diff --git a/scheduler/task.h b/scheduler/task.h
new file mode 100644
index 0000000..bd14296
--- /dev/null
+++ b/scheduler/task.h
@@ -0,0 +1,94 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ *                     Alexander Afanasyev
+ *                     Zhenkai Zhu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
+ *         Alexander Afanasyev <alexander.afanasyev@ucla.edu>
+ */
+
+#ifndef TASK_H
+#define TASK_H
+
+#define _OVERRIDE
+#ifdef __GNUC__
+#if __GNUC_MAJOR >= 4 && __GNUC_MINOR__ >= 7
+  #undef _OVERRIDE
+  #define _OVERRIDE override
+#endif // __GNUC__ version
+#endif // __GNUC__
+
+#include <boost/function.hpp>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+#include <sys/time.h>
+
+//////////////////////////////////////////////////
+// forward declarations
+class Task;
+typedef boost::shared_ptr<Task> TaskPtr;
+
+class Scheduler;
+typedef boost::shared_ptr<Scheduler> SchedulerPtr;
+
+struct event;
+//////////////////////////////////////////////////
+
+
+/**
+ * @brief Base class for a task
+ */
+class Task : public boost::enable_shared_from_this<Task>
+{
+public:
+  // callback of this task
+  typedef boost::function<void ()> Callback;
+  // tag identifies this task, should be unique
+  typedef std::string Tag;
+  // used to match tasks
+  typedef boost::function<bool (const TaskPtr &task)> TaskMatcher;
+
+  // Task is associated with Schedulers due to the requirement that libevent event is associated with an libevent event_base
+  Task(const Callback &callback, const Tag &tag, const SchedulerPtr &scheduler);
+  virtual ~Task();
+
+  virtual void
+  run() = 0;
+
+  Tag
+  tag() { return m_tag; }
+
+  event *
+  ev() { return m_event; }
+
+  timeval *
+  tv() { return m_tv; }
+
+  // Task needs to be resetted after the callback is invoked if it is to be schedule again; just for safety
+  // it's called by scheduler automatically when addTask or rescheduleTask is called;
+  // Tasks should do preparation work here (e.g. set up new delay, etc. )
+  virtual void
+  reset() = 0;
+
+  // set delay
+  // This overrides whatever delay kept in m_tv
+  void
+  setTv(double delay);
+
+  void
+  execute();
+
+protected:
+  Callback m_callback;
+  Tag m_tag;
+  SchedulerPtr m_scheduler;
+  bool m_invoked;
+  event *m_event;
+  timeval *m_tv;
+};
+
+
+#endif // TASK_H
