CN106250212A - Resource access method and device - Google Patents

Resource access method and device Download PDF

Info

Publication number
CN106250212A
CN106250212A CN201610619350.5A CN201610619350A CN106250212A CN 106250212 A CN106250212 A CN 106250212A CN 201610619350 A CN201610619350 A CN 201610619350A CN 106250212 A CN106250212 A CN 106250212A
Authority
CN
China
Prior art keywords
shared resource
system shared
copy
resource
described system
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610619350.5A
Other languages
Chinese (zh)
Inventor
安占磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Nubia Technology Co Ltd
Original Assignee
Nubia Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201610619350.5A priority Critical patent/CN106250212A/en
Publication of CN106250212A publication Critical patent/CN106250212A/en
Pending legal-status Critical Current

Links

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/46Multiprogramming arrangements
    • G06F9/468Specific access rights for resources, e.g. using capability register
    • 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/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/526Mutual exclusion algorithms

Abstract

The invention discloses a kind of resource access device and method, its device includes: receiver module, and for receiving the access operation application to system shared resource, the type of described access operation application includes read operation and write operation;Judge module, if the type for current access operation application is read operation type, then judges whether the system shared resource that application accesses is in the constraint phase;Read operation module, if the system shared resource for application access is in the constraint phase, then the copy to described system shared resource carries out read operation, otherwise, the original version of described system shared resource is carried out read operation.The present invention substitutes existing lock mechanism by using copy mechanism, ensure when read-write operation shares resource, substantially need not take latching operation, promote the access speed sharing resource to a certain extent, thus save the data scanning time, the control to shared resource is the most flexible.

Description

Resource access method and device
Technical field
The present invention relates to system resource access technical field, particularly relate to a kind of resource access method and device.
Background technology
At present, in terminal system, it is a very important part that data consistency accesses, and generally can use lock machine System realizes the concordance of data and accesses.When mobile terminal accessing shares data, such as when carrying out garbage files scanning, first Access lock resource, the access of data could be realized on the premise of obtaining lock resource.Such as operate same file, first access One overall variable (lock), controls the thread access to resource by the state of global variable.But, along with mobile terminal Storage control increasing, the nuclear volume of CPU increases, and data volume sharply increases, use lock mechanism realize the one of data access There is inefficient problem in cause property.
Summary of the invention
Present invention is primarily targeted at a kind of resource access method of proposition and device, it is intended to improve system shared resource Access speed so that share resource control more flexible.
For achieving the above object, a kind of resource access device that the present invention provides, including:
Receiver module, for receiving the access operation application to system shared resource, the type of described access operation application Including read operation and write operation;
Judge module, if the type for current access operation application is read operation type, then judge application access is Altogether enjoy whether resource is in the constraint phase;
Read operation module, if the system shared resource for application access is in the constraint phase, then shares money to described system The copy in source carries out read operation, otherwise, the original version of described system shared resource is carried out read operation.
Alternatively, described device also includes:
Write operation module, if the type for current access operation application is write operation type, is then that described system is shared Resource sets up copy, modifies described copy, and sets up the constraint phase for described copy.
Alternatively, described write operation module, it is additionally operable to judge whether all read operations of described system shared resource are tied Bundle;If all read operations to described system shared resource terminate, then set up copy for described system shared resource, to described Copy is modified.
Alternatively, described device also includes:
Release recycling module, for the copy of described system shared resource being carried out read operation knot in described read operation module Shu Hou, releases the constraint phase of described system shared resource, and reclaims the original version of described system shared resource.
Alternatively, described device also includes:
Release recycling module, for before the copy of described system shared resource being carried out read operation and terminates, it is judged that described Whether the constraint phase of system shared resource reaches threshold value;If the constraint phase of described system shared resource reaches threshold value, then force to solve Except the constraint phase of described system shared resource, and reclaim the original version of described system shared resource.
The embodiment of the present invention also proposes a kind of resource access method, including:
Receiving the access operation application to system shared resource, the type of described access operation application includes read operation and writes Operation;
If the type of current access operation application is read operation type, then judge that system shared resource that application accesses is whether It is in the constraint phase;
If the system shared resource that application accesses is in the constraint phase, then the copy to described system shared resource carries out reading behaviour Make, otherwise, the original version of described system shared resource is carried out read operation.
Alternatively, after described reception accesses the step of operation application to system shared resource, also include:
If the type of current access operation application is write operation type, then set up copy for described system shared resource, right Described copy is modified, and sets up the constraint phase for described copy.
Alternatively, if the type of current access operation application is write operation type, then building for described system shared resource Vertical copy, before the step modify also included described copy:
Judge whether all read operations of described system shared resource are terminated;
If all read operations to described system shared resource terminate, then perform step: build for described system shared resource Vertical copy, modifies to described copy.
Alternatively, if the system shared resource that described application accesses is in the constraint phase, then to described system shared resource After copy carries out the step of read operation, also include:
The copy of described system shared resource is being carried out after read operation terminates, releasing the constraint of described system shared resource Phase, and reclaim the original version of described system shared resource.
Alternatively, if the system shared resource that described application accesses is in the constraint phase, then to described system shared resource After copy carries out the step of read operation, also include:
Before the copy of described system shared resource being carried out read operation and terminates, it is judged that the constraint of described system shared resource Whether the phase reaches threshold value;
If the constraint phase of described system shared resource reaches threshold value, then the constraint of system shared resource described in compulsory commutation Phase, and reclaim the original version of described system shared resource.
A kind of resource access method of present invention proposition and device, receiving the operation of the access to system shared resource Shen Please time, if the type of current access operation application is read operation type, then judge application access system shared resource whether locate In the constraint phase;If the system shared resource that application accesses is in the constraint phase, then the copy of described system shared resource is read Operation, otherwise, carries out read operation to the original version of described system shared resource;Additionally, for write operation, it needs original Old data once back up, and then modify Backup Data, revise complete after, and the old data constraint phase release after real again The recovery of the oldest data resource.Thus, by using copy mechanism to substitute existing lock mechanism, it is ensured that share money at read-write operation During source, substantially need not take latching operation, promote the access speed sharing resource to a certain extent, thus when saving data scanning Between, the control to shared resource is the most flexible.
Accompanying drawing explanation
Fig. 1 is the hardware architecture diagram of the optional mobile terminal realizing each embodiment of the present invention;
Fig. 2 is the wireless communication system schematic diagram of mobile terminal as shown in Figure 1;
Fig. 3 is the module diagram of resource access device first embodiment of the present invention;
Fig. 4 is the module diagram of resource access device the second embodiment of the present invention;
Fig. 5 is the module diagram of resource access device the 3rd embodiment of the present invention;
Fig. 6 is the schematic flow sheet of resource access method first embodiment of the present invention;
Fig. 7 is the schematic flow sheet of resource access method the second embodiment of the present invention;
Fig. 8 is the schematic flow sheet of resource access method the 3rd embodiment of the present invention;
Fig. 9 is a kind of concrete resource browsing process schematic diagram in the embodiment of the present invention.
The realization of the object of the invention, functional characteristics and advantage will in conjunction with the embodiments, are described further referring to the drawings.
Detailed description of the invention
Should be appreciated that specific embodiment described herein, only in order to explain the present invention, is not intended to limit the present invention.
Embodiment of the present invention scheme relates to sharing of terminal system resource, and the terminal being directed to can be the fixing ends such as PC End, it is also possible to refer to that mobile terminal, the embodiment of the present invention are illustrated with mobile terminal, but be not intended that the restriction to terminal.
The mobile terminal realizing each embodiment of the present invention is described referring now to accompanying drawing.In follow-up description, use For representing the suffix explanation only for the beneficially present invention of such as " module ", " parts " or " unit " of element, itself Not specific meaning.Therefore, " module " can mixedly use with " parts ".
Mobile terminal can be implemented in a variety of manners.Such as, the terminal described in the present invention can include such as moving Phone, smart phone, notebook computer, digit broadcasting receiver, PDA (personal digital assistant), PAD (panel computer), PMP The mobile terminal of (portable media player), guider etc. and consolidating of such as numeral TV, desk computer etc. Determine terminal.Hereinafter it is assumed that terminal is mobile terminal.However, it will be understood by those skilled in the art that, mobile except being used in particular for Outside the element of purpose, structure according to the embodiment of the present invention can also apply to the terminal of fixed type.
Fig. 1 is the hardware architecture diagram of the optional mobile terminal realizing each embodiment of the present invention.
Mobile terminal 100 can include wireless communication unit 110, user input unit 130, output unit 150, memorizer 160, interface unit 170, controller 180 and power subsystem 190 etc..Fig. 1 shows the mobile terminal with various assembly, but It is to it should be understood that, it is not required that implement all assemblies illustrated.Can alternatively implement more or less of assembly.Will under Face describes the element of mobile terminal in detail.
Wireless communication unit 110 generally includes one or more assembly, and it allows mobile terminal 100 and wireless communication system Or the radio communication between network.Such as, wireless communication unit can include broadcast reception module 111, wireless Internet mould At least one in block 113.
Broadcast reception module 111 receives broadcast singal and/or broadcast via broadcast channel from external broadcasting management server Relevant information.Broadcast channel can include satellite channel and/or terrestrial channel.Broadcast management server can be to generate and send Broadcast singal and/or the server of broadcast related information or the broadcast singal generated before receiving and/or broadcast related information And send it to the server of terminal.Broadcast singal can include that TV broadcast singal, radio signals, data are broadcasted Signal etc..And, broadcast singal may further include the broadcast singal combined with TV or radio signals.Broadcast phase Pass information can also provide via mobile communications network, and in this case, broadcast related information can be by mobile communication mould Block 112 receives.Broadcast singal can exist in a variety of manners, and such as, it can be with the electronics of DMB (DMB) Program guide (EPG), the form of electronic service guidebooks (ESG) etc. of digital video broadcast-handheld (DVB-H) and exist.Broadcast Receiver module 111 can be broadcasted by using various types of broadcast systems to receive signal.Especially, broadcast reception module 111 Can be by using such as multimedia broadcasting-ground (DMB-T), DMB-satellite (DMB-S), digital video wide Broadcast-hand-held (DVB-H), forward link media (MediaFLO@) Radio Data System, received terrestrial digital broadcasting integrated service Etc. (ISDB-T) digit broadcasting system receives digital broadcasting.Broadcast reception module 111 may be constructed such that and is adapted to provide for extensively Broadcast the various broadcast systems of signal and above-mentioned digit broadcasting system.Via broadcast reception module 111 receive broadcast singal and/ Or broadcast related information can be stored in memorizer 160 (or other type of storage medium).
Wireless Internet module 113 supports the Wi-Fi (Wireless Internet Access) of mobile terminal.This module can be internally or externally It is couple to terminal.Wi-Fi (Wireless Internet Access) technology involved by this module can include WLAN (WLAN) (Wi-Fi), Wibro (WiMAX), Wimax (worldwide interoperability for microwave access), HSDPA (high-speed downlink packet access) etc..
User input unit 130 can generate key input data to control each of mobile terminal according to the order of user's input Plant operation.User input unit 130 allows user to input various types of information, and can include keyboard, metal dome, touch Plate (such as, detection due to touched and cause resistance, pressure, the sensitive component of change of electric capacity etc.), roller, rocking bar etc. Deng.Especially, when touch pad is superimposed upon on display unit 151 as a layer, touch screen can be formed.
Interface unit 170 is used as at least one external device (ED) and is connected, with mobile terminal 100, the interface that can pass through.Such as, External device (ED) can include wired or wireless head-band earphone port, external power source (or battery charger) port, wired or nothing Line FPDP, memory card port, for connect have the port of device of identification module, audio frequency input/output (I/O) end Mouth, video i/o port, ear port etc..Identification module can be that storage is for verifying that user uses each of mobile terminal 100 Kind of information and subscriber identification module (UIM), client identification module (SIM), Universal Subscriber identification module (USIM) can be included Etc..It addition, the device (hereinafter referred to as " identifying device ") with identification module can be to take the form of smart card, therefore, know Other device can be connected with mobile terminal 100 via port or other attachment means.Interface unit 170 may be used for receive from The input (such as, data message, electric power etc.) of external device (ED) and the input received is transferred in mobile terminal 100 One or more elements or may be used between mobile terminal and external device (ED) transmit data.
It addition, when mobile terminal 100 is connected with external base, interface unit 170 can serve as allowing electricity by it Power provides the path of mobile terminal 100 from base or can serve as allowing from the various command signals of base input by it It is transferred to the path of mobile terminal.May serve as identifying that mobile terminal is from various command signals or the electric power of base input The no signal being accurately fitted within base.
Output unit 150 is configured to provide output signal (such as, audio frequency letter with vision, audio frequency and/or tactile manner Number, video signal, alarm signal, vibration signal etc.).Output unit 150 can include that display unit 151, audio frequency export mould Block 152 etc..
Display unit 151 may be displayed on the information processed in mobile terminal 100.Such as, it is in electricity when mobile terminal 100 During words call mode, display unit 151 can show and call or other (such as, text messaging, multimedia file that communicate Download etc.) relevant user interface (UI) or graphic user interface (GUI).When mobile terminal 100 is in video calling pattern Or during image capture mode, display unit 151 can show image and/or the image of reception of capture, illustrate video or figure UI or GUI of picture and correlation function etc..
Meanwhile, when display unit 151 and touch pad the most superposed on one another with formed touch screen time, display unit 151 can serve as input equipment and output device.Display unit 151 can include liquid crystal display (LCD), thin film transistor (TFT) In LCD (TFT-LCD), Organic Light Emitting Diode (OLED) display, flexible display, three-dimensional (3D) display etc. at least A kind of.Some in these display may be constructed such that transparence is watched from outside with permission user, and this is properly termed as transparent Display, typical transparent display can for example, TOLED (transparent organic light emitting diode) display etc..According to specific The embodiment wanted, mobile terminal 100 can include two or more display units (or other display device), such as, move Dynamic terminal can include outernal display unit (not shown) and inner display unit (not shown).Touch screen can be used for detection and touches Input pressure and touch input position and touch input area.
Dio Output Modules 152 can mobile terminal be in call signal receive pattern, call mode, logging mode, Time under the isotype such as speech recognition mode, broadcast reception mode, that wireless communication unit 110 is received or at memorizer 160 The voice data transducing audio signal of middle storage and be output as sound.And, dio Output Modules 152 can provide with mobile The audio frequency output (such as, call signal receives sound, message sink sound etc.) that the specific function that terminal 100 performs is relevant. Dio Output Modules 152 can include speaker, buzzer etc..
Memorizer 160 can store the process performed by controller 180 and the software program controlling operation etc., or Can temporarily store the data (such as, telephone directory, message, still image, video etc.) that oneself maybe will export through output.And And, memorizer 160 can with storage about when touch be applied to touch screen time the vibration of various modes of output and audio signal Data.
Memorizer 160 can include that the storage medium of at least one type, described storage medium include flash memory, hard disk, many Media card, card-type memorizer (such as, SD or DX memorizer etc.), random access storage device (RAM), static random-access store Device (SRAM), read only memory (ROM), Electrically Erasable Read Only Memory (EEPROM), programmable read only memory (PROM), magnetic storage, disk, CD etc..And, mobile terminal 100 can be connected execution memorizer with by network The network storage device cooperation of the storage function of 160.
Controller 180 generally controls the overall operation of mobile terminal.Such as, controller 180 performs and voice call, data Control that communication, video calling etc. are relevant and process.It addition, controller 180 can include for reproducing (or playback) many matchmakers The multi-media module 1810 of volume data, multi-media module 1810 can construct in controller 180, or it is so structured that with control Device 180 processed separates.Controller 180 can perform pattern recognition process, with the handwriting input that will perform on the touchscreen or figure Sheet is drawn input and is identified as character or image.
Specifically, controller 180 can also include: receiver module 182, grasps for receiving the access to system shared resource Work is applied for, the type of described access operation application includes read operation and write operation;
Judge module 183, if the type for current access operation application is read operation type, then judges what application accessed Whether system shared resource is in the constraint phase;
Read operation module 184, if the system shared resource for application access is in the constraint phase, then shares described system The copy of resource carries out read operation, otherwise, the original version of described system shared resource is carried out read operation.
Write operation module 185, if the type for current access operation application is write operation type, is then that described system is total to Enjoy resource and set up copy, described copy is modified, and sets up the constraint phase for described copy.
Further, described write operation module 185, be additionally operable to judge to all read operations of described system shared resource be No end;If all read operations to described system shared resource terminate, then set up copy for described system shared resource, to institute State copy to modify.
Release recycling module 186, for carrying out reading behaviour to the copy of described system shared resource in described read operation module After making to terminate, release the constraint phase of described system shared resource, and reclaim the original version of described system shared resource.Or release Recycling module 186, for before carrying out read operation and terminating, it is judged that described system is shared to the copy of described system shared resource Whether the constraint phase of resource reaches threshold value;If the constraint phase of described system shared resource reaches threshold value, described in compulsory commutation it is then Altogether enjoy the constraint phase of resource, and reclaim the original version of described system shared resource.
Power subsystem 190 receives external power or internal power under the control of controller 180 and provides operation each unit Suitable electric power needed for part and assembly.
Various embodiment described herein can be to use such as computer software, hardware or its any combination of calculating Machine computer-readable recording medium is implemented.Implementing for hardware, embodiment described herein can be by using application-specific IC (ASIC), digital signal processor (DSP), digital signal processing device (DSPD), programmable logic device (PLD), scene can Program gate array (FPGA), processor, controller, microcontroller, microprocessor, be designed to perform function described herein At least one in electronic unit is implemented, and in some cases, such embodiment can be implemented in controller 180. Software is implemented, the embodiment of such as process or function can with allow to perform the single of at least one function or operation Software module is implemented.Software code can be come by the software application (or program) write with any suitable programming language Implementing, software code can be stored in memorizer 160 and be performed by controller 180.
As shown in Figure 1 mobile terminal 100 may be constructed such that utilize via frame or packet transmission data all if any Line and wireless communication system and satellite-based communication system operate.
The communication system being wherein operable to according to the mobile terminal of the present invention is described referring now to Fig. 2.
Such communication system can use different air interfaces and/or physical layer.Such as, communication system use Air interface includes such as frequency division multiple access (FDMA), time division multiple acess (TDMA), CDMA (CDMA) and universal mobile communications system System (UMTS) (especially, Long Term Evolution (LTE)), global system for mobile communications (GSM) etc..As non-limiting example, under The description in face relates to cdma communication system, but such teaching is equally applicable to other type of system.
With reference to Fig. 2, cdma wireless communication system can include multiple mobile terminal 100, multiple base station (BS) 270, base station Controller (BSC) 275 and mobile switching centre (MSC) 280.MSC280 is configured to and Public Switched Telephony Network (PSTN) 290 form interface.MSC280 is also structured to and the BSC275 formation interface that can be couple to base station 270 via back haul link. If back haul link can construct according to any one in the interface that Ganji knows, described interface includes such as E1/T1, ATM, IP, PPP, frame relay, HDSL, ADSL or xDSL.It will be appreciated that system as shown in Figure 2 can include multiple BSC2750.
Each BS270 can service one or more subregion (or region), by multidirectional antenna or the sky of sensing specific direction Each subregion that line covers is radially away from BS270.Or, each subregion can be by for two or more of diversity reception Antenna covers.Each BS270 may be constructed such that support multiple frequencies distribution, and the distribution of each frequency has specific frequency spectrum (such as, 1.25MHz, 5MHz etc.).
Intersecting that subregion and frequency are distributed can be referred to as CDMA Channel.BS270 can also be referred to as base station transceiver System (BTS) or other equivalent terms.In this case, term " base station " may be used for broadly representing single BSC275 and at least one BS270.Base station can also be referred to as " cellular station ".Or, each subregion of specific BS270 can be claimed For multiple cellular stations.
As shown in Figure 2, broadcast singal is sent in system the mobile terminal operated by broadcsting transmitter (BT) 295 100.Broadcast reception module 111 is arranged on mobile terminal 100 and sentences the broadcast that reception is sent by BT295 as shown in Figure 1 Signal.In fig. 2 it is shown that several global positioning systems (GPS) satellite 300.Satellite 300 helps to position multiple mobile terminals At least one in 100.
In fig. 2, depict multiple satellite 300, it is understood that be, it is possible to use any number of satellite obtain useful Location information.As a typical operation of wireless communication system, it is reverse that BS270 receives from various mobile terminals 100 Link signal.Mobile terminal 100 generally participates in call, information receiving and transmitting communicates with other type of.It is every that certain base station 270 receives Individual reverse link signal is processed in specific BS270.The data obtained are forwarded to the BSC275 being correlated with.BSC provides Call resource distribution and the mobile management function of the coordination of soft switching process included between BS270.BSC275 also will receive Data be routed to MSC280, it provides the extra route service for forming interface with PSTN290.Similarly, PSTN290 Forming interface with MSC280, MSC Yu BSC275 forms interface, and BSC275 correspondingly controls BS270 to be believed by forward link Number it is sent to mobile terminal 100.
Based on above-mentioned mobile terminal hardware configuration and communication system, each embodiment of the present invention is proposed.
Due in prior art, when accessing terminal system and sharing data, such as when carrying out garbage files scanning, first Access lock resource, the access of data could be realized on the premise of obtaining lock resource, and use lock mechanism to realize data access There is inefficient problem in concordance.
To this end, the present invention proposes a solution, copy mechanism is used to substitute existing lock mechanism, it is ensured that read-write behaviour When making to share resource, substantially need not take latching operation, promote the access speed sharing resource to a certain extent, save data and sweep Retouching the time, the control to shared resource is more flexible.
First the concordance of data, so-called data consistency, it is simply that when multiple users try concurrently to access are introduced Individual data base, when their affairs use identical data simultaneously, it may occur that lose renewal, undetermined dependency, no The problems such as consistent analysis and illusion reading.
Such as, in the case of data have multiple copies, if network, server or software failure, can cause Part copy writes successfully, and part copy writes unsuccessfully.These data resulted between each copy are inconsistent, and data content rushes Prominent.In practice, the situation causing data inconsistent has a variety of, and presentation style is the most varied, and such as data update and return Operation failure, in fact data have been updated successfully at storage server.
The logical relation that data consistency is often referred between associated data is the most correct and complete.And data storage is consistent Property model then may be considered a kind of agreement between storage system and data consumer.
Specifically, as it is shown on figure 3, the present invention proposes the first embodiment of a kind of resource access device, including: receiver module 201, judge module 202 and read operation module 203, wherein:
Receiver module 201, for receiving the access operation application to system shared resource, the class of described access operation application Type includes read operation and write operation;
Judge module 202, if the type for current access operation application is read operation type, then judges what application accessed Whether system shared resource is in the constraint phase;
Read operation module 203, if the system shared resource for application access is in the constraint phase, then shares described system The copy of resource carries out read operation, otherwise, the original version of described system shared resource is carried out read operation.
In the present embodiment, the access to system shared resource includes the read operation to system shared resource and write operation, its In, may be simultaneously present multiple read operation, and there is multiple write operation simultaneously, or one or more read operation and one or Multiple write operations are also deposited.
When receiving the access operation application to system shared resource, resolve this access operation application, obtain accessing behaviour The type making to apply for is read operation or write operation.Generally, read operation is then to read system shared resource data, and write operation is then System shared resource data are modified.
If the type of current access operation application is read operation type, then judge that system shared resource that application accesses is whether It is in the constraint phase.
Wherein, the constraint phase is to set up during the write operation to system shared resource, in the present embodiment, is accessing When the type of operation application is write operation type, set up copy for system shared resource, then copy is modified, and for institute State copy and set up the constraint phase.
It is to say, when the type of access operation application is write operation type, it needs original old data are made one Secondary backup, then modifies to Backup Data, revise complete after, and the old data constraint phase release after realize again old data money The recovery in source.
The present embodiment uses copy mechanism to substitute existing lock mechanism, and adds a constraint phase so that deposit at the same time When read-write operation, reduce read operation and the waiting time of write operation, promote the speed of the access to system resource to a certain extent Degree.
Owing to may be simultaneously present read operation and write operation, therefore, the type in current access operation application is read operation During type, it is necessary first to judge whether the system shared resource that application accesses is in the constraint phase, write operation application the most whether is had to visit Asked, and set up and have copy, and set up the constraint phase for amended copy.
If the system shared resource that application accesses is in the constraint phase, then show that the system shared resource that present application accesses enters Went write operation and foundation had copy, now, the copy of system shared resource was carried out read operation, if the system that application accesses is altogether Enjoy resource and be not at the constraint phase, then show the system shared resource write operation the most simultaneously that present application accesses, now, directly Connect the original version to system shared resource and carry out read operation.
The present embodiment is owing to have employed copy mechanism so that the control to shared resource is more flexible.Wherein, for reading behaviour Make, can directly shared resource (original version or copy) be conducted interviews;For write operation, then need to make original old data Once back up, then Backup Data is modified, and set up the constraint phase.Present mechanism ensure that in read-write operation shared system During resource, it is ensured that the concordance of data, and substantially need not take latching operation, it is possible to promote the access of resource to a certain extent Speed, thus save the data scanning time.
In the embodiment above, it should be noted that after write operation occurs, it is necessary to wait and all opening in the constraint phase The reading thread having begun to before beginning terminates, and just can be updated operation, to ensure that the concordance of data accesses.
Specifically, when the type of current access operation application is write operation type, it is judged that to described system shared resource All read operations whether terminate;If all read operations to described system shared resource terminate, then it is that described system shares money Copy is set up in source, modifies described copy, to ensure to access the concordance of data.
As shown in Figure 4, the present invention proposes the second embodiment of a kind of resource access device, and this embodiment is real with above-mentioned first The difference executing example is, described device also includes:
Write operation module 204, if the type for current access operation application is write operation type, is then that described system is total to Enjoy resource and set up copy, described copy is modified, and sets up the constraint phase for described copy.
If as it was previously stated, the type of current access operation application is write operation type, then building for described system shared resource Vertical copy, modifies to described copy, and sets up the constraint phase for described amended copy.
As it is shown in figure 5, the present invention proposes the 3rd embodiment of a kind of resource access device, this embodiment is real with above-mentioned second The difference executing example is, described device also includes: release recycling module 205;
As a kind of embodiment, release recycling module 205 for described system being shared money in described read operation module The copy in source carries out after read operation terminates, releasing the constraint phase of described system shared resource, and reclaiming described system shared resource Original version.
Specifically, after terminating the access of system shared resource, the read operation and the write operation that i.e. exist concurrently with all are tied Shu Hou, can share with deactivation system the constraint phase of resource, and reclaims the original version of described system shared resource, to ensure follow-up number According to the accuracy accessed.
Further, as another embodiment, release recycling module 205 for described system shared resource Copy carries out before read operation terminates, it is judged that whether the constraint phase of described system shared resource reaches threshold value;If described system is shared The constraint phase of resource reaches threshold value, then the constraint phase of system shared resource described in compulsory commutation, and reclaims the shared money of described system The original version in source.
Specifically, for being in the system shared resource of constraint phase, in order to avoid certain read operation thread is ceaselessly carried out, Causing data access to be normally carried out, the present embodiment is provided with certain threshold value to the constraint phase, reaches when the constraint phase of resource During threshold value, application is forced to release the resource constraint phase.
The present embodiment is owing to have employed copy mechanism so that the control to shared resource is more flexible.Wherein, for reading behaviour Make, can directly shared resource (original version or copy) be conducted interviews;For write operation, then need to make original old data Once back up, then Backup Data modified, revise complete after, and the old data constraint phase release after realize old data again The recovery of resource.Present mechanism ensure that when read-write operation shares resource, it is ensured that the concordance of data, and substantially need not Take latching operation, it is possible to promote the access speed of resource to a certain extent, thus save the data scanning time;And by the constraint phase Releasing, it is ensured that follow-up data access accuracy.
As shown in Figure 6, the present invention proposes a kind of resource access method first embodiment, including:
Step S101, receives the access operation application to system shared resource, and the type of described access operation application includes Read operation and write operation;
In the present embodiment, the access to system shared resource includes the read operation to system shared resource and write operation, its In, may be simultaneously present multiple read operation, and there is multiple write operation simultaneously, or one or more read operation and one or Multiple write operations are also deposited.
Step S102, it is judged that access the type of operation application;
When receiving the access operation application to system shared resource, resolve this access operation application, obtain accessing behaviour The type making to apply for is read operation or write operation.Generally, read operation is then to read system shared resource data, and write operation is then System shared resource data are modified.
Step S103, if the type of current access operation application is read operation type, then judges that the system that application accesses is total to Enjoy whether resource is in the constraint phase;
Wherein, the constraint phase is to set up during the write operation to system shared resource, in the present embodiment, is accessing behaviour When the type making to apply for is write operation type, sets up copy for system shared resource, then copy is modified, and be described The constraint phase set up by copy.
It is to say, when the type of access operation application is write operation type, it needs original old data are made one Secondary backup, then modifies to Backup Data, revise complete after, and the old data constraint phase release after realize again old data money The recovery in source.
The present embodiment uses copy mechanism to substitute existing lock mechanism, and adds a constraint phase so that deposit at the same time When read-write operation, reduce read operation and the waiting time of write operation, promote the speed of the access to system resource to a certain extent Degree.
Owing to may be simultaneously present read operation and write operation, therefore, the type in current access operation application is read operation During type, it is necessary first to judge whether the system shared resource that application accesses is in the constraint phase, write operation application the most whether is had to visit Asked, and set up and have copy, and set up the constraint phase for amended copy.
Step S104, if the system shared resource that application accesses is in constraint phase, the then pair to described system shared resource Originally read operation is carried out;
Step S105, if the system shared resource that application accesses is not at the constraint phase, then to described system shared resource Original version carries out read operation.
If the system shared resource that application accesses is in the constraint phase, then show that the system shared resource that present application accesses enters Went write operation and foundation had copy, now, the copy of system shared resource was carried out read operation, if the system that application accesses is altogether Enjoy resource and be not at the constraint phase, then show the system shared resource write operation the most simultaneously that present application accesses, now, directly Connect the original version to system shared resource and carry out read operation.
Step S106, if the type of current access operation application is write operation type, then builds for described system shared resource Vertical copy, modifies to described copy, and sets up the constraint phase for described copy.
If as it was previously stated, the type of current access operation application is write operation type, then building for described system shared resource Vertical copy, modifies to described copy, and sets up the constraint phase for described amended copy.
The present embodiment is owing to have employed copy mechanism so that the control to shared resource is more flexible.Wherein, for reading behaviour Make, can directly shared resource (original version or copy) be conducted interviews;For write operation, then need to make original old data Once back up, then Backup Data is modified, and set up the constraint phase.Present mechanism ensure that in read-write operation shared system During resource, it is ensured that the concordance of data, and substantially need not take latching operation, it is possible to promote the access of resource to a certain extent Speed, thus save the data scanning time.
In the embodiment above, it should be noted that after write operation occurs, it is necessary to wait and all opening in the constraint phase The reading thread having begun to before beginning terminates, and just can be updated operation, to ensure that the concordance of data accesses.
Specifically, when the type of current access operation application is write operation type, it is judged that to described system shared resource All read operations whether terminate;If all read operations to described system shared resource terminate, then it is that described system shares money Copy is set up in source, modifies described copy, to ensure to access the concordance of data.
As it is shown in fig. 7, the present invention proposes a kind of resource access method the second embodiment, this embodiment is implemented with above-mentioned first The difference of example is, the copy of described system shared resource is being carried out after read operation terminates by the present embodiment, releases described system Share the constraint phase of resource, and reclaim the original version of described system shared resource.
Therefore, in the present embodiment, in above-mentioned steps S104: if the system shared resource that application accesses is in the constraint phase, After then the copy to described system shared resource carries out read operation, the method can also include:
Step S107, is carrying out the copy of described system shared resource after read operation terminates, is releasing described system and share The constraint phase of resource, and reclaim the original version of described system shared resource.
Specifically, after terminating the access of system shared resource, the read operation and the write operation that i.e. exist concurrently with all are tied Shu Hou, can share with deactivation system the constraint phase of resource, and reclaims the original version of described system shared resource, to ensure follow-up number According to the accuracy accessed.
The present embodiment is owing to have employed copy mechanism so that the control to shared resource is more flexible.Wherein, for reading behaviour Make, can directly shared resource (original version or copy) be conducted interviews;For write operation, then need to make original old data Once back up, then Backup Data modified, revise complete after, and the old data constraint phase release after realize old data again The recovery of resource.Present mechanism ensure that when read-write operation shares resource, it is ensured that the concordance of data, and substantially need not Take latching operation, it is possible to promote the access speed of resource to a certain extent, thus save the data scanning time;And by the constraint phase Releasing, it is ensured that follow-up data access accuracy.
As shown in Figure 8, the present invention proposes a kind of resource access method the 3rd embodiment, and this embodiment is implemented with above-mentioned first The difference of example is, the present embodiment is the constraint phase to set up threshold value, and the copy of described system shared resource is being carried out read operation Before end, if the constraint phase of described system shared resource reaches threshold value, then the constraint phase of system shared resource described in compulsory commutation, And reclaim the original version of described system shared resource.
Therefore, in the present embodiment, in above-mentioned steps S104: if the system shared resource that application accesses is in the constraint phase, After then the copy to described system shared resource carries out read operation, also include:
Step S108, before carrying out read operation and terminating, it is judged that described system is shared to the copy of described system shared resource Whether the constraint phase of resource reaches threshold value;
Step S109, if the constraint phase of described system shared resource reaches threshold value, then system described in compulsory commutation shares money The constraint phase in source, and reclaim the original version of described system shared resource.
Specifically, for being in the system shared resource of constraint phase, in order to avoid certain read operation thread is ceaselessly carried out, Causing data access to be normally carried out, the present embodiment is provided with certain threshold value to the constraint phase, reaches when the constraint phase of resource During threshold value, application is forced to release the resource constraint phase.
Below as a example by scanning garbage files, embodiment of the present invention scheme is described in detail:
Owing to the operating system of present mobile terminal is the most all multitask and multithreading, carrying out rubbish scanning Meanwhile, also there will be other processes or thread and the resource of scanning is conducted interviews, so, will result in resource-sharing operation.
The concordance that prior art uses lock mechanism to realize data in systems accesses and there is efficiency and scaling problem, Wherein, efficiency is embodied in: the realization of lock mechanism needs the atomization to internal memory to access, and this access operation can destroy flowing water Line operates, and reduces pipeline efficiency.It addition, in the case of using Read-Write Locks mechanism, writing lock is exclusive lock, it is impossible to realize writing Lock and the concurrent operations of read lock, reduce performance next time in some application;Scaling concern is embodied in: when in system, CPU quantity increases The when of many, the synchronization of access efficiency that employing lock mechanism realizes data is on the low side.And along with increasing of CPU quantity, efficiency reduces, It is poor that the data consistency that lock mechanism realizes as can be seen here accesses autgmentability.
Embodiment of the present invention scheme, by using copy mechanism so that the control to shared resource is more flexible.For reading Operation, can directly conduct interviews to shared resource;For write operation, original old data are once backed up, so by its needs Afterwards Backup Data is modified, revise complete after, and the old data constraint phase release after realize the recovery of old data resource again. Here adding a constraint phase, after write operation occurs, it has to wait for all having begun to before the constraint phase starts Reading thread terminate, just can be updated operation.Present mechanism ensure that when read-write operation shares resource, substantially need not Take latching operation, it is possible to promote the access speed of resource to a certain extent, thus save rubbish sweep time.
More specifically, as it is shown in figure 9, for implementing the present invention program, corresponding function can be arranged in system framework Module, such as may include that resource bid management module, resource constraint period management module and replica management module.Wherein, each merit The function of energy module is as follows:
Resource bid management module: when needs access system resources, needs to submit operation application to this module.Resource Shen Module please be manage and corresponding logic can be performed according to the action type of application.
A, write operation type.This module can call replica management module, applies for newly-built copy.
B, read operation type.This module can resource that first inquiry application accesses in resource constraint period management module whether It is in the constraint phase.If being in the constraint phase, thread now can be directed to new resources and conduct interviews.Otherwise, money is directly accessed Source.
Resource constraint period management module: after this module receives resource constraint phase inquiry request, can search for locally registered Resource information, if searching the resource information of request, then mean had thread that this resource was initiated write operation, Now return resource and be in the constraint phase.If not searching, it is meant that resource can directly access, now returning resource and being not at The constraint phase.The old resource being in the constraint phase is also constantly monitored by this module, at the end of the access of old resource, calls pair This management module, application releases the resource constraint phase.There is certain threshold value the constraint phase, when the constraint phase of resource reaches threshold value, still So not being released from, it also can call replica management module, forces application to release the resource constraint phase.Meanwhile, move from this module Except corresponding resource information.
Replica management module: after this module receives the instruction of newly-built copy, can copy a resource, and resource be believed simultaneously Breath is registered to constraint phase resource management's den of monsters.After receiving the instruction releasing the resource constraint phase, it can reclaim old resource, uses pair This substitution of resources.
It is to ensure that when read-write operation shares resource by such scheme, substantially need not take latching operation, it is possible to Promote the access speed of resource to a certain extent, thus save rubbish sweep time.
The present embodiment is owing to have employed copy mechanism so that the control to shared resource is more flexible.Wherein, for reading behaviour Make, can directly shared resource (original version or copy) be conducted interviews;For write operation, then need to make original old data Once back up, then Backup Data modified, revise complete after, and the old data constraint phase release after realize old data again The recovery of resource.Present mechanism ensure that when read-write operation shares resource, it is ensured that the concordance of data, and substantially need not Take latching operation, it is possible to promote the access speed of resource to a certain extent, thus save the sweep time of junk data;And pass through The releasing of constraint phase, it is ensured that the accuracy that follow-up data accesses.
It should be noted that in this article, term " includes ", " comprising " or its any other variant are intended to non-row Comprising of his property, so that include that the process of a series of key element, method, article or device not only include those key elements, and And also include other key elements being not expressly set out, or also include intrinsic for this process, method, article or device Key element.In the case of there is no more restriction, statement " including ... " key element limited, it is not excluded that including this The process of key element, method, article or device there is also other identical element.
The invention described above embodiment sequence number, just to describing, does not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art is it can be understood that arrive above-described embodiment side Method can add the mode of required general hardware platform by software and realize, naturally it is also possible to by hardware, but a lot of in the case of The former is more preferably embodiment.Based on such understanding, prior art is done by technical scheme the most in other words The part going out contribution can embody with the form of software product, and this computer software product is stored in a storage medium In (such as ROM/RAM, magnetic disc, CD), including some instructions with so that a station terminal equipment (can be mobile phone, computer, take Business device, air-conditioner, or the network equipment etc.) perform the method described in each embodiment of the present invention.
These are only the preferred embodiments of the present invention, not thereby limit the scope of the claims of the present invention, every utilize this Equivalent structure or equivalence flow process that bright description and accompanying drawing content are made convert, or are directly or indirectly used in other relevant skills Art field, is the most in like manner included in the scope of patent protection of the present invention.

Claims (10)

1. a resource access device, it is characterised in that including:
Receiver module, for receiving the access operation application to system shared resource, the type of described access operation application includes Read operation and write operation;
Judge module, if the type for current access operation application is read operation type, then judges that the system that application accesses is total to Enjoy whether resource is in the constraint phase;
Read operation module, if the system shared resource for application access is in the constraint phase, then to described system shared resource Copy carries out read operation, otherwise, the original version of described system shared resource is carried out read operation.
Device the most according to claim 1, it is characterised in that described device also includes:
Write operation module, if the type for current access operation application is write operation type, is then described system shared resource Set up copy, described copy is modified, and sets up the constraint phase for described copy.
Device the most according to claim 2, it is characterised in that
Described write operation module, is additionally operable to judge whether terminate all read operations of described system shared resource;If to described All read operations of system shared resource terminate, then set up copy for described system shared resource, modify described copy.
4. according to the device described in claim 1,2 or 3, it is characterised in that described device also includes:
Release recycling module, terminate for the copy of described system shared resource being carried out read operation in described read operation module After, release the constraint phase of described system shared resource, and reclaim the original version of described system shared resource.
5. according to the device described in claim 1,2 or 3, it is characterised in that described device also includes:
Release recycling module, for before the copy of described system shared resource being carried out read operation and terminates, it is judged that described system Whether the constraint phase sharing resource reaches threshold value;If the constraint phase of described system shared resource reaches threshold value, then compulsory commutation institute State the constraint phase of system shared resource, and reclaim the original version of described system shared resource.
6. a resource access method, it is characterised in that including:
Receiving the access operation application to system shared resource, the type of described access operation application includes read operation and writes behaviour Make;
If the type of current access operation application is read operation type, then judge whether the system shared resource that application accesses is in The constraint phase;
If the system shared resource that application accesses is in the constraint phase, then the copy of described system shared resource is carried out read operation, Otherwise, the original version of described system shared resource is carried out read operation.
Method the most according to claim 6, it is characterised in that the described reception access operation application to system shared resource Step after, also include:
If the type of current access operation application is write operation type, then set up copy for described system shared resource, to described Copy is modified, and sets up the constraint phase for described copy.
Method the most according to claim 7, it is characterised in that if the type of current access operation application is write operation class Type, then setting up copy for described system shared resource, before the step modify also included described copy:
Judge whether all read operations of described system shared resource are terminated;
If all read operations to described system shared resource terminate, then perform step: set up pair for described system shared resource This, modify to described copy.
9. according to the method described in claim 6,7 or 8, it is characterised in that if at the system shared resource of described application access In the constraint phase, then, after the copy to described system shared resource carries out the step of read operation, also include:
The copy of described system shared resource is being carried out after read operation terminates, is releasing the constraint phase of described system shared resource, And reclaim the original version of described system shared resource.
10. according to the method described in claim 6,7 or 8, it is characterised in that if at the system shared resource of described application access In the constraint phase, then, after the copy to described system shared resource carries out the step of read operation, also include:
Before the copy of described system shared resource being carried out read operation and terminates, it is judged that the constraint phase of described system shared resource is No reach threshold value;
If the constraint phase of described system shared resource reaches threshold value, then the constraint phase of system shared resource described in compulsory commutation, and Reclaim the original version of described system shared resource.
CN201610619350.5A 2016-07-29 2016-07-29 Resource access method and device Pending CN106250212A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610619350.5A CN106250212A (en) 2016-07-29 2016-07-29 Resource access method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610619350.5A CN106250212A (en) 2016-07-29 2016-07-29 Resource access method and device

Publications (1)

Publication Number Publication Date
CN106250212A true CN106250212A (en) 2016-12-21

Family

ID=57606517

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610619350.5A Pending CN106250212A (en) 2016-07-29 2016-07-29 Resource access method and device

Country Status (1)

Country Link
CN (1) CN106250212A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783243A (en) * 2018-12-28 2019-05-21 南京华飞数据技术有限公司 It is a kind of based on reserved copy and duplicate switching multi-thread data without lock reading/writing method
CN110837422A (en) * 2019-10-12 2020-02-25 上海眼控科技股份有限公司 Multithreading access method, multithreading access system, electronic terminal and storage medium
CN111857545A (en) * 2019-04-28 2020-10-30 深信服科技股份有限公司 Method, system, equipment and computer medium for judging conflict of read-write lock

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104079600A (en) * 2013-03-27 2014-10-01 中兴通讯股份有限公司 File storage method, file storage device, file access client and metadata server system
CN104715001A (en) * 2013-12-12 2015-06-17 国际商业机器公司 Method and system performing wirite operation on shared resource in cluster of data processing system
US20150286563A1 (en) * 2014-04-07 2015-10-08 Oracle International Corporation Read and write operations on shared data resources in parallel processing systems
CN105069081A (en) * 2015-07-31 2015-11-18 北京金山安全软件有限公司 Shared resource access method and device
CN105740295A (en) * 2014-12-12 2016-07-06 中国移动通信集团公司 Processing method and device for distributed data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104079600A (en) * 2013-03-27 2014-10-01 中兴通讯股份有限公司 File storage method, file storage device, file access client and metadata server system
CN104715001A (en) * 2013-12-12 2015-06-17 国际商业机器公司 Method and system performing wirite operation on shared resource in cluster of data processing system
US20150286563A1 (en) * 2014-04-07 2015-10-08 Oracle International Corporation Read and write operations on shared data resources in parallel processing systems
CN105740295A (en) * 2014-12-12 2016-07-06 中国移动通信集团公司 Processing method and device for distributed data
CN105069081A (en) * 2015-07-31 2015-11-18 北京金山安全软件有限公司 Shared resource access method and device

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
JIJO: "内核同步机制-RCU同步机制-嵌入式系统书撰写", 《HTTP://WWW.360DOC.COM/CONTENT/09/0805/00/36491_4675691.SHTML》 *
吴国伟编著: "《Linux内核分析与高级教程》", 31 August 2012, 清华大学出版社 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109783243A (en) * 2018-12-28 2019-05-21 南京华飞数据技术有限公司 It is a kind of based on reserved copy and duplicate switching multi-thread data without lock reading/writing method
CN111857545A (en) * 2019-04-28 2020-10-30 深信服科技股份有限公司 Method, system, equipment and computer medium for judging conflict of read-write lock
CN111857545B (en) * 2019-04-28 2023-12-29 深信服科技股份有限公司 Read-write lock conflict judging method, system, equipment and computer medium
CN110837422A (en) * 2019-10-12 2020-02-25 上海眼控科技股份有限公司 Multithreading access method, multithreading access system, electronic terminal and storage medium

Similar Documents

Publication Publication Date Title
CN104902075B (en) Multi-screen interaction method and system
CN105915623A (en) Device and method of processing application installation package
US8078228B2 (en) Method and apparatus for displaying messages in an idle state of mobile terminal, driving an application for an idle state in a mobile terminal and providing idle state contents for a mobile terminal
CN107239302A (en) A kind of firmware upgrade method, terminal and server
CN105159533A (en) Mobile terminal and automatic verification code input method thereof
KR20100072115A (en) Mobile terminal and nfc service providing method thereof
CN105100059A (en) Method, device and system for processing high-concurrent requests
CN106559563B (en) Image data processing method and device
CN106293124A (en) Input method switching device, terminal and method
CN105740008A (en) Apparatus and method for forbidding chained startup of applications
CN106528576B (en) Page search method, terminal, system and storage medium
CN106874097A (en) The multi-screen display method and device of a kind of terminal screen
CN106020725A (en) Application file processing apparatus and method
CN110109528A (en) Management-control method, mobile terminal and the computer readable storage medium of application program
CN106250212A (en) Resource access method and device
CN106502526A (en) A kind of back-stage management method and terminal
CN106507185A (en) A kind of information processing method and projection terminal
CN106250017A (en) A kind of mobile terminal and multitask management process
CN105792181B (en) A kind of data migration method of analog card, mobile terminal and TSM platform
CN105681434B (en) Mobile terminal application method of data synchronization and device
CN106506364A (en) A kind of cut-in method, client and routing server
CN105897700A (en) Information processing method, terminal and server
CN105657733A (en) Network stabilization control device and method
CN106557555A (en) media playing method and device
CN105744069B (en) A kind of information transferring method, terminal and system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20161221