Method and system for synchronizing the execution of a critical code section
First Claim
1. A method for synchronizing the execution of at least one critical code section (C1) by at least one of a plurality of concurrent tasks (S1, Sn) of an application (4), the application (4) running on an operating system (5) providing cooperative multitasking, the critical code section (C1) being restricted to execution by only a limited number of the plurality of tasks (S1, Sn), the method comprising at least the following steps performed by at least one of the tasks (S1, Sn):
- a. testing (F11) at least one variable (Mx) associated to the at least one critical code section (C1) and setting (F12) the variable (Mx) and entering the associated critical code section (C1), if the variable (Mx) is not set by another task (S1, Sn), or, waiting (F13) for a release (F22) by another task (S1, Sn) and releasing a CPU, if the variable (Mx) is already set by another task (S1, Sn); and
b. resetting (F21) the variable (Mx) and releasing (F22) at least one of 20 the other waiting tasks (S1, Sn) when leaving the critical code section (C1);
c. wherein step a. is performed as an atomic function (F1).
1 Assignment
0 Petitions
Accused Products
Abstract
The invention concerns a method for synchronizing the execution of at least one critical code section (C1) by at least one of a plurality of concurrent tasks (S1, Sn) of an application (4), the application (4) running on an operating system (5) providing cooperative multitasking, the critical code section (C1) being restricted to execution by only a limited number of the plurality of tasks (S1, Sn), the method comprising at least the following steps performed by at least one of the tasks (S1, Sn):
- a. testing (F11) at least one variable (Mx) associated to the at least one critical code section (C1) and setting (F12) the variable (Mx) and entering the associated critical code section (C1), if the variable (Mx) is not set by another task (S1, Sn), or, waiting (F13) for a release (F22) by another task (S1, Sn) and releasing the CPU, if the variable (Mx) is already set by another task (S1, Sn); and
- b. resetting (F21) the variable (Mx) and releasing (F22) at least one of the other waiting tasks (S1, Sn) when leaving the critical code section (C1);
- c. wherein step a. is performed as an atomic function (F1).
18 Citations
15 Claims
-
1. A method for synchronizing the execution of at least one critical code section (C1) by at least one of a plurality of concurrent tasks (S1, Sn) of an application (4), the application (4) running on an operating system (5) providing cooperative multitasking, the critical code section (C1) being restricted to execution by only a limited number of the plurality of tasks (S1, Sn), the method comprising at least the following steps performed by at least one of the tasks (S1, Sn):
-
a. testing (F11) at least one variable (Mx) associated to the at least one critical code section (C1) and setting (F12) the variable (Mx) and entering the associated critical code section (C1), if the variable (Mx) is not set by another task (S1, Sn), or, waiting (F13) for a release (F22) by another task (S1, Sn) and releasing a CPU, if the variable (Mx) is already set by another task (S1, Sn); and b. resetting (F21) the variable (Mx) and releasing (F22) at least one of 20 the other waiting tasks (S1, Sn) when leaving the critical code section (C1); c. wherein step a. is performed as an atomic function (F1). - View Dependent Claims (2, 3, 4, 5, 6, 7, 8)
-
-
9. A system for synchronizing the execution of at least one critical code section (C1) by at least one of a plurality of concurrent tasks (S1, Sn) of an application (4), the application (4) running on an operating system (5) providing cooperative multitasking of a CPU, the critical code section (C1) being restricted to execution by only a limited number of the plurality of tasks (S1, Sn), the system comprising:
-
a. a first function (F1) adapted for being called by at least one of the tasks (S1, Sn), the first atomic function (F1) being further adapted for testing (F11) at least one variable (Mx) associated to the at least one critical code section (C1) and, if the variable (Mx) is not set, setting (F12) the variable (Mx) and granting access for the task (S1, Sn) to the associated critical code section (C1), or, if the variable (Mx) is already set by another task (S1, Sn), forcing the calling task (S1, Sn) to wait (F13) for being released (F22) by another task (S1, Sn) and to release the CPU; and b. a second function (F2) adapted for being called by at least one of the tasks (S1, Sn), the second atomic function (F2) being further adapted for resetting (F21) the variable (Mx) and releasing (F22) at least one other waiting task (S1, Sn) when the calling task (S1, Sn) is leaving the critical code section (C1); c. wherein the first function is atomic. - View Dependent Claims (10, 11, 12, 13, 14, 15)
-
Specification