sunfrancis12
    • 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 No publishing access yet

      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.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      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
    • Make a copy
    • 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 Make a copy 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 No publishing access yet

    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.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    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
    :::warning 註: 老師112年的期中考跟113年題目差很多,須注意!!! ::: ## 必考懶人包 checklist 畫圖&計算 * Scheduling Algorithms(畫圖+計算average waiting time) * CPU-scheduling(有可能出成選擇) & Process state diagram(要會畫) * User mode& kernel mode(要會畫) * switch from process to process(要會畫) 選擇 * Operating System Structure * Threading Issues * Operations on Processes * Scheduler * IPC * IPC in Message-Passing Systems * Storage-device 填空 * compiler&linker&loader位置(填空) * socket組成 * Mechanisms and Policies ## 必考題 ### Scheduling Algorithms(畫圖+計算average waiting time) ![image](https://hackmd.io/_uploads/BJ7DDe9eJe.png) ![image](https://hackmd.io/_uploads/rk1iDzcgyl.png) waiting time 計算: * SJB&FCFS: process開始被執行時的時間 * 計算process第一次執行與process最後一次執行前總共被分幾次quantum做運算 * Waiting time = Last start time - arrival time - (preemption * quantum) * 以上題為例: 第一次執行為10,最後一次被執行完成時是51,在最後一次之前總共先運算了兩次 * p2: 51 - (10)第一次 - 2\*10 = 21 ### CPU-scheduling(有可能出成選擇) & Process state diagram(要會畫) **Process state diagram** ![image](https://hackmd.io/_uploads/rkq9hG9e1l.png) **CPU-scheduling** decisions may take place under the following circumstances * When a process switches from the running state to the waiting state * When a process switches from the running state to the ready state * When a process switches from the waiting state to the ready state * When a process terminates ![image](https://hackmd.io/_uploads/SJq5sN9xJx.png) ### User mode& kernel mode(要會畫) 防止使用者的程式對系統有惡意行為 ![2024-09-24_10.55](https://hackmd.io/_uploads/ryB5g7cgkl.jpg) ### switch from process to process(要會畫) ![image](https://hackmd.io/_uploads/B1nyxrceJx.png) ## 每年必考的填空 compiler&linker&loader位置(填空) ![image](https://hackmd.io/_uploads/Bk2KVXceye.png) IPC in Message-Passing Systems * Blocking (synchronous) * Blocking send * Non-blocking receive Communications in Client-Server Systems * A socket is identified by an **IP address** concatenated with a **port number** Mechanisms and Policies * Mechanisms (determine how to do something) * Policies (determine what will be done) ## 會拿來當選擇題的題目 ### 老師的出題規則 :::info 根據我的觀察,老師選擇題的選項會直接把簡報上面的敘述複製下來,並改掉某個關鍵字讓你做多選 ::: ### Operating System Structure[必考] Monolithic structure * Place all of the functionality of the kernel into a **single, static** binary file that runs in a single address space Layer Approach * The layers are selected such that each uses functions (operations) and services of only **lower-level** layers Microkernel * Removing all **nonessential** components from the kernel and implementing them as **system** and **user-level programs** * **Benefits** * Easier to extend * Easier to port * More secure * More reliable * Disadvantage * Performance can suffer from due to increased **system-function overhead** Loadable kernel modules * The kernel has a set of core components and links in additional services via modules,either at **boot time** or **during run time** (Linking services dynamically) ### Threading Issues[必考] Signal * To **notify** a process that a particular event has occurred * The pattern * Generated * Delivered * Handled Thread Cancellation * Involves terminating a thread **before it has completed** * Two different scenarios * Asynchronous cancellation * Deferred cancellation Lightweight process (LWP) * A **virtual processor** on which the applications can **schedule a user thread** to run * Each LWP is **attached to a kernel thread** ### Operations on Processes[必考] When a process creates a new process, two possibilities for execution * The parent continues to **execute concurrently** with its children * The parent **waits until** some or all of its children have **terminated** The parent may **terminate the execution** of the child * The child has **exceeded its usage** of some of the resources that it has been allocated * The task assigned to the child is **no longer required** * If **parent is exiting**, and the OS does not allow a child to continue if its parent terminates ### Scheduler[必考] Long-Term Scheduler * 控制在記憶體中 Process 的數量 (**degree of multi-programming**) * 當 degree 太低時, CPU 有很多的時間在 idle * 當 degree 太高時,會發生 Thrashing,有太多的 Process 在爭搶有限的 memory,導致 Process 一直在 memory 跟 disk 之間 swap,不斷的做 I/O Short-Term Scheduler (CPU Scheduler) * 執行頻率很高,大約 100ms 執行一次(**invoke frequently**) * 由演算法來縮短每個 Process 的等待時間 * choose what to **excute next** * brought process to **ready queue** ![image](https://i.imgur.com/Ec849XW.png) Medium-Term Schduler 因現代 memory 空間的增長以及虛擬記憶體的觀念引入,過往由 Long-Term Schduler 處理的動作多改由 Medium-Term Schduler 執行 swap out : 將 Process 由 memory 搬到 disk 中 swap in : 將 Process 由 disk 搬到 memory 中 propose : 改善 Process mix / 減少記憶體中的 Process 數量,**降低 degree**釋放記憶體空間(**reduce degree**) ![image](https://hackmd.io/_uploads/rkfQPHclyx.png) > 引用自: [作業系統 CH3 Process](https://hackmd.io/@Chang-Chia-Chi/OS-CH3) ### IPC (Interprocess Communication)[必考] Independent * A process **cannot affec**t or to be affected by the other processes executing in the system Cooperating * A process **can affect** or to be affected by the other processes executing in the system The reasons to cooperate * Information sharing * Computation speedup * Modularity Two models of IPC * Shared memory * Message passing ### IPC in Message-Passing Systems[必考] :::info 考試推常會問有process之間有多少link,需不需要name ::: **Direct communication** * Properties * A links is established automatically between every pair of processes that want to communicate. The processes need to know only each other’s identity to communicate. * **A link** is associated with **exactly two processes** * Between each pair of processes, there exists exactly one link Symmetry * **Both** the sender and the receiver **must name** the other to communicate * send (P, message) * receive(Q, message) Asymmetry * Only the **sender names the recipient**, the recipient is not required to name the sender * send (P, message) * receive(id, message) **Indirect communication** * The messages are sent to and received from mailboxes or ports * send (A, message) * receive(A, message) * Properties: * A links is established between a pair of processes only if both members of the pair **have a shared mailbox** . * A link may be **associated with more than two** processes * Between each pair of communicating processes, a number of **different links may exist**, with each link corresponding to one mailbox. ### Storage-device[必考] ![image](https://hackmd.io/_uploads/Skh6e5ceye.png) ## 考古有出現過的 ### three virtual machines(畫圖) ![image](https://hackmd.io/_uploads/Sy_GG95eye.png) ### Data and task parallelism(畫圖) ![image](https://hackmd.io/_uploads/rkBd-q9xye.png) ### DMA(Direct Memory Access)(選擇) * The **device controller** transfers an entire **block** of data directly to or from its **own buffer** storage to **memory** * With no intervention by the CPU * One interrupt is generated per block

    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
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    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