Legal claims defining the scope of protection, as filed with the USPTO.
1. A method of providing memory management in a real-time operating system (RTOS) based system, the method comprising: creating, by a task generator, a plurality of tasks with a two level stack scheme including a first-level stack and a second-level stack; scheduling, by a task scheduler, a first task in a first state for execution by transferring task contents associated with the first task from the first-level stack to the second-level stack; determining whether the first task is pre-empted; allocating the second-level stack to the first task in a second state, if the first task is not pre-empted; changing, by the task scheduler, an active task for execution; determining whether the first task relinquishes control from the second state and is awaiting a resource; scanning the second-level stack, if the first task relinquishes control from the second state and is awaiting the resource; determining whether a register is present in a range of stack addresses of the second-level stack; determining whether usage of the second-level stack is less than a size of the first-level stack, if there are no registers present in the range of the stack addresses of the second-level stack; and transferring the task contents from the second-level stack to the first-level stack, if the usage of the second-level stack is less than the size of the first-level stack.
2. The method of claim 1 , further comprising: allocating a new first-level stack for the first task, if the usage of the second-level stack is greater than or equal to the size of the first-level stack; copying the task contents from the second-level stack to the new first-level stack; and marking the second-level stack for the first task as free.
3. The method of claim 1 , further comprising: checking for at least one register, if the register is present in the range of stack addresses of the second-level stack; determining whether content of the register is an address or a value; and storing an address offset from a start of the stack and a translation required flag for the register, if the content of the register is the address.
4. The method of claim 1 , further comprising: determining that the second-level stack was previously allocated for the first task, if the first task is pre-empted.
5. The method of claim 1 , wherein the first-level stack is configured to hold context data associated with the first task in the first state.
6. The method of claim 1 , wherein the second-level stack includes a plurality of stacks, where at least one stack of the plurality of stacks is provided to store the task content when the first task shifts from the first state to the second state.
7. The method of claim 1 , wherein the first state is a suspended state.
8. The method of claim 1 , wherein the second state is a running state.
9. The method of claim 1 , wherein the size of the first-level stack is equivalent to a stack memory required to store content of the first task in a suspended state.
10. The method of claim 1 , wherein, a size of the second-level stack is determined based on a stack required for any task to execute any scenario that demands a largest stack in the RTOS based system.
11. The method of claim 1 , wherein a number of stacks in the second-level stack is determined based on a maximum number of pre-empted tasks.
12. The method of claim 1 , wherein a stack pointer is moved to the second-level stack before the first task is moved from the first state to the second state.
13. The method of claim 1 , further comprising: creating, by the task scheduler, at least one stack in the second-level stack, if a number of pre-empted tasks for execution is greater than a pre-defined number.
14. A non-transitory computer-readable medium having instructions embedded thereon, wherein the instructions, when performed on a computer processor, execute a method of a real-time operating system (RTOS) based system, the method comprising: creating, by a task generator, a plurality of tasks with a two level stack scheme including a first-level stack and a second-level stack; scheduling, by a task scheduler, a first task in a first state for execution by transferring task contents associated with the first task from the first-level stack to the second-level stack; determining whether the first task is pre-empted; allocating the second-level stack to the first task in a second state, if the first task is not pre-empted; changing, by the task scheduler, an active task for execution; determining whether the first task relinquishes control from the second state and is awaiting a resource; scanning the second-level stack, if the first task relinquishes control from the second state and is awaiting the resource; determining whether a register is present in a range of stack addresses of the second-level stack; determining whether usage of the second-level stack is less than a size of the first-level stack, if there are no registers present in the range of the stack addresses of the second-level stack; and transferring the task contents from the second-level stack to the first-level stack, if the usage of the second-level stack is less than the size of the first-level stack.
15. A computer processor and memory running a real-time operating system (RTOS) for the computer processor performing a first plurality of tasks including a first task and a second task, the RTOS comprising: a task generator configured to create a plurality of tasks with a two level stack scheme including a first-level stack and a second-level stack; and a task scheduler configured for: scheduling the first task in a first state for execution by transferring task contents associated with the first task from the first-level stack to the second-level stack; determining whether the first task is pre-empted; allocating the second-level stack to the first task in a second state, if the first task is not pre-empted; changing an active task for execution; determining whether the first task relinquishes control from the second state and is awaiting a resource; scanning the second-level stack, if the first task relinquishes control from the second state and is awaiting the resource; determining whether any register any present in a range of stack addresses of the second-level stack; determining whether usage of the second-level stack is less than a size of the first-level stack, if there are no registers present in the range of the stack addresses of the second-level stack; and transferring the task contents from the second-level stack to the first-level stack, if the usage of the second-level stack is less than the size of the first-level stack.
16. The computer processor and memory running the RTOS according to claim 15 , wherein the task scheduler is further configured for: allocating a new first-level stack for the first task, if the usage of the second-level stack is greater than or equal to the size of the current first-level stack; copying the task contents from the second-level stack to the new first-level stack; checking for at least one register, if the register is present in the range of stack addresses of the second-level stack; determining whether content of the register is an address or a value; and storing an address offset from a start of the stack and a translation required flag for the register, if the content of the register is the address.
17. The computer processor and memory running the RTOS according to claim 15 , wherein the task scheduler is further configured for: determining that the second-level stack was previously allocated for the first task, if the first task is pre-empted.
18. The computer processor and memory running the RTOS according to claim 15 , wherein the first-level stack is configured to hold context data associated with the first task in the first state, and the second-level stack includes a plurality of stacks, where at least one stack of the plurality of stacks is provided to store the task content when the first task shifts from the first state to the second state.
19. The computer processor and memory running the RTOS according to claim 15 , wherein the first state is a suspended state, and the second state is a running state, the size of the first-level stack is equivalent to a stack memory required to store content of the first task in the suspended state, and a size of the second-level stack is determined based on a stack required for any task to execute any scenario that demands a largest stack in the RTOS based system.
20. The computer processor and memory running the RTOS according to claim 15 , wherein a number of stacks in the second-level stack is determined based on a maximum number of pre-empted tasks.
Unknown
April 2, 2019
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.