HeMPS  8.0
Macros | Functions
task_migration.c File Reference

This module implements function relative to task migration. This module is used by slave kernel. More...

#include "task_migration.h"
#include "../../include/kernel_pkg.h"
#include "../include/services.h"
#include "../include/plasma.h"
#include "task_location.h"
#include "local_scheduler.h"
#include "communication.h"
#include "utils.h"
Include dependency graph for task_migration.c:

Macros

#define TASK_MIGRATION_DEBUG   0
 When enable shows puts related to task migration.
 

Functions

void send_task_migrated (int migrated_task, int old_proc, unsigned int master_address)
 
void migrate_dynamic_memory (TCB *tcb_aux)
 
void migrate_CODE (TCB *tcb_migration)
 
void handle_migration_code (volatile ServiceHeader *p, TCB *migrate_tcb)
 
void handle_migration_TCB (volatile ServiceHeader *p, TCB *migrate_tcb)
 
void handle_migration_task_location (volatile ServiceHeader *p, TCB *migrate_tcb)
 
void handle_migration_request_msg (volatile ServiceHeader *p, TCB *migrate_tcb)
 
void handle_migration_stack (volatile ServiceHeader *p, TCB *migrate_tcb)
 
void handle_migration_DATA_BSS (volatile ServiceHeader *p, TCB *migrate_tcb, unsigned int master_address)
 
int handle_task_migration (volatile ServiceHeader *p, TCB *tcb_ptr)
 
int handle_migration (volatile ServiceHeader *p, unsigned int master_address)
 

Detailed Description

This module implements function relative to task migration. This module is used by slave kernel.

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

Function Documentation

int handle_migration ( volatile ServiceHeader p,
unsigned int  master_address 
)

Handles all task migration packets, calling the appropriated sub-function.

Parameters
pServiceHeader pointer of the packet a generic task migration packet
master_addressAddress of the kernel master of the slave processor
Returns
The necessity of call the scheduler, 1 - need scheduler, 0 not need scheduler
void handle_migration_code ( volatile ServiceHeader p,
TCB migrate_tcb 
)

Handle the migration code, coping the code to a free page. It is called by the target processor (the new processor)

Parameters
pServiceHeader pointer of the packet with the task code
migrate_tcbThe TCB pointer of the task to be migrated
void handle_migration_DATA_BSS ( volatile ServiceHeader p,
TCB migrate_tcb,
unsigned int  master_address 
)

Handles the migration of the task DATA and BSS data sections It is called by the target processor (the new processor)

Parameters
pServiceHeader pointer of the packet with the task DATA and BSS data sections
migrate_tcbThe TCB pointer of the task to be migrated
void handle_migration_request_msg ( volatile ServiceHeader p,
TCB migrate_tcb 
)

Handles the migration of the task message request data It is called by the target processor (the new processor)

Parameters
pServiceHeader pointer of the packet with the message request data
migrate_tcbThe TCB pointer of the task to be migrated
void handle_migration_stack ( volatile ServiceHeader p,
TCB migrate_tcb 
)

Handles the migration of the task stack data It is called by the target processor (the new processor)

Parameters
pServiceHeader pointer of the packet with the task stack data
migrate_tcbThe TCB pointer of the task to be migrated
void handle_migration_task_location ( volatile ServiceHeader p,
TCB migrate_tcb 
)

Handles the migration of the task task location data It is called by the target processor (the new processor)

Parameters
pServiceHeader pointer of the packet with the task location data
migrate_tcbThe TCB pointer of the task to be migrated
void handle_migration_TCB ( volatile ServiceHeader p,
TCB migrate_tcb 
)

Handles the migration of the task TCB information It is called by the target processor (the new processor)

Parameters
pServiceHeader pointer of the packet with the TCB data
migrate_tcbThe TCB pointer of the task to be migrated
int handle_task_migration ( volatile ServiceHeader p,
TCB tcb_ptr 
)

Handles a task migration order from the kernel master This function is called by the source processor (the old processor)

Parameters
pServiceHeader pointer of the packet with task migration order
tcb_ptrTCB pointer of the task to be migrated
void migrate_CODE ( TCB tcb_migration)

Migrate the code data to the new processor. It is called by the source processor (the older processor) The code is static because corresponds the the task instructions loaded when the task is allocated in a given processor

Parameters
tcb_migrationThe TCB pointer of the task to be migrated
void migrate_dynamic_memory ( TCB tcb_aux)

This function os the core of task migration. It is called by the source processor (the older processor) Its job is to migrate to the new processor the dynamic data section that can change during task execution.

Parameters
tcb_auxThe TCB pointer of the task to be migrated
void send_task_migrated ( int  migrated_task,
int  old_proc,
unsigned int  master_address 
)

Assembles and sends a TASK_MIGRATED packet to the master kernel

Parameters
migrated_taskMigrated task ID
old_procOld processor address of task
master_addressMaster address of the task