Homework

E6118 Fall 2025

DUE: Friday 9/26/2025 at 11:59pm EDT

Overview:

In this assignment, you will use a large language model (LLM) of your choice to build a Linux scheduler, such as ChatGPT, Claude, and DeepSeek, to name but a few. You will guide the LLM with prompts to create the scheduler, but you are not allowed to provide the LLM directly with any code that will go in your scheduler implementation. All of the code for the scheduler implementation must be generated by the LLM. For example, if the LLM produces buggy code, you may not provide the LLM with the correct code that it should implement instead. However, as part of your prompts, you are free to provide the LLM with code that already exists in the Linux kernel or that the LLM previously generated. You are also free to write your own test code to test the correctness and functionality of what the LLM generates.

You may work individually or in groups of 2 of your choosing, and should select your LLM of choice in advance. Sign up for your chosen LLM here. To ensure variety, no more than three groups should use the same LLM.

You should submit the following via email to e6118@lists.cs.columbia.edu:

  1. Implementation patches for your scheduler, formatted in the style of Linux kernel mailing list submissions
  2. A PDF report describing the generated code, your prompting strategy, evaluation results, and experiences, including your evaluation of the effectiveness of the LLM
  3. The complete LLM chat log showing how the code was generated

Your scheduler must be implemented on the Linux 6.14 kernel. Run it on Ubuntu 25.04 using VMWare. The implementation should work on either x86 or Arm64. Follow the VM setup instructions here, and refer to this guide if you need a refresher on compiling and booting a new kernel.

Programming Problems:

The goal of this assignment is to create a new Linux scheduler, a Weight Fair Queuing scheduler.

  1.   A Multicore Scheduler
  2.   Getting WFQ info
    To make it easier to monitor the status of your scheduler, you will implement the following system calls:
  3. #define MAX_CPUS 8 /* We will be testing only on the VMs */
    struct wfq_info {
    	int num_cpus;
    	int nr_running[MAX_CPUS];
    	int total_weight[MAX_CPUS];
    };
    
    /* This system call will fill the buffer with the required values 
     * i.e. the total number of CPUs, the number of WFQ processes on each 
     * CPU and the total weight of WFQ processes on each CPU. 
     * Return value will also be the total number of CPUs.
     * System call number 467.
     */ 
    int get_wfq_info(struct wfq_info *wfq_info);
    
    /* This system call will change the weight for the calling process.
     * Only a root user should be able to increase the weight beyond
     * the default value of 10.  The system call should return an error
     * for any weight less than 1. 
     * System call number 468.
     */ 
    int set_wfq_weight(int weight);
    
    The two system calls should be implemented in kernel/sched/core.c.
  4.   Add load-balancing features to WFQ
    You should have a working scheduler by now. Make sure you test it before you move on to this part. So far your scheduler will run a task only on the CPU that it was originally assigned. Let's change that now! For this part you will be implementing two balancing features. The first will be a periodic load balancing where you will try to move a task from the heaviest CPU to the lightest one and the second is called idle balance which is when a CPU will attempt to steal a task from another CPU when it doesn't have any tasks to run i.e. when its runqueue is empty.

    Load balancing is a key feature of the default Linux scheduler (Completely Fair Scheduler). While CFS follows a rather complicated policy to balance tasks and works to move more than one task in a single go, your scheduler will have a simple policy in this regard. Note while the spec and the Linux kernel refer to default scheduler as the CFS, as of kernel version 6.6 the CFS was merged with the Earliest Eligible Virtual Deadline First (EEVDF) scheduler.

    Periodic load balancing works as follows:

    Idle balancing works as follows:
  5.   Investigate and Demo
    Demonstrate that your scheduler effectively balances weights across all CPUs. The total weight of the processes running on each CPU should be roughly the same. You should start with a CPU-bound test program such as a while loop then try running more complex programs that do I/O to show that the scheduler continues to operate correctly. You should include a test program test/test.c that calls the system calls. You should also include a test/Makefile that builds the program in the same directory resulting in an executable named test. Experiment with different weights and see what impact they have.

    You should provide a complete set of results that describe your experiments. Your results and any explanations should be put into the PDF report. The writeup should be of sufficient detail for someone else to be able to repeat your experiments.

Debugging Tips

The following are some debugging tips you may find useful as you create your new scheduling class.