Math

以前球隊在回防時, 教練總會說"快跑! 別回頭, 到定點再休息". 關於人生, 喘息點在哪兒? 我想就在滴水穿石之間! Week27 (07/07) 網路文章 Elon Musk: The world’s population is accelerating toward collapse and nobody cares 網路資源 Barbara Oakley: “Learning How to Learn” | Talks at Google Week28 (07/14) 網路資源 Numpy Quick Start MathJax basic tutorial and quick reference MathJax語法速查及範例 Week29 (07/21) 網路文章 Path Guide: A New Approach to Indoor Navigation 讀書心得 The Numpy Stack in Python 用簡短的方式介紹numpy, pandas, matplotlib, scipy. numpy: 在matrix, vector處理會比ptython built-in還快很多且方便. 主要的object type是numpy.array, 可以跟list object互相轉換. pandas: 強大的DataFrames在處理csv files時可輕鬆取出及處理想要的內容. pandas.DataFrame與pandas.Series是很重要的object. matplotlib: 把資料圖形化 scipy: 介紹了常態分佈(normal distribution)又稱高斯分佈(Gaussian distribution). Week30 (07/28) 網路文章 A Neural Network in 11 lines of Python 詳細的說明ANN的實現方法, 但沒提到bias?? ...

July 28, 2017 · 1 min · oopsmonk

OSDI

以前球隊在回防時, 教練總會說"快跑! 別回頭, 到定點再休息". 關於人生, 喘息點在哪兒? 我想就在滴水穿石之間! Week22 (06/02) 讀書心得 OSDI: Memory Management Kernel space的memory management, 要考慮到的問題, Internal/External fregmentation, physical/logical contiguous, buddy system, slab allocator. User space的memory管理, page fault handler, Red-Black Tree / AVL Tree. 論文學習 FarmBeats: An IoT Platform for Data-Driven Agriculture PDF ,Slides FarmBeats這套系統提出了几個解決方法: 遠距傳輸, 以往的解法是用satellite或是手機訊號, 這裡是使用TVWS(TV White Space)以減少硬體成本, TVWS是利用數位電視未使用的頻寬做傳輸, 屬於低頻有傳輸距離長, 穿透力強的優點. 天氣感知系統, 透過OpenWeather API的資料來規劃電量的使用及電池的充電與否. 風力輔助系統, 收集農地的風向及風力數據, 透過飛行演算法(Flight Planning Algorithm)規劃出適當的路線, 減少逆風造成的額外耗電量. 本地影像及資料壓縮, 一般Drone的航空影像(Aerial Imagery)或sensors資料都是直接傳到雲端, 透過Farmbeats的gateway做中繼站並壓縮影像及sensors資料, 可支援1星期的在網路無法使用情況. Week23 (06/09) 網路文章 When should we use mutex and when should we use semaphore ...

June 30, 2017 · 3 min · oopsmonk

[Paper] - An Evolutionary Study of Linux Memory Management for Fun and Profit

Memory management主要的功能是page mapping, memory protection, and sharing, 但隨著時間不斷的演進已經算是kernel裡不小的subsystem. 這份研究分析2009~2015年之間4587筆有關memory management(mm)的patches, Linux版本由v2.6.32.1 ~ v4.0-rc4. Source: An Evolutionary Study of Linux Memory Management for Fun and Profit Memory Bugs 5種bugs存在mm: memory error, checking, concurrency, logic and programming. 透過heat map可清楚看到主要bug發生地方 主要的bug fix在: Memory Allocation, Garbage Collection (GC), Virtual Memory Management. 大部份memory leak並不是因為忘了free, 而是錯誤的page fault handling和 free page的計算. MM較大的問題是很難去track正確的狀態. Memory optimization 定義3種optimization patches data structure: 避免nested data structure. Scalability的實現, scalability問題是因為locking for atomic access to shared data structures. memory policy: 使用合理的policy design (latency/throughput, sync/async, lazy/non-lazy, local/global, fairness/performance). fast path: 加速頻繁使用的source code, reduction跟lockless optimization是廣泛被使用. Optimistic barrier是為了減少呼叫barrier/fence system call時的synchronous overheads. (Code reduction, lockless optimization, new function, state caching, inline, code shifting, group excution, optimistic barrier) MM常見的Data structure Radix tree: In adress_space, 主要特色是有效率的存放(sparse)資料. Red-black tree: In vm_area_struct, 可快速的search, insert, delete. 相較於AVL 雖然在search上較快但需要額外的空間, insert/delete比較慢, rotation比較困難. Bitmap: 通常用在RAM的page indexing. List: 廣泛使用的DS, 例如LRU(Last Recently Used) list, 用來追蹤active/inactive pages. ...

June 13, 2017 · 2 min · oopsmonk

RaspberryPi3: GLMark2 using weston with DRM backend

How to use weston with DRM backend in Raspbian, and gets benchmark score by GLMark2. With regards to hardware acceleration, We can enable VC4 driver through raspi-config. # update system and raspi-config script $ sudo apt-get update && sudo apt-get upgrade $ sudo apt-get install raspi-config # enable Broadcom VC4 driver $ sudo raspi-config Advanced Options -> GL Driver -> GL (Full KMS) Test environment: 2017-04-10-raspbian-jessie-lite HDMI 1080P 60Hz CPU/GPU use default settings(no overclock) Test packages: ...

June 5, 2017 · 7 min · oopsmonk

LGS Hell

以前球隊在回防時, 教練總會說"快跑! 別回頭, 到定點再休息". 關於人生, 喘息點在哪兒? 我想就在滴水穿石之間! 主要在了解linux graphic system架構, 並分析wayland weston compositor/glmark2的repaint flow. Week18 (05/05) 網路文章 和百年公斤原器說再見!七大國際單位制將改頭換面 原來用抽像來定義實體早己行之有年. 網路資源 C++ Language Interface Foundation (CLIF) Google 做了一個C++ wrapper generator, 目前看來只for Python, 目標是支援更多的語言. Week19 (05/12) 網路文章 Weston repaint scheduling Week20 (05/19) Wayland的weston compositor可透過wesgr來分析repaint過程. glmark2-es2-wayland 加入debug去看glmark repaint過程 [18:50:21.959] canvas_clear 1510 us [18:50:21.960] scenc_draw 389 us [18:50:21.960] scenc_update 159 us [18:50:21.960] weston weston_output_repaint[+] [18:50:21.960] weston surface_flush_damage [18:50:21.960] weston surface_flush_damage [18:50:21.961] weston surface_flush_damage [18:50:21.961] weston surface_flush_damage [18:50:21.969] weston weston_output_repaint[-] [18:50:21.970] weston weston_output_finish_frame [18:50:21.972] weston weston_surface_commit_state [18:50:21.972] weston core_repaint_req [18:50:21.972] canvas_update 12193 us [18:50:21.972] glmark2 draw 14443 us 網路文章 Boosting Site Speed Using Brotli Compression LinkedIn 使用Brotli 壓縮提高網頁的瀏覽速度, 並使用JavaScript檔案做了Brotli, Zopfli, and gzip演算法比較, 壓縮後的空間以gzip -6為基準Brotil -11結省30%, Brotli -5結省14%左右, Zopfli -1000結省約5%. 時間上gzip -6 壓縮169ms, 解壓35ms, Brotli -11 壓縮11913ms, 解壓22ms, Brotli壓縮時間花的較長, 但解壓及壓縮率完勝. 最終的A/B Test, 網頁在美國地區快了23.6%, 印度地區快了66.5%. LinkedIn 計劃採用Dynamic Brotli 處理動態資料(Base HTML document, JSON API responses, etc.), 也需要改善gzip以配合不支援Brotli的Browser. Browser support: ...

May 31, 2017 · 1 min · oopsmonk

Linux Graphic Stack相關的名詞

Linux graphic 架構還滿複雜的, 在看時需要大略了解几個名詞及之間的關係. X Window System: 目前來到第11版本所以叫X11, 是以X window System Core protocol為基礎的window system. wayland: 由於X11太過複雜且在embbeded system中的效能不佳, 用來取代X window System Core protocol. weston (wayland compositor): 以wayland protocol來實做的compositor做為參考的範例, 實用上會用Westeros, Clutter…等. KMS/UMS: Kernel mode-setting 及User mode-setting. OpenGL: 由Khronos Group制定的跨平台graphic API. GLX: 是一個extension, 做為OpenGL與X window system之間的橋樑. 就像embedded system的EGL, MacOS的AGL. DRM(Direct Rendering Manager): 為了防止世界被破壞, 保護世界的和平. 防止同時使用graphic buffer. DRI(Direct Rendering Infrastructure): Mesa及DRM之間的橋樑. Ref: Introduction to the Direct Rendering Infrastructure CRTC (CRT Controller): Crtc is in charge of reading the framebuffer memory and routes the data to an encoder. ...

May 30, 2017 · 1 min · oopsmonk

Enable gzip compression in Nginx

How to enable and test gzip in Nginx. Official document: ngx_http_gzip_module Enable gzip I use Raspberry Pi System Monitor to test gzip module. Modify /etc/nginx/sites-available/default to enable gzip. In this case I only change the RpiMonitor website in the server, you can apply it to global by /etc/nginx/nginx.conf location /rpi { proxy_pass http://127.0.0.1:9999/RpiMonitor; } Change to location /rpi { proxy_pass http://127.0.0.1:9999/RpiMonitor; gzip on; gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; gzip_proxied any; } Then reload nginx.conf via sudo nginx -s reload ...

May 19, 2017 · 1 min · oopsmonk