Skip to content

Commit

Permalink
update 04d88472ccab31310efc5ea3af2fd0fe7f0973e0
Browse files Browse the repository at this point in the history
Co-authored-by: Woogie Jeon <[email protected]>
  • Loading branch information
tomtomjhj and 33577 committed Sep 16, 2023
1 parent 0b2ced0 commit 64f7e03
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 8 deletions.
4 changes: 2 additions & 2 deletions homework/doc/arc.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ because that version is more complex.
Follow [the Arc section of the Rustnomicon (the book on unsafe Rust)][nomicon-arc].

Some food for thought on Rustnomicon's description:
* Quiz: why does `Arc<T> : Sync` require `T : Send`?
* Quiz: Why does `Arc<T> : Sync` require `T : Send`?
* The [Layout section](https://doc.rust-lang.org/nomicon/arc-mutex/arc-layout.html) explains
why [`NonNull`](https://doc.rust-lang.org/std/ptr/struct.NonNull.html) and `PhantomData` are necessary.
We don't care about them in this course and will not ask about them in the exams
(it's quite interesting, though).
* Their implementation uses `fence(Acquire)`, which we didn't cover in the lecture.
* Their implementation uses `fence(Acquire)`, which we may not be able cover in the lecture due to time constraints.
You can implement (a slightly inefficient version of) Arc only with `AtomicUsize`'s methods and the concepts we covered in the lecture
(you will need to use `Ordering::AcqRel` in some places).
Using `fence(Acquire)` is not required in the homework and exam.
Expand Down
2 changes: 1 addition & 1 deletion homework/doc/hash_table.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Use release-acquire synchronization for atomic accesses, just like many other da


## Testing
Tests in `tests/{growable_array,hash_table}.rs` use the map test functions defined in `tests/map/mod.rs`.
Tests in `tests/{growable_array,hash_table}.rs` use the map test functions defined in `src/test/adt/map.rs`.
* `smoke`:
Simple test case that tries a few operations. Useful for debugging.
* `stress_sequential`:
Expand Down
2 changes: 1 addition & 1 deletion homework/doc/hello_server.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- `../src/hello_server/*.rs`: the server components. You should fill out `todo!()` in those files.

## Grading
The grader runs `./script/grade-hello_server.sh` in the `homework` directory.
The grader runs `./scripts/grade-hello_server.sh` in the `homework` directory.
This script runs the tests with various options.

There will be no partial scores for each module.
Expand Down
3 changes: 0 additions & 3 deletions homework/tests/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ mod basic {
}

#[test]
#[allow(clippy::redundant_clone)]
fn test_cowarc_clone_unique2() {
let mut cow0 = Arc::new(75);
let cow1 = cow0.clone();
Expand Down Expand Up @@ -97,7 +96,6 @@ mod basic {
}

#[test]
#[allow(clippy::redundant_clone)]
fn test_count() {
let a = Arc::new(0);
assert!(Arc::count(&a) == 1);
Expand All @@ -107,7 +105,6 @@ mod basic {
}

#[test]
#[allow(clippy::redundant_clone)]
fn test_ptr_eq() {
let five = Arc::new(5);
let same_five = five.clone();
Expand Down
2 changes: 1 addition & 1 deletion homework/tests/list_set/optimistic_fine_grained.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ fn iter_consistent() {
}
// sorted
assert!(snapshot.windows(2).all(|k| k[0] <= k[1]));
let max = snapshot.last().map(|&x| x).unwrap_or(0);
let max = snapshot.last().copied().unwrap_or(0);
let evens = evens
.iter()
.copied()
Expand Down

0 comments on commit 64f7e03

Please sign in to comment.