Cooperative scheduling using coroutines and threads
First Claim
1. A method comprising:
- defining a first plurality of tasks associated with coroutine execution, and a second plurality of tasks associated with task-specific thread execution;
spawning a plurality of threads, each of the plurality of threads associated with one of the second plurality of tasks;
running a control thread to determine if a first task of the first plurality of tasks or the second plurality of tasks is associated with coroutine execution or with task-specific thread execution;
if the first task is determined to be associated with coroutine execution, running the control thread to swap a coroutine context of the control thread with a coroutine context of the task; and
if the first task is determined to be associated with thread execution, running the control thread to resume a first thread associated with the first task and to suspend the control thread.
2 Assignments
0 Petitions
Accused Products
Abstract
A database system may provide definition of a first plurality of tasks associated with coroutine execution, and a second plurality of tasks associated with task-specific thread execution. Also provided may be spawning of a control thread and a plurality of threads, each of the plurality of threads associated with one of the second plurality of tasks, and running of the control thread to determine if a task of the first plurality of tasks and the second plurality of tasks is associated with coroutine execution or with task-specific thread execution. If the task is determined to be associated with coroutine execution, the control thread may be run to swap a coroutine context of the control thread with a coroutine context of the task. If the task is determined to be associated with thread execution, the control thread may be run to resume a thread associated with the task and to suspend the control thread.
19 Citations
25 Claims
-
1. A method comprising:
-
defining a first plurality of tasks associated with coroutine execution, and a second plurality of tasks associated with task-specific thread execution; spawning a plurality of threads, each of the plurality of threads associated with one of the second plurality of tasks; running a control thread to determine if a first task of the first plurality of tasks or the second plurality of tasks is associated with coroutine execution or with task-specific thread execution; if the first task is determined to be associated with coroutine execution, running the control thread to swap a coroutine context of the control thread with a coroutine context of the task; and if the first task is determined to be associated with thread execution, running the control thread to resume a first thread associated with the first task and to suspend the control thread. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. A non-transitory computer-readable medium storing program code executable by a processor, the program code comprising:
-
code to define a first plurality of tasks associated with coroutine execution, and a second plurality of tasks associated with task-specific thread execution; code to spawn a plurality of threads, each of the plurality of threads associated with one of the second plurality of tasks; code to run a control thread to determine if a first task of the first plurality of tasks or the second plurality of tasks is associated with coroutine execution or with task-specific thread execution; code to run the control thread to swap a coroutine context of the control thread with a coroutine context of the first task, if the first task is determined to be associated with coroutine execution; and code to run the control thread to resume a first thread associated with the first task and to suspend the control thread, if the first task is determined to be associated with thread execution. - View Dependent Claims (12, 13, 14, 15, 16, 17, 18, 19, 20)
-
-
21. A system comprising:
-
a database to store data; and a database management system in communication with the database, the database management system to; define a first plurality of tasks associated with coroutine execution, and a second plurality of tasks associated with task-specific thread execution; spawn a plurality of threads, each of the plurality of threads associated with one of the second plurality of tasks; run a control thread to determine if a first task of the first plurality of tasks or the second plurality of tasks is associated with coroutine execution or with task-specific thread execution; run the control thread to swap a coroutine context of the control thread with a coroutine context of the first task, if the first task is determined to be associated with coroutine execution; and run the control thread to resume a first thread associated with the first task and to suspend the control thread, if the first task is determined to be associated with thread execution. - View Dependent Claims (22, 23, 24, 25)
-
Specification