`

Performance engineer MUST (2)

阅读更多
Spinlock

以下来自Wikipedia
Spinlock
From Wikipedia, the free encyclopedia
Jump to: navigation, search

In software engineering, a spinlock is a lock where the thread simply waits in a loop ("spins") repeatedly checking until the lock becomes available. As the thread remains active but isn't performing a useful task, the use of such a lock is a kind of busy waiting. Once acquired, spinlocks will usually be held until they are explicitly released, although in some implementations they may be automatically released if the thread blocks, or "goes to sleep".

Spinlocks are efficient if threads are only likely to be blocked for a short period of time, as they avoid overhead from operating system process re-scheduling or context switching. For this reason, spinlocks are often used inside operating system kernels. However, spinlocks become wasteful if held for longer durations, both preventing other threads from running and requiring re-scheduling. The longer a lock is held by a thread, the greater the risk that it will be interrupted by the O/S scheduler while holding the lock. If this happens, other threads will be left "spinning" (repeatedly trying to acquire the lock), while the thread holding the lock is not making progress towards releasing it. The result is a semi-deadlock until the thread holding the lock can finish and release it. This is especially true on a single-processor system, where each waiting thread of the same priority is likely to waste its quantum (allocated time where a thread can run) spinning until the thread that holds the lock is finally finished.
分享到:
评论

相关推荐

    Third-Party JavaScript

    They must adapt easily to unknown host environments, coexist with other applications, and manage the tricky security vulnerabilities you get when code and asset files are served from remote web ...

    微软内部资料-SQL性能优化2

    Lesson 2: I/O 73 Lesson 3: CPU 111 Module 3: Troubleshooting Server Performance Module Overview Troubleshooting server performance-based support calls requires product knowledge, good ...

    《ACE程序员指南》

    -Johnny Willemsen, Senior Software Engineer, Remedy IT, The Netherlands "With a large C++ code base, we rely on ACE to enable a cross-platform client-server framework for data quality and data ...

    iPhone Games Projects

    This book is a collection of must-know information from master independent iPhone game developers. Find out how some of the most innovative and creative game developers have made it to the pinnacle of...

    BobBuilder_app

    Very fast performance (typically 2x the insert and 4x the read performance of RaptorDB v1) Extremely small foot print at ~50kb. No dependencies. Multi-Threaded support for read and writes. Data ...

    .A.Comprehensive.Guide.to.Digital.Electronics.and.Computer.System.Architecture.p

    have an interest in understanding and building digital systems without having a formal engineer- ing degree. Their need for practical knowledge in the field is as strong as for degreed engineers, but ...

    starftp.exe

    You may not decompile, reverse engineer, disassemble or otherwise reduce this SOFTWARE to a human perceivable form. You may not modify, rent or resell for profit this SOFTWARE, or create derivative ...

    OS X and iOS Kernel Programming

    Extraordinary care must be taken to ensure that kernel code is free of bugs because any issue may have serious consequences to the stability, security, and performance of the system. This book covers...

    piriform碎片整理大师

    - You may NOT decompile, disassemble, reverse engineer or otherwise attempt to discover the source code of the Product except to the extent that you may be expressly permitted to reverse engineer or ...

    TeeChart2013_131216_SourceCode

    2. This EULA is a legal agreement between you and Steema. If you are acting as an agent of a company or another legal person, such as an officer or other employee acting for your employer, then ...

    TeeChart2013_130818_SourceCode

    2. This EULA is a legal agreement between you and Steema. If you are acting as an agent of a company or another legal person, such as an officer or other employee acting for your employer, then ...

    a project model for the FreeBSD Project.7z

    This is synonymous with deliverable, that is defined as “any measurable, tangible, verifiable outcome, result or item that must be produced to complete a project or part of a project. Often used ...

    Vagaa哇嘎画时代--体验群体智慧的力量!

    3.2 Except as expressly permitted in this Licence, you agree not to reverse engineer, de-compile, disassemble, alter, duplicate, modify, rent, lease, loan, sublicense, make copies, create derivative ...

    Microsoft Windows 7 In Depth.pdf

    engineer, and we do our best to speak in plain English and not snow you with unexplained jargon. As we wrote, we imagined that you, our reader, are a friend or co-worker who’s familiar enough with ...

    polycom宝利通视频会议软件3.9 2018

    1.2You may not reverse engineer, decompile, modify or disassemble the SOFTWARE PRODUCT or otherwise reduce the SOFTWARE PRODUCT to human-perceivable form in whole or in part, except and only to the...

Global site tag (gtag.js) - Google Analytics