Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. For each process, the Arachne module in kernel maintains a dynamically-sized kernel thread pool for each core in the system
    • The pool is initially empty and threads are created by needas needed.
    • The new kernel threads are created using syscall `clone` with the starting function set to the Arachne main loop.
      • We do not need a different clone call because there is already a flag for indicating the type of thread in the existing mechanisms.
  2. When the kernel decides to allocate a core to a process, it takes one kernel thread from the corresponding pool and put it in the run queue
    • run queue is a per-cpu per-scheduling-class data structure

Q1: Can we have just one thread pool instead? 


RELEASE A CORE VOLUNTARILY

...

  1. First, the kernel will ask nicely by leaving a message in the shared memory indicating that it wants N cores back.
  2. Arachne then decides which cores to give back to the kernel.
  3. If somehow an Arachne user thread does not yield in time to relinquish the core, the kernel will be forced to preempt the insubordinate thread T.
  4. Thread T will be downgraded to a SCHED_OTHER thread and scheduled by the CFS.
  5. Later when T finally gets back to the main loop, it will notice that it no longer binds to a core and then exit the main loop.

 


HANDLE BLOCKING SYSCALLS IN KERNEL

...

The scheduling policy used by a particular thread is indicated by the `policy` field in `task_struct`: http://lxr.free-electrons.com/source/include/linux/sched.h?v=4.7#L1495. 


SAMPLE ARACHNE MAIN LOOP IMPLEMENTATION

...