KangMoo
    • 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
    • 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 Versions and GitHub Sync Note Insights 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
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 멀티 프로세스와 멀티 스레드 ![image](https://hackmd.io/_uploads/Ski08ttap.png) - 멀티 프로세스 : 하나의 프로그램을 여러 개의 프로세스로 나누어 실행하는 것 - 멀티 스레드 : 하나의 프로세스 내에서 여러 개의 스레드를 가지는 것 ### 멀티 프로세스 ![image](https://hackmd.io/_uploads/BkMUDKF6p.png) - 멀티 프로세스는 운영체제 내에서 하나의 응용 프로그램에 대해서 동시에 여러 개의 프로세스를 실행할 수 있게 하는 기술을 말한다. - 하나의 부모 프로세스로부터 여러 개의 자식 프로세스가 생성되는 형태로, 각 프로세스는 독립적으로 실행되며, 프로세스 간 통신(IPC)을 통해 데이터를 주고 받을 수 있다. - 통신이 가능할 뿐이지 엄연히 서로 다른 프로세스다. 따라서 각 프로세스는 독립적인 메모리 공간을 가지며, 서로 다른 프로세스 간에는 메모리 공간을 공유하지 않는다. - 멀티 프로세스의 예시로는 브라우저의 탭이 있다. 브라우저는 각 탭마다 별도의 프로세스를 생성하여 실행한다. ![image](https://hackmd.io/_uploads/SyAJ_Ytaa.png) #### 멀티 프로세스의 장점 - 안정성: 하나의 프로세스가 비정상적으로 종료되더라도, 다른 프로세스에는 영향을 미치지 않는다. - 보안: 각 프로세스는 독립적인 메모리 공간을 가지므로, 다른 프로세스의 메모리에 직접 접근할 수 없다. - 병렬성: 여러 개의 프로세스가 동시에 실행되므로, 병렬성을 활용하여 시스템의 성능을 향상시킬 수 있다. - 멀티 스레드의 장점이기도 하다. - 시스템 확장성 : 멀티 프로세스는 다른 프로세스에 영향을 주지 않으므로 모듈의 추가나 변경이 용이하고 시스템의 규모를 쉽게 확장할 수 있다. - 예를 들어 서버의 경우, 여러 개의 프로세스를 생성하여 클라이언트의 요청을 처리할 수 있다. #### 멀티 프로세스의 단점 - 컨텍스트 스위칭 오버헤드 : 프로세스 간 전환 시, CPU가 다른 프로세스로 전환하는 과정에서 오버헤드가 발생한다. - 자원 공유의 비효율성 : 서로 다른 프로세스는 독립적인 메모리 공간을 가지므로 메모리의 낭비가 발생하고 프로세스 간 데이터 공유가 어렵다. 따라서 프로세스 간 통신(IPC)을 통해 데이터를 주고 받아야 하며, 이는 오버헤드를 발생시킨다. ### 멀티 스레드 ![image](https://hackmd.io/_uploads/S1IMucFTT.png) - 멀티 스레드는 하나의 프로세스 내에서 여러 개의 스레드를 가지는 것을 말한다. - 스레드는 프로세스 내의 메모리 공간을 공유하므로, 프로세스 간 통신(IPC)을 통해 데이터를 주고 받을 필요가 없다. - 멀티 스레드의 예시로는 웹 서버가 있다. 웹 서버는 클라이언트의 요청을 받아들일 때마다 새로운 스레드를 생성하여 처리한다. #### 멀티 스레드의 장점 - 스레드는 프로세스보다 가볍다 : 프로세스는 독립적인 메모리 공간을 가지지만, 스레드는 프로세스 내의 메모리 공간을 공유하므로, 프로세스보다 가볍다. 또한 스레드 간의 전환은 프로세스 간의 전환보다 빠르다. - 자원의 효율성 : 스레드는 프로세스 내의 메모리 공간을 공유하므로, 메모리 공간 효율성이 좋고 프로세스 간 데이터 공유가 용이하다. - 컨텍스트 스위칭 오버헤드 감소 : 스레드 간 전환은 프로세스 간 전환보다 빠르다. - 응답 시간 감소 : 스레드는 통신과 자원공유가 빠르고 컨텍스트 스위칭의 오버헤드가 적어 멀티 프로세스보다 빠르게 응답할 수 있다. ### 멀티 스레드의 단점 - 안정성 : 멀티 스레드는 프로세스 내의 메모리 공간을 공유하므로, 하나의 스레드가 비정상적으로 종료되면, 다른 스레드에도 영향을 미칠 수 있다. - 디버깅의 어려움 : 멀티 스레드는 프로세스 내의 메모리 공간을 공유하므로, 디버깅이 어려울 수 있다. - 동기화로 인한 성능 저하 : 여러 스레드가 동시에 공유 자원에 접근할 때, 동기화 문제가 발생할 수 있으며, 이로 인해 성능이 저하될 수 있다. ### 멀티 스레드의 사용 예 ```java class MyThread extends Thread { private int threadNumber; public MyThread(int threadNumber) { this.threadNumber = threadNumber; } public void run() { System.out.println("Thread " + threadNumber + " is running."); } } public class MultiThreadExample { public static void main(String[] args) { for (int i = 0; i < 5; i++) { MyThread thread = new MyThread(i); thread.start(); } } } ```

    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