+ All Categories
Home > Documents > Viva PPT _Final

Viva PPT _Final

Date post: 08-Apr-2017
Category:
Upload: abhijith-c-s
View: 105 times
Download: 2 times
Share this document with a friend
49
Optimal Grouping of Cores in BOSS MOOL B-Tech Project by Abhijith C S (CS11B003)
Transcript
Page 1: Viva PPT _Final

Optimal Grouping of Cores in BOSS MOOLB-Tech Project by Abhijith C S (CS11B003)

Page 2: Viva PPT _Final

Motivation

★ In multi-core systems, the scheduling policy has a very important role to play in achieving maximized performance.

★ At the same time, the improper and unbalanced assignment of processes to the cores might degrade the performance.

Page 3: Viva PPT _Final

Motivation

★ It is an attempt to classify the cores into different sets based on certain criteria, so that each set of cores will get assigned only with a specific type of tasks.

★ Dedicating each set of cores to perform specific types of tasks might improve the overall performance.

Page 4: Viva PPT _Final

Methods

Page 5: Viva PPT _Final

Methods

Grouping could be done in different methods:

1. From Cores’ perspective

2. From Processes’ perspective

Page 6: Viva PPT _Final

1. From Cores’ perspective

A core could restrict the processes from running on it. There are two different possible ways:

1. By Blocking Process Migrations2. By Restricting Entry to Runqueue

Page 7: Viva PPT _Final

1.1 By Blocking Process Migrations

● Active processes are placed in an array called the run queue.

● The run queue may contain priority values for each process.

● It is used by the scheduler to determine which process to run next.

Page 8: Viva PPT _Final

1.1 By Blocking Process Migrations

● When a program is stopped to let another run, the program with the highest priority in the run queue is then allowed to execute.

● If any cores is free to run a process, the process could be taken out from its current computing environment and put it on the other - Process Migrations

Page 9: Viva PPT _Final

1.1 By Blocking Process Migrations

● We could prevent certain types of processes from getting migrated to a set of cores, in effect we can categorize the cores.

● The migration of a process could be blocked until a core to which it could get migrated.

Page 10: Viva PPT _Final

1.2 By Restricting Entry to Runqueue

● A similar alternative to the previous one.

● The scheduler puts the processes into the run queue when it is in the active state, meaning when it is ready to get processed.

● When the process is about to be put into the run queue, it could be checked whether the process is allowed to run on the particular core.

Page 11: Viva PPT _Final

1.2 By Restricting Entry to Runqueue

● Each core will have a run queue in the form of an RB-Tree. If entry to a run queue of a core is restricted, it can try with others.

● It could be put into the run queue of a core on which it is allowed to run.

Page 12: Viva PPT _Final

Pros & Cons

● Since the blocking is happening only after the initialisation of process migration, it might cause unnecessary computations and thus leading to waste of time.

● It is difficult to dynamically set restrictions using per-CPU variables from the user space once the kernel is booted up.

Page 13: Viva PPT _Final

Pros & Cons

● Though these are easy methods to implement, they are not generic solutions.

● These will not alter any properties or parameters associated with the task, that is the task_struct.

Page 14: Viva PPT _Final

Methods

Grouping could be done in different methods:

1. From Cores’ perspective

2. From Processes’ perspective

Page 15: Viva PPT _Final

2. From Processes’ perspective

● An affinity mask is a bit mask indicating what processors a thread should be run on by the scheduler of an operating system.

● Affinity mask of a process could be changed at different stages during the life cycle of a process.

Page 16: Viva PPT _Final

2. From Processes’ perspective

● If we succeed in manipulating the mask with the desired set of cores, we can restrict certain processes from getting scheduled on predefined set of cores.

● We will update the mask where ever applicable.

Page 17: Viva PPT _Final

Pros & Cons

● Quite complex to implement, as the mask might get changed at different stages of the process life cycle.

● Changes the parameters in the task_struct. of the process.

Page 18: Viva PPT _Final

Pros & Cons

● Since the process parameters itself is changed and no more comparison or anything is required at later point of time during the process life cycle, it avoids unnecessary computations.

● It is generic solution, as we are not changing the parameters bound to the cores. Only process specific parameters are changed.

Page 19: Viva PPT _Final

Advantages Over Previous Methods

● It would be changing the parameters associated with a process. Though it might take a few more computations compared to other methods, unnecessary ones are avoided.

● Priority of the processes are taken care.

● More generic solution.

Page 20: Viva PPT _Final

Implementation

Page 21: Viva PPT _Final

Implementation

● The concept of Affinity Mask was manipulated to restrict the process from accessing a predefined set of cores.

● The challenge is in setting the Affinity Mask (cpumask) where ever applicable.

Page 22: Viva PPT _Final

Calculating the Affinity Mask

● A CPU affinity mask is represented by the cpu_set_t structure, implemented as a bitmap.

Page 23: Viva PPT _Final

Calculating the Affinity Mask

● Manipulation of the masks could be done by the following predefined macros:

Page 24: Viva PPT _Final

Setting the Affinity Mask

● The sched_setaffinity() function sets the CPU affinity mask of the thread whose ID is pid to the value specified by the mask.

● We will get the information about the task from the task_struct which has parameters like pid, prio, cpus_allowed etc.

Page 25: Viva PPT _Final

Setting the Affinity Mask

Page 26: Viva PPT _Final

Setting the Affinity Mask

● Each process is also given a priority (called static_prio), but the actual priority of the process is determined dynamically based on loading and other factors.

● When a process is created by fork() system call, the whole content of the parent task_struct will be copied to the child.

Page 27: Viva PPT _Final

Setting the Affinity Mask

The mask is to be changed at two different stages:

1. at Process Creation Stage

2. at Scheduling Stage

Page 28: Viva PPT _Final

1. Changing the Mask at Process Creation Stage

● A new process is created from the userspace essentially via do_fork().

● Even for the creation of kernel threads, firstly kernel_thread() is called which in turn calls do_fork() after making some initialisations.

● The copy_process function, called by do_fork is where the new process is created as a copy of the parent.

Page 29: Viva PPT _Final

1. Changing the Mask at Process Creation Stage

● The copy_process function calls dup_task_struct function which allocates a new task_struct and copies the current process’s descriptors into it.

● At this stage we could manipulate the affinity mask cpus_allowed, with the desired mask.

Page 30: Viva PPT _Final

Setting the Affinity Mask

The mask is to be changed at two different stages:

1. at Process Creation Stage

2. at Scheduling Stage

Page 31: Viva PPT _Final

2. Changing the Mask at Scheduling Stage

● The default linux scheduler is Completely Fair Scheduler (CFS).

● CFS maintains a time-ordered red-black tree rather than the tasks in a run queue.

● Tasks with the gravest need for the processor are stored toward the left side of the tree.

Page 32: Viva PPT _Final

2. Changing the Mask at Scheduling Stage

● The scheduler chooses the left-most node of the red-black tree to schedule next to maintain fairness.

● The generic schedule() function, which preempts the currently running task.

Page 33: Viva PPT _Final

2. Changing the Mask at Scheduling Stage

● The schedule functions picks up the next task to schedule by calling pick_next_task function.

● It will just pick up the left-most task from the red-black tree and returns the associated sched_entity.

Page 34: Viva PPT _Final

2. Changing the Mask at Scheduling Stage

● The schedule functions picks up the next task to schedule by calling pick_next_task function.

● It will just pick up the left-most task from the red-black tree and returns the associated sched_entity.

Page 35: Viva PPT _Final

2. Changing the Mask at Scheduling Stage

● Scheduling class, sched_class, which defines a set of functions that decides the behavior of the scheduler.

● The schedule() function internally calls the __setscheduler function which essentially assigns the scheduler class to a task.

Page 36: Viva PPT _Final

2. Changing the Mask at Scheduling Stage

Page 37: Viva PPT _Final

2. Changing the Mask at Scheduling Stage

● This is where the priority value of the task is compared and put into the corresponding scheduler class.

● Since this is the entry point of a task to the scheduler, the affinity mask must be changed with the desired mask.

Page 38: Viva PPT _Final

Experimentation & Results

Page 39: Viva PPT _Final

Experiment - 1

Cores were grouped in a ratio 1:1 dedicating half of the available cores for real-time processes alone.

Cores were ordered in XXX...YYY... fashion, that is the cores dedicated for processing real-time tasks were grouped together.

Page 40: Viva PPT _Final

Experiment - 2

Cores were grouped in a ratio 1:1 dedicating half of the available cores for real-time processes alone.

Cores were ordered in X-Y-X-Y-X-Y... fashion, that is alternatively.

Page 41: Viva PPT _Final

Experiment - 3

Cores were grouped in a ratio 1:1 dedicating half of the available cores for real-time processes alone.

Cores were ordered in XX-YY-XX-YY-... fashion, that is double alternatively.

Page 42: Viva PPT _Final

Experiment - 4

Cores were grouped in different ratios like 2:1, 1:2, 3:1, 1:3 etc. Dedicating a part of available cores only for real-time processes.

Page 43: Viva PPT _Final

Observations (Summary)

Page 44: Viva PPT _Final

Observations

Page 45: Viva PPT _Final

Observations

Page 46: Viva PPT _Final

Conclusions

Page 47: Viva PPT _Final

Conclusions

● Implemented method is with lesser number of computations and avoids unnecessary ones, and thus more optimal compared to other methods.

● Being a more optimal and generic solution, it is concluded to be the more effective way of grouping the cores.

Page 48: Viva PPT _Final

Conclusions

● Irrespective of the ratio in which the cores are grouped, better performance is obtained when the cores are grouped together.

● The alternate arrangement of cores takes more time especially when the workload is huge.

Page 49: Viva PPT _Final

Conclusions

● The ratio in which the cores to to grouped could be calculated dynamically at runtime as it is workload dependent.

● Finding a generalized solution to calculate the optimal ratio dynamically would improve the performance further.


Recommended