# [2021q1](http://wiki.csie.ncku.edu.tw/linux/schedule) 第 18 週測驗題 ###### tags: `linux2021` :::info 目的: 檢驗學員對 ==[RCU 同步機制](https://hackmd.io/@sysprog/linux-rcu)==, lock-free 程式設計, concurrent linked list, thread-local storage (tls), atomics, SMP 的 [false-sharing](https://en.wikipedia.org/wiki/False_sharing) 的認知 ::: ==[作答表單](https://docs.google.com/forms/d/e/1FAIpQLSfJa6Ex5BbcxBpNyPbZK92rmAIGJ3dqdmNibdkGJ5quC_Kmjg/viewform)== ### 測驗 `1` 考慮二種 concurrent linked list 操作手法: - lock-based - lock-free 在 AMD Ryzen Threadripper 2990WX 32-Core Processor 上,參考的效能評比: - [ ] `bench-lock` * `982500` operations per second - [ ] `bench-lockfree` * `10771081` operations per second 原始程式碼: * [bench.h](https://gist.github.com/jserv/1789389f5bef5ccc37bb136396985ad8) * [bench.c](https://gist.github.com/jserv/ec8a5c39c668122aa1d7153002a1323a) * [lock.c](https://gist.github.com/jserv/dfe37e8aa6d21ed44877c7411cb042ac) * [lockfree.c](https://gist.github.com/jserv/51d483c32b67ec6f85948fa698a0324e) ==不完整== * [Makefile](https://gist.github.com/jserv/7b1acd1ef6ac3fc02136ded6848982a9) 執行 `make` 可建構出二個執行檔: `bench-lock` 和 `bench-lockfree` 請參照 [lock.c](https://gist.github.com/jserv/dfe37e8aa6d21ed44877c7411cb042ac) 的行為,補完 [lockfree.c](https://gist.github.com/jserv/51d483c32b67ec6f85948fa698a0324e) 程式碼,使得 `bench-lockfree` 執行符合預期,並不該遇到任何 assertion 錯誤。 ==作答區== XXX = ? (第 97 行) YYY = ? (第 288 行) ZZZ = ? (第 288 行) RRR = ? (第 489 行)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up