WO2022206227A1 - 系统启动方法、设备、系统及存储介质 - Google Patents

系统启动方法、设备、系统及存储介质 Download PDF

Info

Publication number
WO2022206227A1
WO2022206227A1 PCT/CN2022/077739 CN2022077739W WO2022206227A1 WO 2022206227 A1 WO2022206227 A1 WO 2022206227A1 CN 2022077739 W CN2022077739 W CN 2022077739W WO 2022206227 A1 WO2022206227 A1 WO 2022206227A1
Authority
WO
WIPO (PCT)
Prior art keywords
startup
routines
operating system
groups
phase
Prior art date
Application number
PCT/CN2022/077739
Other languages
English (en)
French (fr)
Inventor
肖月振
Original Assignee
阿里巴巴(中国)有限公司
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 阿里巴巴(中国)有限公司 filed Critical 阿里巴巴(中国)有限公司
Publication of WO2022206227A1 publication Critical patent/WO2022206227A1/zh

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/4406Loading of operating system
    • 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
    • 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • 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/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/48Indexing scheme relating to G06F9/48
    • G06F2209/484Precedence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5021Priority

Definitions

  • the present application relates to the field of computer technology, and in particular, to a system startup method, device, system, and storage medium
  • RTOS real-time operating system
  • a device using an RTOS can enter deep sleep when no work is needed, and then quickly start the RTOS when work is required.
  • some devices such as IP Camera devices, have higher requirements on the system startup speed, and the startup time of traditional RTOS is still too long to meet the needs of practical applications.
  • IP Camera devices IP Camera devices
  • the startup time of traditional RTOS is still too long to meet the needs of practical applications.
  • the smart cat's eye in the IPC device detects that someone passes by the door, it needs to start the camera to collect the image or video of the person passing by the door.
  • the time for the human body to pass the camera may be less than 2 seconds. Image or video data, the smart cat's eye puts forward higher requirements for the system startup speed. Therefore, how to reduce the startup time of the RTOS system is an urgent problem to be solved.
  • Various aspects of the present application provide a system startup method, device, system, and storage medium, so as to shorten the startup time of the operating system and improve the startup speed of the operating system.
  • An embodiment of the present application provides a system startup method, including: dividing a startup process of an operating system into a plurality of startup stages, each startup stage including at least one routine; for at least part of the startup stage, dividing the routines in the startup stage into to m groups, m is a positive integer, and m ⁇ 2; when starting the operating system, initialize the routines in multiple startup phases in sequence, wherein at least part of the routines in the startup phase are initialized During operation, the routines in m groups are concurrently scheduled in the unit of group.
  • An embodiment of the present application further provides an operating system, including: a management module, configured to divide the startup process of the operating system into multiple startup phases, each startup phase including at least one routine; a grouping module, configured to start at least part of the startup stage, divide the routines in the startup stage into m groups, m is a positive integer, and m ⁇ 2; the scheduling module is used to initialize the routines in multiple startup stages in sequence when the operating system is started , wherein, when at least part of the routines in the startup phase are initialized, the routines in the m groups are concurrently scheduled in units of groups.
  • a management module configured to divide the startup process of the operating system into multiple startup phases, each startup phase including at least one routine
  • a grouping module configured to start at least part of the startup stage, divide the routines in the startup stage into m groups, m is a positive integer, and m ⁇ 2
  • the scheduling module is used to initialize the routines in multiple startup stages in sequence when the operating system is started , wherein, when at least
  • Embodiments of the present application further provide an IoT device, including: a memory and a processor; the memory, for storing a computer program and routines in an operating system; a processor, coupled with the memory, for executing the computer program for : Divide the startup process of the operating system into multiple startup phases, and each startup phase includes at least one routine; for at least part of the startup phase, divide the routines in the startup phase into m groups, where m is a positive integer, and m ⁇ 2; when starting the operating system, perform initialization operations on routines in multiple startup phases in sequence, wherein, when performing initialization operations on routines in at least part of the startup phases, take the grouping as a unit, and group m groups The routines in are scheduled concurrently.
  • An embodiment of the present application further provides a system startup method, including: when starting an operating system, determining multiple startup stages included in the operating system, each startup stage including at least one routine, wherein at least part of the routines in the startup stage Divided into m groups, m is a positive integer, and m ⁇ 2; perform initialization operations on routines in multiple startup phases in sequence, wherein, when performing initialization operations on at least part of the routines in startup phases, the The grouping is the unit, and the routines in m groups are concurrently scheduled.
  • An embodiment of the present application further provides a method for starting application software, including: when starting the application software, determining a plurality of start-up phases included in the application software, each start-up phase includes at least one routine, wherein at least some of the start-up phases are The program is divided into m groups, m is a positive integer, and m ⁇ 2; initialization operations are performed on the routines in multiple startup phases in sequence, wherein, when at least part of the routines in the startup phase are initialized, The routines in m groups are scheduled concurrently in groups.
  • Embodiments of the present application further provide a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the processor causes the processor to implement steps in any of the methods provided by the embodiments of the present application.
  • Embodiments of the present application also provide a computer program product, including computer programs/instructions, which, when executed by a processor, cause the processor to implement steps in any of the methods provided by the embodiments of the present application.
  • the startup process of the operating system is divided into multiple startup stages, and for at least part of the startup stages, the routines in the startup stage are divided into multiple groups; when the operating system is started, each The initialization operation is performed in the startup phase; when the initialization operation is performed on at least part of the startup phase, the routines in the multiple groups are concurrently scheduled in units of groups, which can shorten the startup time of the operating system and improve the startup efficiency of the operating system.
  • FIG. 1 is a schematic diagram of the composition of an Internet of Things device provided by an exemplary embodiment of the present application
  • FIG. 2a is a schematic flowchart of a system startup method provided by an exemplary embodiment of the present application
  • FIG. 2b is a schematic flowchart of another system startup method provided by an exemplary embodiment of the present application.
  • 2c is a schematic flowchart of a method for starting application software provided by an exemplary embodiment of the present application
  • FIG. 3 is a schematic diagram of an operating system startup process provided by an exemplary embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of an operating system provided by an exemplary embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an Internet of Things device according to an exemplary embodiment of the present application.
  • the startup process of the operating system is divided into multiple startup phases, and for at least part of the startup phases, the The routines are divided into multiple groups; when the operating system is started, the initialization operation is performed on each start-up phase in sequence; when the initialization operation is performed on at least part of the start-up phase, the routines in the multiple groups are concurrently performed in units of groups scheduling, which can shorten the startup time of the operating system and improve the startup efficiency of the operating system.
  • FIG. 1 is a schematic diagram of the composition of an Internet of Things device according to an exemplary embodiment of the present application.
  • the IoT device 100 includes: a hardware system 10 and a software system 20 .
  • the hardware system 10 is the basis for the operation of the software system 20 in the IoT device 100, and it provides a physical platform and a communication interface for the software system 20 to operate;
  • the software system 20 is the control core of the IoT device 100, which controls the startup, operation and provide information on human-computer interaction, etc.
  • the hardware system 10 includes a processor 101 and a memory 102 coupled to the processor 101 .
  • the hardware system 10 may further include some other peripheral hardware modules, such as an input interface 103, an output interface 104, a power management module 105, a communication module 106, a touch screen 107 and/or an audio module 108 for human-computer interaction, and the like.
  • peripheral hardware modules are represented by dashed boxes.
  • the IoT device is a network camera (IP Camera, IPC) device
  • the hardware system 10 may further include: a camera module 109 .
  • the processor 101 is the hardware core of the IoT device 100, and can be a programmable system on a chip (System On Programmable Chip, SOPC) or a system on a chip (System On Chip, SOC) or a central processing unit (Central Processing Unit, CPU) or It is implemented by a digital signal processor (Digital Signal Processing, DSP) or a microcontroller unit (Microcontroller Unit, MCU), but is not limited to this.
  • SOPC System On Programmable Chip
  • SOC System On Chip
  • CPU Central Processing Unit
  • DSP Digital Signal Processing
  • MCU microcontroller Unit
  • the memory 102 is responsible for providing storage space for the IoT device 100 , and can be used to store various program codes corresponding to the software system 20 , and can be configured to store various other data to support operations on the IoT device 100 . Examples of such data include instructions, messages, pictures, videos, etc. for any application or method operating on the IoT device 100 .
  • Memory 102 may be implemented by any type of volatile or non-volatile storage device or combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk any type of volatile or non-volatile storage device or combination thereof.
  • the input interface 103 and the output interface 104 are the communication interfaces for the Internet of Things device 100 to communicate with the outside world, and may adopt but are not limited to the following interface methods: USB bus, serial port, 1394 bus, Ethernet, IIS, CAN, DMA or GPIO.
  • the power management module 105 is responsible for providing power to various hardware modules of the IoT device 100 .
  • the power management module 105 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the devices on which the power components are located.
  • the communication module 106 is used for wired or wireless communication between the IoT device 100 and other devices.
  • the IoT device 100 can access a wireless network based on a communication standard, such as WiFi, a mobile communication network such as 2G, 3G, 4G/LTE, 5G, or a combination thereof.
  • the communication module 106 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication module 106 also includes a near field communication (NFC) module to facilitate short-range communication.
  • the NFC module may be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • the touch screen 106 can be used as an input device of the Internet of Things device 100, and can input relevant information to the Internet of Things device 100 in response to user input instructions; in addition, the touch screen 106 can also be used as an output device of the Internet of Things device 100 to output relevant information to the user.
  • the IoT device 100 may also include an audio module 108 for receiving a user's voice command, or outputting relevant information to the user in a voice manner.
  • the software system 20 includes an operating system 201, which belongs to system software and is responsible for controlling and managing various software and hardware resources of the IoT device 100, such as hardware drivers, memory management, and task management.
  • Program codes corresponding to the operating system 201 are stored in the memory 102 .
  • the processor 101 can load the program code corresponding to the operating system 201 stored in the memory 102 to implement various control or driving functions of the operating system 201, so as to successfully start the IoT device 100 or ensure the normal operation of IoT devices 100.
  • the operating system 201 may be an embedded operating system, and the embedded operating system may be a real-time operating system (Real Time Operating System, RTOS), or a non-real-time operating system.
  • RTOS means that when external events or data are generated, it can be accepted and processed at a fast enough speed, and the results of its processing can control the production process or respond quickly to the processing system within a specified time. Utilize resources to complete real-time tasks and control the operating system that all real-time tasks run in unison.
  • the embedded operating system can be a real-time operating system ⁇ C/OS-II or VxWorks, or it can be a non-real-time operating system such as embedded Linux or Windows Embedded.
  • the software system 20 may further include application software 202, and the application software 202 is oriented to specific application requirements or application scenarios. According to different application requirements or application scenarios, the functions implemented by the application software 202 will be different.
  • the application software 202 may be detection software, speech recognition software, image processing software, or video playback software. It should be noted that the application software 202 is optional, not mandatory, and may be determined according to the application requirements of the IoT device.
  • the focus is on the operating system 201, especially on the function of the operating system 201 in terms of startup.
  • the startup process of the operating system mainly refers to the process of initializing the routines required in the startup process.
  • a routine refers to a collection of functional interfaces or services provided externally by the operating system.
  • a routine can be an application programming interface (Application Programming Interface, API) of the operating system 201; a routine can also be the IoT device 100 combined with its hardware
  • the service provided by the module externally for example, if the IoT device 100 includes a camera, the routine can be the camera service provided by the IoT device 100, and the IoT device 100 includes a display screen, then the routine can be the display service provided by the IoT device 100 .
  • some standard functions and library functions involved in some drivers also belong to the routines in the embodiments of the present application.
  • initializing the routine mainly refers to the process of calling the routine and running the routine.
  • initializing the routine includes calling the routine, writing relevant parameters into the hardware register corresponding to the routine, and waiting for the relevant hardware to complete the initialization.
  • the initialization of the hardware includes a process of performing self-checking on the hardware, reading relevant parameters from the hardware registers, and performing further actions according to the relevant parameters.
  • it is necessary to perform self-test on different hardware for example, if the routine corresponds to the processor, the processor needs to be self-tested; if the routine corresponds to the motherboard, the motherboard needs to be self-tested .
  • further actions may be to create an interrupt vector or set other registers, etc. according to the relevant parameters read from the hardware registers.
  • routines that need to perform initialization operations are initialized in a serial manner.
  • the startup process of the operating system needs to start three routines, namely routine A1, routine A2 and routine A3.
  • the three routines must be initialized in sequence, that is, routine A1 is initialized first.
  • routine A1 is initialized first.
  • routine A2 is initialized.
  • routine A3 can be initialized.
  • the entire operating system is considered to be successfully started.
  • the process of initializing the routine A1 includes: calling the routine A1, writing relevant parameters into the hardware register corresponding to the routine A1, and waiting The related hardware completes the initialization process. During the whole process, it takes a certain amount of time to wait for the related hardware to complete the initialization. Even if there is no dependency between the routine A1 and the routine A2, it is necessary to wait for the hardware corresponding to the routine A1 to complete the initialization. After the initialization process of the routine A1 is completed, the initialization operation of the routine A2 can be performed. In application scenarios that have high requirements on startup speed, such as IPC devices, this serial initialization method still has a long startup time, which cannot meet the needs of practical applications.
  • the time required to wait for hardware initialization to be completed during the routine startup process is fully utilized to provide a new system startup method.
  • the method as shown in Figure 2a, includes the following steps:
  • routines in a plurality of startup phases in sequence wherein when performing initialization operations on at least part of the routines in the startup phases, take a group as a unit, perform initialization operations on the m groups.
  • the routines are scheduled concurrently.
  • each startup phase may include one routine, or may include multiple routines, for example, 2, 3, or 5 routines.
  • the routines in the startup phases may be divided into m groups for at least part of the startup phases, wherein at least part of the startup phases may be partial startup phases, or is all startup stages, and when at least part of the startup stages is all startup stages, for each startup stage, the routines in the startup stages are divided into m groups. For different start-up stages, the number of divided groups m may be the same or different.
  • the startup process of the operating system is divided into 7 startup stages, which are respectively the startup stage Y1 to the startup stage Y7, and each startup stage is divided into the same number
  • the grouping of 4 groups is taken as an example in Figure 3.
  • the number of routines contained therein may be the same or different, which is not limited. In Figure 3, only the number of routines contained in one packet in each startup phase is shown.
  • the routines in the startup phases are divided into execution times of m groups.
  • the startup process of the operating system may be divided into multiple startup phases in advance, and at least part of the routines in the startup phases may be divided into m groups in advance.
  • m groups are scheduled concurrently.
  • the present application also provides another system startup method, as shown in Figure 2b, the method includes:
  • each startup stage includes at least one routine, wherein at least part of the routines in the startup stage are divided into m groups, where m is a positive integer, and m ⁇ 2;
  • the startup process of the operating system may be divided into a plurality of startup phases in advance, and at least part of the startup phases that need to be grouped into routines may be preset, and then during each startup of the operating system, When the at least part of the start-up phase is scheduled, the routines in the at least part of the start-up phase are further divided into m groups.
  • the operating system startup process may be divided into multiple startup stages in real time, and then, when scheduling the multiple startup stages in sequence, the scheduling process may be performed in real time.
  • the routines in the startup phase to arrive are divided into m groups.
  • the startup process of the operating system is divided into multiple startup phases in advance, and at least part of the routines in the startup phases are divided into m groups as an example for illustration. .
  • the entire startup process is divided into a registration stage and a scheduling stage; wherein, the startup process of the operating system is divided into multiple startup stages and at least part of the routines in the startup stages are divided into m groups
  • the operation in is completed in the registration phase; the scheduling phase refers to the process of scheduling the startup phase as needed to complete the initialization of the routines in each startup phase, that is, the startup process of the operating system.
  • routines in multiple startup phases may be initialized in sequence. Routines in m groups are scheduled concurrently. As shown in Figure 3, 4 groups in each startup phase can be scheduled concurrently to ensure maximum utilization of the processor.
  • the embodiment of the present application adopts the group concurrent scheduling method, which can shorten the startup time of the operating system and improve the startup efficiency of the operating system.
  • the startup phase can be scheduled concurrently, which brings several times improvement to the startup speed of the operating system.
  • the operating system generates a relatively high current during the startup process. If the startup time is too long, it may have a certain impact on the battery replacement frequency or charging frequency of the IPC device.
  • the implementation manner of starting the operating system is not limited.
  • the power switch of the IoT device can be manually triggered to power on the operating system, and the operating system starts the operating system after detecting the power-on signal.
  • the IoT device includes an application program or a hardware module, the application program or the hardware module can generate a wake-up signal, and the IoT device can respond to the wake-up signal generated by the application program or the hardware module in the device where the operating system is located to start the operating system.
  • the IoT device is an IPC device, and the IPC device is provided with a motion detection module, which can generate a wake-up signal when detecting a moving object, and the IPC device can continuously detect the wake-up signal.
  • the detection module When the detection module generates a wake-up signal, the operating system is started.
  • the implementation manner in which the startup process of the operating system is divided into multiple startup phases is not limited, which will be described below with an example.
  • the manufacturer of the IoT device can specify the priority of the routine.
  • the IoT device is implemented as a smart cat's eye, and the device manufacturer wishes to start the camera first, and then start the display screen during the process of starting the smart cat's eye.
  • the priority of the routine corresponding to the camera is higher than the priority of the routine corresponding to the display screen.
  • the startup process of the operating system can be divided into multiple startup stages according to the routine priority when the operating system starts up provided by the device manufacturer. Further optionally, according to the priorities of the routines in the operating system startup process, the routines with the same priority are divided into the same startup phase, and the execution order of the startup phase corresponds to the priority of the routines in the startup phase.
  • the routine B1 needs to be started to complete the initialization operation of the processor working model and the system stack, and then start the routine B1.
  • Routine B2 to complete the hard disk startup.
  • the routine B2 can only be completed after the routine B1 is completed, that is, there is a dependency relationship between the routine B2 and the routine B1, and it can be considered that the priority of the routine B1 is higher than that of the routine B2.
  • the priority between the routines can be determined according to the dependencies between the routines in the multiple startup phases, and then the startup process of the operating system is divided into multiple startup phases. Further, according to the priority between the routines The routines with the same priority are divided into the same startup stage, and the execution order of the startup stage corresponds to the priority of the routines in the startup stage.
  • the routine priority provided by the device manufacturer and the dependency between the routines may be considered simultaneously, according to the routine priority at startup of the operating system provided by the device manufacturer and the example in multiple startup phases. It divides the startup process of the operating system into multiple startup stages. For example, the priority of the routine corresponding to the hardware to be started can be preliminarily determined according to the routine priority provided by the device manufacturer, and then based on the dependencies between the routines in multiple startup phases, the hardware corresponding routine determined initially can be determined. The priorities of the routines are adjusted to obtain the final priorities between routines. Further, routines with the same priority are divided into the same startup stage, and the execution order of the startup stage corresponds to the priority of the routines in the startup stage.
  • the implementation of dividing the routines in the startup phase into m groups is not limited. An example is given below.
  • routines in the startup phase may be randomly divided into m groups.
  • the initialization time between groups can be the same or similar, and The routine is divided into m groups.
  • the initialization time of the routine refers to the time to call and run the routine.
  • the initialization time of the routine includes: in addition to the time to call the routine , and also includes: the time required to write the relevant parameters into the hardware register corresponding to the routine and the time required to wait for the relevant hardware to complete the initialization.
  • the preset number of groups n, n is a positive integer, and n ⁇ 2; wherein, the computing resources can be CPU resources, memory resources, hard disk resources or network resources, the richer the computing resources, the more the preset number of groups n can be.
  • the larger the operating system the shorter the startup time of the operating system.
  • the routines in the startup phase can be divided into m groups according to the preset number of groups. Specifically, the time required for initialization of the routines in the startup phase can be calculated according to the initialization time of the routines in the startup phase.
  • Overall time-consuming which can be the time required for serial initialization of all routines in the startup phase; according to the overall time-consuming and the preset number of groups n, estimate the grouping time required to initialize each group , for example, the ratio of the overall time consumption to the preset number of groups n can be used as the estimated group time required for each group to perform the initialization operation; then, the sum of the initialization time of the routines in each group and the group
  • the routines in the startup phase are divided into m groups with the goal of the same or similar time-consuming.
  • the target routine whose initialization time satisfies a specified condition in the startup phase
  • the specified condition may be that the ratio of the initialization time of the target routine to the total time consumption of the startup phase exceeds a set threshold, for example, the threshold 50%, 60% or 90%.
  • a set threshold for example, the threshold 50%, 60% or 90%.
  • the target routine is divided into C1 group separately, and the routines other than the target routine in the startup phase are divided into C2 group.
  • the routine in the C1 group still needs a long period of time to complete the initialization, which is not conducive to shortening the startup time of the operating system.
  • the target routine is divided into multiple subroutines, and the initialization of the multiple subroutines is determined. Time-consuming; accordingly, with the goal of the sum of the initialization time-consuming of the routines in each group being the same as or similar to the grouping time-consuming, the routines in the startup phase are divided into m groups, including the routines in each group.
  • the goal is that the sum of the initialization time of the program is the same as or similar to the grouping time, and the multiple subroutines and the rest of the routines except the target routine in the startup phase are divided into m groups, and the grouping is used as a unit.
  • the routines in the m groups are concurrently scheduled to shorten the startup time of the operating system and improve the startup speed of the operating system.
  • the routines in the startup phase may be concurrently scheduled in units of groups.
  • the execution task can be understood as an application program, which can realize one or some functional modules of the IoT device, for example, for A group divided in the startup phase is assigned an execution task, and the execution task is responsible for executing the routines in the corresponding group, that is, initializing the routines in the corresponding group.
  • the execution task may have the following states: a running state (running) and a non-running state; further, the non-running state includes: a ready state (ready), a blocked state (blocked), and a suspended state (suspended).
  • a running state running
  • a non-running state includes: a ready state (ready), a blocked state (blocked), and a suspended state (suspended).
  • the running state indicates that the execution task is executing the routine in its corresponding group, and the execution task in the running state will occupy processor resources.
  • the number of execution tasks in the running state at the same time is related to the number of cores of the processor; if the processor has only one core, only one task can be in the running state at the same time; if the processor has multiple cores, Then there can be multiple tasks running at the same time.
  • the ready state means that the execution task can execute the routine in its corresponding group, but it has not yet executed because other execution tasks are occupying processor resources;
  • the blocking state means that the execution task is waiting for a temporary or external event, the temporary or external event. The occurrence of an external event will wake up the execution task, thereby changing the execution task from the blocking state to the ready state or running state. For example, some hardware-related routines need to wait for the hardware initialization to complete before performing subsequent operations.
  • the state of the execution task corresponding to the routine may be a blocking state, and the execution task waits for the hardware initialization to complete, and then changes from the blocking state to the ready state or the running state.
  • tasks in the blocking state do not occupy any processor time and are not selected to enter the running state.
  • the suspended state is also a task state. Unless the task in the suspended state is resumed, the task will never return to the ready state and will not be selected to enter the running state.
  • execution tasks may be created for m groups divided in the startup phase, and each execution task is responsible for initializing the routines in the corresponding group, and starting m execution tasks; According to the states of the m execution tasks, concurrently schedule the m execution tasks.
  • the state of the execution task currently in the running state can be monitored, if the execution task currently in the running state enters the non-running state, then the execution task in the ready state is Perform scheduling, and the scheduled execution tasks enter the running state from the ready state.
  • the implementation manner of scheduling the execution tasks in the ready state is not limited.
  • each execution task maintains a priority. If the execution task currently in the running state enters the non-operational state, the execution task with the highest priority is selected from the execution tasks in the ready state, Schedule the execution task in the ready state.
  • a queue may be maintained, and the execution tasks in the ready state are stored in the queue.
  • the execution task in the ready state at the head of the queue is executed. Tasks are scheduled. No matter which of the above methods is used to schedule the execution task in the ready state, after the execution task in the ready state is scheduled, the state of the execution task changes from the ready state to the running state, and the execution task in the running state completes the execution of the grouping.
  • the execution result can be submitted after all the routines in the group.
  • the execution result indicates that the routines in the corresponding group have been initialized.
  • an inter-process communication (inter-process communication, IPC) object may be applied for for m execution tasks, and the IPC object may be a message queue (message queue), a semaphore (semaphore) or a shared memory (share memory) ), the execution task can refer to or access the IPC object through the identifier of the IPC object, the identifier of the IPC object can be an integer, for example, 125, 567 or 5245, etc., the execution task can provide the execution result to the IPC object, the IPC object can contain m cache spaces, each cache space is used to store the execution result submitted by an execution task, further optionally, in order to ensure that the execution results of the m execution tasks can be provided to the IPC object, in the IPC object The number k of included cache space is greater than the number m of execution tasks.
  • the lock-free IPC technology (Lockfree-IPC) is used to ensure the synchronization problem between multiple execution tasks.
  • the lock-free technology means that multiple execution tasks can write execution results into the IPC object at the same time. Greatly improves the boot time of the operating system.
  • the startup method provided in this embodiment is not only applicable to operating systems, but also applicable to non-operating system-level computer programs, such as various application software; in terms of software types, application software includes but is not limited to: application program (APP) , client, plug-in, applet, browser, etc. From the perspective of software functions, application software can be but not limited to: decompression software on smart terminals or computers, office software, picture viewing software, video playback software, shopping software, Live software, etc. Based on this, the present application also provides a method for starting application software, as shown in Figure 2c, the method includes:
  • each start-up phase includes at least one routine, wherein at least part of the routines in the start-up phase are divided into m groups, where m is a positive integer, and m ⁇ 2;
  • the startup process of the application software can be divided into multiple startup stages in advance, and at least part of the routines in the startup stages can be grouped into m groups in advance;
  • the startup process of the software is divided into a plurality of startup phases, and the routines in at least some of the startup phases are grouped into m groups.
  • the startup process of the application software can be divided into different startup phases; similarly, for the same startup phase, the routines included in different startup processes can also be Grouping into different numbers of groups, specifically, the process of dividing the startup phase and the grouping process can be combined with specific startup scenarios, and the startup stages and groups can be flexibly divided according to the startup scenarios.
  • the execution subject of each step of the method provided in the above-mentioned embodiments may be the same device, or the method may also be executed by different devices.
  • the execution body of steps 201a to 203a may be device A; for another example, the execution body of steps 201a and 202a may be device A, and the execution body of step 203a may be device B; and so on.
  • the present application also provides a new operating system
  • the operating system can be an embedded operating system
  • the embedded operating system can be implemented as an RTOS system such as ⁇ C/OS-II or VxWorks, or can be implemented It is a non-real-time operating system such as embedded Linux or Windows Embedded.
  • the internal architecture of the operating system includes: a management module 41 , a grouping module 42 and a scheduling module 43 .
  • the management module 41 is used to divide the startup process of the operating system into a plurality of startup stages, each startup stage includes at least one routine; the grouping module 42 is used for at least part of the startup stage, for the routines in the startup stage. Divided into m groups, m is a positive integer, and m ⁇ 2; the scheduling module 43 is used to perform initialization operations on routines in multiple startup phases in sequence when the operating system is started, wherein, when at least part of the startup When the routines in the stage perform the initialization operation, the routines in the m groups are concurrently scheduled in the unit of grouping.
  • the scheduling module 43 includes: a global scheduling sub-module 430 and a grouping scheduling sub-module 431.
  • the global scheduling sub-module 430 is used to schedule multiple startup phases in sequence when the operating system is started. Initialization operation; the group scheduling sub-module 431 is used to, when the global scheduling module schedules the startup phase in at least part of the startup phase, take the group as a unit to concurrently execute the routines in the m groups in the scheduled startup phase. schedule.
  • the operating system further includes: a traditional scheduling submodule, the module is used for the startup phase in which the routine is not divided into m groups.
  • the routine is initialized in a serial manner.
  • the global scheduling sub-module 430 is responsible for adopting a serial manner, and for the start-up phase in which the routine is not divided into m groups The routine is initialized.
  • the grouping module 42 when the grouping module 42 divides the routines in the startup phase into m groups, it is specifically used for: according to the initialization time-consuming of the routines in the startup phase, the initialization time-consuming between the groups is the same. or similar as the goal, divide the routines in the startup phase into m groups.
  • the grouping module 42 takes the same or similar initialization time-consuming between the groups as the goal, and divides the routines in the startup phase into m groups, specifically using In: Calculate the total time required for the initialization operation in the startup phase according to the initialization time of the routine in the startup phase; estimate the required initialization operation for each group according to the overall time consumption and the preset number of groups n
  • the grouping time-consuming of n is a positive integer, and n ⁇ 2; with the goal of the sum of the initialization time-consuming of the routines in each group being the same or similar to the grouping time-consuming, divide the routines in the startup phase into m groups middle.
  • the grouping module 42 is further configured to: if there is a target routine whose initialization time consuming meets a specified condition in the startup phase, split the target routine into a plurality of subroutines, and determine a plurality of subroutines.
  • the grouping module 42 divides the routines in the startup phase into m groups with the goal that the sum of the initialization time-consuming of the routines in each group is the same as or similar to the grouping time-consuming, It is specifically used for: with the goal that the sum of the initialization time-consuming of the routines in each group is the same as or similar to the grouping time-consuming, divide multiple subroutines and the rest of the routines except the target routine in the startup phase into m in a group.
  • the group scheduling sub-module 431 when the group scheduling sub-module 431 performs concurrent scheduling on the routines in the m groups in the unit of group, it is specifically used for: respectively creating execution tasks for the m groups, and starting m execution tasks. Each execution task is responsible for executing the routines in the corresponding group; according to the states of the m execution tasks, concurrently schedule the m execution tasks.
  • the group scheduling submodule 431 when the group scheduling submodule 431 performs concurrent scheduling on m execution tasks according to the states of the m execution tasks, it is specifically used for: monitoring the status of the execution tasks currently in the running state, wherein the execution tasks are in the running state.
  • the execution task in the running state executes the routines in the corresponding group and submits the execution result after executing all the routines; if the execution task currently in the running state enters the non-running state, the execution task in the ready state is scheduled and is scheduled.
  • the execution tasks of m enter the running state from the ready state, and the execution results submitted by the m execution tasks are provided to the group synchronization sub-module 432 . As shown in FIG.
  • the scheduling module 43 further includes: a packet synchronization sub-module 432 .
  • the group synchronization sub-module 432 is configured to receive the execution results of the execution tasks submitted by the group scheduling sub-module 431, and when receiving the execution results of the m execution tasks, notify the global scheduling sub-module 430 for the global scheduling sub-module 430 to determine The initialization operation for the currently scheduled startup phase is complete.
  • the group synchronization submodule 432 is also used to: apply for an IPC object for m execution tasks, and the IPC object is used to receive the execution result submitted by its corresponding execution task; obtain m execution tasks from the IPC object The execution result submitted after all routines in the corresponding group have been executed.
  • the number k of cache spaces included in the IPC objects applied for for m execution tasks is greater than the number m of execution tasks, and each cache space is used to store an execution result submitted by one execution task.
  • the group scheduling sub-module 431 may write the execution result of each execution task into the corresponding buffer space in the IPC object.
  • the management module 41 when the management module 41 divides the startup process of the operating system into a plurality of startup phases, it is specifically used for: according to the routine priority and/or multiple startup phases during the startup of the operating system provided by the device manufacturer.
  • the dependencies between routines in a stage divide the startup process of the operating system into multiple startup stages.
  • the management module 41 when the management module 41 divides the startup process of the operating system into a plurality of startup stages according to the routine priority during the startup of the operating system provided by the device manufacturer, it is specifically used for: according to the routine priority. , the routines of the same priority are divided into the same startup phase, and the execution order of the startup phase corresponds to the priority of the routines in the startup phase.
  • the management module 41 is further configured to: start the operating system in response to a wake-up signal generated by an application program or a hardware module in the device where the operating system is located.
  • the device where the operating system is located is an IPC device with a motion detection module
  • the management module 41 responds to the wake-up signal generated by the hardware module in the device where the operating system is located, and starts the operating system, specifically for: monitoring When the motion detection module generates a wake-up signal, the operating system is started; wherein, the motion detection module generates a wake-up signal when a moving object is detected.
  • the operating system is a real-time operating system in an embedded operating system.
  • the operating system further includes an interface module 44 and a performance statistics module 45 .
  • the interface module 44 is used to implement the communication between the management module 41 , the grouping module 42 , the scheduling module 43 and the performance statistics module 45 and upper-layer applications, hardware modules or external devices.
  • the interface module 44 can receive the wake-up signal generated by the upper-layer application or hardware module, and provide the wake-up signal to the scheduling module 43; or can receive the routine priority provided by the device manufacturer when the operating system is started and provide it to the management module 41 Alternatively, the initialization time-consuming of each routine, grouping, or startup phase recorded by the performance statistics module 45 may be reported to an upper-layer application or an external device. Further, the interface module 44 may also notify upper-layer applications, hardware modules, etc.
  • the performance statistics module 45 is used to count the initialization time from the operating system dimension, the startup stage dimension, the grouping dimension or the routine dimension, analyze the initialization time in each dimension during the operating system startup process, and obtain the performance of the parallel startup mode.
  • the present application also provides an internal architecture of an operating system including: a determination module and a scheduling module;
  • a determination module configured to determine a plurality of startup phases included in the operating system when the operating system is started, each startup phase includes at least one routine, wherein at least part of the routines in the startup phase are divided into m groups, where m is A positive integer, and m ⁇ 2; the scheduling module is used to perform initialization operations on routines in multiple startup phases in sequence, wherein when performing initialization operations on routines in at least part of the startup phases, the unit is Concurrent scheduling of routines in m groups.
  • the startup process of the operating system is divided into multiple startup stages, and for at least part of the startup stages, the routines in the startup stage are divided into multiple groups;
  • the initialization operation is performed in each startup phase; when the initialization operation is performed on at least part of the startup phase, the routines in multiple groups are concurrently scheduled in groups, which can shorten the startup time of the operating system and improve the startup efficiency of the operating system .
  • the present application also provides a device for starting application software, including: a determining module and a scheduling module.
  • the determining module is configured to determine a plurality of startup phases included in the application software when the application software is started, and each startup phase includes at least one routine, wherein at least part of the routines in the startup phase are divided into m groups, m is a positive integer, and m ⁇ 2;
  • the scheduling module is used to perform initialization operations on routines in multiple startup phases in sequence, wherein, when performing initialization operations on at least part of the routines in the startup phases, group the routines as unit, schedules the routines in m groups concurrently.
  • FIG. 5 is a schematic structural diagram of an Internet of Things device according to an exemplary embodiment of the present application.
  • the IoT device includes: a memory 54 and a processor 55 .
  • Memory 54 is used to store computer programs and routines in the operating system, and may be configured to store various other data to support operation on the IoT device. Examples of such data include instructions for any application or method to operate on the IoT device.
  • Memory 54 may be implemented by any type of volatile or non-volatile storage device or combination thereof, such as static random access memory (SRAM), electrically erasable programmable read only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • magnetic or Optical Disk any type of volatile or non-volatile storage device or combination thereof.
  • the processor 55 coupled with the memory 54, is used for executing the computer program in the memory 54, so as to: divide the startup process of the operating system into a plurality of startup stages, each startup stage includes at least one routine; for at least part of the startup stage, the routines in the startup stage are divided into m groups, m is a positive integer, and m ⁇ 2; when the operating system is started, the routines in multiple startup stages are sequentially initialized. When at least part of the routines in the startup phase perform the initialization operation, the routines in the m groups are concurrently scheduled in units of groups.
  • the processor 55 when the processor 55 divides the routines in the startup phase into m groups, the processor 55 is specifically configured to: according to the initialization time-consuming of the routines in the startup phase, the initialization time-consuming between the groups is the same or Similarity is the goal, and the routines in the startup phase are divided into m groups.
  • the processor 55 divides the routines in the startup phase into m groups according to the initialization time-consuming of the routine in the startup phase, with the same or similar initialization time-consuming between the groups as the goal, It is specifically used to: calculate the total time required for the initialization operation in the startup phase according to the initialization time of the routine in the startup phase; estimate the initialization operation for each group according to the overall time consumption and the preset number of groups n
  • the required grouping time, n is a positive integer, and n ⁇ 2; with the goal that the sum of the initialization time of the routines in each group is the same as or similar to the grouping time, divide the routines in the startup phase into m in a group.
  • the processor 55 is further configured to: if there is a target routine whose initialization time consuming meets the specified condition in the startup phase, then split the target routine into multiple subroutines, and determine the number of subroutines of the multiple subroutines.
  • Initialization time-consuming accordingly, when the processor 55 divides the routines in the startup phase into m groups with the goal that the sum of the initialization time-consuming of the routines in each group is the same as or similar to the grouping time-consuming, the specific It is used to divide the multiple subroutines and the rest of the routines except the target routine in the startup phase into m pieces with the goal that the sum of the initialization time-consuming of the routines in each group is the same as or similar to the grouping time-consuming in grouping.
  • the processor 55 when the processor 55 performs concurrent scheduling on the routines in the m groups in units of groups, the processor 55 is specifically used for: respectively creating execution tasks for the m groups, and starting m execution tasks, each Each execution task is responsible for executing the routines in the corresponding group; according to the status of the m execution tasks, the m execution tasks are concurrently scheduled.
  • the processor 55 when the processor 55 performs concurrent scheduling on the execution tasks according to the status of the execution tasks to complete the initialization of the startup phase, the processor 55 is specifically used for: monitoring the status of the execution tasks currently in the running state, wherein the execution tasks are in the running state.
  • the execution task in the running state executes the routines in the corresponding group and submits the execution result after executing all the routines; if the execution task currently in the running state enters the non-running state, the execution task in the ready state is scheduled and is scheduled
  • the execution tasks of m enter the running state from the ready state; when the execution results submitted by the m execution tasks are received, it is determined that the initialization operation of the startup phase is completed.
  • the processor 55 is also used to: apply for an IPC object for m execution tasks, and the IPC object is used to receive the execution result submitted by its corresponding execution task; obtain m execution tasks from the IPC object after the execution is completed. The execution result submitted after all the routines in the corresponding group.
  • the number k of cache spaces included in the IPC objects applied for for m execution tasks is greater than the number m of execution tasks, and each cache space is used to store an execution result submitted by an execution task.
  • processor 55 when the processor 55 divides the startup process of the operating system into multiple startup phases, it is specifically used for: according to the routine priority and/or multiple startup phases when the operating system starts up provided by the device manufacturer.
  • the dependencies between routines in the operating system divide the startup process of the operating system into multiple startup phases.
  • the processor 55 divides the startup process of the operating system into a plurality of startup stages according to the routine priority during startup of the operating system provided by the device manufacturer, it is specifically used for: according to the routine priority, Routines with the same priority are divided into the same startup phase, and the execution order of the startup phase corresponds to the priority of the routines in the startup phase.
  • the processor 55 is further configured to: start the operating system in response to a wake-up signal generated by an application program or a hardware module in the device where the operating system is located.
  • the device is an IPC device with a motion detection module
  • the processor 55 responds to the wake-up signal generated by the hardware module in the device where the operating system is located, when starting the operating system, specifically for: When the motion detection module generates a wake-up signal, the operating system is started; wherein, the motion detection module generates a wake-up signal when a moving object is detected.
  • the operating system is a real-time operating system in an embedded operating system.
  • the startup process of the operating system is divided into multiple startup stages, and for at least part of the startup stages, the routines in the startup stage are divided into multiple groups; Perform initialization operations on each startup phase; when performing initialization operations on at least part of the startup phases, concurrently schedule routines in multiple groups in units of groups, which can shorten the startup time of the operating system and improve the startup of the operating system. efficiency.
  • the IoT device further includes: a communication component 56 , a display 57 , a power supply component 58 , an audio component 59 and other components. Only some components are schematically shown in FIG. 5 , which does not mean that the IoT device only includes the components shown in FIG. 5 . It should be noted that the components in the dotted box in FIG. 5 are optional components, not mandatory components, which may depend on the product form of the IoT device.
  • the embodiment of the present application further provides an IoT device, the implementation structure of the IoT device is the same as or similar to that of the IoT device shown in FIG. 5 , and can be implemented with reference to the structure of the IoT device shown in FIG. 5 .
  • the difference between the Internet of Things device provided in this embodiment and the Internet of Things device in the embodiment shown in FIG. 5 is mainly that the functions implemented by the processor executing the computer program stored in the memory are different.
  • the processor of the device executes the computer program stored in the memory, which can be used to: when starting the operating system, determine a plurality of startup stages included in the operating system, and each startup stage includes at least one routine.
  • routines in the startup phase are divided into m groups, m is a positive integer, and m ⁇ 2; the routines in the multiple startup phases are sequentially initialized, wherein, at least part of the startup phases are initialized.
  • routines in the stage perform the initialization operation, the routines in the m groups are concurrently scheduled in the unit of grouping.
  • the embodiment of the present application further provides an IoT device
  • the implementation structure of the IoT device is the same as or similar to that of the IoT device shown in FIG. 5 , and can be implemented with reference to the structure of the IoT device shown in FIG. 5 .
  • the difference between the Internet of Things device provided in this embodiment and the Internet of Things device in the embodiment shown in FIG. 5 is mainly that the functions implemented by the processor executing the computer program stored in the memory are different.
  • the processor of the device executes the computer program stored in the memory, which can be used to: when starting the application software, determine a plurality of start-up stages included in the application software, and each start-up stage includes at least one routine.
  • routines in the startup phase are divided into m groups, m is a positive integer, and m ⁇ 2; the routines in the multiple startup phases are sequentially initialized, wherein, at least part of the startup phases are initialized.
  • routines in the stage perform the initialization operation, the routines in the m groups are concurrently scheduled in the unit of grouping.
  • the embodiments of the present application further provide a computer-readable storage medium storing a computer program, when the computer program is executed by the processor, the processor causes the processor to implement the steps in the method shown in FIG. 2a or FIG. 2b or FIG. 2c.
  • An embodiment of the present application further provides a computer program product, including a computer program/instruction, when the computer program/instruction is executed by a processor, the processor causes the processor to implement the method shown in FIG. 2a or FIG. 2b or FIG. 2c. step.
  • the above-mentioned communication components in FIG. 5 are configured to facilitate wired or wireless communication between the device where the communication components are located and other devices.
  • the device where the communication component is located can access a wireless network based on a communication standard, such as WiFi, a mobile communication network such as 2G, 3G, 4G/LTE, 5G, or a combination thereof.
  • the communication component receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication assembly further includes a near field communication (NFC) module to facilitate short-range communication.
  • the NFC module may be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID radio frequency identification
  • IrDA infrared data association
  • UWB ultra-wideband
  • Bluetooth Bluetooth
  • the above-mentioned display in FIG. 5 includes a screen, and the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user.
  • the touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action.
  • a power supply assembly in FIG. 5 above provides power for various components of the equipment where the power supply assembly is located.
  • a power supply assembly may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the equipment in which the power supply assembly is located.
  • the audio components described above in FIG. 5 may be configured to output and/or input audio signals.
  • the audio component includes a microphone (MIC) that is configured to receive external audio signals when the device in which the audio component is located is in operating modes, such as call mode, recording mode, and speech recognition mode.
  • the received audio signal may be further stored in memory or transmitted via the communication component.
  • the audio assembly further includes a speaker for outputting audio signals.
  • the embodiments of the present application may be provided as a method, a system, or a computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory result in an article of manufacture comprising instruction means, the instructions
  • the apparatus implements the functions specified in the flow or flow of the flowcharts and/or the block or blocks of the block diagrams.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include forms of non-persistent memory, random access memory (RAM) and/or non-volatile memory in computer readable media, such as read only memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
  • RAM random access memory
  • ROM read only memory
  • flash RAM flash memory
  • Computer-readable media includes both persistent and non-permanent, removable and non-removable media, and storage of information may be implemented by any method or technology.
  • Information may be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Flash Memory or other memory technology, Compact Disc Read Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
  • computer-readable media does not include transitory computer-readable media, such as modulated data signals and carrier waves.

Landscapes

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

Abstract

本申请实施例提供一种系统启动方法、设备、系统及存储介质。在本申请实施例中,将操作系统的启动过程划分为多个启动阶段,针对至少部分启动阶段,将启动阶段中的例程划分到多个分组;在启动操作系统时,按序对每个启动阶段进行初始化操作;在对至少部分启动阶段进行初始化操作时,以分组为单位对多个分组中的例程进行并发调度,这样可缩短操作系统的启动时间,提高操作系统的启动效率。

Description

系统启动方法、设备、系统及存储介质 技术领域
本申请涉及计算机技术领域,尤其涉及一种系统启动方法、设备、系统及存储介质
背景技术
传统的嵌入式(Linux)操作系统虽然使用广泛,但也有其难以弥补的缺陷。例如,Linux操作系统有庞大的内核,对任何中断指令的响应都需要一个复杂的处理过程,因此,无法满足一些需要快速响应的需求。传统的实时操作系统(Real-Time Operating System,RTOS)由于内核小巧,对任何中断指令可以做到快速响应,相较于Linux系统具备快速启动的优势,因此,可以将RTOS应用到的具有快速启动需求的场景中。
通常情况下,采用RTOS的设备可以在无需工作时进入深度休眠,一旦需要工作再快速启动RTOS。然而,一些设备,例如网络摄像机(IP Camera)设备对系统启动速度提出了更高要求,传统RTOS的启动时间仍然过长,无法满足实际应用的需求。例如,IPC设备中的智能猫眼在检测到有人经过门前时,需要启动摄像头采集经过门前的人的图像或视频,人体经过摄像头的时间可能小于2秒,为了采集到经过门前的人的图像或视频数据,智能猫眼对系统启动速度提出了更高要求。因此,如何减少RTOS系统的启动时长是亟需解决的问题。
发明内容
本申请的多个方面提供一种系统启动方法、设备、系统及存储介质,用以缩短操作系统的启动时长,提高操作系统的启动速度。
本申请实施例提供一种系统启动方法,包括:将操作系统的启动过程划分 为多个启动阶段,每个启动阶段包括至少一个例程;针对至少部分启动阶段,将启动阶段中的例程划分到m个分组,m为正整数,且m≥2;在启动操作系统时,依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
本申请实施例还提供一种操作系统,包括:管理模块,用于将操作系统的启动过程划分为多个启动阶段,每个启动阶段包括至少一个例程;分组模块,用于针对至少部分启动阶段,将启动阶段中的例程划分到m个分组,m为正整数,且m≥2;调度模块,用于在启动操作系统时,依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
本申请实施例还提供一种物联网设备,包括:存储器和处理器;存储器,用于存储计算机程序和操作系统中的例程;处理器,与存储器耦合,用于执行计算机程序,以用于:将操作系统的启动过程划分为多个启动阶段,每个启动阶段包括至少一个例程;针对至少部分启动阶段,将启动阶段中的例程划分到m个分组,m为正整数,且m≥2;在启动操作系统时,依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
本申请实施例还提供一种系统启动方法,包括:在启动操作系统时,确定操作系统包含的多个启动阶段,每个启动阶段包括至少一个例程,其中,至少部分启动阶段中的例程被划分至m个分组,m为正整数,且m≥2;依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
本申请实施例还提供一种应用软件启动方法,包括:在启动应用软件时,确定应用软件包含的多个启动阶段,每个启动阶段包括至少一个例程,其中,至少部分启动阶段中的例程被划分至m个分组,m为正整数,且m≥2;依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例 程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
本申请实施例还提供一种存储有计算机程序的计算机可读存储介质,当计算机程序被处理器执行时,致使处理器实现本申请实施例提供的任一方法中的步骤。
本申请实施例还提供一种计算机程序产品,包括计算机程序/指令,当计算机程序/指令被处理器执行时,致使处理器实现本申请实施例提供的任一方法中的步骤。
在本申请实施例中,将操作系统的启动过程划分为多个启动阶段,针对至少部分启动阶段,将启动阶段中的例程划分到多个分组;在启动操作系统时,按序对每个启动阶段进行初始化操作;在对至少部分启动阶段进行初始化操作时,以分组为单位对多个分组中的例程进行并发调度,这样可缩短操作系统的启动时间,提高操作系统的启动效率。
附图说明
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:
图1为本申请示例性实施例提供的一种物联网设备的组成示意图;
图2a为本申请示例性实施例提供的一种系统启动方法的流程示意图;
图2b为本申请示例性实施例提供的另一种系统启动方法的流程示意图;
图2c为本申请示例性实施例提供的一种应用软件启动方法的流程示意图;
图3为本申请示例性实施例提供的一种操作系统启动过程的示意图;
图4为本申请示例性实施例提供的一种操作系统的结构示意图;
图5为本申请示例性实施例提供的一种物联网设备的结构示意图。
具体实施方式
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请具体实 施例及相应的附图对本申请技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
针对现有操作系统的启动时间较长,无法满足实际应用需求的问题,在本申请实施例中,将操作系统的启动过程划分为多个启动阶段,针对至少部分启动阶段,将启动阶段中的例程划分到多个分组;在启动操作系统时,按序对每个启动阶段进行初始化操作;在对至少部分启动阶段进行初始化操作时,以分组为单位对多个分组中的例程进行并发调度,这样可缩短操作系统的启动时间,提高操作系统的启动效率。
以下结合附图,详细说明本申请各实施例提供的技术方案。
图1为本申请示例性实施例提供的一种物联网设备的组成示意图。如图1所示,该物联网设备100包括:硬件系统10和软件系统20。其中,硬件系统10是物联网设备100中软件系统20运行的基础,它提供了软件系统20运行的物理平台和通信接口;软件系统20是物联网设备100的控制核心,控制整个设备的启动、运行以及提供人机交互的信息等。
如图1所示,硬件系统10包括处理器101以及与处理器101耦合的存储器102。可选地,硬件系统10还可以包括一些其它外围硬件模块,例如输入接口103、输出接口104、电源管理模块105、通信模块106、用于人机交互的触摸屏107和/或音频模块108等。在图1中,以虚线框表示可选的外围硬件模块。进一步,若物联网设备为网络摄像机(IP Camera,IPC)设备,则硬件系统10还可以包括:摄像头模块109。
其中,处理器101是物联网设备100的硬件核心,可以采用可编程片上系统(System On Programmable Chip,SOPC)或片上系统(System On Chip,SOC)或中央处理器(Central Processing Unit,CPU)或数字信号处理器(Digital Signal Processing,DSP)或微控制单元(Microcontroller Unit,MCU)实现,但不限于此。
存储器102负责为物联网设备100提供存储空间,可用于存储软件系统20对应的各种程序代码,并可被配置为存储其它各种数据以支持在物联网设备100上的操作。这些数据的示例包括用于在物联网设备100上操作的任何应用程序或方法的指令,消息,图片,视频等。
存储器102可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
输入接口103和输出接口104是物联网设备100与外界通信的通信接口,可以采用但不限于下述列举的接口方式:USB总线、串口、1394总线、以太网、IIS、CAN、DMA或GPIO。
电源管理模块105负责为物联网设备100的各种硬件模块提供电力。电源管理模块105可以包括电源管理系统,一个或多个电源,及其他与为电源组件所在设备生成、管理和分配电力相关联的组件。
通信模块106用于物联网设备100和其他设备之间通过有线或无线方式的通信。物联网设备100可以接入基于通信标准的无线网络,如WiFi,2G、3G、4G/LTE、5G等移动通信网络,或它们的组合。在一个示例性实施例中,通信模块106经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,通信模块106还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
触摸屏106可作为物联网设备100的输入设备,可响应用户的输入指令向物联网设备100输入相关信息;另外,触摸屏106还可作为物联网设备100的输出设备,向用户输出相关信息。当然,除了触摸屏106之外,物联网设备100还可以包括音频模块108,用于接收用户的语音指令,或者以语音方式向用户输出相关信息。
如图1所示,软件系统20包括操作系统201,操作系统201属于系统软件, 负责控制和管理物联网设备100的各种软硬件资源,例如硬件驱动、内存管理以及任务管理等。该操作系统201对应的程序代码存储在存储器102中。其中,在物联网设备100启动或正常运行过程中,处理器101可以加载存储器102中存储的操作系统201对应的程序代码,实现操作系统201的各种控制或驱动功能,以便成功启动物联网设备100或确保物联网设备100的正常运行。可选地,操作系统201可以是嵌入式操作系统,嵌入式操作系统可以是实时操作系统(Real Time Operating System,RTOS),也可以是非实时操作系统。RTOS是指当外界事件或数据产生时,能够接受并以足够快的速度予以处理,其处理的结果又能在规定的时间之内来控制生产过程或对处理系统做出快速响应,调度一切可利用的资源完成实时任务,并控制所有实时任务协调一致运行的操作系统。例如,嵌入式操作系统可以是实时操作系统μC/OS-II或VxWorks,也可以是嵌入式Linux或Windows Embedded等非实时操作系统。
进一步,如图1所示,软件系统20还可以包括应用软件202,应用软件202,面向具体应用需求或应用场景。根据应用需求或应用场景的不同,应用软件202所实现的功能会有所不同。例如,应用软件202可以是侦测软件、语音识别软件、图像处理软件或视频播放软件等。需要说明的是,应用软件202为可选,而非必选,具体可根据物联网设备的应用需求而定。
在本实施例中,重点关注操作系统201,尤其是关注操作系统201在启动方面的功能。操作系统的启动过程主要是指对启动过程中所需的例程进行初始化的过程。例程指的是操作系统对外提供的功能接口或服务的集合,例如,例程可以是操作系统201的应用程序接口(Application Programming Interface,API);例程也可以是物联网设备100结合其硬件模块对外提供的服务,例如,物联网设备100包含摄像头,则例程可以是物联网设备100提供的摄像服务,物联网设备100包含显示屏,则例程可以是物联网设备100提供的显示服务。另外,一些驱动程序涉及的标准函数,库函数等也属于本申请实施例中的例程。
在本实施例中,在操作系统启动过程中,对例程进行初始化主要是指调用例程并运行例程的过程。对于与硬件相关的例程来说,对例程进行初始化包括 调用该例程、向该例程对应的硬件寄存器中写入相关参数以及等待相关硬件完成初始化的过程。其中,硬件的初始化包括对硬件进行自检以及从硬件寄存器中读相关参数并根据相关参数做进一步动作的过程。其中,根据例程对应硬件的不同,需要对不同硬件进行自检;例如,若例程对应处理器,则需要对处理器进行自检;若例程对应于主板,则需要对主板进行自检。其中,根据从硬件寄存器中读取的相关参数进一步动作可能是创建中断向量或者设置其它寄存器等。
在传统启动操作系统的方案中,对需要进行初始化操作的例程以串行的方式进行初始化。例如,操作系统的启动过程,需要启动3个例程,分别为例程A1、例程A2以及例程A3,三个例程必须按照顺序依次进行初始化,即先对例程A1进行初始化,例程A1初始化完毕之后,再对例程A2进行初始化,例程A2初始化完毕之后,才能对例程A3进行初始化,例程A3初始化完毕之后,整个操作系统才算启动成功。在此过程中,若例程A1是与硬件相关的例程,则对例程A1进行初始化的过程包括:调用该例程A1、向该例程A1对应的硬件寄存器中写入相关参数以及等待相关硬件完成初始化的过程,整个过程中,需要一定的时间来等待相关硬件完成初始化,即使例程A1与例程A2之间没有依赖关系,也需要等待例程A1对应的硬件完成初始化,等待整个例程A1的初始化过程完毕之后,才能对例程A2进行初始化操作。在对启动速度具有较高要求的应用场景中,例如,IPC设备,这种串行初始化的方式,启动时间依旧较长,不能满足实际应用的需求。
在本申请实施例中,将例程启动过程中需要等待硬件完成初始化的时间充分利用起来,提供一种新的系统启动方法。该方法如图2a所示,包括以下步骤:
201a、将操作系统的启动过程划分为多个启动阶段,每个启动阶段包括至少一个例程;
202a、针对至少部分启动阶段,将启动阶段中的例程划分到m个分组,m为正整数,且m≥2;
203a、在启动操作系统时,依序对多个启动阶段中的例程进行初始化操作, 其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
在本实施例中,可以将操作系统的启动过程中需要初始化的例程划分到多个启动阶段中,然后依序对多个启动阶段进行初始化操作。其中,每个启动阶段中可以包含一个例程,也可以包含多个例程,例如,2个、3个或者5个等。将操作系统的启动过程,划分为多个启动阶段后,可针对至少部分启动阶段,将启动阶段中的例程划分到m个分组中,其中,至少部分启动阶段可以是部分启动阶段,也可以是全部启动阶段,在至少部分启动阶段为全部启动阶段时,针对每个启动阶段,将启动阶段中的例程划分到m个分组。对于不同启动阶段,所划分出的分组数量m可能相同,也可能不相同。在图3所示本实施例中操作系统的启动过程的示例中,将操作系统的启动过程划分为7个启动阶段,分别为启动阶段Y1~启动阶段Y7,且每个启动阶段分为相同数量的分组,图3中以4个分组为例。另外,对同一启动阶段中的不同分组,其包含的例程数量可以相同,也可以不相同,对此不做限定。在图3中,仅示出每个启动阶段中一个分组包含的例程数。
在本实施例中,并不限定将操作系统的启动过程划分为多个启动阶段以及针对至少部分启动阶段,将所述启动阶段中的例程划分到m个分组的执行时间。在一可选实施例中,可以预先将操作系统的启动过程划分为多个启动阶段,并预先将至少部分启动阶段中的例程划分到m个分组中,系统每次启动时,只需基于已有的划分结果和分组结果,依序对多个启动阶段中的例程进行初始化操作即可,以及在调度到例程被分组的启动阶段时,以分组为单位,对该启动阶段中的m个分组进行并发调度。基于此,本申请中还提供另一种系统启动方法,如图2b所示,该方法包括:
201b、在启动操作系统时,确定操作系统包含的多个启动阶段,每个启动阶段包括至少一个例程,其中,至少部分启动阶段中的例程被划分至m个分组,m为正整数,且m≥2;
202b、依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部 分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
在另一可选实施例中,可以预先将操作系统的启动过程划分为多个启动阶段,并预先设定需要对例程进行分组的至少部分启动阶段,进而在每次启动操作系统过程中,当所述至少部分启动阶段被调度到时,再将至少部分启动阶段中的例程划分到m个分组中。
在又一可选实施例中,可在每次操作系统启动过程中,将操作系统的启动过程实时划分为多个启动阶段,接着,在按序对多个启动阶段进行调度时,实时将调度到的启动阶段中的例程划分到m个分组中。
可选地,在图3所示的示例中,以预先将操作系统的启动过程划分为多个启动阶段,并预先将至少部分启动阶段中的例程划分到m个分组中为例进行图示。具体地,在图3中,将整个启动过程分为包括注册阶段和调度阶段;其中,将操作系统的启动过程划分为多个启动阶段并将至少部分启动阶段中的例程划分至m个分组中的操作是在注册阶段完成的;调度阶段是指按需对启动阶段进行调度以对各启动阶段中的例程完成初始化的过程,也就是操作系统的启动过程。
无论上述哪种实施方式,在启动操作系统时,可以依序对多个启动阶段中的例程进行初始化操作,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。如图3所示,对每个启动阶段中的4个分组可以并发调度,保证处理器的利用率最大化。另外,相较于串行初始化的方式,本申请实施例采用分组并发调度的方式,可缩短了操作系统的启动时间,提高操作系统的启动效率。另外,只需对现有例程进行简单的改造,例如,为硬件相关的例程设置等待硬件初始化的时间,无需进行具体算法或者启动框架的修改,非常容易部署到现有的操作系统中,使得启动阶段中的分组可以并发调度,为操作系统的启动速度带来数倍的提升。进一步,对于一些电池供电的IPC设备来说,操作系统在启动过程中,产生的电流较高,若启动时间过长,则可能会对IPC设备的电池更换频率或充电频率带来一定的影 响,采用本申请实施例提供的分组并发调度的系统启动方法,可以缩短操作系统的启动时间,提高IPC设备电池的使用寿命,提高IPC设备的性能。
在本实施例中,并不对启动操作系统的实施方式进行限定。在一可选实施例中,可以手动触发物联网设备的电源开关,为操作系统上电,操作系统检测到上电信号后,启动操作系统。在又一可选实施例中,物联网设备上包含应用程序或者硬件模块,应用程序或者硬件模块可以产生唤醒信号,物联网设备可以响应操作系统所在设备中的应用程序或硬件模块产生的唤醒信号,启动操作系统。进一步可选地,物联网设备为IPC设备,IPC设备上带有移动侦测模块,该移动侦测模块可以侦测到移动对象时产生唤醒信号,IPC设备可以不断检测唤醒信号,在监测到移动侦测模块产生唤醒信号时,启动操作系统。
在本实施例中,并不限定将操作系统的启动过程划分为多个启动阶段的实施方式,下面举例说明。
在一可选实施例中,物联网设备的厂商可以指定例程的优先级,例如,物联网设备实现为智能猫眼,设备厂商希望在启动智能猫眼过程中,首先启动摄像头,再启动显示屏,则摄像头对应例程的优先级要高于显示屏对应例程的优先级。基于上述,可以根据设备厂商提供的操作系统启动时的例程优先级,将操作系统的启动过程划分为多个启动阶段。进一步可选地,根据操作系统启动过程中例程的优先级,将相同优先级的例程划分至同一启动阶段中,启动阶段的执行顺序与启动阶段中例程的优先级对应。
在另一可选实施例中,考虑到例程之间具有依赖关系,例如,对物联网设备进行上电后,需要启动例程B1来完成处理器工作模型和系统栈的初始化操作,接着启动例程B2,来完成硬盘的启动。其中,例程B2必须在例程B1完成之后才能完成,也即例程B2与例程B1之间存在依赖关系,则可以认为例程B1的优先级高于例程B2。基于上述,可以根据多个启动阶段中例程之间的依赖关系,确定例程之间的优先级,进而将操作系统的启动过程划分为多个启动阶段,进一步,根据例程之间的优先级,将相同优先级的例程划分至同一启动阶段中,启动阶段的执行顺序与启动阶段中例程的优先级对应。
在又一可选实施例中,可以同时考虑设备厂商提供的例程优先级和例程之间的依赖关系,根据设备厂商提供的操作系统启动时的例程优先级和多个启动阶段中例程之间的依赖关系,将操作系统的启动过程划分为多个启动阶段。例如,可以根据设备厂商提供的例程优先级,初步确定需要启动的硬件对应例程的优先级,然后再根据多个启动阶段中例程之间的依赖关系,对初步确定的硬件对应例程的优先级进行调整,以得到最终的例程之间的优先级,进一步,将相同优先级的例程划分至同一启动阶段中,启动阶段的执行顺序与启动阶段中例程的优先级对应。
在本实施例中,并不限定将启动阶段中的例程划分到m个分组的实施方式。下面举例说明。
在一可选实施例中,可以将启动阶段中的例程随机划分到m个分组中。
在又一可选实施例中,考虑到需要缩短操作系统的启动时间,可以根据启动阶段中例程的初始化耗时,以分组之间的初始化耗时相同或相近为目标,将启动阶段中的例程划分到m个分组。其中,例程的初始化耗时指的是调用以及运行该例程的时间,进一步,若例程是硬件相关的例程,则例程的初始化耗时除了包括:调用该例程的时间之外,还包括:向该例程对应的硬件寄存器中写入相关参数的时间以及等待相关硬件完成初始化所需要的时间。
进一步可选地,考虑到分组的数目越多,对分组并发调度所需耗时可能就越短,但是消耗物联网设备的计算资源也就越多,因此,可以根据物联网设备自身的计算资源,预先预设的分组数目n,n为正整数,且n≥2;其中,计算资源可以是CPU资源、内存资源、硬盘资源或者网络资源,计算资源越丰富,预设的分组数目n可以越大,操作系统的启动时长就会越短。基于此,可以根据预设的分组数目,将启动阶段中的例程划分到m个分组中,具体地,可以根据启动阶段中例程的初始化耗时,计算对启动阶段进行初始化操作所需的总体耗时,该总体耗时可以是启动阶段中所有例程串行初始化需要的时间;根据总体耗时和预设的分组数目n,预估对每个分组进行初始化操作所需的分组耗时,例如,可以将总体耗时与预设的分组数目n的比值作为每个分组进行初始化操作 所需的预估分组耗时;接着,以每个分组中例程的初始化耗时之和与分组耗时相同或相近为目标,将启动阶段中的例程划分到m个分组中。
在本实施例中,启动阶段中存在初始化耗时满足指定条件的目标例程,指定条件可以是目标例程的初始化耗时占该启动阶段总体耗时的比例超过设定的阈值,例如该阈值为50%、60%或者90%。例如,目标例程的初始化耗时占该启动阶段总体耗时的比例为90%,则启动阶段中的其余例程占据该启动阶段总体耗时的10%,在分组时,以每个分组中例程的初始化耗时之和与分组耗时相同或相近为目标,将目标例程单独划分为C1组,启动阶段中除目标例程之外的例程划分为C2组,在C2组中的例程初始化完毕之后,C1组中的例程还需要很长一段时间才能初始化完毕,这样做不利于缩短操作系统的启动时间。鉴于此,在本申请一些可选实施例中,若启动阶段中存在初始化耗时满足指定条件的目标例程,则将目标例程拆分为多个子例程,并确定多个子例程的初始化耗时;相应地,以每个分组中例程的初始化耗时之和与分组耗时相同或相近为目标,将启动阶段中的例程划分到m个分组中,包括以每个分组中例程的初始化耗时之和与分组耗时相同或相近为目标,将多个子例程以及启动阶段中除目标例程之外的其余例程,划分到m个分组中,并以分组为单位,对m个分组中的例程进行并发调度,以缩短操作系统的启动时间,提高操作系统的启动速度。
在本实施例中,将启动阶段中的例程划分到m个分组之后,可以以分组为单位,对m个分组中的例程进行并发调度。考虑到操作系统具有多任务机制,即在同一时间内操作系统可以运行多个执行任务,执行任务可以理解为一个应用程序,该应用程序可以实现物联网设备的一个或一些功能模块,例如,为启动阶段中划分的一个分组分配一个执行任务,该执行任务负责执行对应分组中的例程,即对相应分组中的例程进行初始化。另外,执行任务可以有以下几种状态:运行态(running)和非运行态;进一步,非运行态包括:就绪态(ready)、阻塞态(blocked)以及挂起态(suspended)。当然,除了这几种状态之外,嵌入式设备100中的任务还可以具有其它状态,对此不做限定。其中,运行态表示该执行任务正在执行其对应分组中的例程,处于运行态的执行任务会占用处理 器资源。需要说明的是,同一时刻处于运行态的执行任务数量与处理器的内核数量有关;如果处理器只有一个内核,则在同一时刻只能有一个任务处于运行态;如果处理器有多个内核,则在同一时刻可以有多个任务同时处于运行态。就绪态表示执行任务能够执行其对应分组中的例程,但是目前还没有执行,是因为有其他执行任务正在占用处理器资源;阻塞态表示表示执行任务正在等待一个临时或外部事件,该临时或外部事件的发生会唤醒该执行任务,从而将该执行任务从阻塞态转为就绪态或运行态,例如,一些硬件相关的例程需要等待硬件初始化完毕之后,才能进行后续操作,在等待硬件初始化的过程中,该例程对应执行任务的状态可以是阻塞态,该执行任务等待硬件初始化完毕之后,由阻塞态转换为就绪态或者运行态。另外,处于阻塞态的任务不占用任何处理器的时间,且不会被选择进入运行态。挂起态也是一种任务状态,处于挂起态的任务除非被恢复,否则该任务永远不会回到就绪态,也不会被选择进入运行态。
基于上述,在本申请一些可选实施例中,可以为启动阶段中划分的m个分组分别创建执行任务,每个执行任务负责对相应分组中的例程进行初始化,并启动m个执行任务;根据m个执行任务的状态,对m个执行任务进行并发调度。
进一步可选地,在对m个执行任务进行并发调度过程中,可以监测当前处于运行态的执行任务的状态,若当前处于运行态的执行任务进入非运行态,则对处于就绪态的执行任务进行调度,被调度的执行任务从就绪态进入运行态。在本实施例中,并不限定对处于就绪态的执行任务进行调度的实施方式。在一可选实施例中,每个执行任务都维护有一个优先级,若当前处于运行态的执行任务进入非运行态,则从处于就绪态的执行任务中,选择优先级最高的执行任务,对该处于就绪态的执行任务进行调度。在另一可选实施例中,可以维护一个队列,在该队列中存放有处于就绪态的执行任务,若当前处于运行态的执行任务进入非运行态,则对处于队首的就绪态的执行任务进行调度。无论上述哪种对处于就绪态的执行任务进行调度的方式,对处于就绪态的执行任务进行调度之后,该执行任务的状态由就绪态变为运行态,处于运行态的执行任务在执 行完分组中的全部例程后可以提交执行结果,该执行结果表示其对应分组中的例程均已初始化完毕,在接收到m个执行任务提交的执行结果时,可以确定启动阶段的初始化操作完成。
在一可选实施例中,可以为m个执行任务申请进程间通信(inter-process communication,IPC)对象,IPC对象可以是消息队列(message queue)、信号量(semaphore)或共享内存(share memory)中的任意一种,执行任务可以通过IPC对象的标识符来引用或访问IPC对象,IPC对象的标识符可以是整数,例如,125、567或者5245等,执行任务可以将执行结果提供给IPC对象,IPC对象可以包含m个缓存空间,每个缓存空间用于存储一个执行任务提交的执行结果,进一步可选地,为了保证m个执行任务均可以将执行结果提供给IPC对象,IPC对象中包含缓存空间的数量k大于执行任务的数量m。接着,若可以从IPC对象中获取m个执行任务在执行完对应分组中的全部例程后提交的执行结果,则认为m个分组所在启动阶段的初始化操作完成。在本实施例中,采用无锁IPC技术(Lockfree-IPC)来保证多个执行任务之间的同步问题,无锁技术指的是多个执行任务可以同时向IPC对象中写入执行结果,可以极大地提高操作系统的启动时间。
本实施例提供的启动方法,不仅适用于操作系统,同样可应用于非操作系统级的计算机程序,例如各种应用软件;从软件类型来看,应用软件包括但不限于:应用程序(APP)、客户端、插件、小程序、浏览器等,从软件功能来看,应用软件可以是但不限于:智能终端或电脑上的解压软件、办公软件、看图软件、视频播放软件、购物软件、直播软件等。基于此,本申请还提供一种应用软件启动方法,如图2c所示,该方法包括:
201c、在启动应用软件时,确定应用软件包含的多个启动阶段,每个启动阶段包括至少一个例程,其中,至少部分启动阶段中的例程被划分至m个分组,m为正整数,且m≥2;
202c、依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程 进行并发调度。
可选地,可以预先将应用软件的启动过程划分为多个启动阶段,并预先将至少部分启动阶段中的例程分组到m个分组中;也可以在每次启动应用软件时,实时将应用软件的启动过程划分为多个启动阶段,并将至少部分启动阶段中的例程分组到m个分组中。在实时划分启动阶段的方案中,在不同启动过程中,可以将应用软件的启动过程划分为不同的启动阶段;同理,对于同一启动阶段,在不同启动过程中也可以将其包含的例程分组到不同数量的分组中,具体可以将划分启动阶段的过程和分组过程与具体启动场景相结合,可以根据启动场景灵活划分启动阶段和分组。
关于本实施例提供的应用软件启动方法中的其它内容与前述操作系统启动方法中的内容相同或相似,具体可参见前述,在此不再赘述。
需要说明的是,上述实施例所提供方法的各步骤的执行主体均可以是同一设备,或者,该方法也由不同设备作为执行主体。比如,步骤201a至步骤203a的执行主体可以为设备A;又比如,步骤201a和202a的执行主体可以为设备A,步骤203a的执行主体可以为设备B;等等。
另外,在上述实施例及附图中的描述的一些流程中,包含了按照特定顺序出现的多个操作,但是应该清楚了解,这些操作可以不按照其在本文中出现的顺序来执行或并行执行,操作的序号如201a、202a等,仅仅是用于区分开各个不同的操作,序号本身不代表任何的执行顺序。另外,这些流程可以包括更多或更少的操作,并且这些操作可以按顺序执行或并行执行。需要说明的是,本文中的“第一”、“第二”等描述,是用于区分不同的消息、设备、模块等,不代表先后顺序,也不限定“第一”和“第二”是不同的类型。
除了上述系统启动方法之外,本申请还提供一种新的操作系统,该操作系统可以是嵌入式操作系统,嵌入式操作系统可以实现为μC/OS-II或VxWorks等RTOS系统,也可以实现为嵌入式Linux或Windows Embedded等非实时操作系统,如图4所示,该操作系统的内部架构包括:管理模块41、分组模块42以及调度模块43。
其中,管理模块41,用于将操作系统的启动过程划分为多个启动阶段,每个启动阶段包括至少一个例程;分组模块42,用于针对至少部分启动阶段,将启动阶段中的例程划分到m个分组,m为正整数,且m≥2;调度模块43,用于在启动操作系统时,依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
在一可选实施例中,调度模块43包括:全局调度子模块430和分组调度子模块431,全局调度子模块430,用于在启动操作系统时,依序对多个启动阶段进行调度以进行初始化操作;分组调度子模块431,用于在全局调度模块调度到至少部分启动阶段中的启动阶段时,以分组为单位,对被调度到的启动阶段中的m个分组中的例程进行并发调度。
在一可选实施例中,对于没有将例程划分到m个分组的启动阶段,操作系统还包括:传统调度子模块,该模块用于对没有将例程划分到m个分组的启动阶段中的例程,采用串行的方式进行初始化。
在另一可选实施例中,对于没有将例程划分到m个分组的启动阶段,全局调度子模块430负责采用串行的方式,对没有将例程划分到m个分组的启动阶段中的例程进行初始化。
在一可选实施例中,分组模块42在将启动阶段中的例程划分到m个分组时,具体用于:根据启动阶段中例程的初始化耗时,以分组之间的初始化耗时相同或相近为目标,将启动阶段中的例程划分到m个分组。
进一步可选地,分组模块42在根据启动阶段中例程的初始化耗时,以分组之间的初始化耗时相同或相近为目标,将启动阶段中的例程划分到m个分组时,具体用于:根据启动阶段中例程的初始化耗时,计算对启动阶段进行初始化操作所需的总体耗时;根据总体耗时和预设的分组数目n,预估对每个分组进行初始化操作所需的分组耗时,n为正整数,且n≥2;以每个分组中例程的初始化耗时之和与分组耗时相同或相近为目标,将启动阶段中的例程划分到m个分组中。
在一可选实施例中,分组模块42还用于:若启动阶段中存在初始化耗时满足指定条件的目标例程,则将目标例程拆分为多个子例程,并确定多个子例程的初始化耗时;相应地,分组模块42在以每个分组中例程的初始化耗时之和与分组耗时相同或相近为目标,将启动阶段中的例程划分到m个分组中时,具体用于:以每个分组中例程的初始化耗时之和与分组耗时相同或相近为目标,将多个子例程以及启动阶段中除目标例程之外的其余例程,划分到m个分组中。
在一可选实施例中,分组调度子模块431在以分组为单位,对m个分组中的例程进行并发调度时,具体用于:为m个分组分别创建执行任务,并启动m个执行任务,每个执行任务负责执行对应分组中的例程;根据m个执行任务的状态,对m个执行任务进行并发调度。
在一可选实施例中,分组调度子模块431在根据m个执行任务的状态,对m个执行任务进行并发调度时,具体用于:监测当前处于运行态的执行任务的状态,其中,处于运行态的执行任务执行对应分组中的例程并在执行完全部例程后提交执行结果;若当前处于运行态的执行任务进入非运行态,则对处于就绪态的执行任务进行调度,被调度的执行任务从就绪态进入运行态,并将m个执行任务提交的执行结果提供给分组同步子模块432。如图4所示,调度模块43还包括:分组同步子模块432。分组同步子模块432,用于接收分组调度子模块431提交的执行任务的执行结果,并在接收到m个执行任务的执行结果时,通知全局调度子模块430,以供全局调度子模块430确定当前调度的启动阶段的初始化操作完成。
在一可选实施例中,分组同步子模块432还用于:为m个执行任务申请IPC对象,IPC对象用于接收与其对应的执行任务提交的执行结果;从IPC对象中获取m个执行任务在执行完对应分组中的全部例程后提交的执行结果。
在一可选实施例中,为m个执行任务申请的IPC对象中包含的缓存空间的数量k大于执行任务的数量m,每个缓存空间用于存储一个执行任务提交的执行结果。具体地,分组调度子模块431可在将每个执行任务的执行结果写入IPC对象中对应的缓存空间中。
在一可选实施例中,管理模块41在将操作系统的启动过程划分为多个启动阶段时,具体用于:根据设备厂商提供的操作系统启动时的例程优先级和/或多个启动阶段中例程之间的依赖关系,将操作系统的启动过程划分为多个启动阶段。
在一可选实施例中,管理模块41在根据设备厂商提供的操作系统启动时的例程优先级,将操作系统的启动过程划分为多个启动阶段时,具体用于:根据例程优先级,将相同优先级的例程划分至同一启动阶段中,启动阶段的执行顺序与启动阶段中例程的优先级对应。
在一可选实施例中,管理模块41还用于:响应操作系统所在设备中的应用程序或硬件模块产生的唤醒信号,启动操作系统。
进一步可选地,操作系统所在设备为带有移动侦测模块的IPC设备,则管理模块41在响应操作系统所在设备中的硬件模块产生的唤醒信号,启动操作系统时,具体用于:在监测到移动侦测模块产生唤醒信号时,启动操作系统;其中,移动侦测模块在侦测到移动对象时产生唤醒信号。
在一可选实施例中,操作系统为嵌入式操作系统中的实时操作系统。
在一可选实施例中,操作系统还包括接口模块44和性能统计模块45。接口模块44用于实现管理模块41、分组模块42、调度模块43以及性能统计模块45与上层应用、硬件模块或外部设备之间的通信。具体地,接口模块44可接收上层应用或硬件模块产生的唤醒信号,并将唤醒信号提供给调度模块43;或者可接收设备厂商提供的操作系统启动时的例程优先级并提供给管理模块41;或者,可将性能统计模块45记录的各例程、分组或启动阶段等初始化耗时上报给上层应用或外部设备。进一步,接口模块44还可以在操作系统启动完毕之后,通知上层应用、硬件模块等。性能统计模块45用于从操作系统维度、启动阶段维度、分组维度或例程维度统计初始化耗时,对操作系统启动过程中各个维度上的初始化耗时进行分析,得到并行启动方式的性能。
除此之外,本申请还提供一种操作系统的内部架构包括:确定模块和调度模块;
确定模块,用于在启动操作系统时,确定操作系统包含的多个启动阶段,每个启动阶段包括至少一个例程,其中,至少部分启动阶段中的例程被划分至m个分组,m为正整数,且m≥2;调度模块,用于依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。详细内容可参见前述实施例在此不再赘述。
本申请实施例提供的操作系统,将操作系统的启动过程划分为多个启动阶段,针对至少部分启动阶段,将启动阶段中的例程划分到多个分组;在启动操作系统时,按序对每个启动阶段进行初始化操作;在对至少部分启动阶段进行初始化操作时,以分组为单位对多个分组中的例程进行并发调度,这样可缩短操作系统的启动时间,提高操作系统的启动效率。
除此之外,本申请还提供一种应用软件启动装置,包括:确定模块和调度模块。其中,确定模块,用于在启动应用软件时,确定应用软件包含的多个启动阶段,每个启动阶段包括至少一个例程,其中,至少部分启动阶段中的例程被划分至m个分组,m为正整数,且m≥2;调度模块,用于依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。关于各功能模块所实现操作的详细描述,可参见前述实施例,对此不做赘述。
图5为本申请示例性实施例提供的一种物联网设备的结构示意图。如图5所示,该物联网设备包括:存储器54和处理器55。
存储器54,用于存储计算机程序和操作系统中的例程,并可被配置为存储其它各种数据以支持在物联网设备上的操作。这些数据的示例包括用于在物联网设备上操作的任何应用程序或方法的指令。
存储器54可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。
处理器55,与存储器54耦合,用于执行存储器54中的计算机程序,以用于:将操作系统的启动过程划分为多个启动阶段,每个启动阶段包括至少一个例程;针对至少部分启动阶段,将启动阶段中的例程划分到m个分组,m为正整数,且m≥2;在启动操作系统时,依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
在一可选实施中,处理器55在将启动阶段中的例程划分到m个分组时,具体用于:根据启动阶段中例程的初始化耗时,以分组之间的初始化耗时相同或相近为目标,将启动阶段中的例程划分到m个分组。
在一可选实施中,处理器55在根据启动阶段中例程的初始化耗时,以分组之间的初始化耗时相同或相近为目标,将启动阶段中的例程划分到m个分组时,具体用于:根据启动阶段中例程的初始化耗时,计算对启动阶段进行初始化操作所需的总体耗时;根据总体耗时和预设的分组数目n,预估对每个分组进行初始化操作所需的分组耗时,n为正整数,且n≥2;以每个分组中例程的初始化耗时之和与分组耗时相同或相近为目标,将启动阶段中的例程划分到m个分组中。
在一可选实施中,处理器55还用于:若启动阶段中存在初始化耗时满足指定条件的目标例程,则将目标例程拆分为多个子例程,并确定多个子例程的初始化耗时;相应地,处理器55在以每个分组中例程的初始化耗时之和与分组耗时相同或相近为目标,将启动阶段中的例程划分到m个分组中时,具体用于:以每个分组中例程的初始化耗时之和与分组耗时相同或相近为目标,将多个子例程以及启动阶段中除目标例程之外的其余例程,划分到m个分组中。
在一可选实施中,处理器55在以分组为单位,对m个分组中的例程进行并发调度时,具体用于:为m个分组分别创建执行任务,并启动m个执行任务,每个执行任务负责执行对应分组中的例程;根据m个执行任务的状态,对m个执行任务进行并发调度。
在一可选实施中,处理器55在根据执行任务的状态,对执行任务进行并发 调度,以完成启动阶段的初始化时,具体用于:监测当前处于运行态的执行任务的状态,其中,处于运行态的执行任务执行对应分组中的例程并在执行完全部例程后提交执行结果;若当前处于运行态的执行任务进入非运行态,则对处于就绪态的执行任务进行调度,被调度的执行任务从就绪态进入运行态;在接收到m个执行任务提交的执行结果时,确定启动阶段的初始化操作完成。
在一可选实施中,处理器55还用于:为m个执行任务申请IPC对象,IPC对象用于接收与其对应的执行任务提交的执行结果;从IPC对象中获取m个执行任务在执行完对应分组中的全部例程后提交的执行结果。
在一可选实施中,为m个执行任务申请的IPC对象中包含的缓存空间的数量k大于执行任务的数量m,每个缓存空间用于存储一个执行任务提交的执行结果。
在一可选实施中,处理器55在将操作系统的启动过程划分为多个启动阶段时,具体用于:根据设备厂商提供的操作系统启动时的例程优先级和/或多个启动阶段中例程之间的依赖关系,将操作系统的启动过程划分为多个启动阶段。
在一可选实施中,处理器55在根据设备厂商提供的操作系统启动时的例程优先级,将操作系统的启动过程划分为多个启动阶段时,具体用于:根据例程优先级,将相同优先级的例程划分至同一启动阶段中,启动阶段的执行顺序与启动阶段中例程的优先级对应。
在一可选实施中,处理器55还用于:响应操作系统所在设备中的应用程序或硬件模块产生的唤醒信号,启动操作系统。
在一可选实施中,设备为带有移动侦测模块的IPC设备,则处理器55在响应操作系统所在设备中的硬件模块产生的唤醒信号,启动操作系统时,具体用于:在监测到移动侦测模块产生唤醒信号时,启动操作系统;其中,移动侦测模块在侦测到移动对象时产生唤醒信号。
在一可选实施中,操作系统为嵌入式操作系统中的实时操作系统。
本申请实施例提供的物联网设备,将操作系统的启动过程划分为多个启动阶段,针对至少部分启动阶段,将启动阶段中的例程划分到多个分组;在启动 操作系统时,按序对每个启动阶段进行初始化操作;在对至少部分启动阶段进行初始化操作时,以分组为单位对多个分组中的例程进行并发调度,这样可缩短操作系统的启动时间,提高操作系统的启动效率。
进一步,如图5所示,该物联网设备还包括:通信组件56、显示器57、电源组件58、音频组件59等其它组件。图5中仅示意性给出部分组件,并不意味着物联网设备只包括图5所示组件。需要说明的是,图5中虚线框内的组件为可选组件,而非必选组件,具体可视物联网设备的产品形态而定。
本申请实施例还提供一种物联网设备,该物联网设备的实现结构与图5所示物联网设备的实现结构相同或类似,可参照图5所示物联网设备的结构实现。本实施例提供的物联网设备与图5所示实施例中物联网设备的区别主要在于:处理器执行存储器中存储的计算机程序所实现的功能不同。对本实施例提供的物联网设备来说,其处理器执行存储器中存储的计算机程序,可用于:在启动操作系统时,确定操作系统包含的多个启动阶段,每个启动阶段包括至少一个例程,其中,至少部分启动阶段中的例程被划分至m个分组,m为正整数,且m≥2;依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
本申请实施例还提供一种物联网设备,该物联网设备的实现结构与图5所示物联网设备的实现结构相同或类似,可参照图5所示物联网设备的结构实现。本实施例提供的物联网设备与图5所示实施例中物联网设备的区别主要在于:处理器执行存储器中存储的计算机程序所实现的功能不同。对本实施例提供的物联网设备来说,其处理器执行存储器中存储的计算机程序,可用于:在启动应用软件时,确定应用软件包含的多个启动阶段,每个启动阶段包括至少一个例程,其中,至少部分启动阶段中的例程被划分至m个分组,m为正整数,且m≥2;依序对多个启动阶段中的例程进行初始化操作,其中,在对至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对m个分组中的例程进行并发调度。
相应地,本申请实施例还提供一种存储有计算机程序的计算机可读存储介质,当计算机程序被处理器执行时,致使处理器实现图2a或图2b或图2c所示方法中的步骤。
本申请实施例还提供一种一种计算机程序产品,包括计算机程序/指令,当计算机程序/指令被处理器执行时,致使所述处理器实现图2a或图2b或图2c所示方法中的步骤。
上述图5中的通信组件被配置为便于通信组件所在设备和其他设备之间有线或无线方式的通信。通信组件所在设备可以接入基于通信标准的无线网络,如WiFi,2G、3G、4G/LTE、5G等移动通信网络,或它们的组合。在一个示例性实施例中,通信组件经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。
上述图5中的显示器包括屏幕,其屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。
上述图5中的电源组件,为电源组件所在设备的各种组件提供电力。电源组件可以包括电源管理系统,一个或多个电源,及其他与为电源组件所在设备生成、管理和分配电力相关联的组件。
上述图5中的音频组件,可被配置为输出和/或输入音频信号。例如,音频组件包括一个麦克风(MIC),当音频组件所在设备处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器或经由通信组件发送。在一些实施例中,音频组件还包括一个扬声器,用于输出音频信号。
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序 的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
以上所述仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。

Claims (21)

  1. 一种系统启动方法,其特征在于,包括:
    将操作系统的启动过程划分为多个启动阶段,每个启动阶段包括至少一个例程;
    针对至少部分启动阶段,将所述启动阶段中的例程划分到m个分组,m为正整数,且m≥2;
    在启动操作系统时,依序对所述多个启动阶段中的例程进行初始化操作,其中,在对所述至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对所述m个分组中的例程进行并发调度。
  2. 根据权利要求1所述的方法,其特征在于,将所述启动阶段中的例程划分到m个分组,包括:
    根据所述启动阶段中例程的初始化耗时,以分组之间的初始化耗时相同或相近为目标,将所述启动阶段中的例程划分到m个分组。
  3. 根据权利要求2所述的方法,其特征在于,根据所述启动阶段中例程的初始化耗时,以分组之间的初始化耗时相同或相近为目标,将所述启动阶段中的例程划分到m个分组,包括:
    根据所述启动阶段中例程的初始化耗时,计算对所述启动阶段进行初始化操作所需的总体耗时;
    根据所述总体耗时和预设的分组数目n,预估对每个分组进行初始化操作所需的分组耗时,n为正整数,且n≥2;
    以每个分组中例程的初始化耗时之和与所述分组耗时相同或相近为目标,将所述启动阶段中的例程划分到m个分组中。
  4. 根据权利要求3所述的方法,其特征在于,还包括:
    若所述启动阶段中存在初始化耗时满足指定条件的目标例程,则将所述目标例程拆分为多个子例程,并确定所述多个子例程的初始化耗时;
    相应地,以每个分组中例程的初始化耗时之和与所述分组耗时相同或相近为目标,将所述启动阶段中的例程划分到m个分组中,包括:
    以每个分组中例程的初始化耗时之和与所述分组耗时相同或相近为目标,将所述多个子例程以及所述启动阶段中除目标例程之外的其余例程,划分到m个分组中。
  5. 根据权利要求1所述的方法,其特征在于,以分组为单位,对所述m个分组中的例程进行并发调度,包括:
    为m个分组分别创建执行任务,并启动m个执行任务,每个执行任务负责执行对应分组中的例程;
    根据所述m个执行任务的状态,对所述m个执行任务进行并发调度。
  6. 根据权利要求5所述的方法,其特征在于,根据所述执行任务的状态,对所述执行任务进行并发调度,以完成所述启动阶段的初始化,包括:
    监测当前处于运行态的执行任务的状态,其中,处于运行态的执行任务执行对应分组中的例程并在执行完全部例程后提交执行结果;
    若当前处于运行态的执行任务进入非运行态,则对处于就绪态的执行任务进行调度,被调度的执行任务从就绪态进入运行态;
    在接收到m个执行任务提交的执行结果时,确定所述启动阶段的初始化操作完成。
  7. 根据权利要求6所述的方法,其特征在于,还包括:
    为m个执行任务申请IPC对象,所述IPC对象用于接收与其对应的执行任务提交的执行结果;
    从IPC对象中获取m个执行任务在执行完对应分组中的全部例程后提交的执行结果。
  8. 根据权利要求7所述的方法,其特征在于,为m个执行任务申请的IPC对象中包含的缓存空间的数量k大于执行任务的数量m,每个缓存空间用于存储一个执行任务提交的执行结果。
  9. 根据权利要求1所述的方法,其特征在于,将操作系统的启动过程划分 为多个启动阶段,包括:
    根据设备厂商提供的操作系统启动时的例程优先级和/或多个启动阶段中例程之间的依赖关系,将操作系统的启动过程划分为多个启动阶段。
  10. 根据权利要求9所述的方法,其特征在于,根据设备厂商提供的操作系统启动时的例程优先级,将操作系统的启动过程划分为多个启动阶段,包括:
    根据所述例程优先级,将相同优先级的例程划分至同一启动阶段中,启动阶段的执行顺序与启动阶段中例程的优先级对应。
  11. 根据权利要求1-10任一项所述的方法,其特征在于,还包括:
    响应所述操作系统所在设备中的应用程序或硬件模块产生的唤醒信号,启动所述操作系统。
  12. 根据权利要求11所述的方法,其特征在于,所述设备为带有移动侦测模块的IPC设备,则响应所述操作系统所在设备中的硬件模块产生的唤醒信号,启动所述操作系统,包括:
    在监测到所述移动侦测模块产生唤醒信号时,启动所述操作系统;其中,所述移动侦测模块在侦测到移动对象时产生唤醒信号。
  13. 根据权利要求1-10任一项所述的方法,其特征在于,所述操作系统为嵌入式操作系统中的实时操作系统。
  14. 一种操作系统,其特征在于,包括:
    管理模块,用于将操作系统的启动过程划分为多个启动阶段,每个启动阶段包括至少一个例程;
    分组模块,用于针对至少部分启动阶段,将所述启动阶段中的例程划分到m个分组,m为正整数,且m≥2;
    调度模块,用于在启动操作系统时,依序对所述多个启动阶段中的例程进行初始化操作,其中,在对所述至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对所述m个分组中的例程进行并发调度。
  15. 根据权利要求14所述的系统,其特征在于,所述调度模块包括:
    全局调度子模块,用于在启动操作系统时,依序对所述多个启动阶段进行 调度以进行初始化操作;
    分组调度子模块,用于在所述全局调度模块调度到所述至少部分启动阶段中的启动阶段时,以分组为单位,对所述被调度到的初始阶段中的m个分组中的例程进行并发调度。
  16. 一种物联网设备,其特征在于,包括:存储器和处理器;
    所述存储器,用于存储计算机程序和操作系统中的例程;
    所述处理器,与所述存储器耦合,用于执行所述计算机程序,以用于:
    将操作系统的启动过程划分为多个启动阶段,每个启动阶段包括至少一个例程;针对至少部分启动阶段,将所述启动阶段中的例程划分到m个分组,m为正整数,且m≥2;在启动操作系统时,依序对所述多个启动阶段中的例程进行初始化操作,其中,在对所述至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对所述m个分组中的例程进行并发调度。
  17. 根据权利要求16所述的设备,其特征在于,所述物联网设备为网络摄像机IPC。
  18. 一种系统启动方法,其特征在于,包括:
    在启动操作系统时,确定所述操作系统包含的多个启动阶段,每个启动阶段包括至少一个例程,其中,至少部分启动阶段中的例程被划分至m个分组,m为正整数,且m≥2;
    依序对所述多个启动阶段中的例程进行初始化操作,其中,在对所述至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对所述m个分组中的例程进行并发调度。
  19. 一种应用软件启动方法,其特征在于,包括:
    在启动应用软件时,确定所述应用软件包含的多个启动阶段,每个启动阶段包括至少一个例程,其中,至少部分启动阶段中的例程被划分至m个分组,m为正整数,且m≥2;
    依序对所述多个启动阶段中的例程进行初始化操作,其中,在对所述至少部分启动阶段中的例程进行初始化操作时,以分组为单位,对所述m个分组中 的例程进行并发调度。
  20. 一种存储有计算机程序的计算机可读存储介质,其特征在于,当所述计算机程序被处理器执行时,致使所述处理器实现权利要求1-13以及18-19任一项所述方法中的步骤。
  21. 一种计算机程序产品,包括计算机程序/指令,其特征在于,当所述计算机程序/指令被处理器执行时,致使所述处理器实现权利要求1-13以及18-19任一项所述方法中的步骤。
PCT/CN2022/077739 2021-03-30 2022-02-24 系统启动方法、设备、系统及存储介质 WO2022206227A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110340887.9A CN115145641A (zh) 2021-03-30 2021-03-30 系统启动方法、设备、系统及存储介质
CN202110340887.9 2021-03-30

Publications (1)

Publication Number Publication Date
WO2022206227A1 true WO2022206227A1 (zh) 2022-10-06

Family

ID=83403451

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/077739 WO2022206227A1 (zh) 2021-03-30 2022-02-24 系统启动方法、设备、系统及存储介质

Country Status (2)

Country Link
CN (1) CN115145641A (zh)
WO (1) WO2022206227A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6049795A (en) * 1997-06-27 2000-04-11 Fujitsu Limited Application program starting method, recording medium on which said computer program is recorded, and computer system
CN106874031A (zh) * 2017-01-03 2017-06-20 青岛海信电器股份有限公司 一种终端设备系统程序的启动方法及装置
CN110908724A (zh) * 2019-12-03 2020-03-24 深圳市迅雷网络技术有限公司 一种Android App启动方法及相关组件
CN111258740A (zh) * 2020-02-03 2020-06-09 北京无限光场科技有限公司 一种用于启动应用程序的方法、装置和电子设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6049795A (en) * 1997-06-27 2000-04-11 Fujitsu Limited Application program starting method, recording medium on which said computer program is recorded, and computer system
CN106874031A (zh) * 2017-01-03 2017-06-20 青岛海信电器股份有限公司 一种终端设备系统程序的启动方法及装置
CN110908724A (zh) * 2019-12-03 2020-03-24 深圳市迅雷网络技术有限公司 一种Android App启动方法及相关组件
CN111258740A (zh) * 2020-02-03 2020-06-09 北京无限光场科技有限公司 一种用于启动应用程序的方法、装置和电子设备

Also Published As

Publication number Publication date
CN115145641A (zh) 2022-10-04

Similar Documents

Publication Publication Date Title
US9104499B2 (en) System for minimizing resource latency between processor application states in a portable computing device by scheduling resource state set transitions
US8954980B2 (en) Conserving power through work load estimation for a portable computing device using scheduled resource set transitions
JP5809366B2 (ja) ポータブルコンピューティングデバイスにおいて要求をスケジューリングするための方法およびシステム
US8726055B2 (en) Multi-core power management
JP2008506187A (ja) 複数のカーネルの並列実行のための方法およびシステム
KR20150132218A (ko) 게스트 운영 체계 및 가상 프로세서들과 함께 하이퍼바이저를 이용하는 시스템들 및 방법들
US20120254822A1 (en) Processing optimization load adjustment
US11422857B2 (en) Multi-level scheduling
US20120291043A1 (en) Minimizing Resource Latency Between Processor Application States In A Portable Computing Device By Using A Next-Active State Set
US20180276047A1 (en) Systems and methods for dynamic low latency optimization
US20160091949A1 (en) Performance management for a multiple-cpu platform
CN116578422B (zh) 资源分配方法和电子设备
WO2022206227A1 (zh) 系统启动方法、设备、系统及存储介质
WO2024037068A1 (zh) 任务调度方法、电子设备及计算机可读存储介质
EP4280060A1 (en) Power consumption control method and apparatus
CN115658278B (zh) 一种支持高并发协议交互的微任务调度机
CN114816031B (zh) 终端设备的省电方法、终端设备及介质
CN113495787A (zh) 资源分配方法、装置、存储介质及电子设备
CN116027878B (zh) 功耗调整方法和电子设备
CN116055443B (zh) 识别社交场景的方法、电子设备及计算机可读存储介质
CN116028209B (zh) 资源调度方法、电子设备及存储介质
US20240111596A1 (en) Quality-of-Service Partition Configuration
US11347544B1 (en) Scheduling work items based on declarative constraints
EP4287024A1 (en) Multi-core processor, multi-core processor processing method, and related device
US20240236863A9 (en) Power Consumption Control Method and Apparatus

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22778412

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22778412

Country of ref document: EP

Kind code of ref document: A1