This application is based upon, and claims the benefit of priority from, corresponding Japanese Patent Application No. 2015-167758 filed in the Japan Patent Office on Aug. 27, 2015, the entire contents of which are incorporated herein by reference.
Unless otherwise indicated herein, the description in this section is not prior art to the claims in this application and is not admitted to be prior art by inclusion in this section.
In a typical electronic device, an interrupt occurs to each of a plurality of processes.
An electronic device according to an aspect of the disclosure includes a plurality of processes, a plurality of interrupt waiting units, and an interrupt handler. The plurality of interrupt waiting units correspond to the plurality of processes, respectively. The interrupt handler processes interrupts of the plurality of processes. The plurality of interrupt waiting unit sets an interrupt waiting flag to wait for an occurrence of the interrupt and wait for a process corresponding to each of the plurality of interrupt waiting units. The interrupt handler, when the interrupt occurred, sets an interrupt style of the occurred interrupt and clears the set interrupt waiting flag. the plurality of interrupt waiting units include a first interrupt waiting unit that corresponds to a first process associated with the set interrupt style and a second interrupt waiting unit that corresponds to a second process not associated with the set interrupt style. the first interrupt waiting unit operates the first process when the interrupt waiting flag was cleared. The second interrupt waiting unit set the interrupt waiting flag when the interrupt waiting flag was cleared. The interrupt waiting flag is located to each of the plurality of processes.
These as well as other aspects, advantages, and alternatives will become apparent to those of ordinary skill in the art by reading the following detailed description with reference where appropriate to the accompanying drawings. Further, it should be understood that the description provided in this summary section and elsewhere in this document is intended to illustrate the claimed subject matter by way of example and not by way of limitation.
Example apparatuses are described herein. Other example embodiments or features may further be utilized, and other changes may be made, without departing from the spirit or scope of the subject matter presented herein. In the following detailed description, reference is made to the accompanying drawings, which form a part thereof.
The example embodiments described herein are not meant to be limiting. It will be readily understood that the aspects of the present disclosure, as generally described herein, and illustrated in the drawings, can be arranged, substituted, combined, separated, and designed in a wide variety of different configurations, all of which are explicitly contemplated herein.
Hereinafter, a comparative example will be described by referring to the drawings before describing an embodiment of the disclosure.
The electronic device 90 in
The electronic device 90 can execute the process 91, the process 92, an interrupt waiting unit 93, which waits for the interrupt to the process 91 as a Linux interrupt waiting function, an interrupt waiting unit 94, which waits for the interrupt to the process 92 as a Linux interrupt waiting function, and an interrupt handler 95 as a task for processing the interrupts.
The process 91 includes a main process thread 91a, which executes a main processing of the process 91, and an interrupt process thread 91b, which processes the interrupt.
The process 92 includes a main process thread 92a, which executes a main processing of the process 92, and an interrupt process thread 92b, which processes the interrupt.
When the main process thread 91a waits for the occurrence of the interrupt, the interrupt process thread 91b of the process 91 executes an interrupt acquiring request on the interrupt waiting unit 93. Accordingly, as illustrated in
Similarly, when the main process thread 92a waits for the occurrence of the interrupt, the interrupt process thread 92b of the process 92 executes an interrupt acquiring request on the interrupt waiting unit 94. Accordingly, as illustrated in
When setting the interrupt waiting flag 90b, if the interrupt waiting flag 90b has already been set, the interrupt waiting unit 93 and the interrupt waiting unit 94 set the interrupt waiting flag 90b again.
When any interrupt such as a press of a power button, a press of a power saving key for power saving, or reception of an instruction from a network occurs, the interrupt handler 95 clears the interrupt waiting flag 90b on the RAM 90a. That is, the interrupt handler 95 releases the interrupt waiting flag 90b from the set state.
Then, the interrupt handler 95, as illustrated in
Upon detecting a change in the interrupt waiting flag 90b from the set state as illustrated in
Similarly, upon detecting a change in the interrupt waiting flag 90b from the set state as illustrated in
Upon released from the wait state, the interrupt process thread 91b of the process 91 confirms the interrupt style 90c on the RAM 90a to determine whether or not the interrupt style 90c is matched with the process 91. Then, if the interrupt process thread 91b determines that the interrupt style 90c is matched with the process 91, the main process thread 91a is operated. On the other hand, if the interrupt process thread 91b determines that the interrupt style 90c is not matched with the process 91, the interrupt acquiring request is executed on the interrupt waiting unit 93. Accordingly, the interrupt waiting unit 93, as illustrated in
Similarly, upon released from the wait state, the interrupt process thread 92b of the process 92 confirms the interrupt style 90c on the RAM 90a to determine whether or not the interrupt style 90c is matched with the process 92. Then, if the interrupt process thread 92b determines that the interrupt style 90c is matched with the process 92, the main process thread 92a is operated. On the other hand, if the interrupt process thread 92b determines that the interrupt style 90c is not matched with the process 92, the interrupt acquiring request is executed on the interrupt waiting unit 94. Accordingly, the interrupt waiting unit 94, as illustrated in
When setting the interrupt waiting flag 90b, if the interrupt waiting flag 90b has already been set, the interrupt waiting unit 93 and the interrupt waiting unit 94 set the interrupt waiting flag 90b again.
According to the operation illustrated in
Then, the interrupt handler 95, when any interrupt has occurred, clears the interrupt waiting flag 90b (Step S121), and sets the interrupt style 90c for the occurred interrupt (Step S122).
Accordingly, the interrupt waiting unit 93 confirms that the interrupt waiting flag 90b has been cleared (Step S131) and causes the process 91 to wake up (Step S132). Then, the interrupt process thread 91b of the process 91, upon determining that the interrupt style 90c is not matched with the process 91 (Step S133), executes the interrupt acquiring request on the interrupt waiting unit 93 (Step S134). Consequently, the interrupt waiting unit 93 sets the interrupt waiting flag 90b (Step S135) to put the process 91 to sleep (Step S136).
Similarly, the interrupt waiting unit 94 confirms that the interrupt waiting flag 90b has been cleared (Step S141), and causes the process 92 to wake up (Step S142). Then, the interrupt process thread 92b of the process 92, upon determining that the interrupt style 90c is not matched with the process 92 (Step S143), executes the interrupt acquiring request on the interrupt waiting unit 94 (Step S144). Consequently, the interrupt waiting unit 94 sets the interrupt waiting flag 90b (Step S145) to put the process 92 to sleep (Step S146).
However, there is a problem in which the electronic device according to the comparative example may not be able to execute any of the plurality of processes corresponding to the interrupt.
This will be described below in detail.
In the example illustrated in
The operation timings of the process 91 and the process 92 are not necessarily simultaneous because the operation timings depend on the priority of the tasks and a scheduler for Linux OS.
Accordingly, as illustrated in
Hereinafter, an embodiment of the disclosure will be described by referring to the drawings.
First, a description will be given of a configuration of a Multifunction Peripheral (MFP) as an electronic device according to the embodiment.
As illustrated in
The storage unit 17 stores an interrupt process program 17a, which controls an interrupt to each of a plurality of processes. The interrupt process program 17a may be installed in the MFP 10 at the production stage of the MFP 10, may be additionally installed in the MFP 10 from an external storage medium such as a SD card or a Universal Serial Bus (USB) memory, or may be additionally installed in the MFP 10 from the network.
The control unit 20 includes, for example, a Central Processing Unit (CPU) 21, a Read Only Memory (ROM) 22 storing a program and various kinds of data, and a Random Access Memory (RAM) 23 used as a work area of the CPU21. The CPU21 executes the program stored in the storage unit 17 or the ROM22.
The MFP 10 illustrated in
The control unit 20 (see
The process 31 includes a main process thread 31a, which executes a main processing of the process 31, and an interrupt process thread 31b, which processes the interrupt.
The process 32 includes a main process thread 32a, which executes a main processing of the process 32, and an interrupt process thread 32b, which processes the interrupt.
Next, a description will be given of an operation of the MFP 10.
When the main process thread 31a waits for the occurrence of the interrupt, the interrupt process thread 31b of the process 31 executes an interrupt acquiring request on the interrupt waiting unit 33. Accordingly, as illustrated in
Similarly, when the main process thread 32a waits for the occurrence of the interrupt, the interrupt process thread 32b of the process 32 executes an interrupt acquiring request on the interrupt waiting unit 34. Accordingly, as illustrated in
When any interrupt such as a press of a power button, a press of a power saving key for power saving, or reception of an instruction from the network occurs, the interrupt handler 35 clears the interrupt waiting flag 23a and the interrupt waiting flag 23b on the RAM23. That is, the interrupt handler 35 releases the interrupt waiting flag 23a and the interrupt waiting flag 23b from the set state.
Then, the interrupt handler 35, as illustrated in
Upon detecting a change in the interrupt waiting flag 23a from the set state as illustrated in
Similarly, upon detecting a change in the interrupt waiting flag 23b from the set state as illustrated in
Upon released from the wait state, the interrupt process thread 31b of the process 31 confirms the interrupt style 23c on the RAM23 to determine whether or not the interrupt style 23c is matched with the process 31. Then, if the interrupt process thread 31b determines that the interrupt style 23c is matched with the process 31, the main process thread 31a is operated. On the other hand, if the interrupt process thread 31b determines that the interrupt style 23c is not matched with the process 31, the interrupt acquiring request is executed on the interrupt waiting unit 33. Accordingly, the interrupt waiting unit 33, as illustrated in
Similarly, upon released from the wait state, the interrupt process thread 32b of the process 32 confirms the interrupt style 23c on the RAM23 to determine whether or not the interrupt style 23c is matched with the process 32. Then, if the interrupt process thread 32b determines that the interrupt style 23c is matched with the process 32, the main process thread 32a is operated. On the other hand, if the interrupt process thread 32b determines that the interrupt style 23c is not matched with the process 32, the interrupt acquiring request is executed on the interrupt waiting unit 34. Accordingly, the interrupt waiting unit 34, as illustrated in
According to the operation illustrated in
Then, the interrupt handler 35, when any interrupt has occurred, clears the interrupt waiting flag 23a and the interrupt waiting flag 23b (Step S61), and sets the interrupt style 23c of the occurred interrupt (Step S62).
Accordingly, the interrupt waiting unit 33 confirms that the interrupt waiting flag 23a has been cleared (Step S71) and causes the process 31 to wake up (Step S72). Then, the interrupt process thread 31b of the process 31, upon determining that the interrupt style 23c is not matched with the process 31 (Step S73), executes the interrupt acquiring request on the interrupt waiting unit 33 (Step S74). Consequently, the interrupt waiting unit 33 sets the interrupt waiting flag 23a (Step S75) to put the process 31 to sleep (Step S76).
Similarly, the interrupt waiting unit 34 confirms that the interrupt waiting flag 23b has been cleared (Step S81) to cause the process 32 to wake up (Step S82). Then, the interrupt process thread 32b of the process 32, upon determining that the interrupt style 23c is not matched with the process 32 (Step S83), executes the interrupt acquiring request on the interrupt waiting unit 34 (Step S84). Consequently, the interrupt waiting unit 34 sets the interrupt waiting flag 23b (Step S85) to put the process 32 to sleep (Step S86).
As described above, the MFP 10 has the interrupt waiting flag 23a for the process 31 to wait for the occurrence of the interrupt, and the interrupt waiting flag 23b for the process 32 to wait for the occurrence of the interrupt. Thus, since the interrupt waiting flags 23a and 23b are provided for the respective processes, the process 31 and the process 32 each ensure execution of the appropriate processing corresponding to the interrupt.
The interrupt waiting unit may set the interrupt waiting flag when the main process thread has been completed. In this situation, when the main process thread 31a (or 32a) has been completed, the interrupt acquiring request is executed on the interrupt waiting unit 33 (or 34). The interrupt waiting unit 33 (or 34) sets the interrupt waiting flag 23a (or 23b) for the process 31 (or 32) in the specific address on the RAM23 of the MFP 10 to wait for the occurrence of the interrupt, and retains the process 31 in the wait state by putting the process 31 (or 32) to sleep.
Accordingly, even if the process 31 (or 32) is repeated, the process 31 and the process 31 (or 32) ensures execution of the appropriate processing corresponding to the interrupt.
While in the embodiment the electronic device of the disclosure is the MFP, the electronic device may be an image forming apparatus other than the MFP such as a copy-only machine, a printer-only machine, or a scanner-only machine, or may be an electronic device other than the image forming apparatus such as a Personal Computer (PC).
While various aspects and embodiments have been disclosed herein, other aspects and embodiments will be apparent to those skilled in the art. The various aspects and embodiments disclosed herein are for purposes of illustration and are not intended to be limiting, with the true scope and spirit being indicated by the following claims.
Number | Name | Date | Kind |
---|---|---|---|
5864701 | Col | Jan 1999 | A |
7320044 | Zandonadi | Jan 2008 | B1 |
7664903 | B{hacek over (e)}lono{hacek over (z)}nik | Feb 2010 | B2 |
20060117316 | Cismas | Jun 2006 | A1 |
20070028240 | Hayakawa | Feb 2007 | A1 |
20090222250 | Ito | Sep 2009 | A1 |
20100162265 | Heddes | Jun 2010 | A1 |
20110173640 | Kreuzenstein | Jul 2011 | A1 |
20110219208 | Asaad | Sep 2011 | A1 |
Number | Date | Country |
---|---|---|
10-31596 | Feb 1998 | JP |
Number | Date | Country | |
---|---|---|---|
20170060625 A1 | Mar 2017 | US |