CN103279417A - Methods and device for detecting abnormal locking - Google Patents

Methods and device for detecting abnormal locking Download PDF

Info

Publication number
CN103279417A
CN103279417A CN2013102214778A CN201310221477A CN103279417A CN 103279417 A CN103279417 A CN 103279417A CN 2013102214778 A CN2013102214778 A CN 2013102214778A CN 201310221477 A CN201310221477 A CN 201310221477A CN 103279417 A CN103279417 A CN 103279417A
Authority
CN
China
Prior art keywords
lock
file
release
code
locking
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
CN2013102214778A
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.)
Fuzhou Rockchip Electronics Co Ltd
Original Assignee
Fuzhou Rockchip Electronics 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 Fuzhou Rockchip Electronics Co Ltd filed Critical Fuzhou Rockchip Electronics Co Ltd
Priority to CN2013102214778A priority Critical patent/CN103279417A/en
Publication of CN103279417A publication Critical patent/CN103279417A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides methods and a device for detecting abnormal locking directly and simply. One method includes a program is started; when the program is locked, an ID of locking is generated, a locking marked file is generated in a set path, contents or file name of the locking marked file is related to the ID of locking, time of locking, code file name or line number of locked code; and when the program is unlocked, the related locking marked file is deleted according to the ID of locking to be unlocked. The other method for detecting abnormal locking includes that when the program is locked, an ID of locking is generated, contents related to the locking information are recorded in a locking chronological file; and when the program is unlocked, contents related to the unlocking information are recorded in the locking chronological file. The methods are convenient to operate, and whether the problem of abnormal locking occurs in the code file or not and the reason can be discovered directly through naked-eye observation.

Description

Detect the unusual method and apparatus of lock
Technical field
The present invention relates to computer realm, relate in particular to the unusual method and apparatus of lock in a kind of test computer programs operational process.
Background technology
In various systems development process, all need to use lock to control and share and concurrent visit.Lock also claims mutual exclusion lock, for example in sharing, when a file is used by a user, locks, and other people just temporarily can not use, and need wait until and just can visit use after the release.If therefore lock does not reasonably discharge, deadlock will appear.The investigation of deadlock is a FAQs of system debug.At present, main deadlock discovery mechanism mainly is the checking mechanism that depends on language itself in the industry, or daily record.But use aforesaid way and make that the analysis of lock is very complicated, also not directly perceived with investigation, analyst's ability is had high requirement, and can spend the extensive work time.
Summary of the invention
The objective of the invention is to, a kind of directly perceived, easy unusual method and apparatus of detection lock is provided.
For achieving the above object, the invention provides a kind of unusual method of lock that detects, may further comprise the steps:
Start-up routine;
During lock program, generate the ID of lock, generate the lock tab file in the path of setting, the row of the interior perhaps filename of lock tab file and the ID of lock, the time that locks, code file name or the code that locks is number relevant;
During release, according to the ID of the lock of release, the corresponding lock of deletion tab file.
Preferably, behind the step start-up routine, carry out step:
Found lock trace file folder;
During lock program, in lock trace file folder, generate the lock tab file.
Preferably, in lock program, when generating the ID of lock, write the relevant content of information of this locking in the lock chronological file, the information of this locking comprises the ID of lock, the state of the time that locks, code file name, the code that locks or lock, and stores;
During release, write the relevant content of information of this release in the lock chronological file, the information of this release comprises the code of the ID of lock, release time, code file name, release or the state of lock, and stores.
Preferably, described lock chronological file is positioned at the identical file folder with the lock tab file.
The present invention also provides another kind of detection lock unusual method, may further comprise the steps:
Start-up routine;
During lock program, generate the ID of lock, write the relevant content of information of this locking in the lock chronological file, the information of this locking comprises the ID of lock, the state of the time that locks, code file name, the code that locks or lock, and stores;
During release, write the relevant content of information of this release in the lock chronological file, the information of this release comprises the code of the ID of lock, release time, code file name, release or the state of lock, and stores.
Correspondingly, the invention provides a kind of unusual device of lock that detects, comprise with lower module:
Memory module is used for storage lock tab file;
Start module, be used for start-up routine;
Locking module when being used for lock program, generates the ID of lock, generates the lock tab file in the path of setting, and the row of the interior perhaps filename of lock tab file and the ID of lock, the time that locks, code file name or the code that locks is number relevant;
Separate lock module, when being used for release, according to the ID of the lock of release, the corresponding lock of deletion tab file.
Preferably, described detection is locked in the unusual device,
Start module and also be used for founding lock trace file folder, described lock trace file folder is stored in the memory module;
When locking module is used for lock program, in lock trace file folder, generate the lock tab file.
Preferably, locking module also is used in lock program, when generating the ID of lock, writes the relevant content of information of this locking in the lock chronological file, and the information of this locking comprises the ID of lock, the state of the time that locks, code file name, the code that locks or lock;
When separating lock module also for release, write the relevant content of information of this release in the lock chronological file, the information of this release comprises the code of the ID of lock, release time, code file name, release or the state of lock;
Described lock chronological file is stored in the memory module.
More preferably, described lock chronological file presss from both sides with the identical file that the lock tab file is positioned at memory module.
The invention provides the another kind of unusual device of lock that detects, comprise with lower module:
Start module, be used for start-up routine;
Locking module when being used for lock program, generates the ID of lock, writes the relevant content of information of this locking in the lock chronological file, and the information of this locking comprises the ID of lock, the state of the time that locks, code file name, the code that locks or lock;
Separate lock module, when being used for release, write the relevant content of information of this release in the lock chronological file, the information of this release comprises the code of the ID of lock, release time, code file name, release or the state of lock.
Lock the checking mechanism that depends on language itself unusually with the prior art analysis, or daily record difference, the present invention generates the ID of lock when lock program, generate the lock tab file number relevant with the row of ID, the time that locks, the code file name of locking or the code that locks in the path of setting; During release, according to the ID of the lock of release, the corresponding lock of deletion tab file.Therefore (when for example deadlock appears in program) checks the lock tab file at once under the unusual situation of lock occurring, if there is the lock of discovery tab file to exist, then the explanation locking is not also removed, can be according to the interior perhaps filename of lock tab file, check the situation of lock, for example Suo position etc.
In another correlation technique of the present invention, when lock program, generate the ID of lock, write the relevant content of information of this locking in the lock chronological file, the information of this locking comprises the ID of lock, the state of the time that locks, code file name, the code that locks or lock; During release, write the relevant content of information of this release in the lock chronological file, the information of this release comprises the code of the ID of lock, release time, code file name, release or the state of lock.Therefore (when for example deadlock appears in program) checks the lock chronological file at once under the unusual situation of lock occurring, can be according to the content of lock chronological file, check the situation of lock, for example Suo position, state (locking or release), and corresponding code position etc.
The present invention is easy to operate, can find whether occur locking unusual problem and reason in the code file very intuitively by visual inspection.And arrangement of the present invention is convenient, and tool free does not need the developer to possess very strong code debugging ability; Simultaneously do not need the developer to participate in the overall process, when reducing to test to developer's dependence.
Description of drawings
Fig. 1 is the process flow diagram of the unusual method of the described detection lock of the specific embodiment of the invention;
Fig. 2 is the Organization Chart of the unusual device of the described detection lock of the specific embodiment of the invention.
Embodiment
As shown in Figure 1, present embodiment provides a kind of unusual method of lock that detects, and may further comprise the steps:
The S101 start-up routine;
During the S102 lock program, generate the ID of lock, generate the lock tab file in lock trace file folder, the interior perhaps filename of lock tab file is the ID of lock, records the time of locking, code file name and the row of the code that locks number in locking tab file; And write the relevant content of information of this locking in the chronological file at lock, and store.The information of this locking comprises the state of the ID of lock, the time that locks, code file name, the code that locks and lock.
The state of described lock has two kinds usually: locking and release, and when locking, the state of lock is locking, during release, the state of lock is release.
In the present embodiment, use the account of the history of lock chronological file record lock, therefore can preset the lock file, will lock chronological file and be placed in one.Analyze the situation of lock for ease of the staff, will lock tab file and also place in the same lock trace file folder.
Among some embodiment, do not adopt the lock chronological file, and use the lock tab file that the situation of lock is analyzed separately, at this moment, when start-up routine, can be according to default scheme, generate a lock trace file folder according to specified path, will lock tab file and be created in this document folder.
During the S103 release, according to the ID of the lock of release, the corresponding lock of deletion tab file, and in the lock chronological file, write the relevant content of information of this release,, and store.The information of this release comprises ID, release time, code file name, the code of release and the state of lock of lock.
Locking or release information related content can directly be lock ID, lock/the release time, the code file name, lock/code of release and the state of lock.Also can be the content of above-mentioned information after according to certain rule transformation, in a word, as long as can make the analyst according to the related content solution read lock ID, lock/the release time, the code file name, lock/code of release and the state of lock.
The lock chronological file also can place in other the path of setting with the lock tab file.For example in the root directory under certain drive.Analyze and search if program has the lock trace file folder of its correspondence can be convenient to the analyst, for example we can be in the operation catalogue of program, and perhaps other position generates a lock trace file folder.
As lock_trace,
There are two types of files the file the inside, overall chronological file and the tab file of single lock.
The lock chronological file: there is the day-to-day account of all locks the inside.
Content as:
0x3f7789 (locking ID at random), xxyyzz.c (code file name), capable number of 555(), 2013-03-03 15:01:02.005 (time), Lock (locking)
0x3f7789 (locking ID at random), xxyyzz.c (code file name), capable number of 577(), 2013-03-03 15:01:07.005 (time), Lock (release)
In locking or release each time, all can increase the similar content of delegation.
The effect of this file is, record locking and release each time after system's operation, can be utilized the situation that takies of this each lock of file analysis.
The lock tab file: can generate a file under the lock_trace file when locking each time, filename is the ID at random of lock.In release, this file can be deleted
The purpose of design tab file is, program occur deadlock possible in, onlinely at once check the lock_trace file, if there is the tab file of discovery to exist, then the explanation locking is also removed, and directly opens tab file, checks the position of lock.
The content of lock tab file is as follows substantially
Xxyyzz.c (code file name), capable number of 577(), 2013-03-03 15:01:07.005 (time)
Design the locking and unlocking function of all shared locks, complete design is as Lock and Unlock
The requirement of Lock function is to carry out following task:
1) generating the ID that locks, can be to generate random number according to the time;
2) record current code filename and row number;
3) time of record locking;
4) lock.
The performed task of Unlock function is:
1) file of deletion Lock function generation;
2) release.
In different embodiment, the lock chronological file can be distinguished use separately with the lock tab file.But the two is combined, more easily the unusual situation of lock in the analysis judgment system.System occurs directly opening the lock_trace catalogue under the possible situation of deadlock, can observe deadlock position by naked eyes.Can also analyze simultaneously the details of lock according to chronological file.
As shown in Figure 2, present embodiment provides a kind of unusual device 20 of lock that detects, and this device can be PC, server or other electronic equipments, comprises with lower module:
Memory module 204 is used for storage lock tab file and lock chronological file;
Start module 201, be used for start-up routine, found lock trace file folder, described lock trace file folder is stored in the memory module;
Locking module 202 when being used for lock program, generates the ID of lock, is generating the lock tab file in lock trace file folder, the file of the lock tab file ID that locks by name, and its content is the row number of the time that locks, code file name and the code that locks; Write the relevant content of information of this locking in the chronological file at lock, the information of this locking comprises the ID of lock, the state of the time that locks, code file name, the code that locks or lock;
Separate lock module 203, when being used for release, according to the ID of the lock of release, the corresponding lock of deletion tab file.When separating lock module also for release, write the relevant content of information of this release in the lock chronological file, the information of this release comprises the code of the ID of lock, release time, code file name, release or the state of lock.
The above only is embodiments of the invention; be not so limit claim of the present invention; every equivalent structure or equivalent flow process conversion that utilizes instructions of the present invention and accompanying drawing content to do; or directly or indirectly be used in other relevant technical fields, all in like manner be included in the scope of patent protection of the present invention.

Claims (10)

1. one kind is detected the unusual method of lock, may further comprise the steps:
Start-up routine;
During lock program, generate the ID of lock, generate the lock tab file in the path of setting, the row of the interior perhaps filename of lock tab file and the ID of lock, the time that locks, code file name or the code that locks is number relevant;
During release, according to the ID of the lock of release, the corresponding lock of deletion tab file.
2. the unusual method of detection lock according to claim 1 is characterized in that, behind the step start-up routine, carries out step:
Found lock trace file folder;
During lock program, in lock trace file folder, generate the lock tab file.
3. unusual method is locked in detection according to claim 1, it is characterized in that, in lock program, when generating the ID of lock, in the lock chronological file, write the relevant content of information of this locking, the information of this locking comprises the state of the ID of lock, the time that locks, code file name, the code that locks or lock, and stores;
During release, write the relevant content of information of this release in the lock chronological file, the information of this release comprises the code of the ID of lock, release time, code file name, release or the state of lock, and stores.
4. the unusual method of detection lock according to claim 3 is characterized in that, described lock chronological file is positioned at the identical file folder with the lock tab file.
5. one kind is detected the unusual method of lock, may further comprise the steps:
Start-up routine;
During lock program, generate the ID of lock, write the relevant content of information of this locking in the lock chronological file, the information of this locking comprises the ID of lock, the state of the time that locks, code file name, the code that locks or lock, and stores;
During release, write the relevant content of information of this release in the lock chronological file, the information of this release comprises the code of the ID of lock, release time, code file name, release or the state of lock, and stores.
6. one kind is detected the unusual device of lock, comprises with lower module:
Memory module is used for storage lock tab file;
Start module, be used for start-up routine;
Locking module when being used for lock program, generates the ID of lock, generates the lock tab file in the path of setting, and the row of the interior perhaps filename of lock tab file and the ID of lock, the time that locks, code file name or the code that locks is number relevant;
Separate lock module, when being used for release, according to the ID of the lock of release, the corresponding lock of deletion tab file.
7. the unusual device of detection lock according to claim 6 is characterized in that described detection is locked in the unusual device,
Start module and also be used for founding lock trace file folder, described lock trace file folder is stored in the memory module;
When locking module is used for lock program, in lock trace file folder, generate the lock tab file.
8. unusual device is locked in detection according to claim 6, it is characterized in that, locking module also is used in lock program, when generating the ID of lock, write the relevant content of information of this locking in the chronological file at lock, the information of this locking comprises the ID of lock, the state of the time that locks, code file name, the code that locks or lock;
When separating lock module also for release, write the relevant content of information of this release in the lock chronological file, the information of this release comprises the code of the ID of lock, release time, code file name, release or the state of lock;
Described lock chronological file is stored in the memory module.
9. the unusual device of detection lock according to claim 8 is characterized in that, described lock chronological file presss from both sides with the identical file that the lock tab file is positioned at memory module.
10. one kind is detected the unusual device of lock, comprises with lower module:
Start module, be used for start-up routine;
Locking module when being used for lock program, generates the ID of lock, writes the relevant content of information of this locking in the lock chronological file, and the information of this locking comprises the ID of lock, the state of the time that locks, code file name, the code that locks or lock;
Separate lock module, when being used for release, write the relevant content of information of this release in the lock chronological file, the information of this release comprises the code of the ID of lock, release time, code file name, release or the state of lock.
CN2013102214778A 2013-06-05 2013-06-05 Methods and device for detecting abnormal locking Pending CN103279417A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2013102214778A CN103279417A (en) 2013-06-05 2013-06-05 Methods and device for detecting abnormal locking

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2013102214778A CN103279417A (en) 2013-06-05 2013-06-05 Methods and device for detecting abnormal locking

Publications (1)

Publication Number Publication Date
CN103279417A true CN103279417A (en) 2013-09-04

Family

ID=49061946

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2013102214778A Pending CN103279417A (en) 2013-06-05 2013-06-05 Methods and device for detecting abnormal locking

Country Status (1)

Country Link
CN (1) CN103279417A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108089926A (en) * 2018-01-08 2018-05-29 马上消费金融股份有限公司 Method, device and equipment for acquiring distributed lock and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0816430A (en) * 1994-06-27 1996-01-19 Mitsubishi Electric Corp Parallel program tracing device
CN1629821A (en) * 2003-12-19 2005-06-22 华为技术有限公司 Method and system for thread deadlock detection of multithread processor
CN101295266A (en) * 2008-06-05 2008-10-29 华为技术有限公司 Method, device and system for detecting and removing deadlock
US20100333110A1 (en) * 2009-06-30 2010-12-30 International Business Machines Corporation Deadlock detection method and system for parallel programs

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0816430A (en) * 1994-06-27 1996-01-19 Mitsubishi Electric Corp Parallel program tracing device
CN1629821A (en) * 2003-12-19 2005-06-22 华为技术有限公司 Method and system for thread deadlock detection of multithread processor
CN101295266A (en) * 2008-06-05 2008-10-29 华为技术有限公司 Method, device and system for detecting and removing deadlock
US20100333110A1 (en) * 2009-06-30 2010-12-30 International Business Machines Corporation Deadlock detection method and system for parallel programs

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108089926A (en) * 2018-01-08 2018-05-29 马上消费金融股份有限公司 Method, device and equipment for acquiring distributed lock and readable storage medium

Similar Documents

Publication Publication Date Title
CN111756575B (en) Performance analysis method and device of storage server and electronic equipment
US8060795B2 (en) Solution for automatically incorporating diagnostic data within screen capture images
US9229738B2 (en) Software development tool for providing user context information to improve message quality at development time
US8291379B2 (en) Runtime analysis of a computer program to identify improper memory accesses that cause further problems
US10235234B2 (en) Method and apparatus for determining failure similarity in computing device
US8881296B2 (en) Marking and obscuring sensitive values in traces
CN107688531A (en) Geo-database integration method of testing, device, computer equipment and storage medium
US20080244332A1 (en) Machine instruction level race condition detection
Sutherland et al. Acquiring volatile operating system data tools and techniques
US10657028B2 (en) Method for replicating production behaviours in a development environment
CN103577310A (en) Method and device for recording software debugging logs
Xu System problem detection by mining console logs
Huang et al. Scaling predictive analysis of concurrent programs by removing trace redundancy
WO2014190427A1 (en) Identifying client states
Cai et al. Lock trace reduction for multithreaded programs
CN107908490A (en) GPU registers reliability verification method and system in a kind of server DC tests
CN113569234B (en) Visual evidence obtaining system for android attack scene reconstruction and implementation method
CN103279417A (en) Methods and device for detecting abnormal locking
Didriksen Forensic analysis of OOXML documents
Fairbanks A technique for measuring data persistence using the ext4 file system journal
Buquerin et al. Digital forensics investigation of the tesla autopilot file system,”
CN113641628B (en) Data quality detection method, device, equipment and storage medium
JP5592828B2 (en) Patch impact analysis apparatus, method and program
CN107656868B (en) Debugging method and system for acquiring thread name by using thread private data
Khanji et al. Database auditing and forensics: Exploration and evaluation

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information

Address after: 350000 Fuzhou Gulou District, Fujian, software Avenue, building 89, No. 18

Applicant after: FUZHOU ROCKCHIP ELECTRONICS CO., LTD.

Address before: 350000 Fuzhou Gulou District, Fujian, software Avenue, building 89, No. 18

Applicant before: Fuzhou Rockchip Semiconductor Co., Ltd.

COR Change of bibliographic data
RJ01 Rejection of invention patent application after publication

Application publication date: 20130904

RJ01 Rejection of invention patent application after publication