Peter Chen; Kohan Chen
    • Create new note
    • Create a note from template
      • 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
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me 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 New
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
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
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    --- tags: linux2023 --- # 2023q1 Homework5 (assessment) contributed by < `Urbaner3` > :::spoiler 實驗環境 ```shell! $ gcc --version gcc (Ubuntu 12.2.0-3ubuntu1) 12.2.0 $ lscpu Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Byte Order: Little Endian CPU(s): 4 On-line CPU(s) list: 0-3 Model name: Intel(R) Core(TM) i3-7100 CPU @ 3.90GHz Thread(s) per core: 2 Core(s) per socket: 2 Socket(s): 1 Stepping: 9 CPU(s) scaling MHz: 21% CPU max MHz: 3900.0000 CPU min MHz: 800.0000 BogoMIPS: 7799.87 Virtualization: VT-x Caches (sum of all): L1d: 64 KiB (2 instances) L1i: 64 KiB (2 instances) L2: 512 KiB (2 instances) L3: 3 MiB (1 instance) NUMA: NUMA node(s): 1 NUMA node0 CPU(s): 0-3 ``` ::: ## 作業要求 > [assessment](https://hackmd.io/@sysprog/r1O7Xcp12) ### 作業檢討及疑問 (周邊硬體/記憶體/資訊流) 輸入輸出,又稱 I/O, remove_head extract #### [檢討] 以下連結之段落: lab-0 $\to$ [Valgrind + 自動測試程式](https://hackmd.io/@sysprog/linux2023-lab0/%2F%40sysprog%2Flinux2023-lab0-b) $\to$ 自動測試程式 $\to$ 追蹤記憶體配置和釋放的狀況,依序可以移動到上述指定段落。以下是我的感想: 這邊的敘述十分清楚,但仍思考著如何運用。 ##### 計畫與紀錄: [呼叫堆疊](https://hackmd.io/@sysprog/linux2023-lab0/%2F%40sysprog%2Flinux2023-lab0-b) 。 Signal 處理和應用,這一段看一次還不會懂,準備看第二次搭配下方流程圖,逐漸熟悉 signal 的用法。 [提問:ternery operator(?)語法](https://hackmd.io/blv00xPxQ4CdyzFRJJSi_w?view#Signal-%E8%99%95%E7%90%86%E5%92%8C%E6%87%89%E7%94%A8),作業說明提到程式碼,在段落,[Valgrind + 自動測試程式](https://hackmd.io/@sysprog/linux2023-lab0/%2F%40sysprog%2Flinux2023-lab0-b) $\to$ 自動測試程式 $\to$ Signal 處理和應用 ,依頁面順序,找到這句話 「report_event 函式的實作程式如下」,下方程式碼,含有 ternery operator 在第5-8行。有點不順眼的寫法,有使用另一個 ternery operator 當作前面 operator 的輸出。 同一頁,[Valgrind + ...] $\to$ 命令直譯器的初始化準備,這一段介紹 `cmd`, `param` 兩種過渡的資料型態,為了處理輸入的執行命令而設定這些變數。 > :warning: 改進你的提問,參見〈[提問的智慧](https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way)〉 > 之前太過急躁,沒有做到〈提問的智慧〉中說到的,坐下來再想一想問題,等到整理好,形成解題步驟後,再貼上來提問。有過一兩次,但明顯還沒習慣,只有英文中文的空格有養成習慣而已,思考上,提問還沒有預想到回答者或是瀏覽者的感受,光是想清楚自己的想法就很難了,有養成另外紀錄的習慣。沒注意有可能冒犯到文章中說的開發者,真的很抱歉。 :smiley_cat: Urbaner3 #### 整合網頁伺服器--- 整合 [tiny-web-server](https://github.com/7890/tiny-web-server) :star: 注:[此頁](https://hackmd.io/@sysprog/linux2023-lab0/%2F%40sysprog%2Flinux2023-lab0-c)無法編輯,故將提問貼於此。 > 「提問」本該在這裡發生,而非在作業描述中,除非你發現作業描述存在錯誤,才去「修正」 > :notes: jserv `select` 及 `poll` 皆使用此種模式,好處是可以同時監控多個 file descriptor (這也是 I/O multiplexer 的寓意,一如數位邏輯電路的本意),但缺點是需要兩次的系統呼叫,從圖中也可以看到,先運用 `select` 系統呼叫切換到核心空間內等待資料,接著核心接收到資料後通知呼叫端,再重新觸發 `recvfrom` 系統呼叫,意味著需要多次 context switch,成本相對比其他模式 (如 Blocking I/O) 來得高。 :::info 此處提到 kernel space ,是指 web 相關功能嗎? 仍未看到相關的程式碼,考慮等弄清楚有哪些功能可以選擇,有 linenoise, cmd_select 光是就已知就有這些。請補充相關可選用之功能,以及 web 命令工作原理,可參考 signal 頁面用流程圖說明,說明到 signal 的程度即可明白。 > $\to$ 可參照 ==[Linux 核心設計: 針對事件驅動的 I/O 模型演化](https://hackmd.io/@sysprog/linux-io-model)== > :notes: jserv 感謝,沒想到有這一頁,看起來像是排程器的實例,可以讓我參閱。是該好好學習排程了。 > $\to$ 在第一次的作業設計中,希望學員先接觸課程會提到的 I/O multiplexing,至少查詢過 man page,之後再讓學員從實驗中理解系統行為。 ::: `web` 命令搭配 `curl` 可成功新增節點,各種指令也可執行。 :::info 想知道 "解決 `favicon.ico` 的問題" 這個段落,如何使用瀏覽器發 request,如同[頁面](https://hackmd.io/@sysprog/linux2023-lab0-c#%E8%A7%A3%E6%B1%BA-faviconico-%E7%9A%84%E5%95%8F%E9%A1%8C)顯示表格的實驗結果。 > $\to$ 在網頁瀏覽器網址給予 `http://127.0.0.1:9999` 一類的輸入 ::: 仔細看老師有幫我改了段落的文字,完成回答,這實在有 [freerider](https://today.line.me/hk/v2/article/pe85w69) 的嫌疑,我期待我成為機敏的學習者,而不是小白。 :smiley_cat: Urbaner3 --- ### 飲料機延畢文讀後感 ---- 交大學生讀到這篇真的感觸很深,我還是2015年畢業,相同時空背景,完全正中下懷,有種單身的毒素排除不了,想到其他人都有好的工作,好的婚姻經驗,湧起一股憂傷。其他的話先不說,先去抒發一下,一次80分鐘就讀完23篇,但配合Jserv的課,和Jserv的名字,想起一份辛勞,雙重中毒,我要去排解這種愁緒,失陪了。 隔天,決定[「捨棄私情吧」](https://ibb.co/cNZ8tbQ),簡單說明一下,每週大約花十到二十小時,看教材,說明影片和寫作業。從 lab0 開始練習處理字串排序,從零開始逐漸習慣 list_head 這個結構,配合 list_entry 這個重要的功能,在兩種指標, struct list_head 和 element_t 因為彼此互相鑲嵌,又有 next, prev 的鍊結,很像回文一樣,struct, next, struct, next, ...互相交錯。為了取得特定的相對位置之指標,學會用 list_entry 。再來是 merge sort, quick sort 有運用到自動評分程式、幾個 helper function 也就是附註檔案集。這些我不是很懂,所以在遇到 segmentation fault 或是 gdb 執行遇到迴圈時,很難繼續推進。後面論文、valgrind 也都還沒有做。隨堂測驗一二,一開始真的看不懂,漸漸從同學的共筆當中,慢慢看到自己學習的盲點,好在隨著教材越看越順,才能夠準備足夠的背景知識,我想飲料機是個目的明確的產品,但牽涉到的物件、模組真的很複雜,想到跨系去學機械的情形,對應到我數學系過來資工系,記憶體和系統的概念,還不是很習慣。但真的看到系統模組也就理解 kernel space 和 user space 對應到讀寫排程的情形,在改模組的時候,神經很緊張,因為習慣還不夠齊全,很類似飲料機的機械架構,那種無力感,所以我才會一口氣就把整篇文章看完。 一開始接觸 fibonacci driver 直覺覺得這個作業的一切都寫的很清楚。我以為會很順利的,殊不知,遇到 bignum 這個字串運算,我還是有一點混亂,記不住眾多變數的功用沒辦法直接從名字去判斷。如 xs 型態,reverse 操作等等。小地方比如為何 size 要加二而不是加一,一時之間完全不知道要如何下手。幾乎不大冷靜,雖然不像飲料機有機械成本的問題,對我來說,時間不夠用才是壓力,另外則是需要一份好的工作,很害怕能力不夠會不被錄取,加上自己有身心障礙的個人需求,也不容易找到能配合的公司。另一邊還要學紅黑樹,真的覺得蠟燭兩頭燒,我該做的就是按照急迫順序,還有執行並檢視輸出。 回來說說實作的順序 string addition to big number, operations of bn structure, fast doubling method 我發現我困惑在這些操作,或是說我看了許多的範例,他們並不是清楚獨立的,我無法區分三個步驟,步驟彼此獨立,產出不相關的結構和資料。不如將他們當作三次實作,比較不同,找出能理解並實作出來的三步驟還有數字結構,而不是只是看別人寫的,自己不試著寫一次。所以有 xs, fast doubling, bn structure, list_head style, 加上8個改善方案。 因為作業三卡住,作業四能進行的也不多,但也只好面對,既然老師都把書寄給我們,就盡力去讀,吸收多少,能實作多少出來就做多少。 $$$$$$$$$$$$$$$$$$$$$$ 沒想到三週後,我可以準備用 gdb 來研究 fibdrv 而且準備進行進程的研究。從 FB 討論區的提問,到翻閱 CS:APP 雖然沒有明確的作法,但卻有直覺知道,必須用 gdb 測試,追蹤 fibdrv 才有可能,很像飲料機一樣,但這次我的目標是 kernel space ,這個記憶體空間,所以對飲料機產生那麼大的共鳴,但這些感情真的是好看而已,我決定整理一下,折疊一些想法和計畫,讓這片文章更加簡明。 [這篇作業](https://hackmd.io/@DokiDokiPB/2023q1_week5_assessment)我的回覆其實也可以作為我「初解」 (assessment) 的一部分,稍後再做整理。 ### 教材討論

    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