Selects where to execute a task and application Cluster scheduler implements the cluster resources management, task mapping, application mapping, and also can implement task migration heuristics. Adittionally it have a function named: SearchCluster, which selects the cluster to send an application. This function in only used in the global master mode.
More...
#include "cluster_scheduler.h"
#include "../../include/kernel_pkg.h"
#include "utils.h"
#include "processors.h"
#include "applications.h"
Selects where to execute a task and application Cluster scheduler implements the cluster resources management, task mapping, application mapping, and also can implement task migration heuristics. Adittionally it have a function named: SearchCluster, which selects the cluster to send an application. This function in only used in the global master mode.
HEMPS VERSION - 8.0 - support for RT applications
Distribution: June 2016
Created by: Marcelo Ruaro - contact: marce.nosp@m.lo.r.nosp@m.uaro@.nosp@m.acad.nosp@m..pucr.nosp@m.s.br
Research group: GAPH-PUCRS - contact: ferna.nosp@m.ndo..nosp@m.morae.nosp@m.s@pu.nosp@m.crs.b.nosp@m.r
void allocate_cluster_resource |
( |
int |
cluster_index, |
|
|
int |
nro_resources |
|
) |
| |
|
inline |
Allocate resources to a Cluster by decrementing the number of free resources. If the number of resources is higher than free_resources, then free_resourcers receives zero, and the remaining of resources are allocated by reclustering
- Parameters
-
cluster_index | Index of cluster to allocate the resources |
nro_resources | Number of resource to allocated. Normally is the number of task of an application |
int application_mapping |
( |
int |
cluster_id, |
|
|
int |
app_id |
|
) |
| |
This heuristic maps all task of an application Note that some task can not be mapped due the cluster is full or the processors not satisfies the task requiriments. In this case, the reclustering will be used after the application_mapping funcion calling into the kernel_master.c source file Clearly the tasks that need reclustering are those one that have he allocated_processor equal to -1
- Parameters
-
cluster_id | ID of the cluster where the application will be mapped |
app_id | ID of the application to be mapped |
- Returns
- 1 if mapping OK, 0 if there are no available resources
int map_task |
( |
int |
task_id | ) |
|
Maps a task into a cluster processor. This function only selects the processor not modifying any management structure The mapping heuristic is based on the processor's utilization (slack time) and the number of free_pages
- Parameters
-
task_id | ID of the task to be mapped |
- Returns
- Address of the selected processor
void page_released |
( |
int |
cluster_id, |
|
|
int |
proc_address, |
|
|
int |
task_ID |
|
) |
| |
This function is called by manager inside it own code and in the modules: reclustering and cluster_scheduler. It is called even when a task is removed from a processor. Automatically, this function update the Processors structure by calling the remove_task function
- Parameters
-
cluster_id | Index of cluster to remove the page |
proc_address | Address of the processor that is removing the task |
task_ID | ID of the removed task |
void page_used |
( |
int |
cluster_id, |
|
|
int |
proc_address, |
|
|
int |
task_ID |
|
) |
| |
This function is called by kernel manager inside it own code and in the modules: reclustering and cluster_scheduler. It is called even when a task is mapped into a processor, by normal task mapping or reclustering. Automatically, this function update the Processors structure by calling the add_task function
- Parameters
-
cluster_id | Index of cluster to allocate the page |
proc_address | Address of the processor that is receiving the task |
task_ID | ID of the allocated task |
void release_cluster_resources |
( |
int |
cluster_index, |
|
|
int |
nro_resources |
|
) |
| |
|
inline |
Release resources of a Cluster by incrementing the number of free resources according to the nro of resources by reclustering
- Parameters
-
cluster_index | Index of cluster to allocate the resources |
nro_resources | Number of resource to release. Normally is the number of task of an application |
int SearchCluster |
( |
int |
GM_cluster_id, |
|
|
int |
app_task_number |
|
) |
| |
Selects a cluster to insert an application
- Parameters
-
GM_cluster_id | cluster ID of the global manager processor |
app_task_number | Number of task of requered application |
- Returns
- > 0 if mapping OK, -1 if there is not resources available