HeMPS  8.0
Functions | Variables
local_scheduler.c File Reference

local_scheduler is a kernel module in charge of implementing task scheduling following a LST (Least Slack Time) algorithm. More...

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

Functions

unsigned int get_time_slice ()
 
void init_scheduling_ptr (Scheduling **sched_ptr, int tcb_index)
 
void clear_scheduling (Scheduling *scheduling_tcb)
 
void update_slack_time (Scheduling *input_task, unsigned int current_time)
 
void real_time_task (Scheduling *real_time_task, unsigned int period, int deadline, unsigned int execution_time)
 
unsigned int round_robin ()
 
void dynamic_slice_time (Scheduling *scheduled, unsigned int time)
 
void update_real_time (unsigned int current_time)
 
SchedulingLST (unsigned int current_time)
 

Variables

Scheduling scheduling [MAX_LOCAL_TASKS]
 Scheduling array with its size equal to the max number of task that can execute into the processor.
 
unsigned int time_slice
 Time slice used to configure the processor to generate an interruption.
 
unsigned int schedule_overhead = 500
 Used to dynamically estimate the scheduler overhead.
 
unsigned int instant_overhead
 Used to dynamically estimate the scheduler overhead.
 
unsigned int cpu_utilization = 0
 RT CPU utilization, only filled with RT constraints.
 

Detailed Description

local_scheduler is a kernel module in charge of implementing task scheduling following a LST (Least Slack Time) algorithm.

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

The main function of this module is the LST algorithm, which is called by kernel_slave. It returns the pointer for the selected task to execute into the processor. This module is used only by the slave kernel

Function Documentation

void clear_scheduling ( Scheduling scheduling_tcb)

Clear a scheduling instance, used when the task is removed from slave processor

Parameters
scheduling_tcbScheduling pointer to be cleared
void dynamic_slice_time ( Scheduling scheduled,
unsigned int  time 
)
inline

This algorithm try to given an extra time slice to task selected by LST. The main approach is looking for the READY task slack time and the closer end of period

Parameters
scheduledScheduled task pointer
timeCurrent system time
unsigned int get_time_slice ( )

Get the time slice. Useful to provide the kernel slave time slice

Returns
Global variable time_slice
void init_scheduling_ptr ( Scheduling **  sched_ptr,
int  tcb_index 
)

Initializes the scheduling array with valid pointers

Parameters
sched_ptrPointer to pointer of the scheduler variable into TCB structure
tcb_indexTCB array index
Scheduling* LST ( unsigned int  current_time)

The LST algorithm called by kernel slave. It select the next RT task with the least slack time, or the next BE task following a round-robin order

Parameters
current_timeCurrent system time
Returns
The Scheduling pointer of the scheduled task
void real_time_task ( Scheduling real_time_task,
unsigned int  period,
int  deadline,
unsigned int  execution_time 
)

Funcion called by kernel slave when a task call the primitive RealTime. This function set the real-time paramenters for the task.

Parameters
real_time_taskTask pointer that change or is setting its RT parameters
periodTask period in clock cycles
deadlineTask deadline in clock cycles
execution_timeTask execution time in clock cycles
unsigned int round_robin ( )

A simple round-robin scheduler

Returns
The next round index
void update_real_time ( unsigned int  current_time)
inline

Updates the dynamic RT parameters for all RT tasks. The dynamic RT parameters are: remaining execution time, status, slack-time

Parameters
current_timeCurrent system time
void update_slack_time ( Scheduling input_task,
unsigned int  current_time 
)
inline

Updates the task slack time. The slack time is the time until the task start the next period, once it finishes it execution time for the current period

Parameters
input_taskScheduling structure of the task to be updated
current_timeCurrent system time