Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sim: Increased priority of loop task. #6689

Merged
merged 1 commit into from Jul 22, 2022

Conversation

fjpanag
Copy link
Contributor

@fjpanag fjpanag commented Jul 22, 2022

Summary

In simulator there is the loop task that performs various house-keeping functions.
It mostly emulates functions that normally would happen in interrupts.

This task was assigned a very low priority, so house-keeping was taking place if and when there was any idle time in the system.
In case of high load, it couldn't run.

This PR increases the loop task priority to max, as it is better suited for its interrupt-like role.

Impact

Simulator house-keeping tasks run more reliably and steadily, even in high load cases.

Testing

After the change I run the simulator and used my firmware. It seems that nothing is broken.

Simultaneously, I tested whether it fixes things.
I have a piece of code that looks like this:

	clock_t start = clock();

	char buf[1];
	while (read(s_dev, buf, 1) == 1)
	{
		// Do stuff with the received byte.

		if ((clock() - start) > TIMEOUT)
			break;
	}

This was not working before, as there was no idle CPU time for the loop task to operate (although it works on an actual hardware target).

After the change, I am able to receive bytes from the simulated serial port.

@xiaoxiang781216 xiaoxiang781216 merged commit ad7f503 into apache:master Jul 22, 2022
@fjpanag fjpanag deleted the sim_loop branch July 22, 2022 17:26
@jerpelea jerpelea added this to To-Add in Release Notes - 11.0.0 Aug 30, 2022
@jerpelea jerpelea moved this from To-Add to Added in Release Notes - 11.0.0 Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants