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

Implement better wait for status change in VxWorks/RTEMS #684

Open
jphickey opened this issue Dec 11, 2020 · 0 comments
Open

Implement better wait for status change in VxWorks/RTEMS #684

jphickey opened this issue Dec 11, 2020 · 0 comments
Assignees

Comments

@jphickey
Copy link
Contributor

Is your feature request related to a problem? Please describe.
As a follow on to previous PR #678, this implements a new "impl" function which waits for a global table change to complete using an OS-specific primitive. But only POSIX/pthreads was initially updated to use a proper wait primitive for this operation. For VxWorks and RTEMS, these continue to use a simple unlock - task delay - re-lock and poll for the change.

This works but can potentially introduce noticable extra/unnecessary delay. In particular, during task startup the parent task is using the accessing record at the same time the child starts up and also needs to access the same record. Therefore the child task will hit this wait condition. On POSIX the child resumes immediately once the parent task has completed its use of the record. But currently for VxWorks and RTEMS they must wait for the Task Delay to expire.

Describe the solution you'd like
Need to investigate/consider the various sync primitives that the OS provides, and use something more appropriate that will not add extra unnecessary delay or polling.

Describe alternatives you've considered
Keep polling. It isn't "broken" in a strict sense - the contention should be resolved and the right thing will happen after the delay expires. It's just not what the user might expect (that is, there might be a millisecond or two delay between OS_TaskCreate returning and the user task actually running).

Additional context
RTEMS Barrier might be an option. However I do not see any way to sync a barrier with a condition (like a POSIX condition variable) - so these leave open the possibility that the other task finishes its operation just before the current task is about to wait - meaning it will end up waiting for an event that has already happened.

But so long as a timeout is also used, that means it will just fall back to the timeout - so if this happens its not worse than what is implemented now.

Originally discussed in review of #678 at CCB 2020-12-09

Requester Info
Joseph Hickey, Vantage Systems, Inc.

@jphickey jphickey self-assigned this Dec 11, 2020
jphickey added a commit to jphickey/osal that referenced this issue Aug 10, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
When cleaning up a task the child task resources should be
cleaned first, followed by the main task resources.

This is because child tasks are also associated with the original
creator within OSAL and will be found through OSAL ForEachObject,
and also via links within the ES task table.

By cleaning child tasks first, this avoids attempting to delete
the child task twice.
jphickey pushed a commit to jphickey/osal that referenced this issue Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants