Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Thread does not run in APS partition: (1 Item)
   
Thread does not run in APS partition  
I have programmatically created APS partititons using the API provided in the reference guide.
There were no errors while creating the partitions and it was also verfied with the aps show command.

Then I also attached threads to the partitions and there were no errors during the attach function as well.
However after running the program when I check the partition stats in the profiling window, it seems that the threads 
ran only in the system partition and not in the specified partitions.

Also although when I query the partition associated with the thread using SCHED_APS_QUERY_THREAD, it returns the right 
id, but on checking the visual timeline view, the thread seems to be associated only with the system partition and has 
an id of 0.

Unsure about what is happening here. 


int create_partition(int budget_percent, char* name) {
	sched_aps_create_parms partition;
	APS_INIT_DATA(&partition);
	partition.budget_percent = budget_percent;
	partition.critical_budget_ms = 0;
	partition.max_budget_percent = budget_percent;
	partition.name = name;
	int ret = SchedCtl( SCHED_APS_CREATE_PARTITION, &partition,	sizeof(partition));
	if (ret != EOK) {
		printf("Couldn't create partition \"%s\": %s (%d).\n", partition.name, strerror(errno), errno);
	} else {
		printf ("The new partition's ID is %d.\n", partition.id);
	}
	printf("The returned partition id is %d \n", partition.id);
	return partition.id;
}

void join_partition(int partition_id, int thread_id) {
	sched_aps_join_parms join_data;
	APS_INIT_DATA(&join_data);
	join_data.id = partition_id;
	join_data.pid = getpid();
	join_data.tid = thread_id;
	int ret = SchedCtl( SCHED_APS_JOIN_PARTITION, &join_data, sizeof(join_data));
	if (ret != EOK) {
		printf("Couldn't join partition %d: %s (%d).\n",
				join_data.id, strerror(errno), errno);
	} else {
		printf ("Thread %d is now in partition %d and the return value %d \n", thread_id, join_data.id, ret);
	}
}