使用 Compare and Swap 做到 Lock Free
- October 28, 2020
- Liu, An-Chi 劉安齊
Big open source projects are huge, such as the Servo browser in Rust. I have counted the lines of code for you. There are almost a hundred thousand lines of code in the Servo project. To develop such a big project, knowing how to debug in a right way is very important, since you would like to find the bottleneck in a fast and efficient way.
In this article, I will teach you some tips to use GDB developing and debugging your Rust code and the Servo project. The debug method can be also applied to C/C++ as well.
Continue reading透過效能分析工具 (Profiler),我們可以得知更多關於軟體的運行資訊,像是花了多少記憶體、多少 CPU Cycles、多少 Cache Misses、I/O 處理時間等等,這些資訊對我們去找到程式效能瓶頸很有幫助。想辦法找到那裡讓程式變慢,進而最大化效能,便是我們做效能分析的最大目的。
本文將介紹 Linux 上的 perf 效能分析工具,藉由一個簡單的程式範例,示範如何使用 perf 去分析一隻程式,我們將會發現使用分析工具時能更輕易的發現問題根源。本文參考 Gabriel Krisman Bertaz 寫的 Performance analysis in Linux。
Continue readingElixir 是一個動態 Functional Programming 語言,專門用來打造可擴展且易維護的系統。
Elixir 基於 Erlang VM 所建,適合用在需要低延遲、分散式、錯誤容忍(fault-tolerant)的系統上,同時也可以用在網頁開發、嵌入式軟體、資料處理、多媒體處理等用途上。這篇文章「Game of Phones: History of Erlang and Elixir」介紹了 Elixir 來龍去脈,值得一看。
Elixir 寫起來滿有趣的,寫了之後才意識到原來 JS 和 Rust 從 Functional Programming 借鏡了不少概念,所以在從頭學 Elixir 的過程,一些 FP 的特色,像是 Pattern Matching、Enumerable 都已經在先前接觸過。
看完官方的語言教學後,覺得需要藉由寫小專案更熟悉,所以就研究如何用 Elixir 建造一個簡單的 HTTP Server。
Continue reading接續上篇介紹碩一下的修課,接下來談談課外活動和研究。課外活動只有去美術社畫畫,相較於大學時到處實習、參加開源專案和參與社群,就顯得比較單調。由於我比較晚才下定決心好好念碩士,在探索領域和找題目上已經比較晚,但我依然在這學期發現自己有興趣研究的領域,並且也找到題目,暑假也開始進行研究了。
Continue reading