コード例 #1
0
ファイル: dasa_nd.c プロジェクト: sbhal/sched
struct rt_info* sched_dasa_nd(struct list_head *head, int flags)
{
	struct rt_info *task, *best = local_task(head->next);
	struct rt_info *new_schedule=NULL, *prev_schedule = NULL;
	list_for_each_entry(task, head, task_list[LOCAL_LIST]){
		if(check_task_failure(task, flags))
			return task;

		initialize_lists(task);
		livd(task, false, flags); //updating value density values for all tasks in queue
		if(task->local_ivd < best->local_ivd)
			best = task;
		}
	copy_list(task, LOCAL_LIST, SCHED_LIST1);
	quicksort(best, SCHED_LIST1, SORT_KEY_LVD, 0);
	//best points to task with highest value density
	new_schedule = task = best;
	while(1) {
		prev_schedule = new_schedule;
		if (insert_on_list(task, new_schedule, SCHED_LIST2, SORT_KEY_DEADLINE, 0))
			new_schedule = task;

		if (!list_is_feasible(new_schedule, SCHED_LIST2)){
			list_remove(task, SCHED_LIST2);
			new_schedule = prev_schedule;
			}
		//moving to next task
		task = task_list_entry(task->task_list[SCHED_LIST1].next, SCHED_LIST1);
		if(task == best) //list iteration completed
			break;
		}

	return (new_schedule == NULL) ? best : new_schedule;
}
コード例 #2
0
struct rt_info* sched_hvdf(struct list_head *head, int flags)
{
	struct rt_info *task, *best = local_task(head->next);

	/*Check for each entry in the list*/
	list_for_each_entry(task, head, task_list[LOCAL_LIST]){

	/* Check if task is aborted, if yes, the return it. Otherwise
	   check if the deadline is blown, if yes, abort the task using 
	   abort_thread(). {Done in handle_task_failure() function.}
	 */
		if(check_task_failure(task, flags))
			return task;

	/* Calculate inverse value density for the current task.*/
		livd(task, false, flags);

	/* Compare the inverse value densities and assign the higher value
	   density task to best.
	 */
		if(task->local_ivd < best->local_ivd)
			best = task ;

	}


	if(flags & SCHED_FLAG_PI)
		best = get_pi_task(best, head, flags);

	return best;
}
コード例 #3
0
ファイル: rma.c プロジェクト: longqzh/chronnOS
struct rt_info* sched_rma(struct list_head *head, int flags)
{
	struct rt_info *best = local_task(head->next);

	if(flags & SCHED_FLAG_PI)
		best = get_pi_task(best, head, flags);

	return best;
}
コード例 #4
0
ファイル: hvdf.c プロジェクト: longqzh/chronnOS
struct rt_info* sched_hvdf(struct list_head *head, int flags)
{
	struct rt_info *it, *best = local_task(head->next);

	list_for_each_entry(it, head, task_list[LOCAL_LIST]) {
		if(check_task_failure(it, flags))
			return it;

		livd(it, false, flags);
		if(it->local_ivd < best->local_ivd)
			best = it;
	}

	if(flags & SCHED_FLAG_PI)
		best = get_pi_task(best, head, flags);

	return best;
}