bitcoin/doc
fanquake c1059c9fef
Merge bitcoin/bitcoin#24770: Put lock logging behind DEBUG_LOCKCONTENTION preprocessor directive
4394733331 Add DEBUG_LOCKCONTENTION documentation to the developer notes (Jon Atack)
39a34b6877 Put lock logging behind DEBUG_LOCKCONTENTION preprocessor directive (Jon Atack)

Pull request description:

  This is a more minimal, no-frills version of #24734 for backport. The other fixes and improvements in that pull can be done after.

  *Copy of the PR 24734 description:*

  PRs #22736, #22904 and #23223 changed lock contention logging from a `DEBUG_LOCKCONTENTION` compile-time preprocessor directive to a runtime `lock` log category and improved the logging output. This changed the locking from using `lock()` to `try_lock()`:

  - `void Mutex::UniqueLock::lock()` acquires the mutex and blocks until it gains access to it

  - `bool Mutex::UniqueLock::try_lock()` doesn't block but instead immediately returns whether it acquired the mutex; it may be used by `lock()` internally as part of the deadlock-avoidance algorithm

  In theory the cost of `try_lock` might be essentially the [same](https://www.erisian.com.au/bitcoin-core-dev/log-2022-03-31.html#l-697) relative to `lock`. The test-and-set logic of these calls is purported to be ~ constant time, optimised and light/quick if used carefully (i.e. no mutex convoying), compared to system calls, memory/cache coherency and fences, wait queues, and (particularly) lock contentions. See the discussion around https://github.com/bitcoin/bitcoin/pull/22736#issuecomment-902851054 and after with respect to performance/cost aspects.  However, there are reasonable concerns (see [here](https://github.com/bitcoin/bitcoin/pull/22736#discussion_r691277896) and [here](https://www.erisian.com.au/bitcoin-core-dev/log-2022-03-31.html#l-620)) that `Base::try_lock()` may be potentially [costly](https://www.erisian.com.au/bitcoin-core-dev/log-2022-03-31.html#l-700) or [risky](https://github.com/bitcoin/bitcoin/pull/22904#issuecomment-930484001) compared to `Base::lock()` in this very frequently called code.

  One alternative to keep the run-time lock logging would be to gate the `try_lock` call behind the logging conditional, for example as proposed in ccd73de1dd and ACKed [here](https://github.com/bitcoin/bitcoin/pull/22736#issuecomment-901980815). However, this would add the [cost](https://github.com/bitcoin/bitcoin/pull/22736#issuecomment-910102353) of `if (LogAcceptCategory(BCLog::LOCK))` to the hotspot, instead of replacing `lock` with `try_lock`, for the most frequent happy path (non-contention).

  It turns out we can keep the advantages of the runtime lock contention logging (the ability to turn it on/off at runtime) while out of prudence putting the `try_lock()` call and `lock` logging category behind a  `DEBUG_LOCKCONTENTION` compile-time preprocessor directive, and also still retain the lock logging enhancements of the mentioned PRs, as suggested in https://github.com/bitcoin/bitcoin/pull/24734#issuecomment-1085785480 by W. J. van der Laan, in https://github.com/bitcoin/bitcoin/pull/22736#discussion_r691280693, and in the linked IRC discussion.

  Proposed here and for backport to v23.

ACKs for top commit:
  laanwj:
    Code review ACK 4394733331

Tree-SHA512: 89b1271cae1dca0eb251914b1a60fc5b68320aab4a3939c57eec3a33a3c8f01688f05d95dfc31f91d71a6ed80cfe2d67b77ff14742611cc206175e47b2e5d3b1
2022-04-08 13:30:24 +01:00
..
man scripted-diff: Fix typo in stub manual pages 2021-01-12 16:46:55 +01:00
policy [docs] package feerate 2022-04-01 14:14:57 -04:00
release-notes doc: Add historical release notes for 22.0 2021-09-14 13:20:48 +02:00
.gitignore
assets-attribution.md
assumeutxo.md doc: add assumeutxo notes 2021-10-04 16:40:00 -04:00
benchmarking.md doc: update doc/benchmarking.md 2021-06-24 11:15:29 +02:00
bips.md doc: Mention missing BIP157 in bips.md 2022-02-22 18:16:43 +01:00
bitcoin_logo_doxygen.png
bitcoin-conf.md doc: added info to bitcoin.conf doc 2021-07-06 09:32:37 -04:00
build-android.md build, qt: Use Android NDK r23 LTS 2021-12-05 03:00:02 +02:00
build-freebsd.md doc: mention that BDB is for the legacy wallet in build-freebsd.md 2022-03-23 15:35:29 +00:00
build-netbsd.md doc: mention that BDB is for the legacy wallet in build-netbsd.md 2022-03-24 10:53:04 +00:00
build-openbsd.md lint: codespell 2.1.0 2022-04-07 12:49:51 +01:00
build-osx.md Merge bitcoin/bitcoin#24585: doc: mention that BDB is for the legacy wallet in build-osx.md 2022-03-17 21:13:39 +01:00
build-unix.md doc: clarify that BDB is only required for the legacy wallet 2022-03-18 10:27:49 +00:00
build-windows.md doc: Install only "-posix" MinGW compiler when possible 2022-02-02 19:29:01 +02:00
cjdns.md Add and improve informational links in doc/cjdns.md 2022-04-01 16:11:14 +02:00
dependencies.md Merge bitcoin/bitcoin#24681: build: Bump libevent minimum version up to 2.1.8 2022-04-06 13:19:36 +01:00
descriptors.md Merge bitcoin/bitcoin#24043: Add (sorted)multi_a descriptor for k-of-n multisig inside tr 2022-03-04 07:28:23 -05:00
developer-notes.md Add DEBUG_LOCKCONTENTION documentation to the developer notes 2022-04-05 12:49:50 +02:00
dnsseed-policy.md
Doxyfile.in Generate doxygen documentation for test sources 2021-05-19 22:08:18 -07:00
external-signer.md Move external signer out of wallet module 2021-04-08 17:56:00 +02:00
files.md Ignore banlist.dat 2021-07-30 11:21:51 +02:00
fuzzing.md fuzz: parse the command line arguments in fuzz tests 2022-01-11 11:53:34 +01:00
guix.md docs: Point to contrib/guix/README.md in doc/guix.md 2021-01-08 11:40:01 -05:00
i2p.md doc: update i2p.md with cjdns, improve local addresses section 2022-03-22 12:54:23 +01:00
init.md doc: Replace tabs for spaces 2021-02-04 12:06:13 +00:00
JSON-RPC-interface.md Update 'Secure string handling' 2020-12-29 01:49:30 +05:30
managing-wallets.md Update doc to match new default wallet type 2022-02-09 07:38:48 +00:00
multiprocess.md multiprocess: Add comments and documentation 2021-04-23 03:02:50 -05:00
multisig-tutorial.md doc: update multisig-tutorial.md to default wallet type 2022-03-10 12:50:34 +01:00
p2p-bad-ports.md init, doc: improve -onlynet help and tor/i2p documentation 2022-03-03 16:14:01 +01:00
productivity.md doc: Add libnatpmp stuff 2021-01-07 18:07:10 +02:00
psbt.md doc: M-of-N multisig using descriptor wallets and PSBTs, as well as a signing flow 2021-08-16 10:43:07 +05:00
README_doxygen.md
README_windows.txt
README.md doc, init: add links to doc/cjdns.md 2022-03-24 20:12:32 +01:00
reduce-memory.md doc: update reduce-memory.md peer connections info 2021-04-17 20:17:59 +02:00
reduce-traffic.md doc: Use precise permission flags where possible 2020-07-10 15:37:42 +02:00
release-notes-24098.md Add release notes 2022-04-05 13:19:37 -04:00
release-notes-24118.md Add sendall RPC née sweep 2022-03-29 16:37:47 -04:00
release-notes-24198.md doc: add wtxid info in release-notes 2022-02-09 21:15:19 -03:00
release-notes-24494.md [doc] release notes for random change target 2022-03-25 11:57:51 +00:00
release-notes-empty-template.md doc: Add template for empty release notes 2022-03-17 14:15:07 +01:00
release-notes.md doc: Add template for empty release notes 2022-03-17 14:15:07 +01:00
release-process.md Merge bitcoin/bitcoin#24583: doc: Add template for empty release notes 2022-04-05 09:11:11 +02:00
REST-interface.md Update /<count>/ endpoints to use a '?count=' query parameter instead 2022-04-05 13:19:37 -04:00
shared-libraries.md doc: libbitcoinconsensus: add missing error code description, fix NBitcoin link 2020-12-05 13:37:00 +01:00
tor.md doc: update tor.md with cjdns and getnodeaddresses, fix tor grep, 2022-03-22 12:54:21 +01:00
tracing.md tracing: misc follow-ups to 22902 2022-02-18 20:48:52 +05:30
translation_process.md doc: Remove unnecessary steps from translations update process 2021-07-03 21:31:29 +02:00
translation_strings_policy.md doc: Do not translate technical or extremely rare errors 2020-05-05 04:46:08 +03:00
zmq.md doc: Improve ZMQ documentation 2021-12-06 13:31:28 -03:00

Bitcoin Core

Setup

Bitcoin Core is the original Bitcoin client and it builds the backbone of the network. It downloads and, by default, stores the entire history of Bitcoin transactions, which requires a few hundred gigabytes of disk space. Depending on the speed of your computer and network connection, the synchronization process can take anywhere from a few hours to a day or more.

To download Bitcoin Core, visit bitcoincore.org.

Running

The following are some helpful notes on how to run Bitcoin Core on your native platform.

Unix

Unpack the files into a directory and run:

  • bin/bitcoin-qt (GUI) or
  • bin/bitcoind (headless)

Windows

Unpack the files into a directory, and then run bitcoin-qt.exe.

macOS

Drag Bitcoin Core to your applications folder, and then run Bitcoin Core.

Need Help?

Building

The following are developer notes on how to build Bitcoin Core on your native platform. They are not complete guides, but include notes on the necessary libraries, compile flags, etc.

Development

The Bitcoin repo's root README contains relevant information on the development process and automated testing.

Resources

Miscellaneous

License

Distributed under the MIT software license.