roundrobin problem

Scott J scott.j at myrealbox.com
Fri Aug 23 01:51:42 UTC 2002


Hi, everyone

	I've got a problem with roundrobin in my program.

	Create and start task1,task2,task3, all of them with DEFAULT_MODES | TIMESLICE, DEFAULT_ATTRIBUTES and the same priority 3, ticks_per_timeslice is 500. The roundrobin goes well.
	
	Now	add a new task: task0 with priority 1, DEFAULT_MODES, DEFAULT_ATTRIBUTES.

	task0()
	{
		while( 1 ) {
			task_wake_after( 100 );
		}
	}

	The roundrobin failed, only task0 and task1 executed. 

	I think the statements in _Thread_Dispatch() :

    if ( heir->budget_algorithm == THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE )
      heir->cpu_time_budget = _Thread_Ticks_per_timeslice;

	reset the heir's timeslice though its timeslice has not finished. So task1 always executes.

	If the statements were

    if ( ( heir->budget_algorithm == THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE ) &&
    	 ( heir->cpu_time_budget == 0 ) )
        heir->cpu_time_budget = _Thread_Ticks_per_timeslice;

	roundrobin goes well again. 	

	This happens in rtems-4.5.1-pre3 and rtems-ss-20020807.

	Is the modification right? Joel, what do you think about it?

	Thanks.

----
Scott
Aug 23, 2002





More information about the users mailing list