Ticket #514: timeslice_exhaust.diff
File timeslice_exhaust.diff, 13.5 KB (added by Joel Sherrill, on 12/03/06 at 13:31:13) |
---|
-
CPUKIT/ADA/RTEMS.ADS
diff -x *~ -N -P -r -u rtems-orig/CPUKIT/ADA/RTEMS.ADS rtems/CPUKIT/ADA/RTEMS.ADS
old new 9 9 -- 10 10 -- 11 11 -- 12 -- COPYRIGHT (c) 1997 .12 -- COPYRIGHT (c) 1997-2003. 13 13 -- On-Line Applications Research Corporation (OAR). 14 14 -- 15 15 -- The license and distribution terms for this file may in … … 205 205 All_Mode_Masks : constant RTEMS.Mode := 16#0000_ffff#; 206 206 Current_Mode : constant RTEMS.Mode := 16#0000_0000#; 207 207 Preempt_Mask : constant RTEMS.Mode := 16#0000_0100#; 208 Timeslice_Mask : constant RTEMS.Mode := 16#0000_0 200#;208 Timeslice_Mask : constant RTEMS.Mode := 16#0000_0A00#; 209 209 ASR_Mask : constant RTEMS.Mode := 16#0000_0400#; 210 210 Interrupt_Mask : RTEMS.Mode; 211 211 Preempt : constant RTEMS.Mode := 16#0000_0000#; 212 212 No_Preempt : constant RTEMS.Mode := 16#0000_0100#; 213 213 No_Timeslice : constant RTEMS.Mode := 16#0000_0000#; 214 214 Timeslice : constant RTEMS.Mode := 16#0000_0200#; 215 Timeslice_Exhaust : constant RTEMS.Mode := 16#0000_0800#; 215 216 ASR : constant RTEMS.Mode := 16#0000_0000#; 216 217 No_ASR : constant RTEMS.Mode := 16#0000_0400#; 217 218 -
CPUKIT/RTEMS/INCLUDE/RTEMS/RTEMS/MODES.H
diff -x *~ -N -P -r -u rtems-orig/CPUKIT/RTEMS/INCLUDE/RTEMS/RTEMS/MODES.H rtems/CPUKIT/RTEMS/INCLUDE/RTEMS/RTEMS/MODES.H
old new 32 32 /* 33 33 * The following constants define the individual modes and masks 34 34 * which may be used to compose a mode set and to alter modes. 35 * 36 * The following combinations correspond to the POSIX Schedulers. 37 * 38 * SCHED_FIFO - RTEMS_PREEMPT | RTEMS_NO_TIMESLICE 39 * SCHED_RR - RTEMS_PREEMPT | RTEMS_TIMESLICE_EXHAUST 40 * SCHED_OTHER - RTEMS_PREEMPT | RTEMS_TIMESLICE 35 41 */ 36 42 37 43 #define RTEMS_ALL_MODE_MASKS 0x0000ffff … … 40 46 #define RTEMS_CURRENT_MODE 0 41 47 42 48 #define RTEMS_PREEMPT_MASK 0x00000100 /* preemption bit */ 43 #define RTEMS_TIMESLICE_MASK 0x00000 200 /* timeslice bit*/44 #define RTEMS_ASR_MASK 0x00000400 /* RTEMS_ASR enable bit 49 #define RTEMS_TIMESLICE_MASK 0x00000A00 /* timeslice bits */ 50 #define RTEMS_ASR_MASK 0x00000400 /* RTEMS_ASR enable bit */ 45 51 #define RTEMS_INTERRUPT_MASK CPU_MODES_INTERRUPT_MASK 46 52 47 53 #define RTEMS_PREEMPT 0x00000000 /* enable preemption */ 48 54 #define RTEMS_NO_PREEMPT 0x00000100 /* disable preemption */ 49 55 50 #define RTEMS_NO_TIMESLICE 0x00000000 /* disable timeslicing */ 51 #define RTEMS_TIMESLICE 0x00000200 /* enable timeslicing */ 56 #define RTEMS_NO_TIMESLICE 0x00000000 /* disable timeslicing */ 57 #define RTEMS_TIMESLICE 0x00000200 /* use basic timeslicing */ 58 #define RTEMS_TIMESLICE_EXHAUST 0x00000800 /* POSIX SCHED_RR */ 52 59 53 #define RTEMS_ASR 0x00000000 /* enable RTEMS_ASR 54 #define RTEMS_NO_ASR 0x00000400 /* disable RTEMS_ASR 60 #define RTEMS_ASR 0x00000000 /* enable RTEMS_ASR */ 61 #define RTEMS_NO_ASR 0x00000400 /* disable RTEMS_ASR */ 55 62 56 63 /* 57 64 * The number of bits for interrupt levels is CPU dependent. -
CPUKIT/RTEMS/INLINE/RTEMS/RTEMS/MODES.INL
diff -x *~ -N -P -r -u rtems-orig/CPUKIT/RTEMS/INLINE/RTEMS/RTEMS/MODES.INL rtems/CPUKIT/RTEMS/INLINE/RTEMS/RTEMS/MODES.INL
old new 74 74 * 75 75 * DESCRIPTION: 76 76 * 77 * This function returns TRUE if mode_set indicates that timeslicing77 * This function returns TRUE if mode_set indicates that basic timeslicing 78 78 * is enabled, and FALSE otherwise. 79 79 */ 80 80 … … 85 85 return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE; 86 86 } 87 87 88 /*PAGE 89 * 90 * _Modes_Is_timeslice_exhaust 91 * 92 * DESCRIPTION: 93 * 94 * This function returns TRUE if mode_set indicates that timeslicing 95 * as defined by POSIX SCHED_RR is enabled, and FALSE otherwise. 96 */ 97 98 RTEMS_INLINE_ROUTINE boolean _Modes_Is_timeslice_exhaust ( 99 Modes_Control mode_set 100 ) 101 { 102 return (mode_set & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE_EXHAUST; 103 } 88 104 /*PAGE 89 105 * 90 106 * _Modes_Get_interrupt_level -
CPUKIT/RTEMS/MACROS/RTEMS/RTEMS/MODES.INL
diff -x *~ -N -P -r -u rtems-orig/CPUKIT/RTEMS/MACROS/RTEMS/RTEMS/MODES.INL rtems/CPUKIT/RTEMS/MACROS/RTEMS/RTEMS/MODES.INL
old new 54 54 55 55 /*PAGE 56 56 * 57 * _Modes_Is_timeslice_exhaust 58 * 59 */ 60 61 #define _Modes_Is_timeslice_exhaust( _mode_set ) \ 62 (((_mode_set) & RTEMS_TIMESLICE_MASK) == RTEMS_TIMESLICE_EXHAUST) 63 64 /*PAGE 65 * 57 66 * _Modes_Get_interrupt_level 58 67 * 59 68 */ -
CPUKIT/RTEMS/SRC/TASKMODE.C
diff -x *~ -N -P -r -u rtems-orig/CPUKIT/RTEMS/SRC/TASKMODE.C rtems/CPUKIT/RTEMS/SRC/TASKMODE.C
old new 81 81 if ( mask & RTEMS_PREEMPT_MASK ) 82 82 executing->is_preemptible = _Modes_Is_preempt(mode_set) ? TRUE : FALSE; 83 83 84 if ( mask & RTEMS_TIMESLICE_MASK ) { 85 if ( _Modes_Is_timeslice(mode_set) ) 86 executing->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE; 87 else 84 switch ( mode_set & RTEMS_TIMESLICE_MASK ) { 85 break; 86 case RTEMS_TIMESLICE: 87 executing->budget_algorithm = 88 THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE; 89 break; 90 case RTEMS_TIMESLICE_EXHAUST: 91 executing->budget_algorithm = 92 THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE; 93 break; 94 case RTEMS_NO_TIMESLICE: 95 default: /* XXX default is an invalid case */ 88 96 executing->budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE; 97 break; 89 98 } 90 99 91 100 /* -
CPUKIT/RTEMS/SRC/taskcreate.c
diff -x *~ -N -P -r -u rtems-orig/CPUKIT/RTEMS/SRC/taskcreate.c rtems/CPUKIT/RTEMS/SRC/taskcreate.c
old new 169 169 * Initialize the core thread for this task. 170 170 */ 171 171 172 Thread_CPU_budget_algorithms budget_algorithm; 173 budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_NONE; 174 175 switch ( mode_set & RTEMS_TIMESLICE_MASK ) { 176 case RTEMS_TIMESLICE: 177 budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE; 178 break; 179 case RTEMS_TIMESLICE_EXHAUST: 180 budget_algorithm = THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE; 181 break; 182 case RTEMS_NO_TIMESLICE: 183 default: 184 /* XXX this is an invalid case */ 185 break; 186 } 187 172 188 status = _Thread_Initialize( 173 189 &_RTEMS_tasks_Information, 174 190 the_thread, … … 177 193 is_fp, 178 194 core_priority, 179 195 _Modes_Is_preempt(initial_modes) ? TRUE : FALSE, 180 _Modes_Is_timeslice(initial_modes) ? 181 THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE : 182 THREAD_CPU_BUDGET_ALGORITHM_NONE, 196 budget_algorithm, 183 197 NULL, /* no budget algorithm callout */ 184 198 _Modes_Get_interrupt_level(initial_modes), 185 199 (Objects_Name) name -
DOC/USER/TASK.T
diff -x *~ -N -P -r -u rtems-orig/DOC/USER/TASK.T rtems/DOC/USER/TASK.T
old new 178 178 179 179 @cindex timeslicing 180 180 181 The timeslicing component is used by the RTEMS scheduler to determine how 182 the processor is allocated to tasks of equal priority. If timeslicing is 183 enabled (@code{@value{RPREFIX}TIMESLICE}), then RTEMS will limit the amount 184 of time the task can execute before the processor is allocated to another 185 ready task of equal priority. The length of the timeslice is application 186 dependent and specified in the Configuration Table. If timeslicing is 187 disabled (@code{@value{RPREFIX}NO_TIMESLICE}), then the task will be 188 allowed to execute until a task of higher priority is made ready. If 189 @code{@value{RPREFIX}NO_PREEMPT} is selected, then the timeslicing 190 component is ignored by the scheduler. 181 If a task is preemptible, then the task's execution time may be limited 182 using timeslicing. The timeslicing component of task mode is used by the 183 RTEMS scheduler to determine how the processor is allocated to 184 tasks of equal priority. The length of the timeslice quantum is 185 application dependent and specified in the Configuration Table. There 186 are three algorithms for timeslice management in the RTEMS Classic API. 187 188 189 @itemize @bullet 190 191 @item If the (@code{@value{RPREFIX}NO_TIMESLICE}) is selected, 192 timeslicing is disabled. Thus the task will be 193 allowed to execute until a task of higher priority is made ready. 194 195 @cindex SCHED_OTHER 196 197 @item If the @code{@value{RPREFIX}TIMESLICE}) timeslicing algorithm 198 is enabled, then RTEMS will limit the amount of time the task 199 can execute before the processor is allocated to another 200 ready task of equal priority. Each time a task using this algorithm 201 is context switched to it will have its timeslice replenished. For 202 example, if the timeslicing quantum is ten milliseconds and the task 203 executes for five milliseconds before being context switched out, then 204 the next time it executes it will again be given a full ten millisecond 205 timeslice. This is the same algorithm used by POSIX threads using 206 the @code{SCHED_OTHER} scheduling algorithm. Note that the POSIX 207 standard does not specify the behavior of the @code{SCHED_OTHER} 208 algorithm, thus leaving it implementation defined. 209 210 @cindex SCHED_RR 211 212 @item If the @code{@value{RPREFIX}TIMESLICE_EXHAUST}) timeslicing algorithm 213 is enabled, then RTEMS will limit the amount of time the task 214 can execute before the processor is allocated to another 215 ready task of equal priority. A task using this algorithm 216 will only have its timeslice replenished when it has been completely 217 used. For example, if the timeslicing quantum is ten milliseconds and 218 the task executes for five milliseconds before being context switched out, 219 then the next time it executes it will only have five milliseconds 220 remaining in its timeslice. This is the same algorithm used by POSIX 221 threads using the @code{SCHED_RR} scheduling algorithm. 222 223 @end itemize 224 225 If a task is not preemptible (e.g. @code{@value{RPREFIX}NO_PREEMPT} 226 is selected), then the timeslicing component is ignored by the scheduler. 191 227 192 228 The asynchronous signal processing component is used to determine when 193 229 received signals are to be processed by the task. … … 209 245 @item @code{@value{RPREFIX}PREEMPT} - enable preemption (default) 210 246 @item @code{@value{RPREFIX}NO_PREEMPT} - disable preemption 211 247 @item @code{@value{RPREFIX}NO_TIMESLICE} - disable timeslicing (default) 212 @item @code{@value{RPREFIX}TIMESLICE} - enable timeslicing 248 @item @code{@value{RPREFIX}TIMESLICE} - enable basic timeslicing 249 @item @code{@value{RPREFIX}TIMESLICE_EXHAUST} - enable POSIX style timeslicing 213 250 @item @code{@value{RPREFIX}ASR} - enable ASR processing (default) 214 251 @item @code{@value{RPREFIX}NO_ASR} - disable ASR processing 215 252 @item @code{@value{RPREFIX}INTERRUPT_LEVEL(0)} - enable all interrupts (default) … … 395 432 @code{@value{RPREFIX}TIMESLICE_MASK} and disables timeslicing 396 433 397 434 @item @code{@value{RPREFIX}TIMESLICE} is masked by 398 @code{@value{RPREFIX}TIMESLICE_MASK} and enables timeslicing 435 @code{@value{RPREFIX}TIMESLICE_MASK} and enables basic timeslicing 436 437 @item @code{@value{RPREFIX}TIMESLICE} is masked by 438 @code{@value{RPREFIX}TIMESLICE_EXHAUST} and enables POSIX style timeslicing 399 439 400 440 @item @code{@value{RPREFIX}ASR} is masked by 401 441 @code{@value{RPREFIX}ASR_MASK} and enables ASR processing … … 426 466 427 467 @item @code{@value{RPREFIX}TIMESLICE} is masked by 428 468 @code{@value{RPREFIX}TIMESLICE_MASK} and enables timeslicing 469 with automatic timeslice replenishment. 470 471 @item @code{@value{RPREFIX}TIMESLICE} is masked by 472 @code{@value{RPREFIX}TIMESLICE_MASK} and enables timeslicing 473 with timeslice replenishment only when consumed. 429 474 430 475 @item @code{@value{RPREFIX}ASR} is masked by 431 476 @code{@value{RPREFIX}ASR_MASK} and enables ASR processing … … 463 508 <TD ALIGN=center>disables timeslicing</TD></TR> 464 509 <TR><TD ALIGN=center>@value{RPREFIX}TIMESLICE</TD> 465 510 <TD ALIGN=center>@value{RPREFIX}TIMESLICE_MASK</TD> 466 <TD ALIGN=center>enables timeslicing</TD></TR> 511 <TD ALIGN=center>enables timeslicing with automatic replenishment</TD></TR> 512 <TR><TD ALIGN=center>@value{RPREFIX}TIMESLICE_EXHAUST</TD> 513 <TD ALIGN=center>@value{RPREFIX}TIMESLICE_MASK</TD> 514 <TD ALIGN=center>enables timeslicing with replenishment only when consumed</TD></TR> 467 515 <TR><TD ALIGN=center>@value{RPREFIX}ASR</TD> 468 516 <TD ALIGN=center>@value{RPREFIX}ASR_MASK</TD> 469 517 <TD ALIGN=center>enables ASR processing</TD></TR> … … 1241 1289 @cindex current task mode 1242 1290 @cindex set task mode 1243 1291 @cindex get task mode 1292 @cindex set task timeslicing mode 1293 @cindex get task timeslicing mode 1244 1294 @cindex set task preemption mode 1245 1295 @cindex get task preemption mode 1246 1296 @cindex obtain task mode … … 1312 1362 @code{@value{RPREFIX}TIMESLICE_MASK} and disables timeslicing 1313 1363 1314 1364 @item @code{@value{RPREFIX}TIMESLICE} is masked by 1315 @code{@value{RPREFIX}TIMESLICE_MASK} and enables timeslicing 1365 @code{@value{RPREFIX}TIMESLICE_MASK} and enables basic timeslicing 1366 with automatic timeslice replenishment. 1367 1368 @item @code{@value{RPREFIX}TIMESLICE_EXHAUST} is masked by 1369 @code{@value{RPREFIX}TIMESLICE_MASK} and enables timeslicing 1370 with timeslice replenishment only when it has been consumed. 1316 1371 1317 1372 @item @code{@value{RPREFIX}ASR} is masked by 1318 1373 @code{@value{RPREFIX}ASR_MASK} and enables ASR processing