CN114895969A - Operating system sleeping method and device, computing equipment and storage medium - Google Patents

Operating system sleeping method and device, computing equipment and storage medium Download PDF

Info

Publication number
CN114895969A
CN114895969A CN202210580014.XA CN202210580014A CN114895969A CN 114895969 A CN114895969 A CN 114895969A CN 202210580014 A CN202210580014 A CN 202210580014A CN 114895969 A CN114895969 A CN 114895969A
Authority
CN
China
Prior art keywords
size
swap space
swap
target
space
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210580014.XA
Other languages
Chinese (zh)
Inventor
陈雄
郭纳福
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Uniontech Software Technology Co Ltd
Original Assignee
Uniontech Software Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Uniontech Software Technology Co Ltd filed Critical Uniontech Software Technology Co Ltd
Priority to CN202210580014.XA priority Critical patent/CN114895969A/en
Publication of CN114895969A publication Critical patent/CN114895969A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4418Suspend and resume; Hibernate and awake
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a method, a device, a computing device and a storage medium for operating system dormancy, wherein the method comprises the following steps: when the condition that the operating system is dormant is detected, acquiring the size of a swap space existing in the computing equipment and the size of a current memory; judging whether the swap space needs to be expanded or not according to the size of the current memory and the size of the existing swap space; if the swap space needs to be expanded, determining the size of the target swap space; deleting the existing swap space; creating a swap file with the size equal to that of a target swap space, and setting the swap file as the target swap space; memory data of the computing device is swapped in to the target swap space to achieve operating system dormancy. Therefore, when the operating system is in a sleep state, the swap space is automatically expanded according to the size of data in the memory, so that the normal sleep function of the operating system is ensured.

Description

Operating system sleeping method and device, computing equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for operating system hibernation, a computing device, and a readable storage medium.
Background
The system is dormant, that is, the operating system of the computing device automatically stores all data in the memory to the swap space, and cuts off power supply to all devices, which is equivalent to a power saving state of the computing device. For example, a period of time may be set for operating the computing device, and the computing device may enter a sleep state. Under the state, documents and programs opened in the memory can be switched into the swap space, and the swap space comprises two forms, namely a swap partition and a swap file. However, if the swap space is insufficient, the system may fail to sleep, and if the configured swap space is much larger than the memory size, a large amount of waste of the disk space may be caused. Therefore, it is necessary to specify a proper size for the swap space.
At present, the size of the swap space can be designated only when an operating system is installed, and once the operating system is installed, the process of adjusting the size of the swap space is very complicated. The swap space is a part of storage space divided on the disk. The swap space comprises a swap partition and a swap file.
Therefore, it is desirable to provide an operating system hibernation method to solve the technical problem that the existing system hibernation method cannot automatically adjust the size of the swap space during hibernation.
Disclosure of Invention
To this end, embodiments of the present invention provide a method and apparatus for operating system hibernation in an effort to solve or at least alleviate the above-identified problems.
According to an aspect of the embodiments of the present invention, there is provided an operating system hibernation method, executed in a computing device, the method including: when the condition that the operating system is dormant is detected, acquiring the size of a swap space existing in the computing equipment and the size of a current memory; judging whether the swap space needs to be expanded or not according to the size of the current memory and the size of the existing swap space; if the swap space needs to be expanded, determining the size of the target swap space; deleting the existing swap space; creating a swap file with the size equal to that of a target swap space, and setting the swap file as the target swap space; memory data of the computing device is swapped in to the target swap space to achieve operating system dormancy.
Optionally, the step of determining the size of the target swap space includes: responding to the operation of designating the size of the swap space on the user interaction interface, and acquiring the designated size of the swap space; and taking the size of the designated swap space as the size of the target swap space.
Optionally, the step of determining the size of the target swap space includes: judging whether the size of the current memory is larger than a target value or not; if the size of the current memory is larger than a target value, the size of the target swap space is the product of a target coefficient and the size of the current memory, wherein the target value is the size of the physical memory of the computing equipment, and the target coefficient is a value not smaller than 1; and if the size of the current memory is not larger than the target value, the size of the target swap space is any value in the range of the size of the current memory and the target value.
Optionally, the step of setting the target swap file as the target swap space includes: updating the path of the target swap space into the path of the target swap file; formatting the target swap file into a swap file type; and activating the formatted target swap file.
Optionally, the step of creating a swap file with the size equal to the target swap space includes: judging whether the size of the residual storage space of the external storage device in the computing device is smaller than that of the target swap space, if not, creating a swap file with the size equal to that of the target swap space, and using the swap file as the target swap file.
Optionally, the step of determining whether to expand the swap space according to the size of the current memory and the size of the existing swap space includes: and judging whether the size of the current memory is larger than that of the existing swap space, if so, expanding the swap space, and if not, expanding the swap space.
The operating system dormancy method provided by the invention also comprises the following steps: and if the swap space does not need to be expanded, the memory data of the computing equipment is exchanged into the existing swap space.
According to another aspect of the embodiments of the present invention, there is provided an operating system hibernation apparatus for execution in a computing device, the apparatus comprising: the obtaining module is suitable for obtaining the size of a swap space existing in the computing equipment and the size of a current memory when the condition that the operating system is in a dormant state is detected; the judging module is suitable for judging whether the swap space needs to be expanded or not according to the size of the current memory and the size of the existing swap space, and determining the size of the target swap space if the swap space needs to be expanded; the capacity expansion swap space module is suitable for deleting the existing swap space, creating a swap file with the same size as the target swap space and setting the swap file as the target swap space; and the dormancy module is suitable for converting the memory data into the target swap space so as to realize the dormancy of the operating system.
According to yet another aspect of the present invention, there is provided a computing device comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the method as described above.
According to another aspect of the present invention, there is provided a readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform the method as described above.
According to the operating system dormancy method provided by the embodiment of the invention, when the condition that the operating system is dormant is detected, the size of the existing swap space and the size of the current memory in the computing equipment are obtained, whether the swap space needs to be expanded is judged according to the size of the current memory and the size of the existing swap space, when the swap space needs to be expanded, the existing swap space is deleted, the swap space with enough size is created, and the memory data of the computing equipment is exchanged into the newly created swap space, so that the operating system is dormant. According to the content, when the operating system is in a sleep state, the swap space is automatically expanded according to the size of data in the memory, so that the normal sleep function of the operating system is ensured.
The foregoing description is only an overview of the technical solutions of the embodiments of the present invention, and the embodiments of the present invention can be implemented according to the content of the description in order to make the technical means of the embodiments of the present invention more clearly understood, and the detailed description of the embodiments of the present invention is provided below in order to make the foregoing and other objects, features, and advantages of the embodiments of the present invention more clearly understandable.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 shows a block diagram of a computing device 100, according to one embodiment of the invention;
FIG. 2 illustrates a flow diagram of a method 200 for operating system hibernation according to one embodiment of the invention;
FIG. 3 illustrates a schematic diagram of an operating system hibernation apparatus 300 according to one embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
In order to solve the technical problem that the existing system hibernation method cannot automatically adjust the size of the swap space during hibernation, the invention provides an operating system hibernation method which can be implemented as an application program and installed in a computing device 100. The method may also be implemented as a plug-in, integrated into the operating system of the computing device 100.
It should be noted that, no matter the os hibernation method provided by the present invention is implemented as an application or a plug-in, when the os is started, i.e. the computing device 100 is powered on and successfully logs in to the user, the os hibernation method provided by the present invention is started at the same time when entering the user interface.
In some embodiments, the executable program of the os hibernation method provided by the present invention is stored in the/usr/bin/directory, in order to implement the os hibernation method to self-boot with the os booting, (boot method the present invention is not limited, for example, the os hibernation method is self-booted with root authority), a predetermined type of configuration file corresponding to the executable program for os hibernation is created, and the predetermined type of configuration file is stored in the/usr/lib/system directory, so that, when the operating system is started, reading a configuration file which is stored in advance and corresponds to the operating system dormancy method by executing a sudo system enabled swap expansion service command, the application program corresponding to the operating system hibernation method provided by the invention or the application program where the plug-in is located can be started at the same time.
The type of the predetermined type of configuration file may be set according to an actual application scenario, which is not limited in the present invention. For example, the predetermined type of configuration file may be a service file, where an example of a service file is as follows:
[Unit]
Description=Launch swapExpan in normal mode
After=basic.target
[Service]
Type=forking
ExecStart=/usr/bin/swapExpan
User=root
[Install]
WantedBy=basic.target
the computing device 100 described above may be implemented as a server, such as an application server, a Web server, or the like; but may also be implemented as a desktop computer, a notebook computer, a processor chip, a tablet computer, etc., but is not limited thereto. FIG. 1 shows a block diagram of the physical components (i.e., hardware) of a computing device 100. In a basic configuration, computing device 100 includes at least one processing unit 102 and system memory 104. According to one aspect, depending on the configuration and type of computing device, system memory 104 includes, but is not limited to, volatile storage (e.g., random access memory), non-volatile storage (e.g., read-only memory), flash memory, or any combination of such memories.
According to one aspect, system memory 104 includes an operating system 105, and when the operating system hibernation method provided by the present invention is implemented as a plug-in, the operating system 105 incorporates a plug-in for the operating system hibernation functionality provided by the present invention. When the operating system hibernation method provided by the present invention is implemented as an application 150, system memory 104 also includes application 150.
According to one aspect, the operating system 105, for example, is adapted to control the operation of the computing device 100. Further, the examples are practiced in conjunction with a graphics library, other operating systems, or any other application program, and are not limited to any particular application or system. This basic configuration is illustrated in fig. 1 by those components within dashed line 108. According to one aspect, the computing device 100 has additional features or functionality. For example, according to one aspect, computing device 100 includes additional data storage devices (removable and/or non-removable) such as, for example, magnetic disks, optical disks, or tape. Such additional storage is illustrated in FIG. 1 by removable storage device 109 and non-removable storage device 110.
As stated hereinabove, in accordance with one aspect, a number of program modules and data files are stored in system memory 104. When the operating system hibernation method provided by the present invention is implemented as application 150 and executed on processing unit 102, application 150 executes a process that includes, but is not limited to, one or more of the stages of method 200 shown in FIG. 2. According to one aspect, the type of application is not limited, e.g., the application further comprises: email and contacts applications, word processing applications, spreadsheet applications, database applications, slide show applications, drawing or computer-aided applications, web browser applications, and the like.
According to one aspect, examples may be practiced in a circuit comprising discrete electronic elements, a packaged or integrated electronic chip containing logic gates, a circuit utilizing a microprocessor, or on a single chip containing electronic elements or microprocessors. For example, an example may be practiced via a system on a chip (SOC) in which each or many of the components shown in fig. 1 may be integrated on a single integrated circuit. According to one aspect, such SOC devices may include one or more processing units, graphics units, communication units, system virtualization units, and various application functions, all integrated (or "burned") onto a chip substrate as a single integrated circuit. When operating via an SOC, the functions described herein may be operated via application-specific logic integrated with other components of the computing device 100 on a single integrated circuit (chip). Embodiments of the invention may also be practiced using other technologies capable of performing logical operations (e.g., AND, OR, AND NOT), including but NOT limited to mechanical, optical, fluidic, AND quantum technologies. In addition, embodiments of the invention may be practiced within a general purpose computer or in any other circuits or systems.
According to one aspect, computing device 100 may also have one or more input devices 112, such as a keyboard, mouse, pen, voice input device, touch input device, or the like. Output device(s) 114 such as a display, speakers, printer, etc. may also be included. The foregoing devices are examples and other devices may also be used. Computing device 100 may include one or more communication connections 116 that allow communication with other computing devices 118. Examples of suitable communication connections 116 include, but are not limited to: RF transmitter, receiver and/or transceiver circuitry; universal Serial Bus (USB), parallel, and/or serial ports.
The term computer readable media as used herein includes computer storage media. Computer storage media may include volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information, such as computer readable instructions, data structures, or program modules. System memory 104, removable storage 109, and non-removable storage 110 are all examples of computer storage media (i.e., memory storage). Computer storage media may include Random Access Memory (RAM), Read Only Memory (ROM), electrically erasable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM, Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other article of manufacture which can be used to store information and which can be accessed by the computer device 100. In accordance with one aspect, any such computer storage media may be part of computing device 100. Computer storage media does not include a carrier wave or other propagated data signal.
According to one aspect, communication media is embodied by computer readable instructions, data structures, program modules, or other data in a modulated data signal (e.g., a carrier wave or other transport mechanism) and includes any information delivery media. According to one aspect, the term "modulated data signal" describes a signal that has one or more feature sets or that has been altered in such a manner as to encode information in the signal. By way of example, and not limitation, communication media includes wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, Radio Frequency (RF), infrared, and other wireless media.
FIG. 2 shows a flow diagram of an operating system hibernation method 200 according to one embodiment of the invention. The method 200 is suitable for execution in the computing device 100, and the method 200 includes steps S210 to S290. By the method 200, the swap space can be automatically expanded according to the size of data in the memory when the operating system is in a sleep state, so that the normal sleep function of the operating system is ensured.
Step S210 is executed first to detect whether a condition of operating system hibernation is reached. The sleep condition is preset by the user, or may be default by the system, which is not limited. Setting the sleep time is prior art, and is not described herein, and all methods for setting the sleep time are within the scope of the present invention.
When the computing device detects that the operating system hibernation condition is reached, step S220 is continuously executed to obtain the size of the swap space and the size of the current memory that exist in the computing device, where the size of the current memory is the size of data in the current memory. And then, executing step S230, determining whether to expand the swap space according to the size of the current memory and the size of the existing swap space, specifically, determining whether the size of the current memory is larger than the size of the existing swap space, if so, indicating that the existing swap space cannot accommodate all data in the current memory, the swap space needs to be expanded, and if not, indicating that the existing swap space can accommodate all data in the current memory, the swap space does not need to be expanded.
If the swap space does not need to be expanded, step S240 is executed to swap the memory data of the computing device into the existing swap space.
If the swap space needs to be expanded, step S250 is executed to determine the size of the target swap space. The size of the target space can be determined in a user-defined mode of the swap space size, and the size of the target space can also be determined according to the current memory size and the physical memory size of the computing device.
In some embodiments, the step of determining the size of the target space by means of user-defined swap space size includes: the method includes that a user specifies the size of a swap space on a user interaction interface, after a certain interface is triggered, a computing device responds to the operation of specifying the size of the swap space on the user interaction interface, the size of the swap space specified by the user is obtained, and the size of the swap space specified by the user is used as the size of a target swap space.
In some embodiments, determining the size of the target space based on the current memory size and the physical memory size of the computing device comprises: and judging whether the size of the current memory is larger than that of the physical memory, if so, taking the size of the target swap space as the product of the target coefficient and the size of the current memory, and taking the target coefficient as a numerical value not smaller than 1. The size of the target coefficient may be set according to hardware of the computing device, which is not limited by the present invention, for example, the target coefficient may be any value between 1 and 2. When the size of the current memory is not larger than that of the physical memory, the size of the target swap space is any value in the range of the size of the current memory and the physical memory.
After the size of the target swap space is determined, step S260 is continuously executed to delete the existing swap space, step S270 is continuously executed to create a swap file with the size equal to that of the target swap space as the target swap file. Specifically, whether the size of the residual storage space of the external storage device in the computing device is smaller than that of the target swap space is judged, if not, the residual storage space is enough, and then a swap file with the size equal to that of the target swap space is created to serve as the target swap file. If the size of the remaining storage space of the external storage device in the computing device is smaller than the size of the target swap space, which indicates that the remaining storage space is insufficient, the swap file with the size equal to that of the target swap space cannot be created, that is, the creation of the swap file fails, and step S210 is continuously executed.
After the target swap file is successfully created, step S280 is executed to set the target swap file as a target swap space, which is equivalent to expanding the swap space.
In some embodiments, the process of expanding swap space is as follows: firstly, obtaining the path of the existing swap space, updating the path of the target swap space into the path of a target swap file, formatting the target swap file into a swap file type, and finally activating the formatted target swap file to realize the capacity expansion of the swap space.
After the swap space is expanded, step S290 is continuously executed to swap the memory data of the computing device into the target swap space, so as to implement the hibernation of the operating system.
Therefore, automatic expansion of the swap space in the sleep process of the operating system is achieved. Steps S210 to S290 are performed whenever the os hibernation is detected.
FIG. 3 is a block diagram illustrating an operating system hibernation apparatus 300 according to an embodiment of the present invention. The apparatus 300 includes an obtaining module 310, a determining module 320, a capacity expansion swap space module 330, and a hibernation module 340, which are coupled in sequence.
The obtaining module 310 is adapted to, when it is detected that the operating system hibernation condition is reached, obtain the size of the swap space and the size of the current memory that are already present in the computing device.
The judging module 320 is adapted to judge whether the swap space needs to be expanded according to the size of the current memory and the size of the existing swap space, and determine the size of the target swap space if the swap space needs to be expanded.
And the capacity expansion swap space module 330 is suitable for deleting the existing swap space, creating a swap file with the size equal to that of the target swap space as the target swap file, and setting the target swap file as the target swap space.
And the dormancy module 340 is adapted to swap in the memory data to the target swap space to implement the dormancy of the operating system.
It should be noted that the operating principle of the os hibernation apparatus 300 is similar to that of the os hibernation method 200, and reference may be made to the description of the os hibernation method 200 for relevant points, which is not described herein again.
According to the sleep method of the operating system, when the condition that the operating system is in sleep is detected, the size of the existing swap space and the size of the current memory in the computing device are obtained, whether the swap space needs to be expanded is judged according to the size of the current memory and the size of the existing swap space, when the swap space needs to be expanded, the existing swap space is deleted, the swap space with enough size is created, and memory data of the computing device is exchanged into the newly created swap space, so that the sleep of the operating system is realized. Therefore, in the invention, when the operating system is in a sleep state, the swap space is automatically expanded according to the size of data in the memory, so that the normal sleep function of the operating system is ensured.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to perform the operating system hibernation method of the present invention according to instructions in the program code stored in the memory.
By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed in an illustrative rather than a restrictive sense, and the scope of the present invention is defined by the appended claims.

Claims (10)

1. An operating system hibernation method, performed in a computing device, the method comprising:
when the condition that the operating system is dormant is detected, acquiring the size of a swap space existing in the computing equipment and the size of a current memory;
judging whether the swap space needs to be expanded or not according to the size of the current memory and the size of the existing swap space;
if the swap space needs to be expanded, determining the size of the target swap space;
deleting the existing swap space;
creating a swap file with the size equal to that of a target swap space, and setting the swap file as the target swap space;
and swapping the memory data of the computing equipment into the target swap space to realize the dormancy of the operating system.
2. The method of claim 1, wherein determining the size of the target swap space comprises:
responding to the operation of designating the size of the swap space on the user interaction interface, and acquiring the designated size of the swap space;
and taking the size of the designated swap space as the size of the target swap space.
3. The method of claim 1, wherein determining the size of the target swap space comprises:
judging whether the size of the current memory is larger than a target value or not;
if the size of the current memory is larger than a target value, the size of the target swap space is the product of a target coefficient and the size of the current memory, wherein the target value is the size of the physical memory of the computing equipment, and the target coefficient is a value not smaller than 1;
and if the size of the current memory is not larger than the target value, the size of the target swap space is any value in the range of the size of the current memory and the target value.
4. The method of any of claims 1-3, wherein setting the destination swap file to the destination swap space comprises:
updating the path of the target swap space into the path of the target swap file;
formatting the target swap file into a swap file type;
and activating the formatted target swap file.
5. The method of any of claims 1-4, wherein creating a swap file of a size equal to the target swap space comprises:
judging whether the size of the residual storage space of the external storage device in the computing device is smaller than that of the target swap space, and if not, creating a swap file with the size equal to that of the target swap space.
6. The method as claimed in any one of claims 1 to 5, wherein the step of determining whether to expand the swap space according to the size of the current memory and the size of the existing swap space includes:
and judging whether the size of the current memory is larger than that of the existing swap space, if so, expanding the swap space, and if not, expanding the swap space.
7. The method of any of claims 1 to 6, further comprising the step of:
and if the swap space does not need to be expanded, the memory data of the computing equipment is exchanged into the existing swap space.
8. An operating system hibernation apparatus to be executed in a computing device, the apparatus comprising:
the obtaining module is suitable for obtaining the size of a swap space existing in the computing equipment and the size of a current memory when the condition that the operating system is in a dormant state is detected;
the judging module is suitable for judging whether the swap space needs to be expanded or not according to the size of the current memory and the size of the existing swap space, and determining the size of the target swap space if the swap space needs to be expanded;
the capacity expansion swap space module is suitable for deleting the existing swap space, creating a swap file with the same size as the target swap space and setting the swap file as the target swap space;
and the dormancy module is suitable for swapping the memory data into the target swap space so as to realize the dormancy of the operating system.
9. A computing device, comprising:
at least one processor; and
a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-7.
10. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1 to 7.
CN202210580014.XA 2022-05-25 2022-05-25 Operating system sleeping method and device, computing equipment and storage medium Pending CN114895969A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210580014.XA CN114895969A (en) 2022-05-25 2022-05-25 Operating system sleeping method and device, computing equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210580014.XA CN114895969A (en) 2022-05-25 2022-05-25 Operating system sleeping method and device, computing equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114895969A true CN114895969A (en) 2022-08-12

Family

ID=82725365

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210580014.XA Pending CN114895969A (en) 2022-05-25 2022-05-25 Operating system sleeping method and device, computing equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114895969A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115826731A (en) * 2022-10-19 2023-03-21 科东(广州)软件科技有限公司 Dormancy control method and device, operating system and computing equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115826731A (en) * 2022-10-19 2023-03-21 科东(广州)软件科技有限公司 Dormancy control method and device, operating system and computing equipment

Similar Documents

Publication Publication Date Title
KR101555210B1 (en) Apparatus and method for downloadin contents using movinand in portable terminal
US11734113B2 (en) Solid state disk access method and apparatus, device, and medium
CN111033466A (en) Partitioning flash memory and implementing flexible boot with image upgrade capability
CN107943710B (en) Memory management method and memory controller using the same
CN116821437B (en) Data processing method, device, electronic equipment and storage medium
CN114895969A (en) Operating system sleeping method and device, computing equipment and storage medium
US10437946B1 (en) Using implemented core sources for simulation
CN114880289A (en) File grouping display method and computing device
CN106775485A (en) The method and system that a kind of SD card based on mobile terminal is formatted
CN116501415B (en) Command execution method and device, electronic equipment and computer readable storage medium
CN114327660B (en) Initialization method of external memory based on FPGA
CN115617488A (en) Operating system migration method and device, computing equipment and storage medium
CN114816772A (en) Debugging method, debugging system and computing device for application running based on compatible layer
CN110515665B (en) Starting method, system and device of processor system
US20210326251A1 (en) Non-volatile storage device, host device, and data storage system
CN111857882A (en) Extensible SSD (solid State disk) firmware loading method and device, computer equipment and storage medium
CN112416657A (en) System cloning method
CN107229413B (en) Memory management method, memory control circuit unit and memory storage device
CN115617771A (en) Distributed file system and data processing method
CN117632809B (en) Memory controller, data reading method and memory device
JP6482362B2 (en) Source code generation system, source code generation device, source code generation method and program
CN114756291B (en) Hardware self-adaption method and device
US20230350593A1 (en) Method, system, and circuit for deploying file system on embedded memory in programmable computing device
US20230195345A1 (en) Multi-dimensional solid state drive block access
CN114896179B (en) Memory page copying method and device, computing equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination