Project 1: Buzzing with Threads! Solution

$35.00 $29.05

You'll get a: . zip file solution, download link after Payment



lu654842pkg tmp 71f1b3bb7b78937d

The goal of the project is to understand and implement a credit-based scheduler in a user-level threads library.To do so you are required to modify the provided library which implements a O(1) priority scheduler and a priority co-scheduler for reference.


lu654842pkg tmp 71f1b3bb7b78937d

  • GT Threads Library – GTThreads is a user-level thread library. Some of the features of the library are as follows:

    1. Multi-Processor support: The user-level threads (uthreads) are run on all the processors available on the system.

    1. Local runqueue: Each CPU has its own runqueue. The user-level threads (uthreads) are assigned to one of these run queues at the time of creation. Part of the work in the project might involve using some metrics before assigning these uthreads the processor and/or run-time runqueue balancing.

    1. O(1) priority scheduler and co-scheduler: The library implements these two scheduling algorithms. The code can be used for reference. Priority hash tables used in the library can be used, with some hacking, for the purpose of the credit scheduler. In particular, look at the functions “sched_find_best_uthread_group” and “sched_find_best_uthread”.

    1. You will be able to test your code in class-assigned Virtual Machines in an OpenStack cloud. Detailed information about how to set up the testing environment will soon be made available via Canvas. However, it is

recommended that you do your initial development and testing on your local machines (most of you must be having at least dual core machines). Once your work is sufficiently stable, you can test it on the virtual machine.

  • What is credit scheduler

    1. The credit scheduler is a proportional fair share CPU scheduler built from the ground up to be work conserving on SMP hosts. You would also need to perform the migration of uthreads between the kthreads, if a kthread is idle (this maintains the principles of work-conserving and load balancing). Please take a look at the following resources:

Project Details

lu654842pkg tmp 71f1b3bb7b78937d

  1. The project requires you to do the following to receive full credit:

    1. Implement a Credit Scheduler for the provided SMP GTThreads library.

    1. Provide a way for a user to set the desired scheduler during the GTThreads initialization.

    1. Implement a function for matrix multiplication, using the provided code.

      1. For this, you are required to modify the matrix multiplication files in a way that it takes an integer as a command line argument for the type of scheduler (0 for priority scheduler, 1 for credit scheduler) and set the appropriate value during GTThreads initialization.

    1. Yield – When a user-level thread executes this function, it should yield the CPU to the scheduler, which then schedules the next thread (per its scheduling scheme). On voluntary preemption, the thread should be charged credits only for the actual CPU cycles used.

      1. Have a command line argument that will enable/disable the yield functionality.

      1. For this, you are required to implement a library function for voluntary preemption gt_yield()

    1. Load balancing – Implement uthread migration if a kthread is idle.

      1. Have a command line argument that will enable/disable load balancing.

    1. Code execution –

      1. Write a Makefile with the basic rules for compilation and clean up.

      1. Include a README on how to run your project and other parameters if required.

    1. Write a final report (in PDF format) summarize your implementation and detailing the results.

  • Deliverable Phases

    1. The above list of requirements is divided into phases to make sure you are able to build the project in a timely manner. We recommend you follow the phases as it will help you achieve the goal of the project.

      1. Phase 1 –Understand the given skeleton code. Once you have an idea about the flow go ahead and create flow diagrams illustrating

        • High level control flow for scheduling in the GTThread library.

        • Flow chart for O(1) priority scheduler.

      1. Phase 2: Now since you have the understanding of the library flow it’s time to do some implementation

        • Have a flow chart for the design.

        • How will you verify your design – think and discuss on the piazza on how to test credit scheduling is working or not?

        • Start writing the code.

      1. Mid-check-point (see deadlines for the date)

      1. Phase 3: Add Yield and Load Balancing functionalities.

      2. Phase 4 : Start compiling the report and make sure you don’t miss

        • The flow diagrams.

        • Design implementation.

        • How Yield and Load balancing is implemented and their impact

        • Results.

Detailed information about the report can be found below in the Report section.


lu654842pkg tmp 71f1b3bb7b78937d


  1. You are required to run 128 uthreads. Each uthread will work on one matrix by itself. For a given uthread you have the following options

    • Credits equals {25, 50, 75, 100}.

    • Matrix sizes (M) equals – {32, 64, 128, 256}.

  1. So there are 16 (4 X 4) possible combinations of credit and matrix size (also termed as group_name), for example – credit = 25 and matrix = 32 (c_25_m_32) or credit = 50 and matrix = 32 (c_50_m_32).

  1. Every combination of credit and matrix is executed by 8 threads. Each thread multiplies two (M,M) matrices independent of other threads.(16 combinations, each having 8 threads totals to 128 uthreads.)


  • Terminologies

    1. CPU Time – time spent by a uthread running every time it was scheduled (i.e. excluding the time it spent waiting to be scheduled).

    1. Wait Time – time spent by a uthread waiting in the queue, to be scheduled.

    1. Execution Time – CPU Time + Wait Time

  1. Testing Credit Scheduler –is tested withoutload balancing enabled. We have provided two files in the output directory.

    1. Detailed_output.csv – records the per uthread statistics.












  1. Cummulative_output.csv – capture the aggregate statistics of uthreads belonging to the same group_name.

lu654842pkg tmp d96b6b3e9e16cbbb

group_name mean_cpu_time mean_wait_time mean_exec_time sd_cpu_time sd_wait_time sd_exec_time



  1. Graphs: Plot a split bar graph showing mean_exec_time (composed of

mean_cpu_time (bottom) and mean_wait_time (top)) vs group_name, keeping the matrix size constant while varying the credits {25, 50, 75,100}. A separate plot is expected for every matrix size.

The file should be named​​m_<i>.png(where i == fixed matrix size)

  1. Testing Yield –

Measure the CPU cycles from the beginning of the time slice to yield. Display the amount of credits deducted and remaining after the yield. The reduction should be proportional to the amount of CPU time spent. Also, print queues of the kthread pre and post yield. Have a flag that can enable / disable this functionality.

In the report, explain the mechanism used to implement yield and also include screenshots of the queues, while during the demo it will be tested using the command line argument.

  1. Load Balance – Print queues of kthreads post and pre for every migrating uthread. This should show the uthread migrated from one kthread to another. Also, plot split bar graphs as mentioned earlier to show the total execution time.

In the report, explain the mechanism used to implement load balancing and also include screenshots of the queues, while during the demo it will be tested using the command line argument.

The split bar graph file should be named​​lb_m_<i>.png(where i == fixed matrix size)


lu654842pkg tmp 71f1b3bb7b78937d

Important Note – Please make sure the .csv files have the same name as provided, with columns in the same order and are placed in the output/csv directory. Similarly, .png graph files should have the naming convention as mentioned above and should be placed in output/graphs directory. The evaluation scripts will only look for the given name/format and any deviation will not be evaluated.


lu654842pkg tmp 71f1b3bb7b78937d

  • We will provide you the details of Virtual Machines that you will be using to test the code. You are required to use the VM to get the evaluation results through the Virtual Machines provided by us. The VM will be used during the demo session as well. No personal/other machines will be allowed.

    • How to access VM – <to be updated>

  • Private repo creation – We will highly recommend to use private repos to regularly backup your code. <to be updated>

  • We have spent time to develop FAQs for the project do check them.


lu654842pkg tmp 71f1b3bb7b78937d

Report Template –to be shared soon! (Before the class on Thursday)

Evaluation – Scoring Matrix

lu654842pkg tmp 71f1b3bb7b78937d









Fine grain scoring matrix –

  • Results



Total = 30 points

Detailed Output File


Cumulative Output File







Total = 40 points

Goal of the project

Explain in your words the goal

5 points

of the project

Control Flow Diagram

10 points

Design Description

15 points

Evaluation and Results

10 points




Total = 30 points

Code & Questions

The code will be downloaded from the

30 points

submission and is executed. Questions

will be asked related to the


Submission Instructions

lu654842pkg tmp 71f1b3bb7b78937d

Please see the submission practice document in the project directory.


lu654842pkg tmp 71f1b3bb7b78937d

  • Release Date: Monday, Aug 26, 2019

  • Mid-check-point: This is a guideline aimed to have you figure out at what stage of the project completion you are at. Make sure you are done with Phase 1 and 2 by September 12, Thursday.

  • Due date – Friday, September 20, 2019 11:59PM – Final report and code

Communication Policy

lu654842pkg tmp 71f1b3bb7b78937d

Our effort is to ensure we can address the problems of all students in a prompt manner and students help each other (while honoring the Georgia Tech honor code as mentioned above). Additionally, we would like to make sure everyone is aware of the solutions to general doubts and problems faced as you work on your projects. Thus, to have transparent communication we are following the below given policy –

  1. All the questions related to project/class must be asked on the Piazza.

  1. Emails to the TAs should be done in cases such as submission issues or unless asked due to an issue affecting an individual only.

If an email is sent –

  1. If an email is sent – make sure the email is sent to both the TA’s

    1. Ranjan Sarpangala Venkatesh |

    2. Harshit Daga |

  1. To ensure emails are answered in a timely manner we have our filters set for the subject pattern [CS-6210]. Please make sure to add [CS-6210] before your subject.

For example [CS-6210] Is George P. Burdell real?

Late Submission

lu654842pkg tmp 71f1b3bb7b78937d

  1. A flat penalty of 30% for late submission will give you an extension by 3 days.

  1. To avail late submission – email must be sent to the TAs within 12 hours of the deadline.

  1. TAs will let you know about the late submission process.