Locking wikipedia

Locking wikipedia DEFAULT

Lock and key

For other uses, see Lock and Key (disambiguation).

Mechanical or electronic fastening device

A typical modern padlock and its keys

A lock is a mechanical or electronic fastening device that is released by a physical object (such as a key, keycard, fingerprint, RFID card, security token, coin, etc.), by supplying secret information (such as a number or letter permutation or password), or by a combination thereof or only being able to be opened from one side such as a door chain.

A key is a device that is used to operate a lock (such as to lock or unlock it). A typical key is a small piece of metal consisting of two parts: the bit or blade, which slides into the keyway of the lock and distinguishes between different keys, and the bow, which is left protruding so that torque can be applied by the user. In its simplest implementation, a key operates one lock or set of locks that are keyed alike, a lock/key system where each similarly keyed lock requires the same, unique key.

The key serves as a security token for access to the locked area; locks are meant to only allow persons having the correct key to open it and gain access. In more complex mechanical lock/key systems, two different keys, one of which is known as the master key, serve to open the lock. Common metals include brass, plated brass, nickel silver, and steel.


Premodern history[edit]

Locks have been in use for over 6000 years, with one early example discovered in the ruins of Nineveh, the capital of ancient Assyria.[1] Locks such as this were developed into the Egyptian wooden pin lock, which consisted of a bolt, door fixture or attachment, and key. When the key was inserted, pins within the fixture were lifted out of drilled holes within the bolt, allowing it to move. When the key was removed, the pins fell part-way into the bolt, preventing movement.[2]

The warded lock was also present from antiquity and remains the most recognizable lock and key design in the Western world. The first all-metal locks appeared between the years 870 and 900, and are attributed to the English craftsmen.[3] It is also said that the key was invented by Theodorus of Samos in the 6th century BC.[1]

'The Romans invented metal locks and keys and the system of security provided by wards.'[4]

Affluent Romans often kept their valuables in secure locked boxes within their households, and wore the keys as rings on their fingers. The practice had two benefits: It kept the key handy at all times, while signaling that the wearer was wealthy and important enough to have money and jewellery worth securing.[5]

Drunk man's lock at the bottom (black lock) and a regular modern lock at the top

A special type of lock, dating back to the 17th-18th century, although potentially older as similar locks date back to the 14th century, can be found in the Beguinage of the Belgian city Lier.[6][7] These locks are most likely Gothic locks, that were decorated with foliage, often in a V-shape surrounding the keyhole.[8] They are often called drunk man's lock, however the reference to being drunk may be erroneous as these locks were, according to certain sources, designed in such a way a person can still find the keyhole in the dark, although this might not be the case as the ornaments might have been purely aesthetic.[6][7] In more recent times similar locks have been designed.[9][10]

Modern locks[edit]

With the onset of the Industrial Revolution in the late 18th century and the concomitant development of precision engineering and component standardization, locks and keys were manufactured with increasing complexity and sophistication.

The lever tumbler lock, which uses a set of levers to prevent the bolt from moving in the lock, was invented by Robert Barron in 1778.[11] His double acting lever lock required the lever to be lifted to a certain height by having a slot cut in the lever, so lifting the lever too far was as bad as not lifting the lever far enough. This type of lock is still used today.[12]

The lever tumbler lock was greatly improved by Jeremiah Chubb in 1818.[11] A burglary in Portsmouth Dockyard prompted the British Government to announce a competition to produce a lock that could be opened only with its own key.[5] Chubb developed the Chubb detector lock, which incorporated an integral security feature that could frustrate unauthorized access attempts and would indicate to the lock's owner if it had been interfered with. Chubb was awarded £100 after a trained lock-picker failed to break the lock after 3 months.[13]

In 1820, Jeremiah joined his brother Charles in starting their own lock company, Chubb. Chubb made various improvements to his lock: his 1824 improved design didn't require a special regulator key to reset the lock; by 1847 his keys used six levers rather than four; and he later introduced a disc that allowed the key to pass but narrowed the field of view, hiding the levers from anybody attempting to pick the lock.[14] The Chubb brothers also received a patent for the first burglar-resisting safe and began production in 1835.

The designs of Barron and Chubb were based on the use of movable levers, but Joseph Bramah, a prolific inventor, developed an alternative method in 1784. His lock used a cylindrical key with precise notches along the surface; these moved the metal slides that impeded the turning of the bolt into an exact alignment, allowing the lock to open. The lock was at the limits of the precision manufacturing capabilities of the time and was said by its inventor to be unpickable. In the same year Bramah started the Bramah Locks company at 124 Piccadilly, and displayed the "Challenge Lock" in the window of his shop from 1790, challenging "...the artist who can make an instrument that will pick or open this lock" for the reward of £200. The challenge stood for over 67 years until, at the Great Exhibition of 1851, the American locksmith Alfred Charles Hobbs was able to open the lock and, following some argument about the circumstances under which he had opened it, was awarded the prize. Hobbs' attempt required some 51 hours, spread over 16 days.

The earliest patent for a double-acting pin tumbler lock was granted to American physician Abraham O. Stansbury in England in 1805,[15] but the modern version, still in use today, was invented by American Linus Yale Sr. in 1848.[16] This lock design used pins of varying lengths to prevent the lock from opening without the correct key. In 1861, Linus Yale Jr. was inspired by the original 1840s pin-tumbler lock designed by his father, thus inventing and patenting a smaller flat key with serrated edges as well as pins of varying lengths within the lock itself, the same design of the pin-tumbler lock which still remains in use today.[17] The modern Yale lock is essentially a more developed version of the Egyptian lock.

Despite some improvement in key design since, the majority of locks today are still variants of the designs invented by Bramah, Chubb and Yale.

Types of lock[edit]

With physical keys[edit]

  • Pin tumbler lock: without a key in the lock, the driver pins (blue) are pushed downwards, preventing the plug (yellow) from rotating.

  • Wafer tumbler lock: without a key in the lock, the wafers (red) are pushed down by springs. The wafers nestle into a groove in the lower part of the outer cylinder (green) preventing the plug (yellow) from rotating.

  • Tubular lock: the key pins (red) and driver pins (blue) are pushed towards the front of the lock, preventing the plug (yellow) from rotating. The tubular key has several half-cylinder indentations which align with the pins.

A warded lock uses a set of obstructions, or wards, to prevent the lock from opening unless the correct key is inserted. The key has notches or slots that correspond to the obstructions in the lock, allowing it to rotate freely inside the lock. Warded locks are typically reserved for low-security applications as a well-designed skeleton key can successfully open a wide variety of warded locks.

The pin tumbler lock uses a set of pins to prevent the lock from opening unless the correct key is inserted. The key has a series of grooves on either side of the key's blade that limit the type of lock the key can slide into. As the key slides into the lock, the horizontal grooves on the blade align with the wards in the keyway allowing or denying entry to the cylinder. A series of pointed teeth and notches on the blade, called bittings, then allow pins to move up and down until they are in line with the shear line of the inner and outer cylinder, allowing the cylinder or cam to rotate freely and the lock to open. An additional pin called the master pin is present between the key and driver pins in locks that accept master keys, to allow the plug to rotate at multiple pin elevations.

A wafer tumbler lock is similar to the pin tumbler lock and works on a similar principle. However, unlike the pin lock (where each pin consists of two or more pieces) each wafer is a single piece. The wafer tumbler lock is often incorrectly referred to as a disc tumbler lock, which uses an entirely different mechanism. The wafer lock is relatively inexpensive to produce and is often used in automobiles and cabinetry.

The disc tumbler lock or Abloy lock is composed of slotted rotating detainer discs.

The lever tumbler lock uses a set of levers to prevent the bolt from moving in the lock. In its simplest form, lifting the tumbler above a certain height will allow the bolt to slide past. Lever locks are commonly recessed inside wooden doors or on some older forms of padlocks, including fire brigade padlocks.

A magnetic keyed lock is a locking mechanism whereby the key utilizes magnets as part of the locking and unlocking mechanism. A magnetic key would use from one to many small magnets oriented so that the North and South poles would equate to a combination to push or pull the lock's internal tumblers thus releasing the lock.

With electronic keys[edit]

An electronic lock works by means of an electric current and is usually connected to an access control system. In addition to the pin and tumbler used in standard locks, electronic locks connects the bolt or cylinder to a motor within the door using a part called an actuator. Types of electronic locks include the following:

A keycard lock operates with a flat card of similar dimensions as a credit card. In order to open the door, one needs to successfully match the signature within the keycard.

The lock in a typical remote keyless system operates with a smart key radio transmitter. The lock typically accepts a particular valid code only once, and the smart key transmits a different rolling code every time the button is pressed. Generally the car door can be opened with either a valid code by radio transmission, or with a (non-electronic) pin tumbler key. The ignition switch may require a transponder car key to both open a pin tumbler lock and also transmit a valid code by radio transmission.

A smart lock is an electromechanics lock that gets instructions to lock and unlock the door from an authorized device using a cryptographic key and wireless protocol. Smart locks have begun to be used more commonly in residential areas, often controlled with smartphones.[18][19] Smart locks are used in coworking spaces and offices to enable keyless office entry.[20] In addition, electronic locks cannot be picked with conventional tools.


Locksmithing is a traditional trade, and in most countries requires completion of an apprenticeship. The level of formal education required varies from country to country, from no qualifications required at all in the UK,[21] to a simple training certificate awarded by an employer, to a full diploma from an engineeringcollege. Locksmiths may be commercial (working out of a storefront), mobile (working out of a vehicle), institutional, or investigational (forensic locksmiths). They may specialize in one aspect of the skill, such as an automotive lock specialist, a master key system specialist or a safe technician. Many also act as security consultants, but not all security consultants have the skills and knowledge of a locksmith.[citation needed]

Historically, locksmiths constructed or repaired an entire lock, including its constituent parts. The rise of cheap mass production has made this less common; the vast majority of locks are repaired through like-for-like replacements, high-security safes and strongboxes being the most common exception. Many locksmiths also work on any existing door hardware, including door closers, hinges, electric strikes, and frame repairs, or service electronic locks by making keys for transponder-equipped vehicles and implementing access control systems.

Although the fitting and replacement of keys remains an important part of locksmithing, modern locksmiths are primarily involved in the installation of high quality lock-sets and the design, implementation, and management of keying and key control systems. Locksmiths are frequently required to determine the level of risk to an individual or institution and then recommend and implement appropriate combinations of equipment and policies to create a "security layer" that exceeds the reasonable gain of an intruder.

Key duplication[edit]

Main article: Key duplication

Video showing the process of cutting a key

Traditional key cutting is the primary method of key duplication. It is a subtractive process named after the metalworking process of cutting, where a flat blank key is ground down to form the same shape as the template (original) key. The process roughly follows these stages:

  1. The original key is fitted into a vise in a machine, with a blank attached to a parallel vise which is mechanically linked.
  2. The original key is moved along a guide in a movement which follows the key's shape, while the blank is moved in the same pattern against a cutting wheel by the mechanical linkage between the vices.
  3. After cutting, the new key is deburred by scrubbing it with a metal brush to remove particles of metal which could be dangerously sharp and foul locks.

Modern key cutting replaces the mechanical key following aspect with a process in which the original key is scanned electronically, processed by software, stored, then used to guide a cutting wheel when a key is produced. The capability to store electronic copies of the key's shape allows for key shapes to be stored for key cutting by any party that has access to the key image.

Different key cutting machines are more or less automated, using different milling or grinding equipment, and follow the design of early 20th century key duplicators.

Key duplication is available in many retail hardware stores and as a service of the specialized locksmith, though the correct key blank may not be available. More recently, online services for duplicating keys have become available.


For other uses, see Keyhole (disambiguation).

A keyhole (or keyway) is a hole or aperture (as in a door or lock) for receiving a key.[22] Lock keyway shapes vary widely with lock manufacturer, and many manufacturers have a number of unique profiles requiring a specifically milled key blank to engage the lock's tumblers.


A key pictured in the coat of arms of Siuntio


Keys appear in various symbols and coats of arms, the best-known being that of the Holy See:[23] derived from the phrase in Matthew 16:19 which promises Saint Peter, in Roman Catholic tradition the first pope, the Keys of Heaven. But this is by no means the only case. Many examples are given on Commons.

See also[edit]


  1. ^ abde Vries, N. Cross and D. P. Grant, M. J. (1992). Design Methodology and Relationships with Science: Introduction. Eindhoven: Kluwer Academic Publishers. p. 32. ISBN . Archived from the original on 2016-10-24.
  2. ^Ceccarelli, Marco (2004). International Symposium on History of Machines and Mechanisms. New York: Kluwer Academic Publishers. p. 43. ISBN . Archived from the original on 2016-10-24.
  3. ^"History". Locks.ru. Archived from the original on 2010-04-20. Retrieved 2010-06-10.
  4. ^"Key | lock device". Encyclopedia Britannica. Retrieved 2020-01-13.
  5. ^ ab"History". Slate Magazine. Archived from the original on 2012-12-09. Retrieved 2012-12-09.
  6. ^ abR. De Bruyn, ‘Oude sloten op deurtjes in het Liers begijnhof’, in: 't land van Ryen jaargang 17, aflevering 3-4, 1967, p.158,, article in Dutch
  7. ^ abEchtpaar schrijft eerste boek sinds twintig jaar over Liers begijnhof nieuwsblad.be, Chris van Rompaey, 17 april 2018, article in Dutch
  8. ^Dictionary, Lexicon of locks and keys historicallocks.com
  9. ^United States patent keyhole guide for locks and method of using the same patentimages, Eugene Toussant, 1990
  10. ^V-Lock Helps Drunks Get Home to Bed wired.com, Charlie Sorrel, 5 april 2010
  11. ^ abChatwood, Arthur Brunel (1911). "Lock" . In Chisholm, Hugh (ed.). Encyclopædia Britannica. 16 (11th ed.). Cambridge University Press. pp. 841–844.
  12. ^Pulford, Graham W. (2007). High-Security Mechanical Locks : An Encyclopedic Reference. Elsevier. p. 317. ISBN .
  13. ^"Lock Making: Chubb & Son's Lock & Safe Co Ltd". Wolverhampton City Council. 2005. Retrieved 16 November 2006.
  14. ^Roper, C.A. & Phillips, Bill (2001). The Complete Book of Locks and Locksmithing. McGraw-Hill Publishing. ISBN .
  15. ^The Complete Book of Home, Site, and Office Security: Selecting, Installing, and Troubleshooting Systems and Devices. McGraw-Hill Professional. 2006. p. 11. ISBN . Archived from the original on 2016-11-21.
  16. ^The Geek Atlas: 128 Places Where Science and Technology Come Alive. O'Reilly Media, Inc. 21 May 2009. p. 445. ISBN . Archived from the original on 2016-05-01.
  17. ^"Inventor of the Week Archive". Massachusetts Institute of Technology. Archived from the original on 2013-05-29.
  18. ^"Ditch the keys: it's time to get a smart lock". Popular Mechanics. 26 November 2013. Archived from the original on 16 December 2014. Retrieved 15 June 2016.
  19. ^"Kisi And KeyMe, two smart phone apps, might make house keys obsolete". The Huffington Post. Archived from the original on 11 March 2015. Retrieved 9 June 2015.
  20. ^Kurutz, Steven. "Losing The Key". The New York Times. Archived from the original on 3 January 2016. Retrieved 9 June 2015.
  21. ^"What qualifications do I need to be a locksmith?". Master Locksmiths Association. Retrieved 2019-05-23.
  22. ^Gove, Philip Babcock, ed. (1981). "keyhole". Webster's Third New International Dictionary of English Language. Merriam-Webster Inc. p. 1239.
  23. ^Fox-Davies, Arthur Charles (1909). A Complete Guide to Heraldry. New York: Dodge Publishing. p. 291. ISBN . LCCN 09023803 – via Internet Archive.

Further reading[edit]

  • Phillips, Bill. (2005). The Complete Book of Locks and Locksmithing. McGraw-Hill. ISBN 0-07-144829-2.
  • Alth, Max (1972). All About Locks and Locksmithing. Penguin. ISBN 0-8015-0151-2
  • Robinson, Robert L. (1973). Complete Course in Professional Locksmithing Nelson-Hall. ISBN 0-911012-15-X

External links[edit]

Sours: https://en.wikipedia.org/wiki/Lock_and_key

Wikipedia:Protection policy

Policy on page protection

See also: Wikipedia:Requests for page protection and Wikipedia:Lists of protected pages

"WP:PP" and "WP:PROTECT" redirect here. For other uses, see Wikipedia:Perennial proposals, Wikipedia:WikiProject Parliamentary Procedure, Wikipedia:Party and person, Wikipedia:Child protection, and Wikipedia:WikiProject Protected areas.

This page in a nutshell: While Wikipedia strives to be as open as possible, sometimes it is necessary to limit editing of certain pages in order to prevent vandalism, edit warring, or other disruptive edits.

In some circumstances, pages may need to be protected from modification by certain groups of editors. Pages are protected when a specific damaging event has been identified that can not be prevented through other means such as a block. Otherwise, Wikipedia is built on the principle that anyone can edit it, and it therefore aims to have as many of its pages as possible open for public editing so that anyone can add material and correct errors. This policy states in detail the protection types and procedures for page protection and unprotection and when each protection should and should not be applied.

Protection is a technical restriction applied only by administrators, although any user may request protection. Protection can be indefinite or expire after a specified time. The various levels of protection are detailed below, and they can be applied to the page edit, page move, page create, and file upload actions. Even when a page is protected from editing, the source code (wikitext) of the page can still be viewed and copied by anyone.

A protected page is marked at its top right by a padlock icon, usually added by the template.

Types of protection


The following technical options are available to administrators for protecting different actions to pages:

  • Edit protection protects the page from being edited.
  • Move protection protects the page from being moved or renamed.
  • Creation protection prevents a page (normally a previously deleted one) from being created (also known as "salting").
  • Upload protection prevents new versions of a file from being uploaded, but it does not prevent editing to the file's description page (unless edit protection is applied).

The following technical options are available to administrators for adding protection levels to the different actions to pages:

  • Pending changes protection(only available for edit protection) means edits by unregistered and new editors are not visible to readers who are not logged-in until the edits are approved by a reviewer or an administrator.
  • Semi-protection prevents the action by unregistered editors and editors with accounts that are not confirmed.
  • Extended confirmed protection, also known as 30/500 protection, prevents the action by users without 30 days' tenure and 500 edits on the English Wikipedia. In most cases it should not be a protection level of first resort, and should be used where semi-protection has proven to be ineffective. Its use is logged at the Administrators' noticeboard.
  • Template protection prevents the action by everyone except template editors and administrators (who have this right as part of their toolset).
  • Full protection prevents the action by everyone except administrators.

Any type of protection (with the exception of cascading protection) may be requested at Wikipedia:Requests for page protection. Changes to a fully protected page should be proposed on the corresponding talk page, then carried out by an administrator if they are uncontroversial or there is consensus for them.

Except in the case of office actions (see below), Arbitration Committee remedies, or pages in the MediaWiki namespace (see below), administrators may unprotect a page if the reason for its protection no longer applies, a reasonable period has elapsed, and there is no consensus that continued protection is necessary. Editors desiring the unprotection of a page should, in the first instance, ask the administrator who applied the protection unless the administrator is inactive or no longer an administrator; thereafter, requests may be made at Requests for unprotection. Note that such requests will normally be declined if the protecting administrator is active and was not consulted first. A log of protections and unprotections is available at Special:Log/protect.

Unregistered or Newly registeredAuto-confirmed, ConfirmedExtended confirmedTemplate editorAdminAppropriate for
No protection normal editingThis is the default protection level, used for the vast majority of pages.
changes protection
all users can edit. However, once an unregistered or new editor makes an edit, that edit and any subsequent edits by anyone will remain hidden from "readers" (users not logged in) until the edit made by the unregistered or new editor is reviewed by a pending changes reviewer or admin. Logged-in editors always see all changes (whether accepted or not) immediately. Infrequently edited pages with high levels of vandalism, BLP violations, edit-warring, or other disruption from unregistered and new users.
Semi-protection-shackle.svgSemi-protectioncannot editnormal editingPages that are frequently edited by anonymous and registered users; some highly visible templates & modules.
confirmed prot.
cannot editnormal editing*Specific topic areas authorized by ArbCom; pages where semi-protection has failed; high-risk templates where template protection would be too restrictive.
Template-protection-shackle.svgTemplate prot.cannot editnormal editingHigh-risk or very frequently used templates & modules; also some high-risk pages outside template space.
Full-protection-shackle.svgFull protectioncannot editnormal editingArticles with persistent disruption from extended confirmed accounts; critical or extremely frequently used templates & modules.
* In order to edit through extended confirmed protection, a template editor must also be extended confirmed, but in practice this is essentially always the case.

Other modes of protection:

Full protection

Gold padlock


A fully protected page cannot be edited or moved by anyone except administrators. The protection may be for a specified time or may be indefinite.

Modifications to a fully protected page can be proposed on its talk page (or at another appropriate forum) for discussion. Administrators can make changes to the protected article reflecting consensus. Placing the template on the talk page will draw the attention of administrators for implementing uncontroversial changes.

Content disputes

See also: Wikipedia:Stable version

"WP:PREFER" redirects here. For what title name should be preferred, see Wikipedia:Disambiguation § Primary topic.

While content disputes and edit warring may be addressed with user blocks issued by uninvolved administrators, allowing normal page editing by other editors at the same time, the protection policy provides an alternative approach as administrators have the discretion to temporarily fully protect an article to end an ongoing edit war. This approach may better suit multi-party disputes and contentious content, as it makes talk page consensus a requirement for implementation of requested edits.


When protecting a page because of a content dispute, administrators have a duty to avoid protecting a version that contains policy-violating content, such as vandalism, copyright violations, defamation, or poor-quality coverage of living people. Administrators are deemed to remain uninvolved when exercising discretion on whether to apply protection to the current version of an article, or to an older, stable, or pre-edit-war version.

Protected pages may not be edited except to make changes that are uncontroversial or for which there is clear consensus. Editors convinced that the protected version of an article contains policy-violating content, or that protection has rewarded edit warring or disruption by establishing a contentious revision, may identify a stable version prior to the edit war and request reversion to that version. Before making such a request, editors should consider how independent editors might view the suggestion and recognize that continuing an edit war is grounds for being blocked.

Administrators who have made substantive content changes to an article are considered involved and must not use their advanced permissions to further their own positions. When involved in a dispute, it is almost always wisest to respect the editing policies that bind all editors and call for input from an uninvolved administrator, rather than to invite controversy by acting unilaterally.



Applying page protection as a preemptive measure is contrary to the open nature of Wikipedia and is generally not allowed if applied for these reasons. However, brief periods of an appropriate and reasonable protection level are allowed in situations where blatant vandalism or disruption is occurring by multiple users and at a level of frequency that requires its use in order to stop it. The duration of the protection should be set as short as possible, and the protection level should be set to the lowest restriction needed in order to stop the disruption while still allowing productive editors to make changes.

"History only" review


If a deleted page is going through deletion review, only administrators are normally capable of viewing the former content of the page. If they feel it would benefit the discussion to allow other users to view the page content, administrators may restore the page, blank it or replace the contents with template or a similar notice, and fully protect the page to prevent further editing. The previous contents of the page are then accessible to everyone via the page history.

Protected generic file names

Generic file names such as File:Photo.jpg, File:Map.jpg, and File:Sound.wav are fully protected to prevent new versions being uploaded. Furthermore, File:Map.jpg and File:Sound.wav are salted.

Permanent protection

Brown padlock


Administrators cannot change or remove the protection for some areas on Wikipedia, which are permanently protected by the MediaWiki software:

  • Edits to the MediaWiki namespace, which defines parts of the site interface, are restricted to administrators.
  • Edits to personal CSS and JavaScript pages such as User:Example/monobook.css and User:Example/cologneblue.js are restricted to the associated user and interface administrators. Interface administrators may edit these pages, for example, to remove a user script that has been used in an inappropriate way. Administrators may delete (but not edit or restore) these pages.
  • Edits to personal JSON pages such as User:Example/data.json are restricted to the associated user and administrators.

In addition to hard-coded protection, the following are usually fully protected for an indefinite period of time:

Template protection

Main page: Wikipedia:Template editor

Pink padlock


A template-protected page can be edited only by administrators or users in the Template editors group. This protection level should be used almost exclusively on high-risk templates and modules. In cases where pages in other namespaces become transcluded to a very high degree, this protection level is also valid.

This is a protection level[1] that replaces full protection on pages that are merely protected due to high transclusion rates, rather than content disputes. It should be used on templates whose risk factor would have otherwise warranted full protection. It should not be used on less risky templates on the grounds that the template editor user right exists—the existence of the right should not result in more templates becoming uneditable for the general editing community. In borderline cases, extended confirmed protection or lower may be applied to high risk templates that the general editing community still needs to edit regularly.

Editors may request edits to a template-protected page by proposing them on its talk page, using the template if necessary to gain attention.


See also: Wikipedia:Rough guide to semi-protection

Silver padlock


Semi-protected pages cannot be edited by unregistered users (IP addresses), as well as accounts that are not autoconfirmed (accounts that are at least four days old and have made at least ten edits to Wikipedia) or confirmed. Semi-protection is useful when there is a significant amount of disruption or vandalism from new or unregistered users, or to prevent sockpuppets of blocked or banned users from editing, especially when it occurs on biographies of living persons who have had a recent high level of media interest. An alternative to semi-protection is pending changes, which is sometimes favored when an article is being vandalized regularly, but otherwise receives a low amount of editing.

Such users can request edits to a semi-protected page by proposing them on its talk page, using the {{Edit semi-protected}} template if necessary to gain attention. If the page in question and its talk page are both protected, please make your edit request at Wikipedia:Requests for page protection instead. New users may also request the confirmed user right at Wikipedia:Requests for permissions/Confirmed.

Guidance for administrators

Administrators may apply indefinite semi-protection to pages that are subject to heavy and persistent vandalism or violations of content policy (such as biographies of living persons, neutral point of view). Semi-protection should not be used as a preemptive measure against vandalism that has not yet occurred or to privilege registered users over unregistered users in (valid) content disputes.

In addition, administrators may apply temporary semi-protection on pages that are:

  • Subject to significant but temporary vandalism or disruption (for example, due to media attention) if blocking individual users is not a feasible option.
  • Subject to edit warring if all parties involved are unregistered or new editors (i.e. in cases in which full protection would otherwise be applied). This does not apply when autoconfirmed users are involved.
  • Subject to vandalism or edit warring where unregistered editors are engaging in IP hopping by using different computers, obtaining new addresses by using dynamic IP allocation, or other address-changing schemes.
  • Article discussion pages, if they have been subject to persistent disruption. Such protection should be used sparingly because it prevents unregistered and newly registered users from participating in discussions. A page and its talk page should not normally be protected at the same time. If a page and its talk page are both protected, the talk page should direct affected editors to Wikipedia:Request for edit to ensure that no editor is entirely prevented from contributing.
  • Protection should be used sparingly on the talk pages of blocked users, including IP addresses. Instead the user should be re-blocked with talk page editing disallowed. When required, or when re-blocking without talk page editing allowed is unsuccessful, protection should be implemented for only a brief period not exceeding the duration of the block.

Today's featured article may be semi-protected just like any other article. But since that article is subject to sudden spurts of vandalism during certain times of day, administrators should semi-protect it for brief periods in most instances. For the former guideline, see Wikipedia:Main Page featured article protection.

Creation protection (salting)

Blue padlock


Administrators can prevent the creation of pages. This level of protection is useful for pages that have been deleted but repeatedly recreated. Such protection is case-sensitive. There are several levels of creation protection that can be applied to pages, identical to the levels for edit protection. A list of protected titles may be found at Special:ProtectedTitles (see also historical lists).

Pre-emptive restrictions on new article titles are instituted through the title blacklist system, which allows for more flexible protection with support for substrings and regular expressions.

Pages that have been creation-protected are sometimes referred to as "salted". Editors wishing to re-create a salted title with appropriate content should either contact an administrator (preferably the protecting administrator), file a request at Wikipedia:Requests for page protection#Current requests for reduction in protection level, or use the deletion review process. To make a convincing case for re-creation, it is helpful to show a draft version of the intended article when filing a request.

Administrators should choose the appropriate level of create protection—autoconfirmed, extended-confirmed,[2] or full. Due to the implementation of ACPERM, non-confirmed editors cannot create pages in mainspace; thus, semi-creation protection should be rare, used only for protection of pages outside of mainspace.

While creation-protection is usually permanent, temporary creation protection may be applied if a page is repeatedly recreated by a single user (or sockpuppets of that user, if applicable).

Move protection

Green padlock


Move protected pages, or more technically, fully move-protected pages, cannot be moved to a new title except by an administrator. Move protection is commonly applied to:

Fully edit-protected pages are also implicitly move-protected.

As with full edit protection, protection because of edit warring should not be considered an endorsement of the current name. When move protection is applied during a requested move discussion, the page should be protected at the location it was at when the move request was started.

All files are implicitly move-protected; only file movers and administrators can rename files.

Upload protection

Purple padlock


Upload-protected files, or more technically, fully upload-protected files, cannot be replaced with new versions except by an administrator. Upload protection does not protect file pages from editing. It may be applied by an administrator to:

  • Files subject to persistent upload vandalism.
  • Files subject to a dispute between editors.
  • Files that should not be replaced, such as images used in the interface or transcluded to the main page.
  • Files with common or generic names. (e.g., File:Map.png)

As with full edit protection, administrators should avoid favoring one version over another, and protection should not be considered an endorsement of the current version. An exception to this rule is when they are protected due to upload vandalism.

Pending changes protection

Further information: Wikipedia:Pending changes

White padlock


Pending changes protection is a tool used to suppress vandalism and certain other persistent problems while allowing all users to continue to submit edits. Pending changes protection can be used as an alternative to semi-protection to allow unregistered and new users to edit pages, while keeping the edits hidden from the view of most readers until those changes are accepted by a pending changes reviewer.

When a page under pending changes protection is edited by an unregistered (IP addresses) editor or a new user, the edit is not directly visible to the majority of Wikipedia readers, until it is reviewed and accepted by an editor with the pending changes reviewer right. When a page under pending changes protection is edited by an autoconfirmed user, the edit will be immediately visible to Wikipedia readers, unless there are pending edits waiting to be reviewed.

Pending changes are visible in the page history, where they are marked as pending review. Readers that are not logged in (the vast majority of readers) are shown the latest accepted version of the page; logged-in users see the latest version of the page, with all changes (reviewed or not) applied. When editors who are not reviewers make changes to an article with unreviewed pending changes, their edits are also marked as pending and are not visible to most readers.

A user who clicks "edit this page" is always, at that point, shown the latest version of the page for editing regardless of whether the user is logged in or not.

  • If the editor is not logged in, their changes join any other changes to the article awaiting review – for the present they remain hidden from not-logged-in users. (This means that when the editor looks at the article after saving, the editor won't see the change made.)
  • If the editor is logged in and a pending changes reviewer, and there are pending changes, the editor will be prompted to review the pending changes before editing – see Wikipedia:Pending changes.
  • If the editor is logged in and not a pending changes reviewer, then...
    • If there are no unreviewed pending edits waiting, this editor's edits will be visible to everyone immediately; but
    • If there are unreviewed pending edits waiting, then this editor's edits will be visible only to other logged-in users (including themself) immediately, but not to readers not logged in.

Reviewing of pending changes should be resolved within reasonable time limits.

When to apply pending changes protection

Pending changes may be used to protect articles against:

Pending changes protection should not be used as a preemptive measure against violations that have not yet occurred. Like semi-protection, PC protection should never be used in genuine content disputes, where there is a risk of placing a particular group of editors (unregistered users) at a disadvantage. Pending changes protection should not be used on articles with a very high edit rate, even if they meet the aforementioned criteria. Instead semi-protection should be considered.

In addition, administrators may apply temporary pending changes protection on pages that are subject to significant but temporary vandalism or disruption (for example, due to media attention) when blocking individual users is not a feasible option. As with other forms of protection, the time frame of the protection should be proportional to the problem. Indefinite PC protection should be used only in cases of severe long-term disruption.

Removal of pending changes protection can be requested of any administrator, or at requests for unprotection.

The reviewing process is described in detail at Wikipedia:Reviewing pending changes.

Extended confirmed protection

See also: Wikipedia:Rough guide to extended confirmed protection

Dark blue padlock


Extended confirmed protection, also known as 30/500 protection, only allows edits by editors with the extended confirmed user access level, granted automatically to registered users with at least 30 days' tenure and 500 edits.

Where semi-protection has proven to be ineffective, administrators may use extended confirmed protection to combat disruption (such as vandalism, abusive sockpuppetry, edit wars, etc.) on any topic. Extended confirmed protection should not be used as a preemptive measure against disruption that has not yet occurred, nor should it be used to privilege extended confirmed users over unregistered/new users in valid content disputes on articles not covered by Arbitration Committee 30/500 rulings. Extended confirmed protection may be applied at the discretion of an administrator when creation-protecting a page.[2]High-risk templates may be extended-confirmed protected at administrator discretion when template protection would be too restrictive or semi-protection would be ineffective to stop widespread disruption.[3]

Until August 12, 2016,[4] 30/500 protection applied only in topic areas determined by the Arbitration Committee, which authorized its use on articles reasonably construed as belonging to the Arab–Israeli conflict;[5] as an arbitration enforcement tool by motion or remedy;[6] or as a result of community consensus.[7] In February 2019, the community authorized uninvolved administrators to place pages reasonably construed as belonging to the India–Pakistan conflict under extended confirmed protection as part of a general sanctions regime.[8] In May 2020 the Arbitration Committee authorized extended confirmed protection to pages related to the history of Jews and antisemitism in Poland during World War II (1933–45).[9]

As of September 23, 2016, a bot posts a notification in a subsection of AN when this protection level is used.[10] Any protection made as arbitration enforcement must be logged at Wikipedia:Arbitration enforcement log. A full list of the 2953 pages under 30/500 protection can be found here.

Users can request edits to an extended confirmed-protected page by proposing them on its talk page, using the template if necessary to gain attention.

Office actions

See also: Wikipedia:Office actions

Black padlock


As outlined in Meta-Wiki:Office actions#Use of advanced rights by Foundation staff, pages may be protected by Wikimedia Foundation staff in response to issues such as copyright infringement or libel. Such actions override community consensus. Administrators should not edit or unprotect such pages without permission from Wikimedia Foundation staff.

Cascading protection

"WP:CASCADE" redirects here. You may be also looking for Help:Cascading Style Sheets or Wikipedia:Cascade-protected items.

Turquoise padlock


Cascading protection fully protects a page, and extends that full protection automatically to any page that is transcluded onto the protected page, whether directly or indirectly. This includes templates, images and other media that are hosted on the English Wikipedia. Files stored on Commons are not protected by any other wiki's cascading protection and, if they are to be protected, must be either temporarily uploaded to the English Wikipedia or explicitly protected at Commons (whether manually or through cascading protection there). When operational, KrinkleBot cascade-protects Commons files transcluded at Wikipedia:Main Page/Tomorrow, Wikipedia:Main Page/Commons media protection and Main Page. As the bot's response time varies, media should not be transcluded on the main page (or its constituent templates) until after it has been protected. (This is particularly relevant to Template:In the news, for which upcoming images are not queued at Wikipedia:Main Page/Tomorrow.) Cascading protection:

  • Should be used only to prevent vandalism when placed on particularly visible pages, such as the main page.
  • Is available only for fully protected pages; it is disabled for lower levels of protection as it represents a security flaw. See Phabricator:T10796 for more information.
  • Is not instantaneous; it may be several hours before it takes effect. See Phabricator:T20483 for more information.
  • Should generally not be applied directly to templates or modules, as it will not protect transclusions inside tags or transclusions that depend on template parameters, but will protect the documentation subpage. See § Protection of templates below, for alternatives.

The list of cascading-protected pages can be found at Wikipedia:Cascade-protected items. Requests to add or remove cascading protection on a page should be made at Wikipedia talk:Cascade-protected items as an edit request.

Deprecated protection



See also: Meta-Wiki:Superprotect

Superprotect was a level of protection, allowing editing only by Wikimedia Foundation employees who are in the Staff global group. It was implemented on August 10, 2014 and used the same day to override community consensus regarding the use of the Media Viewer on the German Wikipedia's primary site JavaScript, common.js. It was never used on the English Wikipedia. On November 5, 2015, the WMF decided to remove superprotect from all Wikimedia wikis.

Cascading semi-protection

Cascading semi-protection was formerly possible, but it was disabled in 2007 after users noticed that non-administrators could fully protect any page by transcluding it onto the page to which cascading semi-protection had been applied by an administrator.

Pending changes protection level 2


Originally, two levels of pending changes protection existed, where level2 required edits by all users who are not pending changes reviewers to be reviewed. Following a community discussion, level2 was retired from the English Wikipedia in January 2017. It was suggested then that "Pending changes level1" be referred to in the future as simply "Pending changes".[11]

Protection by namespace

Article talk pages

Modifications to a protected page can be proposed on its talk page (or at another appropriate forum) for discussion. Administrators can make changes to the protected article reflecting consensus. Placing the template on the talk page will draw the attention of administrators for implementing uncontroversial changes.

Talk pages are not usually protected, and are semi-protected only for a limited duration in the most severe cases of vandalism.

User talk pages

User talk pages are rarely protected. However, protection may be applied if there is severe vandalism or abuse. Users whose talk pages are protected may wish to have an unprotected user talk subpage linked conspicuously from their main talk page to allow good-faith comments from users that the protection restricts editing from.

A user's request to have their own talk page protected is not a sufficient rationale by itself to protect the page, although requests may be considered if a reason is provided.

Blocked users

Blocked users' user talk pages should not ordinarily be protected, as this interferes with the user's ability to contest their block through the normal process. It also prevents others from being able to use the talk page to communicate with the blocked editor.

In extreme cases of abuse by the blocked user, such as abuse of the {{unblock}} template, re-blocking the user with talk page access removed should be preferred over applying protection to the page. If the user has been blocked and with the ability to edit their user talk page disabled, they should be informed of this in a block notice, subsequent notice, or message, and it should include information and instructions for appealing their block off-wiki, such as through the UTRS tool interface or, as a last recourse, the Arbitration Committee.

When required, protection should be implemented for only a brief period, not exceeding the duration of the block.

Confirmed socks of registered users should be dealt with in accordance with Wikipedia:Sockpuppetry; their pages are not normally protected.

User pages


Base user pages (for example, the page User:Example, and not User:Example/subpage or User talk:Example) are automatically protected from creation or editing by unconfirmed accounts and anonymous IP users. An exception to this includes an unconfirmed registered account attempting to create or edit their own user page. IP editors and unconfirmed accounts are also unable to create or edit user pages that do not belong to a currently-registered account. This protection is enforced by an edit filter.[12] Users may opt-out of this protection by placing anywhere on their own user page.

User pages and subpages within their own user space may be protected upon a request from the user, as long as a need exists. Pages within the user space should not be automatically or pre-emptively protected without good reason or cause.[13][14] Requests for protection specifically at uncommon levels (such as template protection) may be granted if the user has expressed a genuine and realistic need.

When a filter is insufficient to stop user page vandalism, a user may choose to create a ".css" subpage (ex. User:Example/Userpage.css), copy all the contents of their user page onto the subpage, transclude the subpage by putting {{User:Example/Userpage.css}} on their user page, and then ask an administrator to fully protect their user page. Because user space pages that end in ".css", ".js", and ".json" are editable only by the user to which that user space belongs (and interface administrators), this will protect your user page from further vandalism.

Deceased users

See also: Wikipedia:Deceased Wikipedians/Guidelines

In the event of the confirmed death of a user, the user's user page (but not the user talk page) should be fully protected.

Protection of templates


See also: Wikipedia:High-risk templates and Wikipedia:Template documentation

Highly visible templates – those used on a large number of pages or frequently substituted – are often edit protected based on the degree of visibility, type of use, content, and other considerations.

Protected templates should normally have the {{documentation}} template. It loads the unprotected page, so that non-admins and IP-users can edit the documentation, categories and interwiki links. It also automatically adds {{pp-template}} to protected templates, which displays a small padlock in the top right corner and categorizes the template as protected. Only manually add {{pp-template}} to protected templates that don't use {{documentation}} (mostly the flag templates).

Cascading protection should generally not be applied directly to templates, as it will not protect transclusions inside tags or transclusions that depend on template parameters, but will protect the template's documentation subpage. Instead, consider any of the following:

  • If the set of subtemplates is static (even if large), protect them using normal protection mechanisms.
  • If the set of subtemplates is unbounded, use MediaWiki:Titleblacklist to protect all subtemplates using a particular naming format (as is done for editnotice templates and subtemplates of Template:TFA title).

Note: All editnotice templates (except those in userspace) are already protected via MediaWiki:Titleblacklist. They can be edited by admins, template editors and page movers only.


See also: Wikipedia:About the sandbox

Sandboxes should not ordinarily be protected since their purpose is to let new users test and experiment with wiki syntax. Most sandboxes are automatically cleaned every 12 hours, although they are frequently overwritten by other testing users. The Wikipedia:Sandbox is cleaned every hour. Those who use sandboxes for malicious purposes, or to violate policies such as no personal attacks, civility, or copyrights, should instead be warned and/or blocked.

Available templates

The following templates may be added at the very top of a page to indicate that it is protected:

On redirect pages, use the {{Redirect category shell}} template, which automatically categorizes by protection level, below the redirect line. A protection template may also be added below the redirect line, but it will serve only to categorize the page, as it will not be visible on the page, and it will have to be manually removed when protection is removed.

See also


Sours: https://en.wikipedia.org/wiki/Wikipedia:Protection_policy
  1. Mba in ucla
  2. Dry aged tofu
  3. Pale powder valspar

Locking differential

Mechanical component which forces two transaxial wheels to spin together

See also: Differential (mechanical device)

ARB air-locking differential fitted to a Mitsubishi Delica L400 LWB Diff

A locking differential is a mechanical component, commonly used in vehicles, designed to overcome the chief limitation of a standard open differential by essentially "locking" both wheels on an axle together as if on a common shaft. This forces both wheels to turn in unison, regardless of the traction (or lack thereof) available to either wheel individually.

When the differential is unlocked (open differential), it allows each wheel to rotate at different speeds (such as when negotiating a turn), thus avoiding tire scuffing. An open (or unlocked) differential always provides the same torque (rotational force) to each of the two wheels on that axle. Therefore, although the wheels can rotate at different speeds, they apply the same rotational force, even if one is entirely stationary, and the other spinning. (Equal torque, unequal rotational speed).

By contrast, a locked differential forces both left and right wheels on the same axle to rotate at the same speed under nearly all circumstances, regardless of the tractional differences at either wheel. Therefore, each wheel can apply as much rotational force as the traction under it will allow, and the torques on each side-shaft will be unequal. (Unequal torque, equal rotational speeds). Exceptions apply to automatic lockers, discussed below.

A locked differential can provide a significant traction advantage over an open differential, but only when the traction under each wheel differs significantly.

All of the above applies to central differentials as well as to those in each axle: full-time four-wheel-drive vehicles have three differentials, one in each axle, and a central one (called a "transfer case") between the front and rear axles.


Automatic lockers[edit]

Automatic lockers lock and unlock automatically with no direct input from the driver. Some automatic locking differential designs ensure that engine power is always transmitted to both wheels, regardless of traction conditions, and will "unlock" only when one wheel is required to spin faster than the other during cornering. These would be more correctly termed automatic unlocking differentials, because their at-rest position is locked. They will never allow either wheel to spin slower than the differential carrier or axle as a whole, but will permit a wheel to be over-driven faster than the carrier speed. The most common example of this type would be the Detroit Locker, made by Eaton Corporation, also known as the Detroit No-Spin, which replaces the entire differential carrier assembly. Others, sometimes referred to as lunchbox lockers, use the stock differential carrier and replace only the internal spider gears and shafts with interlocking plates. Both types of automatic lockers will allow for a degree of differential wheel speed while turning corners in conditions of equal traction, but will otherwise lock both axle shafts together when traction conditions demand it.

  • Pros: Automatic action, no stopping for engagement or disengagement is necessary when road conditions change.
  • Cons: Increased tire wear and noticeable impact on driving behaviour. During cornering, which half-axle is uncoupled is dependent on torque direction applied by the driveline. When the torque direction is reversed, the speed of the driveline is suddenly forced to change from the inner to the outer axle, accompanied by tire chirping and a strong jerk. During cornering, the automatic locker is characterized by heavy understeer which transitions instantly to power oversteer when traction is exceeded.

Some other automatic lockers operate as an open differential until wheel slip is encountered and then they lock up. These types generally use an internal governor to monitor vehicle speed and wheel slip. An example of this is the Eaton automatic locking differential (ALD), or Eaton automatic differential lock (ADL), developed by the Eaton Corporation and introduced in 1973 for GM's Rounded-Line C/K Series pickups and utilities.[1] The Eaton ADL is sometimes incorrectly called the Gov-Lok, despite neither GM nor Eaton ever calling it by that name. Gov-Lok is rather an unofficial name of unknown origin that gained popularity over the years. Both Eaton and GM do not know where the name came from, and Eaton has made several unsuccessful attempts in the past to debunk the Gov-Lok name.[2] An updated version of the old Eaton ADL design is still available from Eaton, now known as the Eaton mLocker mechanical differential lock.

Some other automatic lockers operate as an open differential until high torque is applied, at which point they lock up. This style generally uses internal gears systems with very high friction. An example of this is the ZF sliding pins and cams type available for use in early Volkswagens.

Selectable lockers MRT[edit]

Dodge Power Wagons feature front and rear selectable locking differentials

Selectable lockers allow the driver to lock and unlock the differential at will from the driver's seat. This can be accomplished in many ways.

  • Compressed air (pneumatics).
  • Cable-operated mechanism as is employed on the "Ox Locker".
  • Electronic solenoids and (electromagnetics) like Eaton's "ELocker". However, OEMs are beginning to offer electronic lockers as well. Nissan Corporation's electric locker can be found as optional equipment on the Frontier (Navara) and Xterra. Ford offers an electronic rear locker on the F-series and Ranger trucks. Toyota currently offers a rear e-locker on the Tacoma and 4Runner (TRD Off-Road and TRD Pro trims only), but has also offered front and rear e-lockers on vehicles such as the Land Cruiser in the past.
    • Pros: Allows the differential to perform as an "open" differential for improved driveability and maneuverability, and provides full locking capability when it is desirable or needed.
    • Cons: Mechanically complex with more parts to fail. Some lockers require the vehicle to stop for engagement. Needs human interaction and forward-thinking regarding upcoming terrain. Unskilled drivers often put massive stress on driveline components when leaving the differential in locked operation on terrain not requiring a locker.


A spool is a device that connects the two axles directly to the ring gear. There is no differentiation side to side, so a vehicle equipped with a spool will bark tires in turns and may become unmanageable in wet or snowy weather. Spools are usually reserved for competition vehicles not driven on the street.[3]

Mini-spool uses the stock carrier and replaces only the internal components of the differential, similar in installation to the lunchbox locker. A full spool replaces the entire carrier assembly with a single machined piece. A full spool is perhaps the strongest means of locking an axle, but has no ability to differentiate wheel speeds whatsoever, putting high stress on all affected driveline components.

The internal spider gears of an open differential can also be welded together to make a locked axle; this method is not recommended as the welding process seriously compromises the metallurgical composition of the welded components, and can lead to failure of the unit under stress.


Because they do not operate as smoothly as standard differentials, automatic locking differentials are often responsible for increased tire wear. Some older automatic locking differentials are known for making a clicking or banging noise when locking and unlocking as the vehicle negotiates turns. This is annoying to many drivers. Automatic locking differentials also affect the ability of a vehicle to steer, particularly if a locker is located in the front axle. Aside from tire scuffing while turning any degree on high friction (low slip) surfaces, locked axles cause understeer and, if used on the front axle, will increase steering forces required to turn the vehicle. Furthermore, automatically locking differentials can cause a loss of control on ice where an open differential would allow one wheel to spin and the other to hold, while not transferring power. An example of this would be a vehicle parked sideways on a slippery grade. When both wheels spin, the vehicle will break traction and slide down the grade.


Limited-slip differentials are considered a compromise between a standard differential and a locking differential because they operate more smoothly, and they do direct some extra torque to the wheel with the most traction compared to a standard differential, but are not capable of 100% lockup.

Traction control systems are also used in many modern vehicles, either in addition or as a replacement of locking differentials. Examples include: Volkswagen's electronic differential lock (EDL), Opel's TC+ installed for the first time in Opel Astra G (2001), et cetera. This is not in fact a differential lock, but operates at each wheel. Sensors monitor wheel speeds, and if one is rotating more than a specified number of revolutions per minute (e.g. 100) than the other (i.e. slipping) the traction control system momentarily brakes it. This transfers more power to the other wheel,[4] but still employs the open differential, which is the same as on cars without the EDL option. If all drive wheels lose traction, then throttle control may be automatically applied. Electronic traction control systems may be integrated with anti-lock braking systems, which have a similar action on braking and use some similar components. Such systems are used for example on the most recent[when?]Nissan Pathfinder, Land Rover Defender, Land Rover Freelander, the McLaren P1 and the McLaren 650s.


  • Some utility vehicles such as tow trucks, forklifts, tractors, and heavy equipment use locking differentials to maintain traction, especially when driving on soft, muddy, or uneven surfaces. Lockers are common in agricultural equipment and military trucks. On some farm tractors, there is a pedal that can be stepped on with the operator's heel to lock the differential as needed.
  • Differential locking can also be used in the sport of drifting as an alternative to a limited-slip differential.
  • Four-wheel drive vehicles that drive off-road often use a locking differential to keep from getting stuck when driving on loose, muddy, or rocky terrain. Locking differentials are considered essential equipment for serious off-road driving. Many such vehicles have a locking differential on the central differential (between the front and rear axles), rear differential and front differential, or any combination of any of the three. Differential locks are also used on some "non-utility" four-wheel-drive vehicles (such as the Mitsubishi Shogun) to compensate for a relative lack of axle articulation (vertical wheel movement). High amounts of articulation are desirable for off-road driving, to allow the wheels to maintain ground contact over uneven surfaces, but this can lead to excessive body-roll at high speeds on the road, as well as vague[vague] steering. Such 4x4s often have suspension systems designed as a compromise between articulation and handling. If articulation is limited, one wheel on an axle may be lifted off the ground by rough terrain, thus losing all traction to all wheels (all power goes to the lifted wheel, which spins freely). A rear locking differential is often supplied to make up for this compromise – if a wheel is lifted off the ground, the locking differential can be activated, driving the wheel that remains on the ground.


Sours: https://en.wikipedia.org/wiki/Locking_differential
【LOCK DANCE】30 movimientos de baile locking!

File locking

File locking is a mechanism that restricts access to a computer file, or to a region of a file, by allowing only one user or process to modify or delete it at a specific time and to prevent reading of the file while it's being modified or deleted.

Systems implement locking to prevent the classic interceding update scenario, which is a typical example of a race condition, by enforcing the serialization of update processes to any given file. The following example illustrates the interceding update problem:

  1. Process A reads a customer record from a file containing account information, including the customer's account balance and phone number.
  2. Process B now reads the same record from the same file, so it has its own copy.
  3. Process A changes the account balance in its copy of the customer record and writes the record back to the file.
  4. Process B, which still has the original stale value for the account balance in its copy of the customer record, updates the account balance and writes the customer record back to the file.
  5. Process B has now written its stale account-balance value to the file, causing the changes made by process A to be lost.

Most operating systems support the concept of record locking, which means that individual records within any given file may be locked, thereby increasing the number of concurrent update processes. Database maintenance uses file locking, whereby it can serialize access to the entire physical file underlying a database. Although this does prevent any other process from accessing the file, it can be more efficient than individually locking many regions in the file by removing the overhead of acquiring and releasing each lock.

Poor use of file locks, like any computer lock, can result in poor performance or in deadlocks. File locking may also refer to additional security applied by a computer user either by using Windows security, NTFS permissions or by installing a third party file locking software.

In mainframes[edit]

IBM pioneered file locking in 1963 for use in mainframe computers using OS/360, where it was termed "exclusive control".[1]

In Microsoft Windows[edit]

Microsoft Windows uses three distinct mechanisms to manage access to shared files:

  1. using share-access controls that allow applications to specify whole-file access-sharing for read, write, or delete[2]
  2. using byte-range locks to arbitrate read and write access to regions within a single file[3]
  3. by Windows file systems disallowing executing files from being opened for write or delete access

Windows inherits the semantics of share-access controls from the MS-DOS system, where sharing was introduced in MS-DOS 3.3 . Thus, an application must explicitly allow sharing when it opens a file; otherwise it has exclusive read, write, and delete access to the file until closed (other types of access, such as those to retrieve the attributes of a file are allowed.)

For a file opened with shared access, applications may then use byte-range locking to control access to specific regions of the file. Such byte-range locks specify a region of the file (offset and length) and the type of lock (shared or exclusive). Note that the region of the file being locked is not required to have data within the file, and applications sometimes exploit this ability to implement their functionality.

For applications that use the file read/write APIs in Windows, byte-range locks are enforced (also referred to as mandatory locks) by the file systems that execute within Windows. For applications that use the file mapping APIs in Windows, byte-range locks are not enforced (also referred to as advisory locks.) Byte-range locking may also have other side-effects on the Windows system. For example, the Windows file-sharing mechanism will typically disable client side caching of a file for all clients when byte-range locks are used by any client. The client will observe slower access because read and write operations must be sent to the server where the file is stored.

Improper error-handling in an application program can lead to a scenario where a file is locked (either using "share" access or with byte-range file locking) and cannot be accessed by other applications. If so, the user may be able to restore file access by manually terminating the malfunctioning program. This is typically done through the Task Manager utility.

The sharing mode (dwShareMode) parameter of the [2] function (used to open files) determines file-sharing. The sharing mode can be specified to allow sharing the file for read, write, or delete access, or any combination of these. Subsequent attempts to open the file must be compatible with all previously granted sharing-access to the file. When the file is closed, sharing-access restrictions are adjusted to remove the restrictions imposed by that specific file open.

Byte-range locking type is determined by the parameter in the [4] function used to lock a region of a file. The Windows API function [5] can also be used and acquires an exclusive lock on the region of the file.

Any file containing an executable program file that is currently running on the computer system as a program (e.g. an , , , or other binary program file format) is normally locked by the operating system itself, preventing any application from modifying or deleting it. Any attempt to do so will be denied with a sharing violation error, despite the fact that the program file is not opened by any application. However, some access is still allowed. For example, a running application file can be renamed or copied (read) even when executing.

Files are accessed by applications in Windows by using file handles. These file handles can be explored with the Process Explorer utility. This utility can also be used to force-close handles without needing to terminate the application holding them. This can cause an undefined behavior, since the program will receive an unexpected error when using the force-closed handle and may even operate on an unexpected file since the handle number may be recycled.[citation needed]

Microsoft Windows XP and Server 2003 editions have introduced volume snapshot () capability to NTFS, allowing open files to be accessed by backup software despite any exclusive locks. However, unless software is rewritten to specifically support this feature, the snapshot will be crash consistent only, while properly supported applications can assist the operating system in creating "transactionally consistent" snapshots. Other commercial software for accessing locked files under Windows include File Access Manager and Open File Manager. These work by installing their own drivers to access the files in kernel mode.

In Unix-like systems[edit]

Unix-like operating systems (including Linux and Apple's macOS) do not normally automatically lock open files. Several kinds of file-locking mechanisms are available in different flavors of Unix, and many operating systems support more than one kind for compatibility. The most common mechanism is . Two other such mechanisms are and , which may be separate or may be implemented atop . Although some types of locks can be configured to be mandatory, file locks under Unix are by default advisory. This means that cooperating processes may use locks to coordinate access to a file among themselves, but uncooperative processes are also free to ignore locks and access the file in any way they choose. In other words, file locks lock out other file lockers only, not I/O.

Two kinds of locks are offered: shared locks and exclusive locks. In the case of , different kinds of locks may be applied to different sections (byte ranges) of a file, or else to the whole file. Shared locks can be held by multiple processes at the same time, but an exclusive lock can only be held by one process, and cannot coexist with a shared lock. To acquire a shared lock, a process must wait until no processes hold any exclusive locks. To acquire an exclusive lock, a process must wait until no processes hold either kind of lock. Unlike locks created by , those created by are preserved across s, making them useful in forking servers. It is therefore possible for more than one process to hold an exclusive lock on the same file, provided these processes share a filial relationship and the exclusive lock was initially created in a single process before being duplicated across a .

Shared locks are sometimes called "read locks" and exclusive locks are sometimes called "write locks". However, because locks on Unix are advisory, this isn't enforced. Thus it is possible for a database to have a concept of "shared writes" vs. "exclusive writes"; for example, changing a field in place may be permitted under shared access, whereas garbage-collecting and rewriting the database may require exclusive access.

File locks apply to the actual file, rather than the file name. This is important since Unix allows multiple names to refer to the same file. Together with non-mandatory locking, this leads to great flexibility in accessing files from multiple processes. On the other hand, the cooperative locking approach can lead to problems when a process writes to a file without obeying file locks set by other processes.

For this reason, some Unix-like operating systems also offer limited support for mandatory locking.[6] On such systems, a file whose bit is on but whose group execution bit is off when that file is opened will be subject to automatic mandatory locking if the underlying filesystem supports it. However, non-local NFS partitions tend to disregard this bit.[7] If a file is subject to mandatory locking, attempts to read from a region that is locked with an exclusive lock, or to write to a region that is locked with a shared or exclusive lock, will block until the lock is released. This strategy first originated in System V, and can be seen today in the Solaris, HP-UX, and Linux operating systems. It is not part of POSIX, however, and BSD-derived operating systems such as FreeBSD, OpenBSD, NetBSD, and Apple's macOS do not support it.[8] Linux also supports mandatory locking through the special parameter for file system mounting (), but this is rarely used.

Some Unix-like operating systems prevent attempts to open the executable file of a running program for writing; this is a third form of locking, separate from those provided by and .


More than one process can hold an exclusive on a given file if the exclusive lock was duplicated across a later . This simplifies coding for network servers and helps prevent race conditions, but can be confusing to the unaware.

Mandatory locks have no effect on the system call. Consequently, certain programs may, effectively, circumvent mandatory locking. Stevens & Rago (2005) observed that the editor indeed did that.[9]

Whether and how locks work on network filesystems, such as NFS, is implementation dependent. On BSD systems, calls on a file descriptor open to a file on an NFS-mounted partition are successful no-ops. On Linux prior to 2.6.12, calls on NFS files would act only locally. Kernel 2.6.12 and above implement calls on NFS files using POSIX byte-range locks. These locks will be visible to other NFS clients that implement -style POSIX locks, but invisible to those that do not.[10]

Lock upgrades and downgrades release the old lock before applying the new lock. If an application downgrades an exclusive lock to a shared lock while another application is blocked waiting for an exclusive lock, the latter application may get the exclusive lock and lock the first application out. This means that lock downgrades can block, which may be counter-intuitive.

All locks associated with a file for a given process are removed when any file descriptor for that file is closed by that process, even if a lock was never requested for that file descriptor. Also, locks are not inherited by a child process. The close semantics are particularly troublesome for applications that call subroutine libraries that may access files. Neither of these "bugs" occurs using real -style locks.

Preservation of the lock status on open file descriptors passed to another process using a Unix domain socket is implementation dependent.

Buffered I/O problems[edit]

One source of lock failure occurs when buffered I/O has buffers assigned in the user's local workspace, rather than in an operating system buffer pool. and are commonly used to do buffered I/O, and once a section of a file is read, another attempt to read that same section will, most likely, obtain the data from the local buffer. The problem is another user attached to the same file has their own local buffers, and the same thing is happening for them. An of data obtained from the buffer by will not be obtaining the data from the file itself, and some other user could have changed it. Both could use for exclusive access, which prevents simultaneous writes, but since the reads are reading from the buffer and not the file itself, any data changed by user #1 can be lost by user #2 (over-written). The best solution to this problem is to use unbuffered I/O ( and ) with , which also means using instead of and . Of course, you'll have to make adjustments for function parameters and results returned. Generally speaking, buffered I/O is unsafe when used with shared files.

In AmigaOS[edit]

In AmigaOS, a lock on a file (or directory) can be acquired using the function (in the ). A lock can be shared (other processes can read the file/directory, but can't modify or delete it), or exclusive so that only the process which successfully acquires the lock can access or modify the object. The lock is on the whole object and not part of it. The lock must be released with the function: unlike in Unix, the operating system does not implicitly unlock the object when the process terminates.

Lock files[edit]

Shell scripts and other programs often use a strategy similar to the use of file locking: creation of lock files, which are files whose contents are irrelevant (although often one will find the process identifier of the holder of the lock in the file) and whose sole purpose is to signal by their presence that some resource is locked. A lock file is often the best approach if the resource to be controlled is not a regular file at all, so using methods for locking files does not apply. For example, a lock file might govern access to a set of related resources, such as several different files, directories, a group of disk partitions, or selected access to higher level protocols like servers or database connections.

When using lock files, care must be taken to ensure that operations are atomic. To obtain a lock, the process must verify that the lock file does not exist and then create it, whilst preventing another process from creating it in the meantime. Various methods to do this include:

  • Using the command (a conditional semaphore-file creator distributed in the package).
  • System calls that create a file, but fail if the file already exists. (System calls are available from languages such as C or C++, and shell scripts can make use of noclobber)
  • Using the command and checking the exit code for failure[11]

Lock files are often named with a tilde () prefixed to the name of the file they are locking, or a duplicate of the full file name suffixed with  . If they are locking a resource other than a file, they may be named more arbitrarily.

Certain Mozilla products (such as Firefox, Thunderbird, Sunbird) use this type of file resource lock mechanism (using a temporary file named "parent.lock".)

Unlocker software[edit]

An unlocker is a utility used to determine what process is locking a file, and displays a list of processes as well as choices on what to do with the process (kill task, unlock, etc.) along with a list of file options such as delete or rename. On some Unix-like systems, utilities such as and can be used to inspect the state of file locks by process, by filename, or both.[citation needed]

On Windows systems, if a file is locked, it's possible to schedule its moving or deletion to be performed on the next reboot. This approach is typically used by installers to replace locked system files.

Version control systems[edit]

In version control systems file locking is used to prevent two users changing the same file version in parallel and then when saving, the second user to overwrite what first user changed. This is implemented by marking locked files as read-only in the file system. A user wanting to change the file performs an unlock (also called checkout) operation, and until a check-in (store) operation is done, or the lock is reverted, nobody else is allowed to unlock the file.

See also[edit]


  1. ^IBM System/360 Operating System: Job Control Language Reference(PDF). IBM. June 1971. pp. 162–164. GC28-6704-1.
  2. ^ ab" function". Windows Software Development Toolkit. Microsoft Docs. windows-sdk-content. Microsoft Corporation. Retrieved 2018-11-07.
  3. ^" function". Windows Software Development Toolkit. Microsoft Docs. windows-sdk-content. Microsoft Corporation. Retrieved 2018-11-07.
  4. ^" function". Windows Software Development Toolkit. Microsoft Docs. windows-sdk-content. Microsoft Corporation. Retrieved 2020-07-05.
  5. ^" function". Windows Software Development Toolkit. Microsoft Docs. windows-sdk-content. Microsoft Corporation. Retrieved 2020-07-05.
  6. ^"Mandatory File Locking for the Linux Operating System". kernel.org. Documentation / File Systems. Retrieved 2011-10-08.
  7. ^"Use , , and Sticky Bits with Server for NFS". cc731734(WS.10). Retrieved 2011-10-08.
  8. ^Viega, John; Messier, Matt (2003). "2.8 Locking Files". Secure Programming Cookbook for C and C++ (1st ed.). Sabastopol, CA: O'Reilly Media. p. 792. ISBN .
  9. ^Stevens, W. Richard; Rago, Stephen A. (27 June 2005). Advanced Programming in the UNIX Environment (Second ed.). Addison-Wesley Professional. p. 456. ISBN .
  10. ^"Commonly occurring error messages". nfs.sourceforge.net. Linux NFS FAQ: D. Source Forge.
  11. ^"Lock your script (against parallel run)".

External links[edit]

Sours: https://en.wikipedia.org/wiki/File_locking

Wikipedia locking


For information on "locked" (protected) Wikipedia pages and other uses of the term in the administration of Wikipedia, see Wikipedia:Protection policy, Wikipedia:Edit lock, and Wikipedia:Global locks.

Look up lock or locks in Wiktionary, the free dictionary.

Lock(s) may refer to:

Common meanings[edit]

Arts and entertainment[edit]






  • Lock (computer science), a bookkeeping object used to serialize concurrent access
  • Lock (database), a feature used when multiple users access a database concurrently
  • File locking, describes a mechanism that restricts access to a computer file
  • SIM lock, a restriction on mobile phones to work only in certain countries or with certain providers

Other technologies[edit]

Other uses[edit]

See also[edit]

Topics referred to by the same term

Sours: https://en.wikipedia.org/wiki/Lock
Locking Warm Up - Follow Along - Locking Dance Tutorial

Locking (dance)

Type of dance step

Locking is a style of funk dance, which is today also associated with hip hop. The name is based on the concept of locking movements, which means freezing from a fast movement and "locking" in a certain position, holding that position for a short while and then continuing at the same speed as before. It relies on fast and distinct arm and hand movements combined with more relaxed hips and legs. The movements are generally large and exaggerated, and often very rhythmic and tightly synced with the music. Locking is performance oriented, often interacting with the audience by smiling or giving them a high five, and some moves are quite comical.

Locking was originally danced to traditional funk music, such as that produced or performed by James Brown. Funk music is still commonly favored by locking dancers and used by many competitions such as the locking divisions of Juste Debout and Summer Dance Forever. Locking movements create a strong contrast towards the many fast moves that are otherwise performed quite continuously, combined with mime style performance and acting and other dancers. Locking includes many acrobatics and physically demanding moves, such as landing on one's knees and the split. These moves often require knee protection.


The beginning of Locking can be traced to Don Campbell. In the late 1960s he put together several fad dances adding moves of his own (known as the "Lock") when performing. The original lock was created by accident: Campbell couldn't do a move called the 'Robot Shuffle' and stopped at a particular point whilst moving his arms, creating a 'locking' effect.[1][2] He wasn't able to perform it fluently, for he couldn't remember which step to take next. (Even the acting towards the audience was spontaneous: when people started laughing at Don because of his unfamiliar moves, he responded by pointing at them.) These halts soon became popular as Don added them into his performances. The resulting dance was called Campbellocking, which was later shortened to Locking. In the early 1970s this set off a movement of Locking dance groups, notably Campbell's group The Lockers. Other lockers Jimmy "Scoo B Doo" Foster, Greggory "Campbellock Jr." Pope, Tony "GoGo" Lewis, Fred "Mr Penguin" Berry (a.k.a. Rerun), Leo "Fluky Luke" Williamson, Damita Jo Freeman and others also helped set the foundation for the locking dance and clothes style.

Clothes style can consist of loud striped socks, pegged pants that stopped at the knees, bright colorful satin shirts with big collars, big colorful bow ties, gigantic Apple Boy hats, and white gloves.


Locking may be done in solo or in unison with two or more dancers doing steps or handshakes together. A locker may smile while performing to emphasize the comical nature of the dance; other times, a serious demeanor will be maintained to place emphasis on technique. Other important stylistic features are waving of arms, pointing, walking stationary and grabbing and rotating the cap or hat. Don Campbell created the original freezes, incorporating his unique rhythm and adding gestures such as points and handclaps. Other dancers also adapted this style while creating other steps and moves.

Locking is by nature an improvisational dance but also consists of a set of signature moves of locking pioneers, However, many lockers alter or blend these with other moves or create their own variations. In general, Lockers will often put a small pause and move up on the second and fourth beats to emphasize the locking.

Created by Alpha Anderson. One leg is kicked forward from a crouching position while the upper body is leaned backwards. The upper body can be supported by both hands or no hands at all.
Break down/Rocksteady
In the squatting position, shift the pelvis to the side, then back to the center. Stand up, then return to the squatting position again and repeat the movement for the other side.
Jazz split
A semi-split done with one leg bent, enabling the dancer to get up again in one swift movement.
Altering twirl kicks to the sides first, starting with one leg and using the momentum to "kick" the other out like a pendulum. The upper body remains stationary with the arms out front.
A single powerful and high leg kick while standing on the other.
Knee Drop
A drop to the knees with the knees pointing inwards(into a W shape leg position).
Leo Walk
A funky two step where the first step is an exaggerated step in a particular direction. The other foot is then slid across the floor to meet the first.
Lock/Double Lock
Bending slightly forward with arms forming a circle downward, as if lifting a heavy object.

Up Lock (Muscle man)

A macho man pose, where the arms are drawn above the shoulder. The pose is generally held for a moment or two.
A quick jab to the side. The wrist should be loose while the arm is tight. The arm is lowered in between jabs.
Pimp Walk
A two step involving a small kick of one leg before bringing the other foot beside it. As the other foot reaches the first one, there is a knee split into a "v" shape without stepping again.
Stop and Go
Created by Jimmy "Scoo B Doo" Foster; starting with a muscle man lock, step back with one foot and punch, do a quarter turn in the direction of the back foot breakdown once, and then return reach-around to the same position.
Stomp the cockroach
A ground technique that involves going on one knee and smacking the ground with your hand, indicating you are stomping something beneath you.
Scoo B Doo
Created by Jimmy "Scoo B Doo" Foster; doing a muscle man lock then doing two separate kicks while pacing with one hand in time with the kicks
Scoo B Doo walk
Created by Jimmy "Scoo B Doo" Foster; Walking forward, lifting leg up and bending your back towards the knee
Created by Jimmy "Scoo B Doo" Foster; One arm and leg out then switching to the other leg. Leg out and arms crossed then wrist twirl and clap behind
Scoobot hop
Slightly varied from scoobot with legs hopping towards the sides then the front.
Floor Sweep
Using your hand to swiftly move left to right on the floor, as if using a cloth to wipe.
The Skeeter Rabbit/Skeeter Rabbit Around the World
Created by James "Skeeter Rabbit" Higgins; a kick and shuffle hop move, either at the sides and/or front and back.
Funky Guitar
Hands positioned as if holding a guitar, and start walking backwards.
A quick, extended pointing gesture coming from opposite shoulder, usually held for a few seconds for emphasis.
Wrist Twirl
Twirling wrists while moving arms up
The Seek
Doing a breakdown whilst rolling your arms in front of you and then lifting a hand up over your eyes as if you are looking/seeking for something
Hitch Hike
Arms up and then crossed in front of you, and then three hitchhiker thumbs up to the right and then the left.

See also[edit]


External links[edit]

  • Campbellock The Creator of locking Don "Campbellock" Campbells Official Website.
  • TheLockersDance The Official website for the Group The Lockers.
  • LockerLegends The official website of some of the original members of The Lockers.
  • Locking4Life Created by Gemini and Priska, the Locking4Life concept seeks to glorify Locking today by emphasizing its important role in "street dance" history. The project aims to bring Locking's values and spirit to a multitude of art forms, notably cinema, painting, graphic concepts and video.
  • Video of Locking at the Red Bull BC One competition in Berlin 2005
Sours: https://en.wikipedia.org/wiki/Locking_(dance)

Now discussing:

Lock (computer science)

Synchronization mechanism for enforcing limits on access to a resource

In computer science, a lock or mutex (from mutual exclusion) is a synchronization primitive: a mechanism that enforces limits on access to a resource when there are many threads of execution. A lock is designed to enforce a mutual exclusion concurrency control policy, and with a variety of possible methods there exists multiple unique implementations for different applications.


Generally, locks are advisory locks, where each thread cooperates by acquiring the lock before accessing the corresponding data. Some systems also implement mandatory locks, where attempting unauthorized access to a locked resource will force an exception in the entity attempting to make the access.

The simplest type of lock is a binary semaphore. It provides exclusive access to the locked data. Other schemes also provide shared access for reading data. Other widely implemented access modes are exclusive, intend-to-exclude and intend-to-upgrade.

Another way to classify locks is by what happens when the lock strategy prevents the progress of a thread. Most locking designs block the execution of the thread requesting the lock until it is allowed to access the locked resource. With a spinlock, the thread simply waits ("spins") until the lock becomes available. This is efficient if threads are blocked for a short time, because it avoids the overhead of operating system process re-scheduling. It is inefficient if the lock is held for a long time, or if the progress of the thread that is holding the lock depends on preemption of the locked thread.

Locks typically require hardware support for efficient implementation. This support usually takes the form of one or more atomic instructions such as "test-and-set", "fetch-and-add" or "compare-and-swap". These instructions allow a single process to test if the lock is free, and if free, acquire the lock in a single atomic operation.

Uniprocessor architectures have the option of using uninterruptible sequences of instructions—using special instructions or instruction prefixes to disable interrupts temporarily—but this technique does not work for multiprocessor shared-memory machines. Proper support for locks in a multiprocessor environment can require quite complex hardware or software support, with substantial synchronization issues.

The reason an atomic operation is required is because of concurrency, where more than one task executes the same logic. For example, consider the following C code:

if(lock==0){// lock free, set itlock=myPID;}

The above example does not guarantee that the task has the lock, since more than one task can be testing the lock at the same time. Since both tasks will detect that the lock is free, both tasks will attempt to set the lock, not knowing that the other task is also setting the lock. Dekker's or Peterson's algorithm are possible substitutes if atomic locking operations are not available.

Careless use of locks can result in deadlock or livelock. A number of strategies can be used to avoid or recover from deadlocks or livelocks, both at design-time and at run-time. (The most common strategy is to standardize the lock acquisition sequences so that combinations of inter-dependent locks are always acquired in a specifically defined "cascade" order.)

Some languages do support locks syntactically. An example in C# follows:

publicclassAccount// This is a monitor of an account{privatedecimal_balance=0;privateobject_balanceLock=newobject();publicvoidDeposit(decimalamount){// Only one thread at a time may execute this statement.lock(_balanceLock){_balance+=amount;}}publicvoidWithdraw(decimalamount){// Only one thread at a time may execute this statement.lock(_balanceLock){_balance-=amount;}}}

The code can lead to problems if the instance can be accessed publicly.[1]

Similar to Java, C# can also synchronize entire methods, by using the MethodImplOptions.Synchronized attribute.[2][3]

[MethodImpl(MethodImplOptions.Synchronized)]publicvoidSomeMethod(){// do stuff}


Before being introduced to lock granularity, one needs to understand three concepts about locks:

  • lock overhead: the extra resources for using locks, like the memory space allocated for locks, the CPU time to initialize and destroy locks, and the time for acquiring or releasing locks. The more locks a program uses, the more overhead associated with the usage;
  • lock contention: this occurs whenever one process or thread attempts to acquire a lock held by another process or thread. The more fine-grained the available locks, the less likely one process/thread will request a lock held by the other. (For example, locking a row rather than the entire table, or locking a cell rather than the entire row.);
  • deadlock: the situation when each of at least two tasks is waiting for a lock that the other task holds. Unless something is done, the two tasks will wait forever.

There is a tradeoff between decreasing lock overhead and decreasing lock contention when choosing the number of locks in synchronization.

An important property of a lock is its granularity. The granularity is a measure of the amount of data the lock is protecting. In general, choosing a coarse granularity (a small number of locks, each protecting a large segment of data) results in less lock overhead when a single process is accessing the protected data, but worse performance when multiple processes are running concurrently. This is because of increased lock contention. The more coarse the lock, the higher the likelihood that the lock will stop an unrelated process from proceeding. Conversely, using a fine granularity (a larger number of locks, each protecting a fairly small amount of data) increases the overhead of the locks themselves but reduces lock contention. Granular locking where each process must hold multiple locks from a common set of locks can create subtle lock dependencies. This subtlety can increase the chance that a programmer will unknowingly introduce a deadlock.[citation needed]

In a database management system, for example, a lock could protect, in order of decreasing granularity, part of a field, a field, a record, a data page, or an entire table. Coarse granularity, such as using table locks, tends to give the best performance for a single user, whereas fine granularity, such as record locks, tends to give the best performance for multiple users.

Database locks[edit]

Main article: Lock (database)

Database locks can be used as a means of ensuring transaction synchronicity. i.e. when making transaction processing concurrent (interleaving transactions), using 2-phased locks ensures that the concurrent execution of the transaction turns out equivalent to some serial ordering of the transaction. However, deadlocks become an unfortunate side-effect of locking in databases. Deadlocks are either prevented by pre-determining the locking order between transactions or are detected using waits-for graphs. An alternate to locking for database synchronicity while avoiding deadlocks involves the use of totally ordered global timestamps.

There are mechanisms employed to manage the actions of multiple concurrent users on a database—the purpose is to prevent lost updates and dirty reads. The two types of locking are pessimistic locking and optimistic locking:

  • Pessimistic locking: a user who reads a record with the intention of updating it places an exclusive lock on the record to prevent other users from manipulating it. This means no one else can manipulate that record until the user releases the lock. The downside is that users can be locked out for a very long time, thereby slowing the overall system response and causing frustration.
Where to use pessimistic locking: this is mainly used in environments where data-contention (the degree of users request to the database system at any one time) is heavy; where the cost of protecting data through locks is less than the cost of rolling back transactions, if concurrency conflicts occur. Pessimistic concurrency is best implemented when lock times will be short, as in programmatic processing of records. Pessimistic concurrency requires a persistent connection to the database and is not a scalable option when users are interacting with data, because records might be locked for relatively large periods of time. It is not appropriate for use in Web application development.
  • Optimistic locking: this allows multiple concurrent users access to the database whilst the system keeps a copy of the initial-read made by each user. When a user wants to update a record, the application determines whether another user has changed the record since it was last read. The application does this by comparing the initial-read held in memory to the database record to verify any changes made to the record. Any discrepancies between the initial-read and the database record violates concurrency rules and hence causes the system to disregard any update request. An error message is generated and the user is asked to start the update process again. It improves database performance by reducing the amount of locking required, thereby reducing the load on the database server. It works efficiently with tables that require limited updates since no users are locked out. However, some updates may fail. The downside is constant update failures due to high volumes of update requests from multiple concurrent users - it can be frustrating for users.
Where to use optimistic locking: this is appropriate in environments where there is low contention for data, or where read-only access to data is required. Optimistic concurrency is used extensively in .NET to address the needs of mobile and disconnected applications,[4] where locking data rows for prolonged periods of time would be infeasible. Also, maintaining record locks requires a persistent connection to the database server, which is not possible in disconnected applications.


Lock-based resource protection and thread/process synchronization have many disadvantages:

  • Contention: some threads/processes have to wait until a lock (or a whole set of locks) is released. If one of the threads holding a lock dies, stalls, blocks, or enters an infinite loop, other threads waiting for the lock may wait forever.
  • Overhead: the use of locks adds overhead for each access to a resource, even when the chances for collision are very rare. (However, any chance for such collisions is a race condition.)
  • Debugging: bugs associated with locks are time dependent and can be very subtle and extremely hard to replicate, such as deadlocks.
  • Instability: the optimal balance between lock overhead and lock contention can be unique to the problem domain (application) and sensitive to design, implementation, and even low-level system architectural changes. These balances may change over the life cycle of an application and may entail tremendous changes to update (re-balance).
  • Composability: locks are only composable (e.g., managing multiple concurrent locks in order to atomically delete item X from table A and insert X into table B) with relatively elaborate (overhead) software support and perfect adherence by applications programming to rigorous conventions.
  • Priority inversion: a low-priority thread/process holding a common lock can prevent high-priority threads/processes from proceeding. Priority inheritance can be used to reduce priority-inversion duration. The priority ceiling protocol can be used on uniprocessor systems to minimize the worst-case priority-inversion duration, as well as prevent deadlock.
  • Convoying: all other threads have to wait if a thread holding a lock is descheduled due to a time-slice interrupt or page fault.

Some concurrency control strategies avoid some or all of these problems. For example, a funnel or serializing tokens can avoid the biggest problem: deadlocks. Alternatives to locking include non-blocking synchronization methods, like lock-free programming techniques and transactional memory. However, such alternative methods often require that the actual lock mechanisms be implemented at a more fundamental level of the operating software. Therefore, they may only relieve the application level from the details of implementing locks, with the problems listed above still needing to be dealt with beneath the application.

In most cases, proper locking depends on the CPU providing a method of atomic instruction stream synchronization (for example, the addition or deletion of an item into a pipeline requires that all contemporaneous operations needing to add or delete other items in the pipe be suspended during the manipulation of the memory content required to add or delete the specific item). Therefore, an application can often be more robust when it recognizes the burdens it places upon an operating system and is capable of graciously recognizing the reporting of impossible demands.[citation needed]

Lack of composability[edit]

One of lock-based programming's biggest problems is that "locks don't compose": it is hard to combine small, correct lock-based modules into equally correct larger programs without modifying the modules or at least knowing about their internals. Simon Peyton Jones (an advocate of software transactional memory) gives the following example of a banking application:[5] design a class Account that allows multiple concurrent clients to deposit or withdraw money to an account; and give an algorithm to transfer money from one account to another. The lock-based solution to the first part of the problem is:

class Account: member balance: Integer member mutex: Lock method deposit(n: Integer) mutex.lock() balance ← balance + n mutex.unlock() method withdraw(n: Integer) deposit(−n)

The second part of the problem is much more complicated. A transfer routine that is correct for sequential programs would be

function transfer(from: Account, to: Account, amount: integer) from.withdraw(amount) to.deposit(amount)

In a concurrent program, this algorithm is incorrect because when one thread is halfway through transfer, another might observe a state where amount has been withdrawn from the first account, but not yet deposited into the other account: money has gone missing from the system. This problem can only be fixed completely by taking locks on both account prior to changing any of the two accounts, but then the locks have to be taken according to some arbitrary, global ordering to prevent deadlock:

function transfer(from: Account, to: Account, amount: integer) if from < to // arbitrary ordering on the locks from.lock() to.lock() else to.lock() from.lock() from.withdraw(amount) to.deposit(amount) from.unlock() to.unlock()

This solution gets more complicated when more locks are involved, and the transfer function needs to know about all of the locks, so they cannot be hidden.

Language support[edit]

See also: Barrier (computer science)

Programming languages vary in their support for synchronization:

  • Ada provides protected objects that have visible protected subprograms or entries[6] as well as rendezvous.[7]
  • The ISO/IEC C standard provides a standard mutual exclusion (locks) API since C11. The current ISO/IEC C++ standard supports threading facilities since C++11. The OpenMP standard is supported by some compilers, and allows critical sections to be specified using pragmas. The POSIX pthread API provides lock support.[8]Visual C++ provides the attribute of methods to be synchronized, but this is specific to COM objects in the Windows architecture and Visual C++ compiler.[9] C and C++ can easily access any native operating system locking features.
  • C# provides the keyword on a thread to ensure its exclusive access to a resource.
  • VB.NET provides a keyword like C#'s keyword.
  • Java provides the keyword to lock code blocks, methods or objects[10] and libraries featuring concurrency-safe data structures.
  • Objective-C provides the keyword [11] to put locks on blocks of code and also provides the classes NSLock,[12] NSRecursiveLock,[13] and NSConditionLock[14] along with the NSLocking protocol[15] for locking as well.
  • PHP provides a file-based locking [16] as well as a class in the extension. [17]
  • Python provides a low-level mutex mechanism with a class from the module.[18]
  • The ISO/IEC Fortran standard (ISO/IEC 1539-1:2010) provides the derived type in the intrinsic module and the / statements since Fortran 2008.[19]
  • Ruby provides a low-level mutex object and no keyword.[20]
  • Rust provides the [21] struct.[22]
  • x86 assembly provides the prefix on certain operations to guarantee their atomicity.
  • Haskell implements locking via a mutable data structure called an , which can either be empty or contain a value, typically a reference to a resource. A thread that wants to use the resource ‘takes’ the value of the , leaving it empty, and puts it back when it is finished. Attempting to take a resource from an empty results in the thread blocking until the resource is available.[23] As an alternative to locking, an implementation of software transactional memory also exists.[24]

See also[edit]


  1. ^"lock Statement (C# Reference)".
  2. ^"ThreadPoolPriority, and MethodImplAttribute". MSDN. p. ??. Retrieved 2011-11-22.
  3. ^"C# From a Java Developer's Perspective". Archived from the original on 2013-01-02. Retrieved 2011-11-22.
  4. ^"Designing Data Tier Components and Passing Data Through Tiers". Microsoft. August 2002. Archived from the original on 2008-05-08. Retrieved 2008-05-30.
  5. ^Peyton Jones, Simon (2007). "Beautiful concurrency"(PDF). In Wilson, Greg; Oram, Andy (eds.). Beautiful Code: Leading Programmers Explain How They Think. O'Reilly.
  6. ^ISO/IEC 8652:2007. "Protected Units and Protected Objects". Ada 2005 Reference Manual. Retrieved 2010-02-27.
  7. ^ISO/IEC 8652:2007. "Example of Tasking and Synchronization". Ada 2005 Reference Manual. Retrieved 2010-02-27.
  8. ^Marshall, Dave (March 1999). "Mutual Exclusion Locks". Retrieved 2008-05-30.
  9. ^"Synchronize". msdn.microsoft.com. Retrieved 2008-05-30.
  10. ^"Synchronization". Sun Microsystems. Retrieved 2008-05-30.
  11. ^"Apple Threading Reference". Apple, inc. Retrieved 2009-10-17.
  12. ^"NSLock Reference". Apple, inc. Retrieved 2009-10-17.
  13. ^"NSRecursiveLock Reference". Apple, inc. Retrieved 2009-10-17.
  14. ^"NSConditionLock Reference". Apple, inc. Retrieved 2009-10-17.
  15. ^"NSLocking Protocol Reference". Apple, inc. Retrieved 2009-10-17.
  16. ^"flock".
  17. ^"The Mutex class".
  18. ^Lundh, Fredrik (July 2007). "Thread Synchronization Mechanisms in Python". Retrieved 2008-05-30.
  19. ^John Reid (2010). "Coarrays in the next Fortran Standard"(PDF). Retrieved 2020-02-17.
  20. ^"Programming Ruby: Threads and Processes". 2001. Retrieved 2008-05-30.
  21. ^"std::sync::Mutex - Rust". doc.rust-lang.org. Retrieved 3 November 2020.
  22. ^"Shared-State Concurrency - The Rust Programming Language". doc.rust-lang.org. Retrieved 3 November 2020.
  23. ^Marlow, Simon (August 2013). "Basic concurrency: threads and MVars". Parallel and Concurrent Programming in Haskell. O’Reilly Media. ISBN .
  24. ^Marlow, Simon (August 2013). "Software transactional memory". Parallel and Concurrent Programming in Haskell. O’Reilly Media. ISBN .

External links[edit]

Sours: https://en.wikipedia.org/wiki/Lock_(computer_science)

1444 1445 1446 1447 1448