sysprog
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 2024-06-25,27 討論簡記 > [課程期末專題](https://hackmd.io/@sysprog/linux2024-projects) root fs (rootfs) ![image](https://hackmd.io/_uploads/H1zyxguL0.png) u-boot 是 boot loader,初始化 SRAM, DRAM, flash, eMMC, 等等硬體 root of trust (RoT), initiatated in HW Trusted Firmware for A profile (TF-A) > https://hackmd.io/@sysprog/linux-kvm > https://hackmd.io/@sysprog/linux-pid0 SMP: multi-processor multi-core : 未必對稱 (如 Arm big.LITTLE) multi-core 相對的硬體組態不是 single core,而是 uniprocessor single => island `[_]` `[_]` `[Active]` `[_]` `[_]` Microsoft Xbox, CE, Mobile, NT, ... 我的問題: https://hackmd.io/@Henry0922/linux-final-question-list > 先分析遇到的問題,例如 Mailbox 的中斷處理以及佇列配置,不要急著下手寫程式。 --- https://github.com/sysprog21/concurrent-programs 如何擴充為 MPMC? ```c -/* Returns an index to push or -1 on failure (Queue is full) */ -static inline int mp_try_prepare_push(uint queue_size, - atomic_uint *tail_committed, - atomic_uint *head_pending) -{ - /* Tail needs to be loaded first, otherwise we might overestimate the amount - * of free space */ - uint tail = atomic_load(tail_committed); - uint head = atomic_load(head_pending); - - while (1) { - if (queue_get_free_explicit(queue_size, head, tail) <= 0) - return -1; - - /* As this is an MP queue another thread might have taken our index. */ - /* This will update `head` on failure */ - if (atomic_compare_exchange_strong(head_pending, &head, head + 1)) - return head; - } -} ``` ```c -/* Returns an index to consume */ -static inline int mc_prepare_consume(atomic_uint *head_committed, - atomic_uint *tail_pending, - atomic_uint *head_waiters) -{ - /* Head needs to be loaded first, otherwise we might overestimate the amount - * of committed space */ - uint head = atomic_load(head_committed); - uint tail = atomic_load(tail_pending); - - while (1) { - while (queue_get_committed_explicit(head, tail) == 0) { - QUEUE_WAIT_FOR_HEAD(head_waiters, head_comitted, head); - tail = atomic_load(tail_pending); - } - - /* As this is an MC queue another thread might have taken our index. */ - /* This will update `tail` on failure */ - if (atomic_compare_exchange_strong(tail_pending, &tail, tail + 1)) - return tail; - } -} -static inline void mc_commit_consume(uint prepared_index, - atomic_uint *tail_committed, - atomic_uint *tail_waiters) -{ - uint tail = atomic_load(tail_committed); - - /* Wait for sequential increment */ - while (prepared_index != tail) - QUEUE_WAIT_FOR_TAIL(tail_waiters, tail_committed, tail); - - atomic_fetch_add(tail_committed, 1); - - if (atomic_load(tail_waiters)) - QUEUE_WAKE_ALL_TAIL_WAITERS(tail_committed); -} ``` https://github.com/facebook/folly/blob/main/folly/docs/Synchronized.md MPMC SPSC (specialized) --- quick sort 的 stability > https://github.com/sysprog21/linux-list --- 老師好,我的 github 帳號名稱是 jujuegg,我的期末專題的開發紀錄還沒被放至課程期末專題的頁面中,我在昨日 13:00 左右有發電子郵件給老師,但老師尚未回覆。 > 知道!我要建立新的 HackMD 頁面 -- jserv https://wiki.csie.ncku.edu.tw/User/HenryChaing * 沒有針對作業共筆/測驗進行檢討,投入的狀況 (不要說「我花了大量時間」) ,儘量列舉客觀事實 > 首先是作業的部份,雖然並未達成全部老師的要求,但是我認為不論是我<s>投入的時間</s>或是產出都有達到一定的要求,因此會在這點自評高分。再來是上課與老師的互動,主要是針對測驗題目以及期末專題進行討論,測驗檢討雖然上課當下一知半解,但是在經過與老師的互動下有了表現自己的機會(雖然還是不盡人意),最後課堂結束也有機會好好再研究題目,甚至將其改寫成不同版本但原理相同的程式, <s>也謝謝老師還有批改課後我所加上的紀錄。</s> $\to$ 客觀事實在哪? ## Kuanch https://hackmd.io/@sysprog/rkJd7TFX0 EEVDF since Linux v6.6 => 解決 CFS 的哪些問題? 用 stress-ng 創造 workload Linux v5.1 引入 Energy-Aware Scheduling (EAS),當時的 CPU scheduler 是 CFS $\to$ load balancing, task migration ## weihsinyeh https://github.com/sysprog21/concurrency-primer/pull/7 Fetch and… Transform RMW to directly modify the shared variable (such as addition, subtraction, or bitwise AND, OR, XOR) and return its previous value, all as part of a single atomic operation. Compare with Exchange §5.1, when programmers only need to make simple modification to the shared variable, they can use Fetch and…. 哪裡 weird ? ## yeh-sudo https://hackmd.io/@sysprog/B1W2HKTER 根據[測試結果](https://github.com/yeh-sudo/mt-redis?tab=readme-ov-file#performance) ,吞吐量雖然上升,但是延遲也顯著增加,不知道延遲跟什麼因素有關係? ``` ============================================================================================================================ Type Ops/sec Hits/sec Misses/sec Avg. Latency p50 Latency p99 Latency p99.9 Latency KB/sec ---------------------------------------------------------------------------------------------------------------------------- Sets 38465.04 --- --- 4.11819 2.28700 23.80700 30.71900 2962.48 Gets 384227.73 0.00 384227.73 0.52990 0.27900 16.31900 24.31900 14967.33 Waits 0.00 --- --- --- --- --- --- --- Totals 422692.77 0.00 384227.73 0.85643 0.28700 18.04700 26.36700 17929.81 ``` 如何對 Redis 作效能評比? ```python --*-- cpu0 >>>>>>> | --*-- cpu1 >>> | Redis --*-- cpu2 >>> | urcu --*-- cpu2 >>>>> | concurrency level = 4 (concurrency level = 4) 4 4 ``` taskset : https://man7.org/linux/man-pages/man1/taskset.1.html HT (hyperthreading) 開啟的狀況,找出 logical core https://man7.org/linux/man-pages/man1/chrt.1.html (選擇 RT class) git-bisect ln -s (symbolic) : inode

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    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

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully