Single-stack real-time operating system for embedded systems
First Claim
1. 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 subsystem providing a plurality of task priorities such that not all of the first plurality of tasks run at the same priority, wherein the first plurality of tasks share and use only a single stack;
a plurality of task queues including a pending queue, a running queue and a blocked queue;
a task scheduler that uses the plurality of task queues including the pending queue, the running queue and the blocked queue, and that, when invoked, switches control to a highest-priority one from the pending queue of the first plurality of tasks;
a continuations library subsystem that automatically manages a plurality of continuation points including a first continuation point;
a yield function that sets the first continuation point in the first task and yields control to the task scheduler, whereupon the task scheduler switches control to the second task and wherein at a later time the task scheduler switches control back to the first task at the first continuation point; and
a nested blocking function call subsystem, that invokes a second blocking function in the second task from within a first blocking function in the second task and yields control to the task scheduler, wherein the first blocking function identifies to the RTOS which event is to be waited for, wherein the event has an associated event control block that contains a pointer to a task control block of a task that is currently blocked on the event, such that the RTOS determines from the event control block of the event which task to invoke when the event is triggered, and if there is a task is waiting for this event when the event triggers, then the pending queue of tasks is updated, else a new event state is saved in an event control block and when the task next needs to wait for the event, the task checks the event state in the event control block and determines that the task does not need to be blocked.
2 Assignments
0 Petitions
Accused Products
Abstract
A real time operating system (RTOS) for embedded controllers having limited memory includes a continuations library, a wide range of macros that hide continuation point management, nested blocking functions, and a communications stack. The RTOS executes at least a first and second task and uses a plurality of task priorities. The tasks share only a single stack. The task scheduler switches control to the highest-priority task. The continuations library provides macros to automatically manage the continuation points. The yield function sets a first continuation point in the first task and yields control to the task scheduler, whereupon the task scheduler switches to the second task and wherein at a later time the task scheduler switches control back to the first task at the first continuation point. The nested blocking function invokes other blocking functions from within its body and yields control to the task scheduler.
5 Citations
22 Claims
-
1. 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 subsystem providing a plurality of task priorities such that not all of the first plurality of tasks run at the same priority, wherein the first plurality of tasks share and use only a single stack; a plurality of task queues including a pending queue, a running queue and a blocked queue; a task scheduler that uses the plurality of task queues including the pending queue, the running queue and the blocked queue, and that, when invoked, switches control to a highest-priority one from the pending queue of the first plurality of tasks; a continuations library subsystem that automatically manages a plurality of continuation points including a first continuation point; a yield function that sets the first continuation point in the first task and yields control to the task scheduler, whereupon the task scheduler switches control to the second task and wherein at a later time the task scheduler switches control back to the first task at the first continuation point; and a nested blocking function call subsystem, that invokes a second blocking function in the second task from within a first blocking function in the second task and yields control to the task scheduler, wherein the first blocking function identifies to the RTOS which event is to be waited for, wherein the event has an associated event control block that contains a pointer to a task control block of a task that is currently blocked on the event, such that the RTOS determines from the event control block of the event which task to invoke when the event is triggered, and if there is a task is waiting for this event when the event triggers, then the pending queue of tasks is updated, else a new event state is saved in an event control block and when the task next needs to wait for the event, the task checks the event state in the event control block and determines that the task does not need to be blocked. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. A computerized method of real-time operating system (RTOS) operation of a computer processor having a memory, the method comprising:
-
providing a single stack; performing, in the computer processor, a first plurality of tasks including a first task and a second task, wherein not all of the first plurality of tasks run at the same priority, wherein the first plurality of tasks share and use only the single stack; scheduling tasks using a plurality of task queues including a pending queue, a running queue and a blocked queue; using and sharing the single stack by all of the first plurality of tasks; automatically managing a plurality of continuation points, wherein the plurality of continuation points includes a first continuation point and a second continuation point; creating the first continuation point in the first task and yielding control to the scheduling of tasks, wherein the scheduling of tasks includes selectively switching control to a highest-priority one of the first plurality of tasks, wherein the second task is the highest-priority one from the pending queue of the first plurality of tasks; switching control back to the first task at the first continuation point at a later time; and executing a first blocking function within the first task such that the scheduling of tasks switches to the second task and executing a second blocking function in the second task before continuing the first task after the first blocking function has executed, wherein the first blocking function identifies to the RTOS which event is to be waited for, wherein the event has an associated event control block that contains a pointer to a task control block of a task that is currently blocked on the event, such that the RTOS determines from the event control block of the event which task to invoke when the event is triggered, and if there is a task is waiting for this event when the event triggers, then the pending queue of tasks is updated, else a new event state is saved in an event control block and when the task next needs to wait for the event, the task checks the event state in the event control block and determines that the task does not need to be blocked. - View Dependent Claims (9, 10, 11, 12)
-
-
13. A non-transitory computer-readable medium having instructions embedded thereon, wherein the instructions, when performed on a computer processor, execute a method of real-time operating system (RTOS) operation, the method comprising:
-
providing a single stack; performing, in the computer processor, a first plurality of tasks including a first task and a second task, wherein not all of the first plurality of tasks run at the same priority, wherein the first plurality of tasks share and use only the single stack; scheduling tasks using a plurality of task queues including a pending queue, a running queue and a blocked queue; using and sharing the single stack by all of the first plurality of tasks; automatically managing a plurality of continuation points, wherein the plurality of continuation points includes a first continuation point and a second continuation point; creating the first continuation point in the first task and yielding control to the scheduling of tasks, wherein the scheduling of tasks includes selectively switching control to a highest-priority one from the pending queue of the first plurality of tasks, wherein the second task is the highest-priority one of the first plurality of tasks; switching control back to the first task at the first continuation point at a later time; and executing a first blocking function within the first task such that the scheduling of tasks switches to the second task and executing a second blocking function in the second task before continuing the first task after the first blocking function has executed, wherein the first blocking function identifies to the RTOS which event is to be waited for, wherein the event has an associated event control block that contains a pointer to a task control block of a task that is currently blocked on the event, such that the RTOS determines from the event control block of the event which task to invoke when the event is triggered, and if there is a task is waiting for this event when the event triggers, then the pending queue of tasks is updated, else a new event state is saved in an event control block and when the task next needs to wait for the event, the task checks the event state in the event control block and determines that the task does not need to be blocked. - View Dependent Claims (14, 15, 16, 17)
-
-
18. A computing apparatus including a processor and memory running a real-time operating system (RTOS), the apparatus comprising:
-
a single stack; means for performing, in the computing apparatus, a first plurality of tasks including a first task and a second task, wherein not all of the first plurality of tasks run at the same priority, wherein the first plurality of tasks share and use only the single stack; a plurality of task queues including a pending queue, a running queue and a blocked queue; a task scheduler that uses the plurality of task queues including the pending queue, the running queue and the blocked queue; means for using and sharing the single stack by all of the first plurality of tasks; means for automatically managing a plurality of continuation points, wherein the plurality of continuation points includes a first continuation point and a second continuation point; means for creating the first continuation point in the first task and for yielding control to the task scheduler; means for selectively switching control to a highest-priority one from the pending queue of the first plurality of tasks using the task scheduler, wherein the second task is the highest-priority one of the first plurality of tasks; means for switching control back to the first task at the first continuation point at a later time; and means for executing a first blocking function within the first task such that the task scheduler switches to the second task and executing a second blocking function in the second task before the first task is continued after the first blocking function has executed, wherein the first blocking function identifies to the RTOS which event is to be waited for, wherein the event has an associated event control block that contains a pointer to a task control block of a task that is currently blocked on the event, such that the RTOS determines from the event control block of the event which task to invoke when the event is triggered, and if there is a task is waiting for this event when the event triggers, then the pending queue of tasks is updated, else a new event state is saved in an event control block and when the task next needs to wait for the event, the task checks the event state in the event control block and determines that the task does not need to be blocked. - View Dependent Claims (19, 20, 21, 22)
-
Specification