CN111913735B - Attribute synchronization method and device - Google Patents

Attribute synchronization method and device Download PDF

Info

Publication number
CN111913735B
CN111913735B CN201910376427.4A CN201910376427A CN111913735B CN 111913735 B CN111913735 B CN 111913735B CN 201910376427 A CN201910376427 A CN 201910376427A CN 111913735 B CN111913735 B CN 111913735B
Authority
CN
China
Prior art keywords
attribute
operating system
device node
terminal device
attribute value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910376427.4A
Other languages
Chinese (zh)
Other versions
CN111913735A (en
Inventor
商震
林超
付海望
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu TD Tech Ltd
Original Assignee
Chengdu TD Tech Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu TD Tech Ltd filed Critical Chengdu TD Tech Ltd
Priority to CN201910376427.4A priority Critical patent/CN111913735B/en
Publication of CN111913735A publication Critical patent/CN111913735A/en
Application granted granted Critical
Publication of CN111913735B publication Critical patent/CN111913735B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • 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

Abstract

The embodiment of the invention provides an attribute synchronization method and device.A terminal device runs at least two operating systems, after the attribute of any one operating system is changed, the operating system writes the name of the attribute and the changed attribute value into a corresponding device node file, and different device node files correspond to different operating systems, so that other operating systems read the device node files to finish attribute synchronization. In the process, attribute synchronization can be realized without executing operation system switching, and the process is simple and high in accuracy.

Description

Attribute synchronization method and device
Technical Field
The embodiment of the invention relates to the technical field of terminal equipment, in particular to an attribute synchronization method and device.
Background
At present, terminal devices such as smart phones, tablet computers, electronic readers and the like are widely popularized. With the increase of the hardware level of the intelligent terminal, the processing capacity of the intelligent terminal is enhanced, and many intelligent terminals can run two or more operating systems. Among these operating systems, the operating system that the user is using is referred to as the current operating system, and the other operating systems other than the current operating system are referred to as the background operating systems.
The property (property) of the operating system is used to record the operating system settings or information interaction between processes, and manage various configurations and states of the operating system, and is essentially an inter-process communication (IPC) means for accessing and sharing data in time and space. In general, each of a plurality of operating systems of a terminal device has a set of attributes, and in different operating systems, some of the attributes are the same and some of the attributes are different. For example, the terminal device runs an operating system a and an operating system B at the same time, the operating system a having an attribute 1, an attribute 2, and an attribute 3, and the operating system B having an attribute 2, an attribute 3, and an attribute 4.
In general, a user sets attributes of different operating systems, respectively, so that the operating systems reach a state desired by the user. However, in some scenarios, the attribute of the current operating system needs to be synchronized to the background operating system, and the above example is continued, assuming that the user modifies the attribute 2 and the attribute 3 of the operating system a, if the attribute 2 and the attribute 3 of the operating system B need to be modified synchronously, the user needs to perform system switching, switch the current operating system from the operating system a to the operating system B, and then modify the attribute 2 and the attribute 3 of the operating system B. When the attributes required to be synchronized are more and the modification frequency of the attributes is higher, the attribute synchronization method switched by the system has the disadvantages of complicated steps, complex process and easy error.
Disclosure of Invention
The embodiment of the invention provides an attribute synchronization method and device, which are simple in process and high in accuracy rate by not executing system switching to perform attribute synchronization.
In a first aspect, an embodiment of the present invention provides an attribute synchronization method, which is applied to a terminal device supporting X operating systems, where X is greater than or equal to 2, and each operating system in the multiple operating systems corresponds to X-1 device node files in a kernel of the terminal device, where the method includes:
the terminal equipment detects whether an attribute value of a first attribute of a first operating system changes, wherein the first operating system is any one of the X operating systems;
if the attribute value of the first attribute changes, the terminal device writes the first attribute and a new attribute value of the first attribute into X-1 device node files corresponding to the first operating system respectively, so that the terminal device reads a device node file corresponding to a second operating system in the X-1 device node files to synchronize the first attribute, wherein the second operating system is any one of the operating systems except the first operating system.
In one possible design, the method further comprises:
the terminal equipment monitors whether the equipment node files corresponding to the first operating system are written into a second attribute and the attribute value of the second attribute in X-1 equipment node files corresponding to the second operating system;
if the device node file corresponding to the first operating system is written into the second attribute and the attribute value of the second attribute in the X-1 device node files corresponding to the second operating system, the terminal device reads the attribute values of the second attribute and the second attribute;
and the terminal equipment synchronizes the second attribute according to the second attribute and the attribute value of the second attribute.
In a feasible design, if the attribute value of the first attribute changes, the terminal device writes the first attribute and the new attribute value of the first attribute into X-1 device node files corresponding to the first operating system, respectively, including:
and the terminal equipment performs lock protection on the X-1 equipment node files corresponding to the first operating system, and writes the first attribute and the new attribute value of the first attribute into the X-1 equipment node files corresponding to the first operating system respectively.
In one possible design, the method further comprises:
the terminal equipment judges whether to write the first attribute and the new attribute value of the first attribute into a target equipment node file, wherein the target equipment node file is any one of X-1 equipment node files corresponding to the first operating system;
and if the first attribute and the new attribute value of the first attribute are written into the target equipment node file, the terminal equipment releases the lock protection of the target equipment node file.
In one possible design, the first and second electrodes are,
if the attribute value of the first attribute changes, the terminal device writes the first attribute and the new attribute value of the first attribute into X-1 device node files corresponding to the first operating system, respectively, including:
the terminal equipment judges whether the first attribute is an attribute which needs to be synchronized to the second operating system;
and if the attribute value of the first attribute changes and the first attribute is an attribute which needs to be synchronized to the second operating system, the terminal equipment respectively writes the first attribute and the new attribute value of the first attribute into X-1 equipment node files corresponding to the first operating system.
In one possible design, among the X-1 device node files corresponding to the first operating system, different device node files correspond to different fifo buffers.
In one possible design, the plurality of operating systems includes a user-oriented container system and/or a container system that is not visible to the user.
In a second aspect, an embodiment of the present invention provides an attribute synchronization apparatus, which is applied to a terminal device supporting X operating systems, where X is greater than or equal to 2, and each operating system in the multiple operating systems corresponds to X-1 device node files in a kernel of the terminal device, where the apparatus includes:
a detection module, configured to detect whether an attribute value of a first attribute of a first operating system changes, where the first operating system is any one of the X operating systems;
a writing module, configured to write the first attribute and a new attribute value of the first attribute into X-1 device node files corresponding to the first operating system, respectively, if the detection module detects that the attribute value of the first attribute changes, so that the terminal device reads a device node file, corresponding to a second operating system, of the X-1 device node files to synchronize the first attribute, where the second operating system is any one of the multiple operating systems except the first operating system.
In one possible design, the apparatus further comprises: a reading module and a synchronization module;
the detection module is used for monitoring whether the device node files corresponding to the first operating system are written into a second attribute and the attribute value of the second attribute in X-1 device node files corresponding to the second operating system;
a reading module, configured to read the second attribute and the attribute value of the second attribute if the detection module monitors that, in X-1 device node files corresponding to the second operating system, a device node file corresponding to the first operating system is written in the second attribute and the attribute value of the second attribute;
and the synchronization module is used for updating the second attribute according to the second attribute and the attribute value of the second attribute.
In a feasible design, the writing module is configured to, if the detection module detects that the attribute value of the first attribute changes, perform lock protection on X-1 device node files corresponding to the first operating system, and write the first attribute and the new attribute value of the first attribute into the X-1 device node files corresponding to the first operating system, respectively.
In one possible design, the apparatus further comprises:
a release module, configured to determine whether the write module writes the first attribute and the new attribute value of the first attribute into a target device node file, where the target device node file is any one device node file in X-1 device node files corresponding to the first operating system; and if the first attribute and the new attribute value of the first attribute are written into the target equipment node file, releasing the lock protection of the target equipment node file.
In a feasible design, the detection module is further configured to determine whether the first attribute is an attribute that needs to be synchronized to the second operating system, and if the detection module detects that an attribute value of the first attribute changes and the first attribute is an attribute that needs to be synchronized to the second operating system, the write-in module writes the first attribute and new attribute values of the first attribute into X-1 device node files corresponding to the first operating system, respectively.
In one possible design, among the X-1 device node files corresponding to the first operating system, different device node files correspond to different fifo buffers.
In one possible design, the plurality of operating systems includes a user-oriented container system and/or a container system that is not visible to the user.
In a third aspect, an embodiment of the present invention provides a terminal device, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the method according to the first aspect or various possible implementations of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a storage medium, where instructions are stored, and when the instructions are executed on a terminal device, the terminal device is caused to perform the method according to the first aspect or various possible implementations of the first aspect.
In a fifth aspect, embodiments of the present invention provide a computer program product, which, when run on a terminal device, causes the terminal device to perform the method according to the first aspect or any of the possible implementations of the first aspect.
In the attribute synchronization method and apparatus provided in the embodiments of the present invention, at least two operating systems run on a terminal device, and after an attribute of any one operating system changes, the operating system writes a name of the attribute and a changed attribute value into a corresponding device node file, where different device node files correspond to different operating systems, so that other operating systems read the device node files to complete attribute synchronization. In the process, attribute synchronization can be realized without executing operation system switching, and the process is simple and high in accuracy.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic diagram of an operating system of a terminal device to which an attribute synchronization method according to an embodiment of the present invention is applied;
fig. 2 is a flowchart of an attribute synchronization method according to an embodiment of the present invention;
FIG. 3 is a process diagram of an attribute synchronization method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an attribute synchronization apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of another attribute synchronization apparatus according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of another attribute synchronization apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Typically, some attributes of the operating system need to be modified synchronously, wherein the attributes include which Subscriber Identity Module (SIM) card to access the internet, etc. For example, a terminal device supporting dual card and dual standby is provided with a Subscriber Identity Module (SIM) card 1 and a SIM card 2, the terminal device has two operating systems, namely an operating system a and an operating system B, when the operating system currently running in the terminal device is the operating system a, the terminal device accesses the internet through the SIM card 1, and performs services such as making a call through the SIM1 card; when the operating system currently running by the terminal device is operating system B, the terminal device accesses the internet through SIM card 1, but performs service access such as making a call through SIM 2. If the user needs to modify the internet access through the SIM card 1 into the internet access through the SIM card 2, if the currently running operating system is the operating system a, the user modifies the attribute of the operating system a, so that when the operating system of the terminal device is the operating system a, the terminal device accesses the internet through the SIM2, then the terminal device performs operating system switching according to the instruction of the user, switches to the operating system B, and the user modifies the attribute of the operating system B, so that when the operating system of the terminal device is the operating system B, the terminal device accesses the internet through the SIM 2.
In the attribute modification process, the attribute needing to be synchronized is modified by executing the switching of the operating system. However, when there are many attributes to be synchronized and the modification frequency of the attributes is high, the above method for synchronizing the attributes by switching through the operating system has complex steps, complex process and is prone to errors.
In view of this, the embodiment of the present invention provides an attribute synchronization method, which does not need to perform switching of an operating system during attribute synchronization, and has a simple process and high accuracy.
Embodiments of the present invention are applicable to terminal devices that support multiple operating systems, which are devices capable of providing voice and/or data connectivity to a user, handheld devices with wireless connectivity, or other processing devices connected to a wireless modem. In this embodiment of the present invention, the terminal device may include: a cellular or other communication device having a single line display or a multi-line display or a cellular or other communication device without a multi-line display; personal Communications Systems (PCS) having voice, data processing, facsimile and/or data communications capabilities; personal Digital Assistants (PDAs), which may include radio frequency receivers, pagers, internet/intranet access, web browsers, notepads, calendars, and/or GPS (Global Positioning System) receivers; a conventional laptop and/or palmtop computer or other device having and/or including a radio frequency receiver. As used herein, a "terminal" or "terminal device" may be portable, transportable, installed in a vehicle (aeronautical, maritime, and/or land-based), or situated and/or configured to operate locally and/or in a distributed fashion at any other location(s) on earth and/or in space. As used herein, a "terminal device" may also be a communication terminal, a web terminal, and a music/video playing terminal, and may be, for example, a PDA, a Mobile Internet Device (MID) and/or a mobile phone with a music/video playing function, and may also be a smart tv, a set-top box, and other devices.
Fig. 1 is a schematic diagram of an operating system of a terminal device to which the attribute synchronization method provided in the embodiment of the present invention is applied. Referring to fig. 1, in the embodiment of the present invention, the terminal device supports X operating systems, for example, container systems created by using a Linux container virtualization technology, and the operating systems may be Linux operating systems or Unix operating systems in a conventional sense, or operating systems derived from the Linux operating system. The operating systems include user-oriented container systems and/or container systems that are not visible to the user. The user-oriented container system means that the terminal equipment can execute operating system switching according to the operation of a user, so that the user can set and use the operating system; the operating system which is invisible to the user cannot be visible to the user even if the user executes system operation, and the operating system can only enter a background to be modified, set and the like.
In the embodiment of the present invention, any one of X operating systems supported by a terminal device, hereinafter referred to as a first operating system, corresponds to X-1 device node files, and the device node files are stored in a kernel (kernel) space of the terminal device. For example, if X is 3, that is, the terminal device has 3 operating systems, namely, an operating system a, an operating system B, and an operating system C, then 6 device node files are created in the kernel space, namely, a device node file 1, a device node file 2, and a device node file 3 … …, where the operating system a corresponds to the device node file 1 and the device node file 2; the operating system B corresponds to the device node file 3 and the device node file 4, the operating system B corresponds to the device node files 5 and 6, and if the attribute of a certain operating system changes, the operating system writes the attribute name of the changed attribute and the changed attribute value into the device node file corresponding to the operating system. Taking the operating system a as an example, if the kernel of the terminal device detects that the attribute value of the attribute 1 of the operating system a changes, the terminal device writes the attribute value after the attribute 1 and the attribute value after the attribute 1 change into the device node file 1 and the device node file 2, respectively. Then, without executing the switching of the operating system, the monitoring process of the operating system B monitors that the content of the equipment node file 1 changes, reads the equipment node file 1, reads the attribute 1 and the changed post attribute value thereof, and modifies the attribute 1; and when the monitoring process of the operating system C monitors that the content of the equipment node file 2 changes, reading the equipment node file 2, reading the attribute 1 and the changed attribute value thereof, and modifying the attribute 1.
It should be noted that the operating system described in the embodiment of the present invention includes, but is not limited to, an exemplary operating system, and may also cover all operating systems capable of running in a container.
Next, based on the operating system framework shown in fig. 1, the attribute synchronization method according to the embodiment of the present invention will be described in detail. For example, see fig. 1.
Fig. 2 is a flowchart of an attribute synchronization method according to an embodiment of the present invention. The embodiment comprises the following steps:
101. the terminal device detects whether the attribute value of the first attribute of the first operating system changes.
Wherein the first operating system is any one of the plurality of operating systems.
In general, if a plurality of operating systems are running on a terminal device, the operating system that is being used by a user is referred to as a current operating system, and the operating systems other than the current operating system are referred to as background operating systems.
When a user needs to synchronize the attributes of the operating systems, at this time, the first operating system is the current operating system, the user sets the attributes of the current operating system, the terminal device detects whether the first attribute, that is, any attribute of the first operating system changes, and if the first attribute changes, the step 102 is executed; if any attribute of the current operating system is not changed, the step 101 is returned to. In the process, the first operating system is a user-oriented container system, i.e., an operating system visible to the user.
When research personnel need to synchronize the attributes of the operating systems, at this time, the first operating system is a container system invisible to a user, the research personnel sets the attributes of the container system invisible to the user, the terminal device detects the first attribute of the container system invisible to the user, namely whether any one attribute of the container system invisible to the user changes, and if the any one attribute of the container system invisible to the user does not change, the step 102 is executed; if any one of the attributes of the container system that is not visible to the user has not changed, the process returns to step 101. In addition, the research and development staff may set the operating system that is not visible to the user in the background, and may set the attribute of the operating system that is visible to the user in the background.
102. If the attribute value of the first attribute changes, the terminal device writes the first attribute and a new attribute value of the first attribute into X-1 device node files corresponding to the first operating system respectively, so that the terminal device reads a device node file corresponding to a second operating system in the X-1 device node files to synchronize the first attribute, wherein the second operating system is any one of the operating systems except the first operating system.
For example, assuming that X is 3, that is, there are 3 operating systems on the terminal device, namely, the operating systems are an operating system a, an operating system B, and an operating system C, 6 device node files are created in the kernel space, namely, a device node file 1, a device node file 2, and a device node file 3 … …, where the operating system a corresponds to the device node file 1 and the device node file 2; operating system B corresponds to device node files 3 and 4 and operating system B corresponds to device node files 5 and 6. Taking the first operating system as an operating system a as an example, if a user modifies an attribute a of the operating system a, the terminal device writes new attribute values of the attribute a and the attribute a into a device node file 1 and a device node file 2. Then, the listening process of the operating system B reads the device node file 1 periodically or aperiodically, and reads new attribute values of the attribute a and the attribute a, so as to modify the attribute a of the operating system B, thereby completing the attribute synchronization of the operating system a and the operating system B without executing the switching of the operating system. Similarly, the monitoring process of the operating system C reads the device node file 1 periodically or aperiodically, and reads the new attribute values of the attribute a and the attribute a, so as to modify the attribute a of the operating system C, thereby completing the attribute synchronization of the operating system a and the operating system C without executing the switching of the operating system. That is, the attribute synchronization of the operating system a, the operating system B, and the operating system C is completed.
In the attribute synchronization method provided by the embodiment of the present invention, at least two operating systems are run on the terminal device, and after the attribute of any one operating system changes, the operating system writes the name of the attribute and the changed attribute value into the device node file corresponding to the operating system, and different device node files correspond to different operating systems, so that other operating systems read the device node files to complete attribute synchronization. In the process, attribute synchronization can be realized without executing operation system switching, and the process is simple and high in accuracy.
In the above embodiment, when the first operating system is the current operating system of the terminal device, the user modifies the attribute of the current operating system, and writes the corresponding attribute and the new attribute value into each device node file, so that the other operating systems perform attribute synchronization. In addition, when the attributes of other operating systems change, the terminal device may also perform attribute synchronization by reading the device node file. In this case, the attribute synchronization method further includes: the terminal equipment monitors whether the equipment node files corresponding to the first operating system are written into a second attribute and the attribute value of the second attribute in X-1 equipment node files corresponding to the second operating system; if the device node file corresponding to the first operating system is written into the second attribute and the attribute value of the second attribute in the X-1 device node files corresponding to the second operating system, the terminal device reads the attribute values of the second attribute and the second attribute; and the terminal equipment updates the second attribute according to the second attribute and the attribute value of the second attribute.
In the foregoing embodiment, in order to prevent that the operating system corresponding to the device node file reads the device node file for performing attribute synchronization before the first operating system unsuccessfully writes the attribute name and the new attribute value of the first attribute into the device node file, the related information of the first attribute cannot be correctly read. In the above embodiment, if the attribute value of the first attribute changes, when the terminal device writes the first attribute and the new attribute value of the first attribute into X-1 device node files corresponding to the first operating system, the terminal device performs lock protection on the X-1 device node files corresponding to the first operating system, and writes the first attribute and the new attribute value of the first attribute into X-1 device node files corresponding to the first operating system.
Illustratively, continuing with the above example, assuming that X is 3, that is, there are 3 operating systems on the terminal device, namely, operating system a, operating system B and operating system C, respectively, then 6 device node files are created in the kernel space, namely, device node file 1, device node file 2, device node file 3 … … device node file 6, where operating system a corresponds to device node file 1 and device node file 2; operating system B corresponds to device node files 3 and 4 and operating system B corresponds to device node files 5 and 6. Taking the first operating system as an operating system a as an example, if a user modifies an attribute a of the operating system a, the terminal device writes new attribute values of the attribute a and the attribute a into a device node file 1 and a device node file 2. In the writing process, the terminal device performs lock protection on the device node file 1 and the device node file 2 until the operating system a successfully writes the new attribute values of the attribute a and the attribute a into the device node file 1 and the device node file 2. Then, the listening process of the operating system B reads the device node file 1 periodically or aperiodically, and reads new attribute values of the attribute a and the attribute a, so as to modify the attribute a of the operating system B, thereby completing the attribute synchronization of the operating system a and the operating system B without executing the switching of the operating system. Similarly, the monitoring process of the operating system C reads the device node file 1 periodically or aperiodically, and reads the new attribute values of the attribute a and the attribute a, so as to modify the attribute a of the operating system C, thereby completing the attribute synchronization of the operating system a and the operating system C without executing the switching of the operating system. That is, the attribute synchronization of the operating system a, the operating system B, and the operating system C is completed.
In the foregoing embodiment, in order to prevent a device node file from being always locked and protected, after a terminal device performs lock protection on the device node file, the terminal device determines whether to write the first attribute and a new attribute value of the first attribute into a target device node file, where the target device node file is any one of X-1 device node files corresponding to the first operating system; and if the first attribute and the new attribute value of the first attribute are written into the target equipment node file, the terminal equipment releases the lock protection of the target equipment node file.
In this embodiment of the present invention, if the first operating system detects that the attribute value of the first attribute changes, the terminal device determines, during a process of writing the first attribute and a new attribute value of the first attribute into X-1 device node files corresponding to the first operating system, whether the first attribute is an attribute that needs to be synchronized to the second operating system; and if the terminal equipment detects that the attribute value of the first attribute changes and the first attribute is the attribute which needs to be synchronized to the second operating system, the terminal equipment writes the first attribute and the new attribute value of the first attribute into X-1 equipment node files corresponding to the first operating system respectively.
For example, a list may be configured on the terminal device in advance, where an attribute in the list is an attribute that needs to be synchronized, after the terminal device detects that a first attribute changes, it first determines whether the first attribute is included in the list, and if the first attribute is included in the list, the terminal device considers that the first attribute is an attribute that needs to be synchronized, and the terminal device needs to write the first attribute and a new attribute value of the first attribute into the device node file; otherwise, if the first attribute is not included in the list, the first attribute is considered to be not an attribute which needs to be synchronized, and the terminal device does not need to write the first attribute and a new attribute value of the first attribute in each device node file.
In the above embodiment, different device node files correspond to different fifo buffers in the X-1 device node files corresponding to the first operating system. Therefore, when a certain attribute of the first operating system changes, the first operating system writes the changed attribute into the first-in first-out buffer area, and the operating system corresponding to the first-in first-out buffer area reads the attribute and the attribute value in the first-in first-out buffer area according to the first-in first-out principle, so that the attribute synchronization is realized.
In the above embodiment, when the terminal device writes the first attribute, that is, the attribute whose attribute value changes, in a certain device node file, the writing is performed through a property service (property service). Therefore, when the system property is set in the property service by the Java layer, native (native) layer, setprop command, the property setting (property _ set) in the property service process is called. The method comprises the steps that the content of system attribute synchronization is added into the setting of attribute writing, the terminal device judges whether the attribute of the current operating system needs to be synchronized to other operating systems, if the attribute needs to be synchronized to other operating systems, the terminal device writes the attribute and the attribute value into a device node file created by a kernel space in a key value peer-to-peer mode, and the device node file stores the related information of the attribute needing to be synchronized through a kernel first in first out (kfifo) ring buffer area.
Fig. 3 is a process schematic diagram of an attribute synchronization method according to an embodiment of the present invention. Referring to fig. 3, three operating systems on the terminal device are an operating system a, an operating system B, and an operating system C, respectively, where the operating system C and the kernel space create three domains for the three operating systems: vp1, vp2 and root, vp1 corresponds to 2 kfifo ring buffers, device node file 1 and device node file 2, vp2 corresponds to 2 kfifo ring buffers, namely device node file 3 and device node file 4, and root corresponds to 2 kfifo ring buffers, namely device node file 5 and device node file 6. When the attribute service of the vp1 domain writes the attribute needing synchronization, the terminal device writes the attribute needing synchronization to the 2 kfifo ring buffers corresponding to the vp 1. That is to say, the first operating system of the terminal device writes the attribute to be synchronized into the device node file 1 and the device node file 2 by using a write process, and then, since the device node file 1 and the device node file 2 correspond to the VP2 and the root, respectively, the attribute synchronization process in the VP2 can achieve synchronization between the operating system a and the operating system B by reading the device node file 1; the attribute synchronization process in the root can realize the synchronization of the operating system A and the operating system C by reading the device node file 2.
Fig. 4 is a schematic structural diagram of an attribute synchronization apparatus according to an embodiment of the present invention. The attribute synchronization apparatus according to this embodiment is applied to a terminal device that supports X operating systems, where X is greater than or equal to 2, each operating system in the multiple operating systems corresponds to X-1 device node files in a kernel of the terminal device, and the attribute synchronization apparatus 100 includes:
a detecting module 11, configured to detect whether an attribute value of a first attribute of a first operating system changes, where the first operating system is any one of the X operating systems;
a writing module 12, configured to, if the detection module 11 detects that the attribute value of the first attribute changes, respectively write the first attribute and a new attribute value of the first attribute into X-1 device node files corresponding to the first operating system, so that the terminal device reads a device node file corresponding to a second operating system in the X-1 device node files to synchronize the first attribute, where the second operating system is any one of the multiple operating systems except the first operating system.
Fig. 5 is a schematic structural diagram of another attribute synchronization apparatus according to an embodiment of the present invention. Based on the apparatus shown in fig. 4, the attribute synchronization apparatus in this embodiment further includes: a reading module 13 and a synchronization module 14;
the detection module 11 is configured to monitor whether, in X-1 device node files corresponding to the second operating system, a device node file corresponding to the first operating system is written into a second attribute and an attribute value of the second attribute;
a reading module 13, configured to read the second attribute and the attribute value of the second attribute if, in the X-1 device node files corresponding to the second operating system, the device node file corresponding to the first operating system is written in the second attribute and the attribute value of the second attribute by the detecting module 11;
and a synchronization module 14, configured to update the second attribute according to the second attribute and the attribute value of the second attribute.
In a possible design, the writing module is configured to, if the detection module 11 detects that the attribute value of the first attribute changes, perform lock protection on X-1 device node files corresponding to the first operating system, and write the first attribute and the new attribute value of the first attribute into the X-1 device node files corresponding to the first operating system, respectively.
Referring to fig. 5 again, in a possible design, the attribute synchronization apparatus 100 further includes:
a releasing module 15, configured to determine whether the writing module writes the first attribute and the new attribute value of the first attribute into a target device node file, where the target device node file is any one device node file in X-1 device node files corresponding to the first operating system; and if the first attribute and the new attribute value of the first attribute are written into the target equipment node file, releasing the lock protection of the target equipment node file.
In a feasible design, the detection module 11 is further configured to determine whether the first attribute is an attribute that needs to be synchronized to the second operating system, and if the detection module 11 detects that an attribute value of the first attribute changes and the first attribute is an attribute that needs to be synchronized to the second operating system, the writing module writes the first attribute and a new attribute value of the first attribute into X-1 device node files corresponding to the first operating system, respectively.
In one possible design, among the X-1 device node files corresponding to the first operating system, different device node files correspond to different fifo buffers.
In one possible design, the plurality of operating systems includes a user-oriented container system and/or a container system that is not visible to the user.
The attribute synchronization device provided in the embodiment of the present application can execute the actions of the first operating system in the above embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
It should be noted that each of the modules may be a processing element separately set up, or may be implemented by being integrated into a chip of the apparatus, or may be stored in a memory of the apparatus in the form of program code, and a processing element of the apparatus calls and executes the functions of the processing unit. In addition, all or part of the units can be integrated together or can be independently realized. The processing element described herein may be an integrated circuit having signal processing capabilities. In implementation, the steps of the method or the units above may be implemented by hardware integrated logic circuits in a processor element or instructions in software.
For example, the above units may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors (DSPs), or one or more Field Programmable Gate Arrays (FPGAs), etc. For another example, when some of the above units are implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor that can call the program code. As another example, these units may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Fig. 6 is a schematic structural diagram of another attribute synchronization apparatus according to an embodiment of the present invention. As shown in fig. 6, the attribute synchronization apparatus 200 includes:
at least one processor 21 and memory 22;
the memory 22 stores computer-executable instructions;
the at least one processor 21 executes computer-executable instructions stored by the memory 22 to cause the at least one processor 21 to perform the attribute synchronization method as described above.
For a specific implementation process of the processor 21, reference may be made to the above method embodiments, which implement similar principles and technical effects, and this embodiment is not described herein again.
Optionally, the attribute synchronization apparatus 200 further comprises a communication section 23. Wherein the processor 21, the memory 22 and the communication means 23 may be connected by a bus 24.
An embodiment of the present invention further provides a storage medium, where a computer executing instruction is stored in the storage medium, and the computer executing instruction is used to implement the attribute synchronization method described above when being executed by a processor.
Embodiments of the present invention further provide a computer program product, which, when running on an electronic device, enables the computer to execute the above attribute synchronization method.
In the above embodiments, it should be understood that the described apparatus and method may be implemented in other ways. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules is only one logical division, and other divisions may be realized in practice, for example, a plurality of modules may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or modules, and may be in an electrical, mechanical or other form.
The modules described as separate parts may or may not be physically separate, and parts displayed as modules may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment.
In addition, functional modules in the embodiments of the present invention may be integrated into one processing unit, or each module may exist alone physically, or two or more modules are integrated into one unit. The unit formed by the modules can be realized in a hardware form, and can also be realized in a form of hardware and a software functional unit.
The integrated module implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions for enabling an electronic device (which may be a personal computer, a server, or a first operating system) or a processor (english: processor) to perform some steps of the methods according to the embodiments of the present invention.
It should be understood that the processor may be a Central Processing Unit (CPU), other general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile storage NVM, such as at least one disk memory, and may also be a usb disk, a removable hard disk, a read-only memory, a magnetic or optical disk, etc.
The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, the buses in the figures of the present invention are not limited to only one bus or one type of bus.
The storage medium may be implemented by any type or combination of volatile or non-volatile memory devices, 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 disks. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. Of course, the storage medium may also be integral to the processor. The processor and the storage medium may reside in an Application Specific Integrated Circuits (ASIC). Of course, the processor and the storage medium may reside as discrete components in a terminal or server.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (6)

1. An attribute synchronization method is applied to a terminal device supporting X operating systems, wherein X is more than or equal to 2, each operating system in a plurality of operating systems corresponds to X-1 device node files in a kernel of the terminal device, and the method comprises the following steps:
the terminal equipment detects whether an attribute value of a first attribute of a first operating system changes, wherein the first operating system is any one of the X operating systems;
if the attribute value of the first attribute changes, the terminal device writes the first attribute and a new attribute value of the first attribute into X-1 device node files corresponding to the first operating system respectively, so that the terminal device reads a device node file corresponding to a second operating system in the X-1 device node files to synchronize the first attribute, wherein the second operating system is any one of the operating systems except the first operating system;
if the attribute value of the first attribute changes, the terminal device writes the first attribute and the new attribute value of the first attribute into X-1 device node files corresponding to the first operating system, respectively, including:
the terminal equipment judges whether the first attribute is an attribute which needs to be synchronized to the second operating system;
if the attribute value of the first attribute changes and the first attribute is an attribute which needs to be synchronized to the second operating system, the terminal device performs lock protection on X-1 device node files corresponding to the first operating system, and writes the new attribute values of the first attribute and the first attribute into the X-1 device node files corresponding to the first operating system respectively; in X-1 equipment node files corresponding to the first operating system, different equipment node files correspond to different first-in first-out buffers;
the terminal equipment judges whether to write the first attribute and the new attribute value of the first attribute into a target equipment node file, wherein the target equipment node file is any one of X-1 equipment node files corresponding to the first operating system;
and if the first attribute and the new attribute value of the first attribute are written into the target equipment node file, the terminal equipment releases the lock protection of the target equipment node file.
2. The method of claim 1, further comprising:
the terminal equipment monitors whether the equipment node files corresponding to the first operating system are written into a second attribute and the attribute value of the second attribute in X-1 equipment node files corresponding to the second operating system;
if the device node file corresponding to the first operating system is written into the second attribute and the attribute value of the second attribute in the X-1 device node files corresponding to the second operating system, the terminal device reads the attribute values of the second attribute and the second attribute;
and the terminal equipment synchronizes the second attribute according to the second attribute and the attribute value of the second attribute.
3. The method according to claim 1 or 2,
the plurality of operating systems includes a user-oriented container system and/or a container system that is not visible to a user.
4. An attribute synchronization device is applied to a terminal device supporting X operating systems, wherein X is more than or equal to 2, each operating system in a plurality of operating systems corresponds to X-1 device node files in a kernel of the terminal device, and the attribute synchronization device comprises:
a detection module, configured to detect whether an attribute value of a first attribute of a first operating system changes, where the first operating system is any one of the X operating systems;
a writing module, configured to, if the detection module detects that the attribute value of the first attribute changes, respectively write the first attribute and a new attribute value of the first attribute into X-1 device node files corresponding to the first operating system, so that the terminal device reads a device node file, corresponding to a second operating system, of the X-1 device node files to synchronize the first attribute, where the second operating system is any one of the multiple operating systems except the first operating system;
the detection module is further configured to determine whether the first attribute is an attribute that needs to be synchronized to the second operating system, and if the detection module detects that an attribute value of the first attribute changes and the first attribute is an attribute that needs to be synchronized to the second operating system, the write module performs lock protection on X-1 device node files corresponding to the first operating system, and writes the first attribute and a new attribute value of the first attribute into X-1 device node files corresponding to the first operating system, respectively;
in X-1 equipment node files corresponding to the first operating system, different equipment node files correspond to different first-in first-out buffers;
a release module, configured to determine whether the write module writes the first attribute and the new attribute value of the first attribute into a target device node file, where the target device node file is any one device node file in X-1 device node files corresponding to the first operating system; and if the first attribute and the new attribute value of the first attribute are written into the target equipment node file, releasing the lock protection of the target equipment node file.
5. A terminal device comprising a processor, a memory and a computer program stored on the memory and executable on the processor, wherein the processor implements the method according to any of the claims 1 to 3 when executing the program.
6. A storage medium having stored therein instructions which, when run on a terminal device, cause the terminal device to perform the method of any one of claims 1 to 3.
CN201910376427.4A 2019-05-07 2019-05-07 Attribute synchronization method and device Active CN111913735B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910376427.4A CN111913735B (en) 2019-05-07 2019-05-07 Attribute synchronization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910376427.4A CN111913735B (en) 2019-05-07 2019-05-07 Attribute synchronization method and device

Publications (2)

Publication Number Publication Date
CN111913735A CN111913735A (en) 2020-11-10
CN111913735B true CN111913735B (en) 2022-06-14

Family

ID=73243021

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910376427.4A Active CN111913735B (en) 2019-05-07 2019-05-07 Attribute synchronization method and device

Country Status (1)

Country Link
CN (1) CN111913735B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840408A (en) * 2009-12-31 2010-09-22 创新科存储技术有限公司 Method for implementing write-once read-many
CN102521410A (en) * 2011-12-28 2012-06-27 天津凯发电气股份有限公司 VxWorks-operating-system-based file storage structure and storage method
CN103377005A (en) * 2012-04-20 2013-10-30 中兴通讯股份有限公司 Data synchronization method and device
CN103713943A (en) * 2013-11-28 2014-04-09 小米科技有限责任公司 Native terminal operating system based application function realization method and device
CN104885055A (en) * 2014-03-19 2015-09-02 华为终端有限公司 Method and device for application data synchronization
CN105144102A (en) * 2013-03-07 2015-12-09 微软技术许可有限责任公司 Adaptive data synchronization
WO2016057873A1 (en) * 2014-10-09 2016-04-14 Netapp, Inc. Configuration replication across distributed storage systems
CN106776062A (en) * 2016-11-29 2017-05-31 北京元心科技有限公司 Multi-system contact person attribute information synchronization method and device
CN107122187A (en) * 2017-04-26 2017-09-01 四川中电启明星信息技术有限公司 A kind of operation system OS accesses design method
CN109274709A (en) * 2018-07-30 2019-01-25 深圳点猫科技有限公司 The synchronous method and system of a kind of programming works in education operating system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7962923B2 (en) * 2005-12-30 2011-06-14 Level 3 Communications, Llc System and method for generating a lock-free dual queue

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101840408A (en) * 2009-12-31 2010-09-22 创新科存储技术有限公司 Method for implementing write-once read-many
CN102521410A (en) * 2011-12-28 2012-06-27 天津凯发电气股份有限公司 VxWorks-operating-system-based file storage structure and storage method
CN103377005A (en) * 2012-04-20 2013-10-30 中兴通讯股份有限公司 Data synchronization method and device
CN105144102A (en) * 2013-03-07 2015-12-09 微软技术许可有限责任公司 Adaptive data synchronization
CN103713943A (en) * 2013-11-28 2014-04-09 小米科技有限责任公司 Native terminal operating system based application function realization method and device
CN104885055A (en) * 2014-03-19 2015-09-02 华为终端有限公司 Method and device for application data synchronization
WO2016057873A1 (en) * 2014-10-09 2016-04-14 Netapp, Inc. Configuration replication across distributed storage systems
CN106776062A (en) * 2016-11-29 2017-05-31 北京元心科技有限公司 Multi-system contact person attribute information synchronization method and device
CN107122187A (en) * 2017-04-26 2017-09-01 四川中电启明星信息技术有限公司 A kind of operation system OS accesses design method
CN109274709A (en) * 2018-07-30 2019-01-25 深圳点猫科技有限公司 The synchronous method and system of a kind of programming works in education operating system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
T. Chiba, M 等.A Distributed Real-Time Operating System with Distributed Shared Memory for Embedded Control Systems.《2013 IEEE 11th International Conference on Dependable, Autonomic and Secure Computing》.2014, *
蔡亮 等.基于写操作集的数据库同步复制模型.《计算机工程》.2011,第37卷(第13期), *

Also Published As

Publication number Publication date
CN111913735A (en) 2020-11-10

Similar Documents

Publication Publication Date Title
US10117047B1 (en) Location and time based application management
US9274810B2 (en) Method and an apparatus to update the snapshot image in a nonvolatile memory based on comparing a first data with the second data
CN107832099B (en) Method and device for client version compatibility and storage medium
KR101611373B1 (en) Apparatus and method for booting hibernation in portable terminal
KR101452725B1 (en) Mobile terminal and method for synchronizing data thereof
US20190155792A1 (en) Electronic device and file data journaling method of electronic device
KR101555210B1 (en) Apparatus and method for downloadin contents using movinand in portable terminal
CN106951521B (en) Method, device and system for reading and writing log file
CN112055424A (en) Electronic device and method for switching electronic device
CN111198777A (en) Data processing method, device, terminal and storage medium
US20200034101A1 (en) Data displaying method and electronic device
KR20160048173A (en) Storage processing method, device and terminal
CN114780019A (en) Electronic device management method and device, electronic device and storage medium
CN110737558A (en) Method and device for automatically deploying efi shell system to execute test, computer equipment and storage medium
CN105653539A (en) Index distributed storage implement method and device
CN104980451A (en) Information prompting method and apparatus
CN111913735B (en) Attribute synchronization method and device
US7450962B2 (en) Method for reliably managing database in GSM/GPRS hybrid terminal and hybrid terminal
CN112667538B (en) Method, system, equipment and medium for obtaining network card identification number
CN117707626A (en) System starting method and electronic equipment
US20140099935A1 (en) Method and system for update of network-related information, and electronic device supporting the same
CN108599987B (en) Processing method for network communication function abnormity, application processor and user terminal
JP2015052852A (en) Information processing device, function restriction program, and function restriction method
US11455318B2 (en) Data replication using probabilistic replication filters
CN113805705A (en) Terminal shortcut key operation method and device

Legal Events

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