Skip to content

Commit 29e71b2

Browse files
committed
Update project / library naming: s/kcas/Kcas/g
Project, library, or module name - Kcas - Kcas_data Package: - kcas - kcas_data Algorithm: - k-CAS - k-CAS-n-CMP
1 parent 227b09d commit 29e71b2

File tree

3 files changed

+35
-36
lines changed

3 files changed

+35
-36
lines changed

README.md

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
src="https://raw.githubusercontent.com/ocaml-multicore/kcas/main/doc/kcas.svg">
1010
</a>
1111

12-
# **kcas** &mdash; STM based on lock-free MCAS
12+
# **Kcas** &mdash; STM based on lock-free MCAS
1313

1414
</div>
1515

16-
[**kcas**](https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/index.html)
16+
[**Kcas**](https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/index.html)
1717
provides a software transactional memory (STM) implementation based on an atomic
1818
[lock-free](https://en.wikipedia.org/wiki/Non-blocking_algorithm#Lock-freedom)
1919
multi-word [compare-and-set](https://en.wikipedia.org/wiki/Compare-and-swap)
2020
(MCAS) algorithm
2121
[enhanced with read-only compare operations](doc/gkmz-with-read-only-cmp-ops.md)
2222
and ability to block awaiting for changes.
2323

24-
[**kcas_data**](https://ocaml-multicore.github.io/kcas/doc/kcas_data/Kcas_data/index.html)
24+
[**Kcas_data**](https://ocaml-multicore.github.io/kcas/doc/kcas_data/Kcas_data/index.html)
2525
provides compositional lock-free data structures and primitives for
26-
communication and synchronization implemented using **kcas**.
26+
communication and synchronization implemented using **Kcas**.
2727

2828
Features and properties:
2929

@@ -53,7 +53,7 @@ cases, the non-blocking properties should allow use in many contexts including
5353
those where locks are not acceptable, and the features provided should support
5454
most practical needs.
5555

56-
**kcas** is [published on **opam**](https://opam.ocaml.org/packages/kcas/) and
56+
**Kcas** is [published on **opam**](https://opam.ocaml.org/packages/kcas/) and
5757
is distributed under the [ISC license](LICENSE.md).
5858

5959
[![OCaml-CI Build Status](https://img.shields.io/endpoint?url=https%3A%2F%2Fci.ocamllabs.io%2Fbadge%2Focaml-multicore%2Fkcas%2Fmain&logo=ocaml&style=flat-square)](https://ci.ocamllabs.io/github/ocaml-multicore/kcas)
@@ -167,7 +167,7 @@ And now we have it:
167167

168168
## Introduction
169169

170-
The API of **kcas** is divided into submodules. The main modules are
170+
The API of **Kcas** is divided into submodules. The main modules are
171171

172172
- [`Loc`](https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/Loc/index.html),
173173
providing an abstraction of _shared memory locations_,
@@ -196,7 +196,7 @@ rebind `module Atomic = Loc` and then use the
196196
and/or
197197
[`Xt`](https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/Xt/index.html) APIs
198198
to perform operations over multiple locations. This should not be done
199-
just-in-case, however, as, even though **kcas** is efficient, it does naturally
199+
just-in-case, however, as, even though **Kcas** is efficient, it does naturally
200200
have higher overhead than the Stdlib
201201
[`Atomic`](https://v2.ocaml.org/api/Atomic.html).
202202

@@ -506,7 +506,7 @@ but this sort of [busy-wait](https://en.wikipedia.org/wiki/Busy_waiting) is
506506
usually a _bad idea_ and should be avoided. It is usually better to block in
507507
such a way that the underlying domain can potentially perform other work.
508508

509-
To support blocking **kcas** provides a
509+
To support blocking **Kcas** provides a
510510
[`later`](https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/Retry/index.html#val-later)
511511
operation that amounts to raising a
512512
[`Later`](https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/Retry/index.html#exception-Later)
@@ -608,7 +608,7 @@ val pop_or_raise_if :
608608
```
609609

610610
This works, but creating, checking, and canceling timeouts properly can be a lot
611-
of work. Therefore **kcas** also directly supports an optional `timeoutf`
611+
of work. Therefore **Kcas** also directly supports an optional `timeoutf`
612612
argument for potentially blocking operations. For example, to perform a blocking
613613
pop with a timeout, one can simply explicitly pass the desired timeout in
614614
seconds:
@@ -621,7 +621,7 @@ Exception: Failure "Domain_local_timeout.set_timeoutf not implemented".
621621

622622
Oops! What happened above is that the
623623
[_domain local timeout_](https://github.com/ocaml-multicore/domain-local-timeout)
624-
mechanism used by **kcas** was not implemented on the current domain. The idea
624+
mechanism used by **Kcas** was not implemented on the current domain. The idea
625625
is that, in the future, concurrent schedulers provide the mechanism out of the
626626
box, but there is also a default implementation using the Stdlib `Thread` and
627627
`Unix` modules that works on most platforms. However, to avoid direct
@@ -826,7 +826,7 @@ from scratch? For most professionals the answer might be along the lines of
826826
_"when I took my data structures course at the university"_ or _"when I
827827
interviewed for the software engineering position at Big Co"_.
828828

829-
**kcas** aims to be usable both
829+
**Kcas** aims to be usable both
830830

831831
- for experts implementing correct and performant lock-free data structures, and
832832
- for everyone gluing together programs using such data structures.
@@ -837,10 +837,10 @@ everyone should be doing every time they are writing concurrent programs.
837837
Instead programmers should be able to reuse carefully constructed data
838838
structures.
839839

840-
One source of ready-made data structures is the
841-
[**kcas_data**](https://ocaml-multicore.github.io/kcas/doc/kcas_data/Kcas_data/index.html)
842-
package. Let's explore how we can leverage those data structures. Of course,
843-
first we need to `#require` the package and we'll also open it for convenience:
840+
One source of ready-made data structures is
841+
[**Kcas_data**](https://ocaml-multicore.github.io/kcas/doc/kcas_data/Kcas_data/index.html).
842+
Let's explore how we can leverage those data structures. Of course, first we
843+
need to `#require` the package and we'll also open it for convenience:
844844

845845
```ocaml
846846
# #require "kcas_data"
@@ -852,7 +852,7 @@ first we need to `#require` the package and we'll also open it for convenience:
852852
The
853853
[dining philosophers problem](https://en.wikipedia.org/wiki/Dining_philosophers_problem)
854854
is a well known classic synchronization problem. It is easy to solve with
855-
**kcas**. If you are unfamiliar with the problem, please take a moment to read
855+
**Kcas**. If you are unfamiliar with the problem, please take a moment to read
856856
the description of the problem.
857857

858858
A handy concurrent data structure for solving the dining philosophers problem is
@@ -949,7 +949,7 @@ corresponding linked list node is added or moved to one end of the list. When
949949
the cache overflows, the association whose node is at the other end of the list
950950
is removed.
951951

952-
The **kcas_data** package conveniently provides a
952+
**Kcas_data** conveniently provides a
953953
[`Hashtbl`](https://ocaml-multicore.github.io/kcas/doc/kcas_data/Kcas_data/Hashtbl/index.html)
954954
module providing a hash table implementation that mimics the Stdlib
955955
[`Hashtbl`](https://v2.ocaml.org/api/Hashtbl.html) module and a
@@ -1050,7 +1050,7 @@ an operation to change the capacity of the cache.
10501050

10511051
### Programming with primitive operations
10521052

1053-
In addition to the transactional interface, **kcas** also provides the
1053+
In addition to the transactional interface, **Kcas** also provides the
10541054
[`Op`](https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/Op/index.html)
10551055
interface for performing a list of primitive operations. To program with
10561056
primitive operations one simply makes a list of CAS operations using
@@ -1095,7 +1095,7 @@ val move : ?backoff:Backoff.t -> 'a list Loc.t -> 'a list Loc.t -> unit =
10951095

10961096
Note that we also used the
10971097
[`Backoff`](https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/Backoff/index.html)
1098-
module provided by **kcas** above.
1098+
module provided by **Kcas** above.
10991099

11001100
Now we can simply call `move`:
11011101

@@ -1147,7 +1147,7 @@ in a transaction is more expensive than updating individual locations
11471147
atomically. Contention can cause transactions to retry and perform poorly.
11481148

11491149
With that said, it is possible to create composable and reasonably well
1150-
performing data structures using **kcas**. If a **kcas** based data structure is
1150+
performing data structures using **Kcas**. If a **Kcas** based data structure is
11511151
performing much worse than a similar lock-free or lock-based data structure,
11521152
then there is likely room to improve. Doing so will require good understanding
11531153
of and careful attention to algorithmic details, such as which accessed need to
@@ -1277,7 +1277,7 @@ can see
12771277
the updates are only done in case of success.
12781278

12791279
A problem with the `transfer` function above is that it is not a composable
1280-
transaction. The transaction mechanism provided by **kcas** does not implicitly
1280+
transaction. The transaction mechanism provided by **Kcas** does not implicitly
12811281
perform rollbacks of changes made to locations, but it does offer low level
12821282
support for nested conditional transactions.
12831283

@@ -1519,7 +1519,7 @@ val a_queue : int queue = {head = <abstr>; tail = <abstr>}
15191519
- : int option = None
15201520
```
15211521

1522-
The queue implementation in this section is an example of using **kcas** to
1522+
The queue implementation in this section is an example of using **Kcas** to
15231523
implement a fine-grained lock-free algorithm. Instead of recording all shared
15241524
memory accesses and performing them atomically all at once, the implementation
15251525
updates the tail outside of the transaction. This can potentially improve
@@ -1565,10 +1565,10 @@ understanding of how transactions work.
15651565
We have previously casually talked about "transactions". Let's sharpen our
15661566
understanding of transactions.
15671567

1568-
In **kcas**, a _transaction_ is essentially a function that can be called to
1568+
In **Kcas**, a _transaction_ is essentially a function that can be called to
15691569
prepare a specification of an operation or operations, in the form of a
15701570
_transaction log_, that can then be _attempted to be performed atomically_ by
1571-
the underlying k-CAS-n-CMP algorithm provided by **kcas**.
1571+
the underlying k-CAS-n-CMP algorithm provided by **Kcas**.
15721572

15731573
In other words, and simplifying a bit, when an explicit attempt is made to
15741574
perform a transaction, it basically proceeds in phases:
@@ -2112,13 +2112,13 @@ significantly with relatively low effort.
21122112

21132113
### Beware of torn reads
21142114

2115-
The algorithm underlying **kcas** ensures that it is not possible to read
2115+
The algorithm underlying **Kcas** ensures that it is not possible to read
21162116
uncommitted changes to shared memory locations and that an operation can only
21172117
complete successfully if all of the accesses taken together were atomic. These
21182118
are very strong guarantees and make it much easier to implement correct
21192119
concurrent algorithms.
21202120

2121-
Unfortunately, the transaction mechanism that **kcas** provides does not prevent
2121+
Unfortunately, the transaction mechanism that **Kcas** provides does not prevent
21222122
one specific concurrency anomaly. When reading multiple locations, it is
21232123
possible for a transaction to observe different locations at different times
21242124
even though it is not possible for the transaction to commit successfully unless
@@ -2196,7 +2196,7 @@ having values from different committed transactions. This is something that
21962196
needs to be kept in mind when writing transactions.
21972197

21982198
To mitigate issues due to read skew and to also avoid problems with long running
2199-
transactions, the **kcas** transaction mechanism automatically validates the
2199+
transactions, the **Kcas** transaction mechanism automatically validates the
22002200
transaction log periodically when an access is made to the transaction log.
22012201
Therefore an important guideline for writing transactions is that loops inside a
22022202
transaction should always include an access of some shared memory location

doc/gkmz-with-read-only-cmp-ops.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
> [`Xt`](https://ocaml-multicore.github.io/kcas/doc/kcas/Kcas/Xt/index.html)
99
> API.
1010
11-
The [`kcas` library](https://github.com/ocaml-multicore/kcas/) currently uses
12-
the GKMZ algorithm for
11+
[`Kcas`](https://ocaml-multicore.github.io/kcas/) currently uses the GKMZ
12+
algorithm for
1313
[Efficient Multi-word Compare and Swap](https://arxiv.org/abs/2008.02527) or
1414
MCAS aka k-CAS. This is a nearly optimal algorithm for MCAS as it requires only
1515
`k + 1` CAS operations.

doc/scheduler-interop.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Scheduler interop
22

3-
The blocking mechanism in **kcas** is based on a
3+
The blocking mechanism in **Kcas** is based on a
44
[_domain local await_](https://github.com/ocaml-multicore/domain-local-await)
55
mechanism that schedulers can choose to implement to allow libraries like
6-
**kcas** to work with them.
6+
**Kcas** to work with them.
77

8-
Implementing schedulers is not really what casual users of **kcas** are supposed
8+
Implementing schedulers is not really what casual users of **Kcas** are supposed
99
to do. Below is an example of a _toy_ scheduler whose purpose is only to give a
1010
sketch of how a scheduler can provide the domain local await mechanism.
1111

@@ -14,9 +14,8 @@ Let's also demonstrate the use of the
1414
[`Stack`](https://ocaml-multicore.github.io/kcas/doc/kcas_data/Kcas_data/Stack/index.html),
1515
and
1616
[`Promise`](https://ocaml-multicore.github.io/kcas/doc/kcas_data/Kcas_data/Promise/index.html)
17-
implementations that are conveniently provided by the
18-
[**kcas_data**](https://ocaml-multicore.github.io/kcas/doc/kcas_data/Kcas_data/index.html)
19-
package.
17+
implementations that are conveniently provided by
18+
[**Kcas_data**](https://ocaml-multicore.github.io/kcas/doc/kcas_data/Kcas_data/index.html).
2019

2120
<!--
2221
```ocaml
@@ -93,7 +92,7 @@ end
9392

9493
The idea is that one can spawn a scheduler to run on a new domain. Then one can
9594
run fibers on the scheduler. Because the scheduler provides the domain local
96-
await mechanism libraries like **kcas** can use it to block in a scheduler
95+
await mechanism libraries like **Kcas** can use it to block in a scheduler
9796
independent and friendly manner.
9897

9998
Let's then demonstrate the integration. To start we spawn a scheduler:

0 commit comments

Comments
 (0)