This application is based upon and claims the benefit of priority of the prior Japanese Patent Application No. 2016-047254, filed on Mar. 10, 2016, the entire contents of which are incorporated herein by reference.
The embodiments discussed herein are related to a smart device and a swap method.
The period of the idle mode of a smart device, such as a smartphone or a smart watch, is longer than the time during which the smart device runs. For example, a smartwatch runs in limited occasions, for example, when the smartwatch is notified of an event by a smartphone or when the user changes the setting, and is in the idle mode in the remaining period.
As illustrated in
As described above, the period of the idle mode of a smart device is long and therefore reducing the power consumption during the idle mode enables extension of the running time of the buttery. For this reason, there is a technology for causing transition of the mode of a smart device from the idle mode to the hibernation mode.
As illustrated in
In order to cause transition of the mode of the smart device to the hibernation mode, it is needed to save the data in the central processing unit (CPU) and the memory and to restore the saved data when the smart device enters the active mode.
As illustrated in
There is a technology in which a pre-active mode is provided to a smart device to shorten the restoration process on recovery from the hibernation mode.
In the saving process on the transition to the hibernation mode, the smartwatch 8 divides data into needed data and unneeded data to restart the user processing on its recovery from the hibernation mode and saves the sets of data in a storage. In other words, the smartwatch 8 saves, in a swap area, the data unneeded to restart the user processing on its recovery from the hibernation mode and saves, in a hibernation area, the data needed to restart the user processing on its recovery from the hibernation mode.
In the restoration process on the recovery from the hibernation mode, the smartwatch 8 restores only the data in the hibernation area and transitions to the pre-active mode. In the pre-active mode, the smartwatch 8 restarts the user processing and restores the data in the swap area by using a swap-in and, when all the data in the swap area is restored, transitions to the active mode.
There is another technology that, when a hibernation starting process is performed, shortens the start-up time by curbing the size of a memory management area to a size needed for kernel initialization and reading a hibernation image in parallel with hardware initialization.
There is still another technology that shortens the processing time on re-powering on by, when power is re-supplied, re-reading, in a main memory, initial start-up data that is saved in a hard disk device by using a hibernation function to enable a start-up in an initial mode.
There is still another technology that shortens the sensory latency time to the user by, on recovery from the hibernation mode, recovering only the operating system (OS) to the running mode in the main memory and then recovering each process on the OS to the running mode.
Patent Document 1: Japanese Laid-open Patent Publication No. 2012-252576
Patent Document 2: Japanese Laid-open Patent Publication No. 2004-38546
Patent Document 3: Japanese Laid-open Patent Publication No. 2010-250512
When the pre-active mode illustrated in
As illustrated in
Identifying the area 5a used by the kernel and the area 5b used by the processes needed to restart the processing among the memory area in use thus makes it possible to identify the area unneeded to restart the processing. When it is possible to additionally install an application as in the case of the smart device, however, it is not possible to identify in advance processes needed to restart the processing and therefore it is not possible to identify the area 5b that is used by the processes needed to restart the processing.
According to an aspect of an embodiment, a device includes a memory and a processor coupled to the memory and the processor configured to create a list of processes that are to be executed when user processing is restarted on recovery from a hibernation mode in which power consumption is low; configured to create identification information that identifies a saving area that is obtained by excluding, from an entire memory area of the memory in use, a memory area that is used by the processes included in the list of the processes and a memory area that is used by a kernel of an operating system which is executed by the processor; and configured to save, in a swap area, the data of the memory area that is identified by the identification information created by the second creator.
The object and advantages of the invention will be realized and attained by means of the elements and combinations particularly pointed out in the claims.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory and are not restrictive of the invention, as claimed.
Preferred embodiments of the present invention will be explained with reference to accompanying drawings. Note that the embodiments do not limit the technology disclosed herein.
First of all, transition of the mode of a smart device according to a first embodiment will be described.
The smart device then creates a list Lp on the memory area that is used by the processes in the created list (t3). The smart device further creates a list Lk on the memory that is used by the kernel of the OS (t4). The smart device creates a list Lall on the memory in use on the basis of the memory use status (t5) and deletes (Lp∪Lk) from Lall (t6), where (Lp∪Lk) is a sum set of Lp and Lk. The smart device swaps out the remaining memory blocks in the memory list (t7).
In the last half of the saving process, the smart device saves, in a hibernation area, the remaining areas in use in the memory (t8) and powers off (t9). The smart device then transitions to the hibernation mode. When an event that wakes the smart device up occurs (t10), the power turns on (t11).
In a restoration process, the smart device loads the data in the hibernation area in the storage into the memory (t12) and transitions to a pre-active mode. The smart device restarts the user processing (t13) and loads the data in the swap area of the storage into the memory (t14). When loading the data in the swap area into the memory completes, the smart device transitions to the active mode.
As described above, the smart device according to the first embodiment deletes (LP∪Lk) from Lall and swaps out the remaining memory blocks in the memory list in the first half of the saving process and thus is able to create, in the swap area, the data to be restored in the pre-active mode.
The functional configuration of the smart device according to the first embodiment will be described here.
The memory manager 2 is a module of the OS kernel and manages a memory 5 according to each memory block. The memory manager 2 notifies the swap unit 10 of the memory allocation status according to a request from the swap unit 10. When shortage of the memory 5 occurs, the memory manager 2 notifies the swap unit 10 of the memory shortage.
The process manager 3 is a module of the OS kernel and manages the process. The process manager 3 notifies the swap unit 10 of the list of processes in execution according to a request from the swap unit 10. The list of processes in execution contains information on the parent-child relationship among the processes.
The terminal mode controller 4 manages the mode of the smart device 1. The mode of the smart device 1 includes an active mode, a hibernation mode, and a pre-active mode. On transition of the mode of the smart device 1, the terminal mode controller 4 notifies the swap unit 10 of the mode transition.
The swap unit 10 saves, in a storage 6, the data of the memory 5 by using a swap-out and restores, in the memory 5, the data saved in the storage 6. The swap unit 10 includes a non-saving-subject process list creator 11, a setting information storage unit 11c, a saving-subject memory list creator 12, a saving subject choosing unit 13, and a data saving unit 14.
When notified of the transition to the hibernation mode by the terminal mode controller 4, the non-saving-subject process list creator 11 creates, as a non-saving-subject process list, a list of processes that need to run when the user processing is restarted. The non-saving-subject process list creator 11 acquires the list of processes in execution from the process manager 3 and creates a non-saving-subject process list on the basis of the acquired process list and the setting information storage unit 11c. Note that the non-saving-subject process list is a list of process IDs.
The setting information storage unit 11c stores setting information that is used to create a non-saving-subject process list. As represented in
An privileged-user ID is an identifier of an privileged process that runs according to the manager authority. According to
A service process ID is an identifier of a service process that runs according to service authority of, for example, system management. According to
An added-process name is the name of a process that is added to the non-saving-subject process list among the processes whose identifiers are other than privileged-user IDs and service process IDs. According to
The excluded-process name is the name of a process that is excluded from the non-saving-subject process list among processes whose identifiers are categorized into an privileged-user ID or a service process ID. According to
The non-saving-subject process list creator 11 acquires the list of processes in execution from the process manager 3 and creates a tree by analyzing the parent-child relationships among the processes.
As illustrated in
As illustrated in
The non-saving-subject process list creator 11 also excludes the children of general processes from the non-saving-subject processes as described above and thus is able to appropriately identify processes that need to run when the user processing is restarted.
By using the non-saving-subject process list, the saving-subject memory list creator 12 deletes the area being used by the kernel and the processes that need to run when the user processing is restarted from the whole memory area in use and creates a list of memory blocks of a saving area. The saving area is a memory area whose data is saved in the swap area on the transition to the hibernation mode, i.e., a memory area whose data is restored in the pre-active mode after the recovery from the hibernation mode. The saving-subject memory list creator 12 passes the created list as a saving-subject memory block list to the data saving unit 14. The saving-subject memory block list is a list of identifiers that identify memory blocks.
On receiving a memory shortage notification from the memory manager 2, the saving subject choosing unit 13 creates a list of memory blocks whose data is to be saved in the storage 6 and passes the saving-subject memory block list to the data saving unit 14.
On receiving the saving-subject memory block list, the data saving unit 14 saves, in the storage 6, the data of the saving-subject memory blocks from the memory 5.
The flow of the process performed by the non-saving-subject process list creator 11 will be described here.
The non-saving-subject process list creator 11 then receives an event of transition to the hibernation mode (step S2) and acquires a list of processes in execution from the process manager 3 (step S3).
The non-saving-subject process list creator 11 performs a non-saving list creating process of creating a non-saving-subject process list (step S4) and transmits the non-saving-subject process list to the saving-subject memory list creator 12 (step S5).
The non-saving-subject process list creator 11 creates the non-saving-subject process list and transmits the non-saving-subject process list to the saving-subject memory list creator 12 as described above and thus the saving-subject memory list creator 12 is able to create the saving-subject memory block list.
The non-saving-subject process list creator 11 then refers to the setting information storage unit 11c and adds the service processes to the list (step S12). The non-saving-subject process list creator 11 then refers to the setting information storage unit 11c and adds the processes specified by the added-process names (step S13).
The non-saving-subject process list creator 11 refers to the setting information storage unit 11c and deletes the processes specified by the excluded-process names (step S14). The non-saving-subject process list creator 11 analyzes the parent-child relationships among the processes by using the list of processes in execution and accordingly deletes privileged processes and service processes that are children of general processes from the list (step S15).
As described above, when creating a non-saving-subject process list, the non-saving-subject process list creator 11 excludes privileged processes and service processes that are children of general processes from the list. Thus, the non-saving-subject process list creator 11 is able to appropriately identify processes that need to run when the user processing is restarted.
The flow of the process performed by the saving-subject memory list creator 12 will be described.
On receiving a non-saving-subject process list (step S22), the saving-subject memory list creator 12 creates, as a list1, a list of memory blocks that are used by all the processes contained in the non-saving-subject process list (step S23). The saving-subject memory list creator 12 then creates a list of memory blocks that are used by the kernel as a list2 (step S24) and creates a list of all the memory blocks currently in use as a list3 (step S25).
The saving-subject memory list creator 12 then creates a list4 by taking OR (logical disjunction) of the list1 and the list2 (step S26) and creates a list5 obtained by deleting all the elements of the list4 from the list3 (step S27). The saving-subject memory list creator 12 transmits the list5 as a saving-subject memory block list to the data saving unit 14 (step S28).
The saving-subject memory list creator 12 creates a saving-subject memory block list as described above and thus the data saving unit 14 is able to save, in the swap area, the data unneeded when the user processing is started.
As described above, in the first embodiment, the non-saving-subject process list creator 11 creates a non-saving-subject process list on the basis of the list of processes in execution and the setting information storage unit 11c. The saving-subject memory list creator 12 then creates a saving-subject memory block list on the basis of the non-saving-subject process list. The data saving unit 14 then saves the data in the swap area on the basis of the saving-subject memory block list.
Accordingly, the smart device 1 is able to identify a memory area whose data is to be saved in the swap area on its transition to the hibernation mode and saves the data of the identified memory area in the swap area. In other words, on its transition to the hibernation mode, the smart device 1 is able to save, in the swap area, the data of an appropriate area of the memory.
In the first embodiment, the non-saving-subject process list creator 11 creates a non-saving-subject process list including privileged processes and service processes. Accordingly, the smart device 1 is able to prevent the data of the memory area used by the processes that need to run when the smart device 1 recovers from the hibernation mode from being saved in the swap area and restart the user processing in the pre-active mode.
In the first embodiment, the non-saving-subject process list creator 11 creates the non-saving-subject process list excluding privileged processes and service processes that run as children of general processes. Accordingly, the smart device 1 is able to accurately identify processes that need to run when the user processing is restarted.
In the first embodiment, the non-saving-subject process list creator 11 creates the non-saving-subject process list by adding or excluding processes of specific names. Accordingly, the smart device 1 is able to appropriately control the processes that need to run when the user processing is restarted.
The smart device 1 that creates a non-saving-subject process list on its transition to the hibernation mode has been described as the first embodiment. The smart device may also keep updating the non-saving-subject process list. A smart device that keeps updating a non-saving-subject process list will be described as a second embodiment.
As illustrated in
While the process manager 3a has the same function as that of the process manager 3, the process manager 3a notifies the swap unit 10a of newly starting and ending of processes instead of the list of processes in execution. While the terminal mode controller 4a has the same function as that of the terminal mode controller 4, what is notified of the mode transition differs. Specifically, a saving-subject memory list creator 12a, which will be described below, is notified of the mode transition.
While the swap unit 10a has the same function as that of the swap unit 10, the swap unit 10a includes a non-saving-subject process list creator 11a instead of the non-saving-subject process list creator 11 and includes the saving-subject memory list creator 12a instead of the saving-subject memory list creator 12. The swap unit 10a additionally includes a non-saving-subject process storage unit 15a.
The non-saving-subject process storage unit 15a stores a non-saving-subject process list. On receiving newly starting or ending of a process from the process manager 3a, the non-saving-subject process list creator 11a creates a non-saving-subject process list and updates the non-saving-subject process storage unit 15a. In other words, the non-saving-subject process list creator 11a creates a non-saving-subject process list when a process is newly started or ended.
On being notified of the transition to the hibernation mode by the terminal mode controller 4a, the saving-subject memory list creator 12a refers to the non-saving-subject process storage unit 15a and creates a saving-subject memory block list.
As a result, when the notification content is starting of a process, the non-saving-subject process list creator 11a determines whether the notified process needs to run in the pre-active mode (step S34). When the process does not need to run in the pre-active mode, the non-saving-subject process list creator 11a returns to step S31. On the other hand, when the process needs to run in the pre-active mode, the non-saving-subject process list creator 11a adds the process ID to the non-saving-subject process list (step S35), updates the non-saving-subject process storage unit 15a, and returns to step S31.
When the notification content is ending of a process and the process ID of the notified process is contained in the non-saving-subject process list, the non-saving-subject process list creator 11a deletes the process ID from the non-saving-subject process list (step S36). The non-saving-subject process list creator 11a then updates the non-saving-subject process storage unit 15a and returns to step S31.
The non-saving-subject process list creator 11a updates the non-saving-subject process list when a process is started or ended and thus the non-saving-subject process list creator 11a does not need to create a non-saving-subject process list on transition to the hibernation mode.
The saving-subject memory list creator 12a then receives a mode transition notification (step S42) and reads the non-saving-subject process list from the non-saving-subject process storage unit 15a (step S43). The saving-subject memory list creator 12a creates, as a list1, a list of memory blocks that are used by all the processes contained in the non-saving-subject process list (step S44).
The saving-subject memory list creator 12a creates a list of memory blocks that are used by the kernel as a list2 (step S45) and creates a list of blocks of the entire memory currently in use as a list3 (step S46).
The saving-subject memory list creator 12a creates a list4 by taking the OR of the list1 and the list2 (step S47) and creates a list5 obtained by deleting all the elements of the list4 from the list3 (step S48). The saving-subject memory list creator 12a transmits the list5 as a saving-subject memory block list to the data saving unit 14 (step S49).
The saving-subject memory list creator 12a refers to the non-saving-subject process storage unit 15a and creates the saving-subject memory block list and thus the process of creating a non-saving-subject process list is not needed on the transition to the hibernation mode.
As described above, in the second embodiment, the smart device 1a keeps updating the non-saving-subject process list and thus does not need to create a non-saving-subject process list on its transition to the hibernation mode, and accordingly it is possible shorten the time to save data.
The case where the non-saving-subject process list is kept updated has been described as the second embodiment. Furthermore, the saving-subject memory block list may be kept updated. A smart device that keeps updating a saving-subject memory block list will be described as the third embodiment.
As illustrated in
Differently from the swap unit 10a, the swap unit 10b includes a saving-subject memory list creator 12b instead of the saving-subject memory list creator 12a and includes the data saving unit 14b instead of the data saving unit 14. The swap unit 10b additionally includes a saving-subject memory block storage unit 16b.
The saving-subject memory block storage unit 16b stores a saving-subject memory block list. When the non-saving-subject process list is updated, the saving-subject memory list creator 12b refers to the non-saving-subject process storage unit 15a, creates a saving-subject memory block list, and updates the saving-subject memory block storage unit 16b.
While the data saving unit 14b has the same function as that of the data saving unit 14, the data saving unit 14b, on receiving a mode transition notification from the terminal mode controller 4b, refers to the saving-subject memory block storage unit 16b and saves the data of the memory blocks contained in the saving-subject memory block list.
On detecting an update of the non-saving-subject process list (step S52), the saving-subject memory list creator 12b reads the non-saving-subject process list from the non-saving-subject process storage unit 15a (step S53). The saving-subject memory list creator 12b then creates, as a list1, a list of memory blocks that are used by all the processes contained in the non-saving-subject process list (step S54).
The saving-subject memory list creator 12b creates a list of memory blocks that are used by the kernel as a list2 (step S55) and creates a list of blocks of the entire memory currently in use as a list3 (step S56).
The saving-subject memory list creator 12b creates a list4 by taking OR of the list1 and the list2 (step S57) and creates a list5 obtained by deleting all the elements of the list4 from the list3 (step S58). The saving-subject memory list creator 12b writes the list5 as a saving-subject memory block list to the saving-subject memory block storage unit 16b (step S59).
As described above, when the non-saving-subject process list is updated, the saving-subject memory list creator 12b refers to the non-saving-subject process storage unit 15a, creates a saving-subject memory block list, and writes the saving-subject memory block list in the saving-subject memory block storage unit 16b.
Accordingly, on its transition to the hibernation mode, the smart device 1b does not need the process of creating a saving-subject memory block list.
As a result, when the content of the reception is a mode transition notification, the data saving unit 14b reads the saving-subject memory block list from the saving-subject memory block storage unit 16b (step S63). The data saving unit 14b then saves, in the storage 6, the data of the memory blocks in the saving-subject memory block list (step S64) and returns to step S61.
On the other hand, when the content of the reception is a saving-subject memory block list, the data saving unit 14b saves, in the storage 6, the data of the memory blocks in the saving-subject memory block list (step S64) and returns to step S61.
The data saving unit 14b reads the saving-subject memory block list from the saving-subject memory block storage unit 16b as described above and thus is able to start saving data immediately.
As described above, in the third embodiment, the smart device 1b keeps updating the saving-subject memory block list and thus is able to further shorten the time to save data on its transition to the hibernation mode.
According to the first to third embodiments, the smart device saves data in the storage 6 that is, for example, a flash memory or a hard disk drive (HDD). Note that the storage 6 may be a non-volatile memory, such as a magnetoresistive random access memory (MRAM), as illustrated in
Alternatively, the storage 6 may be partly a non-volatile memory. For example, a hibernation area may be provided to a MRAM and a swap area may be provided to a flash memory. Providing the hibernation area to the MRAM enables fast transition to the pre-active mode.
The swap units according to the first to third embodiments are implemented by a computer by executing swap programs with the same functions as those of the swap units. The computer that executes the swap programs will be described here.
The CPU 50a is a processing device that reads and executes the application and a program, such as the swap program, stored in the memory 50c. The flash memory 50b is a non-volatile memory that stores, for example, the application and the swap program. The flash memory 50b corresponds to the storage 6 illustrated in
The memory 50c is a RAM that stores, for example, the application and the swap program that are read from the flash memory 50b. The memory 50c stores, for example, the data needed to execute the swap program and the intermediate result of execution of the swap program. The memory 50c corresponds to the memory 5 illustrated in
The display unit 50d is a device that displays a screen that is output by the application and is, for example, a liquid crystal display device. The display unit 50d accepts a touch operation of the user and passes the accepted data to the CPU 50a.
The wireless communication unit 50e is a module that performs wireless communications, such as communications via a local area network (LAN), Bluetooth (trademark), and mobile phones. The wireless communication unit 50e may have multiple wireless communication functions.
According to an aspect of the embodiments, it is possible to save, in the swap area, the data of the appropriate area of the memory on transition to the hibernation mode.
All examples and conditional language recited herein are intended for pedagogical purposes of aiding the reader in understanding the invention and the concepts contributed by the inventor to further the art, and are not to be construed as limitations to such specifically recited examples and conditions, nor does the organization of such examples in the specification relate to a showing of the superiority and inferiority of the invention. Although the embodiments of the present invention have been described in detail, it should be understood that the various changes, substitutions, and alterations could be made hereto without departing from the spirit and scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2016-047254 | Mar 2016 | JP | national |