資工系必修 共筆
      • 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
    ###### tags: `計算機組織_戴碧如` ## Chapter 1 - Computer Abstractions and Technology [TOC] #### Seven Great Ideas - Use abstraction to simplify design 把複雜的設計,切成一層一層的,在開發上會變得比較容易且快速。 - Make the common case fast - Performance via parallelism 平行處理 - Performance via pipelining 接力的概念,把流程切成小部分且連續 - Performance via prediction 預處理可能的結果 - Hierarchy of memories 因為所有的資料不會一次都做使用,同一時間只會使用到一小部分的資料,所以把所有的資料放在「便宜、空間大」的儲存裝置,把要處理的資料放在「貴、空間小、速度快」的儲存裝置 - Dependability via redundancy #### Below Your Program - Application software 高階語言撰寫 - System software - Compiler 把高階語言轉換成 machine code - Operating System - Hardware #### Levels of Program Code - High-level language - Assembly language - Hardware representation ![](https://i.imgur.com/r24XbAj.png =50%x) #### Through the Looking Glass LCD screen: picture elements (pixels) - Frame buffer 紀錄 pixel 的顏色 ![](https://i.imgur.com/x4dCTA1.png =70%x) #### Inside the Processor (CPU) - Datapath: performs operations on data - Control: 用來告訴 Datapath 要往哪裡走(控制信號) - Cache memory: SRAM 小且快的 memory #### Abstractions - Instruction set architecture (ISA) - The hardware/software interface 軟體跟硬體之間的介面 #### Memory - Volatile memory - RAM - Non-volatile memory - Hard-Disk, Flash memory, CD\DVD #### Defining Performance 要定義一個 CPU 的 Performance 不能只單看一種面向,必須多個面向一起探討。 #### Responese Time and Throughput - Responese Time (execution time) - How long it takes to do a task 執行一個工作的總時間 - Throughput (bandwidth) - Total work done per unit time 每單位時間的工作量 #### Measuring Execution Time - Elapsed time - Total response time 把所有的處理時間都考慮進去(包含I/O、OS overhead、idle time) - Determines system performance - CPU (execution) time - Comprises **user CPU time** and **system CPU time** :::info 一般而言,user CPU time 反映了主要邏輯程式碼的執行時間,而system CPU time 則反映了執行 I/O 操作、管理記憶體或與操作系統交互的時間。 ::: #### CPU Time ![](https://i.imgur.com/qS6V5fw.png) - clock cycle 指的是一個時脈週期 - clock rate 則是 CPU 每秒鐘所執行的 clock cycle 數量 - CPU Time 就是只說,完成一個 task 所需要的時脈週期總數,除以 CPU 的處理速率(clock rate) - Performance improved by (CPU Time 要變小) - Reducing number of clock cycles (降低一個 Task 所需的 clock cycle 數量) - Increasing clock rate (增加 clock 頻率) - Hardware designer must often trade off **clock rate** against **cycle count** #### Instruction Count and CPI ![](https://i.imgur.com/wiYZqgf.png) - Instruction Count (IC) => 一次需要呼叫的指令數量 - CPI (Cyclesper Instruction) => 一個指令需要花費的 cycle 數量 :::success Clock cycle 總數 = IC x CPI CPU Time = IC x CPI / Clock Rate = IC x CPI x Clock cycle time (一個 clock cycle 所需的時間) ::: > ISA (Instruction Set Architecture) 指令集架構 #### CPI in more detail ![](https://i.imgur.com/wMQE7Gk.png) #### Performance Summary ![](https://i.imgur.com/Bz63itU.png) - performance depends on - Algorithm: affects IC, possibly CPI - Programming language: affects IC, CPI - Compiler: affects IC, CPI - Instruction set architecture: affects IC, CPI, Tc > Tc => Clock Cycle 的週期時間 #### Power Trends ![](https://i.imgur.com/lxVVl6D.png) - Frequency => clock rate - 當 clock rate 越高,功耗(power)就會越高,所以要降低電壓,才能使得功耗不要那麼高 #### Reducing Power - Power Wall - 無法再降低電壓 - 無法散熱 #### Solution of Power Wall :::danger Uniprocessor => Multiprocessor ::: - Requires explicitly parallel programming - Compare with instruction level parallelism - Hardware executes multiple intstruction at once - Hidden from the programmer - Hard to do - Programming for performance - Load balancing - Optimizing communication and synchronization #### SPEC CPU Benchmark - SPEC 一個國際組織 訂定不同的 Benchmark 來評估自己的 Program - SPEC CPU 2006 - Summarize as geometric mean of performance ratios ![](https://i.imgur.com/26vpQSu.png) #### SPEC Power Benchmark - Power consumotion of server at different workload levels - Performance: ssj/sec - Power: Watts (Joules/sec) ![](https://i.imgur.com/DFE3bwv.png) #### Pitfall: Amdahl's Law ![](https://i.imgur.com/mR82A1Y.png) - Corollary: make the common case fast #### Fallacy: Low Power at Idle - Load 的百分比 等比下降,但是 功耗 不會等比下降 - 是還需要考慮、進步的 #### Pitfal: MIPS as a Performance Metric - MIPS: Millions of Instructions Per Second - 比較指令的數量,不能斷定誰比較好,還是要考慮執行時間 ![](https://i.imgur.com/8QM7Cfr.png)

    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