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
    • 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
    • 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 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
  • 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-05-07,14,18 討論簡記 > [課程期末專題](https://hackmd.io/@sysprog/linux2024-projects) ## cheezad CPU cycle 跟用 NOP Futex 來 sleep 差在哪? 前者會佔用 CPU,後者就像系統呼叫,呼叫完之後 CPU 就可以去執行其他東西 sched_setaffinity ![sched_setaffinity](https://hackmd.io/_uploads/r1HJQrqG0.png) thread pool ## han1018 Q: Linux kernel 程式不能用 gdb debug,有推薦的工具嗎? > kgdb ## idoleat 任務建立後先放在同一個 CPU 上稍後才 migrate,與直接將任務分配在指定 CPU 上的差異? 開機後只會先開一核,之後才叫其他核起來,把工作分配過去 -> load balacing PELT 計算 load 作為 balance 依據 CPU Isolation 作為空出一個 CPU 來執行指定任務的方法 tsc 是什麼?time stamp counter 為什麼要 spin? 一直檢查滿了沒會有什麼問題?若是遇到 cache invalidated 就要一直做 cache coherence,動輒數百 CPU 週期,也增加 bus traffic 解決刪除與新增衝突的另一種思維: 預先訂立操作優先度,例如新增優先於刪除,在操作沒有順序時依據優先度決定誰成功。因為是預先定好的關係,不須額外同步,可以直接 local resolution。缺點就是會有操作被捨棄 ## YangYeh-PD 1. 在測試 CPU Scheduler 中,我們可不可以忽略掉任務處理所需的最大時間?儘管不常發生? ![task latency](https://hackmd.io/_uploads/Bk8zMlGQA.png) 不行。儘管這在統計上屬於 outlier,但只要發生一次,系統就會遲鈍。此外,如果發生在 hard real-time 的系統(如火箭上的 OS) 就會造成很嚴重的後果。 2. 在 CPU Scheduler heat map 中,為何每個 CPU core 所分配到的任務量不平均? ![core (socket)](https://hackmd.io/_uploads/r1YEyeGQA.png) 儘管配合 task migration 本來要讓任務分配給不同的 CPU 且達到負載平衡,但任務之間會有資料相依或依循特定的互動執行順序,並非彼此獨立,一旦某些關鍵服務的執行較長,且有顯著等待時,就會造成任務量分配不均的情形。 3. CPU scheduler 專題中有哪些可以解決的問題? * 降低 CPU 最大延遲 (Largest Latency)。 * 嘗試判斷一個任務是否需要 migrate,以降低執行時間。 ## dcciou IEEE 754 single precision signed xi = (int) 7 => 111~2~ 1.11 * 2^2 127+2=129 -> 10000001 11000000 / / xf = (float) 7 => 0 [ exponent ] [ fraction ] | | + sign bit +---> NaN, +/-INF xi * 8 ==> xi << 3 xi * 2 ==> xi << 1 xf * 8 ==> ? xf * 2 ==> 變更 exp xi * 10 = (xi << 3) + (xi << 1) xf * 10 => ? TODO: 針對單精度浮點數運算,提出利用 bitwise 運算達到「乘 10」的操作 (不能用 mul) x10 = x8x1.25 => 8 = 2^3 = 指數部分+3; 1.25部分則使用原本值+1/4原值 = 1.11+0.0111 = 10.0011,溢位 -> 1.00011 * 2 -> 指數再+1,得: 0 10000101 0001100~ (? linux/kernel/printk/printk.c (`__printk_cpu_sync_try_get`) [Reentrant mutex](https://en.wikipedia.org/wiki/Reentrant_mutex) https://hackmd.io/@sysprog/linux2020-zerocopy zero-copy: 既然 zero-copy 實作效率高,為什麼不使用都 zero-copy 實作? 在什麼時候情境才需要使用 zero-copy 或非 zero-copy 的實作? A B C | +- try_lock | | acquire lock | xxxx | release lock | acquire lock

    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