Skip to content

Commit 5e603c1

Browse files
kahgohjagdish-15
andauthored
Fix wording and spelling
Co-authored-by: Jagdish Prajapati <[email protected]>
1 parent 43a2d4b commit 5e603c1

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

exercises/practice/bank-account/.approaches/introduction.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ If the threads happen to start simultaneously, they might both see the account s
1313
They each add $10 to this amount and update the account accordingly.
1414
In this case, each thread sets the amount to $10 even though the transaction was made twice.
1515

16-
The problem here is both threads saw that was $0 in the account prior to adding the deposit.
17-
Instead, each thread needs to take turn to process the deposit for the account so that they can process the transaction one at a time.
16+
The problem here is that both threads saw that there was $0 in the account prior to adding the deposit.
17+
Instead, each thread needs to take turns to process the deposit for the account so that they can process the transaction one at a time.
1818
This way, the later thread can "see" the deposited amount from the first thread.
1919

2020
## Approach: Synchronized methods
@@ -342,10 +342,10 @@ For more information, check the [Read write lock approach][approach-read-write-l
342342

343343
- The synchronized methods is the simplest, requiring no extra objects to be created.
344344
- Synchronized statements provide greater control over which code statements are performed with a lock and which object is to be used as the lock.
345-
- The read write lock allows greater concurrency by letting multiple read operations, such as `getBalance`, to run in parallel.
345+
- The read write lock allows greater concurrency by letting multiple read operations, such as `getBalance`, run in parallel.
346346
However, it requires the lock to be explicitly released.
347347

348-
[approach-read-write-lock]: https://exercism.org/tracks/java/exercises/bank-account/approaches/read-write-lock
348+
[approach-read-write-lock]: https://exercism.org/tracks/java/exercises/bank-account/approaches/readwrite-lock
349349
[approach-reentrant-lock]: https://exercism.org/tracks/java/exercises/bank-acconuunt/approaches/reentrant-lock
350350
[approach-synchronized-methods]: https://exercism.org/tracks/java/exercises/bank-account/approaches/synchronized-methods
351351
[approach-synchronized-statements]: https://exercism.org/tracks/java/exercises/bank-account/approaches/synchronzied-statements

exercises/practice/bank-account/.approaches/readwrite-lock/content.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ class BankAccount {
8585
}
8686
```
8787

88-
A [ReadWriteLock][docs-readwritelock] provides two types of locks - one for reading the other for writing.
88+
A [ReadWriteLock][docs-readwritelock] provides two types of locks - one for reading, the other for writing.
8989
[ReentrantReadWriteLock][docs-reentrantreadwritelock] is an implementation of a [ReadWriteLock][docs-readwritelock].
9090

91-
Read locks are intended for read only type operations, such as `getBalance`, and is acquired by calling `readLock().lock()` on the [ReadWriteLock][docs-readwritelock].
91+
Read locks are intended for read-only type operations, such as `getBalance`, and are acquired by calling `readLock().lock()` on the [ReadWriteLock][docs-readwritelock].
9292
Multiple threads are allowed to acquire read locks at the same time because they are expected to only read data.
9393
This means multiple threads can run `getBalance` at the same time.
9494

@@ -99,7 +99,7 @@ Write locks are acquired by calling `writeLock().lock()` on the [ReadWriteLock][
9999
Only one thread can hold a write lock at a time.
100100
Therefore, `withdraw`, `deposit`, `open` and `close` can not run at the same time.
101101
Additionally, a thread must _also_ wait for _all_ read locks to be released to obtain a write lock.
102-
Similarly, threads must wait for write locks to be released before they granted a read lock.
102+
Similarly, threads must wait for write locks to be released before they are granted a read lock.
103103
This means `getBalance` also can not run at the same time as any of the `withdraw`, `deposit`, `open` and `close` methods.
104104

105105
The locks are released in the `finally` block to ensure they are released, even when an exception is thrown.

exercises/practice/bank-account/.approaches/reentrant-lock/content.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class BankAccount {
8484
```
8585

8686
A [ReentrantLock][docs-reentrantlock] object represents a lock that threads must acquire to perform certain operations.
87-
It used here by the operation methods to ensure they are not trying to update the bank account at the same time.
87+
It is used here by the operation methods to ensure they are not trying to update the bank account at the same time.
8888

8989
The lock is requested by calling [lock][docs-reentrantlock-lock].
9090
The lock is released at the end of the operation by calling [unlock][docs-reentrantlock-unlock] in a `finally` block.

0 commit comments

Comments
 (0)