Skip to content

Commit c0a1915

Browse files
committed
Add implementation of exercise 3-46
1 parent 1509311 commit c0a1915

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

README.org

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
习题完成情况:
2626
- 章节一: 43/46
2727
- 章节二: 88/97
28-
- 章节三: 45/82
28+
- 章节三: 46/82
2929
- 章节四: TODO
3030
- 章节五: TODO
3131
* 运行

chapter3/exercise3-46.org

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#+LATEX_CLASS: ramsay-org-article
2+
#+LATEX_CLASS_OPTIONS: [oneside,A4paper,12pt]
3+
#+AUTHOR: Ramsay Leung
4+
5+
#+DATE: 2025-07-25 Fri 20:23
6+
7+
#+begin_src plantuml :file ../img/chapter3/exercise3-46.png :exports results
8+
@startuml
9+
title Exercise 3.46
10+
participant "Process 1" as P1
11+
participant "Process 2" as P2
12+
participant "Mutex A" as A
13+
14+
note over A: Initial: Mutex A cell = false
15+
par
16+
P1 -> A: acquire
17+
A --> P1: cell = false
18+
19+
P2 -> A: acquire
20+
A --> P2: cell = false
21+
end
22+
P1 -> A: set-car! cell true
23+
24+
P2 -> A: set-car! cell true
25+
26+
note over P1, P2: Both acquired mutex A
27+
@enduml
28+
#+end_src
29+
30+
#+RESULTS:
31+
[[file:../img/chapter3/exercise3-46.png]]

img/chapter3/exercise3-46.png

19.3 KB
Loading

0 commit comments

Comments
 (0)