Method for controlling process priority in semaphore operation
First Claim
1. A multitask processing method for executing any one of a plurality of processes each having a different process priority by using a semaphore having a semaphore priority in a semaphore operation including a first operation and second operation, each process being in a running state, wait state or ready state, the method, performed in a single processor, comprising the steps of:
- comparing, in the first operation, the semaphore priority with a first process priority of a first one of the processes which is in the running state;
changing the first process priority into a first changed priority corresponding to the semaphore priority when the semaphore priority is higher than the first process priority, to execute the first process;
returning, in the second operation, the first changed priority to the first process priority;
comparing the semaphore priority with a second process priority of a second one of the plurality of processes which is in the wait state;
changing the second process priority into a second changed priority corresponding to the semaphore priority when the semaphore priority is higher than the second process priority;
setting the second process having the second changed priority in the ready state;
comparing the returning first process priority with the second changed priority;
setting the first process in the ready state when the second changed priority is higher than the returned first process priority; and
selecting a process having a highest process priority from among the process priorities of the processes which are in the ready state to execute the selected process.
1 Assignment
0 Petitions
Accused Products
Abstract
In the P operation of a semaphore operation, the semaphore priority set in the semaphore is compared with the process priority of an execution process. When the semaphore priority is higher than the process priority of the execution process, the process priority is changed to the semaphore priority and the process is executed in accordance with the changed process priority. In the V operation, on the other hand, the semaphore priority is compared with the process priority of the first process which is placed in the wait state. When the semaphore priority is higher than the process priority of the first process in the wait state, the process priority is changed to the semaphore priority and the process is placed in the ready state. Furthermore, the process priority of the process in the ready state is compared with the process priority of an execution process. When the process priority of the process in the ready state is higher than the process priority of the execution process, the execution process is placed in the ready state.
-
Citations
4 Claims
-
1. A multitask processing method for executing any one of a plurality of processes each having a different process priority by using a semaphore having a semaphore priority in a semaphore operation including a first operation and second operation, each process being in a running state, wait state or ready state, the method, performed in a single processor, comprising the steps of:
-
comparing, in the first operation, the semaphore priority with a first process priority of a first one of the processes which is in the running state; changing the first process priority into a first changed priority corresponding to the semaphore priority when the semaphore priority is higher than the first process priority, to execute the first process; returning, in the second operation, the first changed priority to the first process priority; comparing the semaphore priority with a second process priority of a second one of the plurality of processes which is in the wait state; changing the second process priority into a second changed priority corresponding to the semaphore priority when the semaphore priority is higher than the second process priority; setting the second process having the second changed priority in the ready state; comparing the returning first process priority with the second changed priority; setting the first process in the ready state when the second changed priority is higher than the returned first process priority; and selecting a process having a highest process priority from among the process priorities of the processes which are in the ready state to execute the selected process. - View Dependent Claims (2)
-
-
3. A multitask processing method for executing any one of a plurality of processes each having a different process priority by using a semaphore in a semaphore operation having a first operation and second operation, the semaphore including a first region for storing a semaphore priority and a second region for storing the process priority of one of the processes, each of a plurality of process control blocks corresponding to the processes for storing the different process priority, each process being in a running state, wait state or ready state, the method, performed in a single processor, comprising the steps of:
-
saving, in the first operation, a first process priority stored in a first process control block corresponding to a first one of the processes which is in the running state to the second region of the semaphore; comparing the semaphore priority with the saved process priority; storing a first changed priority corresponding to the semaphore priority into the first process control block when the semaphore priority is higher than the saved process priority; returning, in the second operation, the saved process priority to the first process control block; comparing the semaphore priority stored in the first region of the semaphore with a second process priority stored in a second process control block corresponding to a second one of the processes which is in the wait state; storing a second changed priority corresponding to the semaphore priority in the second process control block when the semaphore priority is higher than the second process priority stored in the second process control block; setting the second process in the ready state; comparing the returned process priority with the second changed priority; setting the first process in the ready state when the second changed priority is higher than the returned process priority; and selecting a process having a highest process priority from among the process priorities of the processes which are in the ready state to execute the selected process. - View Dependent Claims (4)
-
Specification