added cpu_time_budget field to Thread_Control and removed the global variable

_Thread_Ticks_remaining_in_timeslice.
This commit is contained in:
Joel Sherrill
1996-06-05 21:12:06 +00:00
parent 71698522fe
commit 7aa4671d91
7 changed files with 12 additions and 16 deletions

View File

@@ -150,6 +150,7 @@ typedef struct {
/****************** end of common block ********************/
boolean is_global;
boolean do_post_task_switch_extension;
unsigned32 cpu_time_budget;
Chain_Control *ready;
Priority_Information Priority_map;
Thread_Start_information Start;
@@ -210,10 +211,9 @@ SCORE_EXTERN unsigned32 _Thread_Dispatch_disable_level;
SCORE_EXTERN unsigned32 _Thread_Maximum_extensions;
/*
* The following data items are used to manage timeslicing.
* The following is used to manage the length of a timeslice quantum.
*/
SCORE_EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice;
SCORE_EXTERN unsigned32 _Thread_Ticks_per_timeslice;
/*

View File

@@ -150,6 +150,7 @@ typedef struct {
/****************** end of common block ********************/
boolean is_global;
boolean do_post_task_switch_extension;
unsigned32 cpu_time_budget;
Chain_Control *ready;
Priority_Information Priority_map;
Thread_Start_information Start;
@@ -210,10 +211,9 @@ SCORE_EXTERN unsigned32 _Thread_Dispatch_disable_level;
SCORE_EXTERN unsigned32 _Thread_Maximum_extensions;
/*
* The following data items are used to manage timeslicing.
* The following is used to manage the length of a timeslice quantum.
*/
SCORE_EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice;
SCORE_EXTERN unsigned32 _Thread_Ticks_per_timeslice;
/*

View File

@@ -70,7 +70,6 @@ void _Thread_Handler_initialization(
_Thread_Maximum_extensions = maximum_extensions;
_Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice;
_Thread_Ticks_per_timeslice = ticks_per_timeslice;
_Thread_Ready_chain = _Workspace_Allocate_or_fatal_error(
@@ -244,7 +243,7 @@ void _Thread_Dispatch( void )
_User_extensions_Thread_switch( executing, heir );
_Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
heir->cpu_time_budget = _Thread_Ticks_per_timeslice;
/*
* If the CPU has hardware floating point, then we must address saving
@@ -874,8 +873,8 @@ void _Thread_Reset_timeslice( void )
ready = executing->ready;
_ISR_Disable( level );
if ( _Chain_Has_only_one_node( ready ) ) {
_Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
_ISR_Enable( level );
executing->cpu_time_budget = _Thread_Ticks_per_timeslice;
return;
}
_Chain_Extract_unprotected( &executing->Object.Node );
@@ -911,7 +910,7 @@ void _Thread_Tickle_timeslice( void )
!_States_Is_ready( _Thread_Executing->current_state ) )
return;
if ( --_Thread_Ticks_remaining_in_timeslice == 0 ) {
if ( --_Thread_Executing->cpu_time_budget == 0 ) {
_Thread_Reset_timeslice();
}
}

View File

@@ -310,7 +310,6 @@ uninitialized =
/*thread.h*/ (sizeof _Thread_BSP_context) +
(sizeof _Thread_Dispatch_disable_level) +
(sizeof _Thread_Maximum_extensions) +
(sizeof _Thread_Ticks_remaining_in_timeslice) +
(sizeof _Thread_Ticks_per_timeslice) +
(sizeof _Thread_Ready_chain) +
(sizeof _Thread_Executing) +

View File

@@ -150,6 +150,7 @@ typedef struct {
/****************** end of common block ********************/
boolean is_global;
boolean do_post_task_switch_extension;
unsigned32 cpu_time_budget;
Chain_Control *ready;
Priority_Information Priority_map;
Thread_Start_information Start;
@@ -210,10 +211,9 @@ SCORE_EXTERN unsigned32 _Thread_Dispatch_disable_level;
SCORE_EXTERN unsigned32 _Thread_Maximum_extensions;
/*
* The following data items are used to manage timeslicing.
* The following is used to manage the length of a timeslice quantum.
*/
SCORE_EXTERN unsigned32 _Thread_Ticks_remaining_in_timeslice;
SCORE_EXTERN unsigned32 _Thread_Ticks_per_timeslice;
/*

View File

@@ -70,7 +70,6 @@ void _Thread_Handler_initialization(
_Thread_Maximum_extensions = maximum_extensions;
_Thread_Ticks_remaining_in_timeslice = ticks_per_timeslice;
_Thread_Ticks_per_timeslice = ticks_per_timeslice;
_Thread_Ready_chain = _Workspace_Allocate_or_fatal_error(
@@ -244,7 +243,7 @@ void _Thread_Dispatch( void )
_User_extensions_Thread_switch( executing, heir );
_Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
heir->cpu_time_budget = _Thread_Ticks_per_timeslice;
/*
* If the CPU has hardware floating point, then we must address saving
@@ -874,8 +873,8 @@ void _Thread_Reset_timeslice( void )
ready = executing->ready;
_ISR_Disable( level );
if ( _Chain_Has_only_one_node( ready ) ) {
_Thread_Ticks_remaining_in_timeslice = _Thread_Ticks_per_timeslice;
_ISR_Enable( level );
executing->cpu_time_budget = _Thread_Ticks_per_timeslice;
return;
}
_Chain_Extract_unprotected( &executing->Object.Node );
@@ -911,7 +910,7 @@ void _Thread_Tickle_timeslice( void )
!_States_Is_ready( _Thread_Executing->current_state ) )
return;
if ( --_Thread_Ticks_remaining_in_timeslice == 0 ) {
if ( --_Thread_Executing->cpu_time_budget == 0 ) {
_Thread_Reset_timeslice();
}
}

View File

@@ -310,7 +310,6 @@ uninitialized =
/*thread.h*/ (sizeof _Thread_BSP_context) +
(sizeof _Thread_Dispatch_disable_level) +
(sizeof _Thread_Maximum_extensions) +
(sizeof _Thread_Ticks_remaining_in_timeslice) +
(sizeof _Thread_Ticks_per_timeslice) +
(sizeof _Thread_Ready_chain) +
(sizeof _Thread_Executing) +