Multithreading Models & Hyperthreading

Поділитися
Вставка
  • Опубліковано 15 вер 2024

КОМЕНТАРІ • 99

  • @ksvprasad9212
    @ksvprasad9212 5 років тому +73

    I searched many websites and videos to learn Threading and thank GOD I found the best one in your channel. Thanks a lot for your efforts.

  • @DaiMoscv
    @DaiMoscv 2 роки тому +75

    Here is what I understood:
    There are two types of Threads:
    -User Threads which managed in user space without kernel support
    -Kernel Threads where managed directly in kernel
    And these two threads function together there must exist a relationship between them. And the relationship is called Multithreading. There are three ways to establish this relationship, each one having their own advantages and disadvantages.
    Many to one model: Many user threads to one kernel thread. Threads management happens in user level so it's efficient. However, if one of those user thread makes blocking system call then the kernel thread would be blocked which is connected to other user threads. In other words all other user threads would be blocked, ultimately the entire process would be blocked (considering all those threads associated with same process). In addition, only one thread can access to kernel at a time, it cannot utilize multi-processors fully. Because one kernel thread can run only one of those processors.
    One to one model: For one user thread there exists one kernel thread. This model basically overcome disadvantages of many to one model such as multiprocessing thanks to multiple kernel threads (for each user thread) and avoiding risk of blocking entire process when one of the thread calls system blocking. Even so it has its own disadvantages including having obliged to create a kernel thread for each user thread which can be costly. Also having too many kernel threads can affect the performance of the application because one kernel thread can run on only one processor. So if you're having multiprocessor system, let's say 4 cores, then creating more than 4 kernel thread causes overhead and burden to the application. Because of this usually applications set limits on how many threads can be created.
    Many to many model: Many user threads multiplexes to equal or less kernel threads.
    Definition of multiplex: system or signal involving simultaneous transmission of several messages along a single channel of communication.
    The number of kernel may be specified depending on the machine or the application. Developer can create user level threads as many as they want. Even after user thread calls blocking system, the entire process won't blocked. Basically it's the most ideal model among all three.
    Hyperthreading or Simultaneous Multithreading: It's basically whether your system has logical processors. Logical processor is the doubled version of your physical processor (cores). If I have 4 physical processor then I might have 8 logical processor, so my machine can process 8 threads concurrently. To see whether your system supports logical processors (windows) go to cmd and type wmic then type CPU Get NumberOfCores, NumberOfLogicalProcessors. If two numbers are the same then your system doesn't support hyperthreading.

    • @KurooNegai
      @KurooNegai 9 місяців тому

      king

    • @BLG120
      @BLG120 6 місяців тому

      dai muusco

    • @TragicGFuel
      @TragicGFuel 6 місяців тому

      AI generated text ahh comment

  • @gatecomputerscience1484
    @gatecomputerscience1484 2 роки тому +36

    /* Omg, this is the first time when I applied my theoretically knowledge of operating system in my Life */

    • @pmllnckt
      @pmllnckt Рік тому

      Lol ppl r gonna overlook this joke

    • @TragicGFuel
      @TragicGFuel 6 місяців тому

      ​@@pmllncktwhat joke

  • @Sid1138onYT
    @Sid1138onYT 2 роки тому +4

    In some systems (especially real-time systems), an asynchronous connection exists between user and kernel threads. That is, a user thread can make a request to a kernel thread, and that request is queued to the kernel thread. The user thread can then continue processing while the kernel thread does its processing (in parallel on a multi-core system). When the kernel finishes, it sends the results to the user thread (either with a callback function of queuing the results to the user thread).
    This type of user/kernel connection allows a one-to-many relationship. The user thread can be connected to many kernel threads. This relationship also can change the many-to-many relationship. A user thread can connect to many kernel cores, while a kernel thread can connect to many user threads. This is the most powerful of models but also the most difficult to implement.
    With this many-to-many model, a user thread does not block when a kernel thread does. Each user thread can do more work, increasing the amount of processing a multicore system can do. In addition, each kernel thread can be specialized, making each kernel thread simpler and smaller. Programming to take advantage of these capabilities is more difficult than in the other models.
    Let me give an example - crypto-mining. The engineer creates many user threads to perform the crypto-mining calculations. One kernel thread delivers the next piece to user threads while another kernel thread receives and records the results. The user thread requests the next piece and waits until it shows up. When it gets that piece, it requests the next (or even several pieces) and then starts processing the piece it has. When it completes, it sends the results to the record thread, gets the next piece off of its queue, and starts processing again. In this example, user threads will process data almost 100% of the time. Kernel threads do not stall user threads, and user threads do not stall kernel threads. However, user and kernel threads must implement these inter-process queues (a non-trivial exercise).

    • @salonisharma9479
      @salonisharma9479 2 роки тому

      Thanks for adding this to my knowledge. This comment should be pinned.

  • @long-live-linux
    @long-live-linux Рік тому +3

    In Linux world, the word "kernel thread" is used to refer to threads running in kernel space, like ksoftirqd, kworker, kswapd etc. which can be shown when you type "ps aux" in the terminal.
    In this video, "kernel thread" is used as threads managed as "struct task_struct" in the linux source code.
    User threads on the other hand are like pseudo-threads implemented in userspace, where each user threads are assigned memory area for its stack and CPU resisters saved on pseudo-context-switch, triggered by userspace libraries like tokio (popular asynchronous runtime in Rust).
    Hyperthreading is a totally different concept, where the CPU shows the OS an illusion that it has more threads than its cores (of course OS can be informed whether hyperthreading is activated or not).

  • @parkashkumar765
    @parkashkumar765 Рік тому +1

    I have no words to appreciate you Sir, such a best way of teaching.🥰

  • @chillyvanilly6352
    @chillyvanilly6352 4 роки тому +11

    The video is amazing, yet...there is still the open question, how the HyperThreading really works, and is it really a performance-increase along with the the question: how do the L1 and L2 -caches get utilized by the logical-threads then?

  • @midhunrajr372
    @midhunrajr372 3 роки тому +8

    Thankyou for the video But there is a correction:
    Although many-to-many model posses no disadvantages of the other models, in practice it is difficult to implement. Also because modern systems has increasing number of cores (and features like hyper-threading), the kernel thread limitation can be removed. Because of these reasons, most OSs are using the *One-to-One* model instead.

  • @ayushiyadav1
    @ayushiyadav1 3 місяці тому

    thanks a bunch, guy! you're providing quality unmatched education, here on yt for free. GOD bless:) ❤❤

  • @darshanwalunj2787
    @darshanwalunj2787 3 роки тому

    best yt channel for preparing subjects and getting concepts cleared

  • @rifatara16
    @rifatara16 4 роки тому +2

    Thank you sir... Your videos are really helpfull.It helps me to understand to topics of book...

  • @shivushankar2496
    @shivushankar2496 3 роки тому +3

    What an amazing explanation man....... Great piece of work

  • @priyankabehera8288
    @priyankabehera8288 2 роки тому +1

    Tq sir.... For more information rather than our syllabus... ☺☺☺

  • @cinema4dtv56
    @cinema4dtv56 5 років тому +6

    Bro this is not fair because I was searching for videos like this for my exam but not found , but u uploaded it today but I have completed my exam just 1 day back from the date u have uploaded .
    So sad 😞😞😞😞

    • @mwatelaswalehe1506
      @mwatelaswalehe1506 4 роки тому

      What does threads do in computers

    • @manasgupta5004
      @manasgupta5004 4 роки тому

      @@mwatelaswalehe1506 Thread is created by a process,each time will you open a application it creates a thread for that specific application Which handles the task related to that particular application.

  • @hoangminhchau2187
    @hoangminhchau2187 Рік тому +1

    1) Multi-threading
    - 2 types of threads: user thread and kernel thread
    - User thread run on top of the OS and is not support by the OS
    - Kernel thread is support by the OS
    - A relationship must exist between these 2 threads, called multithreading
    - 3 types of relationships: many to one, one to one and many to many
    - Many to one: multiple user threads are linked to only one kernel thread. When an user thread make a blocking system call, it will block the other threads or the whole process.
    - One to one: one user thread is linked to one kernel thread. This model can solve the many to one problem, but the number of kernel threads is limited, so it limits the user threads created.
    - Many to many: multiple user thread are linked to an equal or less than number of kernel threads. So when an user thread makes a blocking system call, the other user threads will be scheduled to another kernel thread
    2) Hyperthreading or Simultaneous Multithreading (SMT)
    - Hyperthreaded systems allows their processor core to become multiple logically processors

  • @snape0001
    @snape0001 11 місяців тому

    It's so cool to see what is going inside.

  • @tamannasain7453
    @tamannasain7453 4 роки тому +2

    Really helpful for concept clarity

  • @carlaludgate6597
    @carlaludgate6597 4 роки тому +2

    Thank you! Very clearly explained

  • @TechnoyashBro
    @TechnoyashBro 3 роки тому +2

    I will get subscription of your neso app but there are nothing facility to discuss with faculty so please help me sir i have one question
    can a multithreaded solution using multiple user-level threads achieve better performance on a multiprocessor system than on single processor system
    Plzz sir explain me in detail

  • @abhishekjaiswal7210
    @abhishekjaiswal7210 3 роки тому +1

    Hi Nesoacademy... When your channel was hacked and we shifted to a new channel then i too put many tweets to bring back your channel..We were lucky that we got back on that time...
    I want to say that if you will be providing notes then it will be good for us to keep track...and revise things easily...
    it's a huge request to provide these notes of the videos.
    thank you

    • @nesoacademy
      @nesoacademy  3 роки тому +2

      Hello Abhishek, thank you for your support when we needed it. Our team is working on the notes and soon they will be available on our website + app. You can also use the ppts to revise the lectures, please follow the link www.nesoacademy.org/cs/03-operating-system/ppts

    • @abhishekjaiswal7210
      @abhishekjaiswal7210 3 роки тому

      @@nesoacademy TYSM sir.
      This is the simplicity and great honour of Nesoacademy .
      We will be waiting.
      Thanks again

  • @ajmalkhaniit
    @ajmalkhaniit 4 роки тому +4

    Solid Explanation 👍⚙️🔗📝

  • @neil19961
    @neil19961 4 роки тому +1

    Beautifully Explained.

  • @solomonngwenya9091
    @solomonngwenya9091 2 роки тому

    Neso Academy is sruely the best

  • @The_Soul2
    @The_Soul2 Рік тому

    No words to explain this is the Best

  • @minhhoangcong9155
    @minhhoangcong9155 Рік тому +1

    Why many-to-one is blocked but many-to-many does not ? I can not understand this part

  • @saddamahmad2310
    @saddamahmad2310 5 років тому +3

    thank you very much sir for this video

  • @aquadap219
    @aquadap219 6 місяців тому

    If you want to check if your Windows machine has hyper-threading capability, you can search for system information in the search bar. In the system summary, you can see how many cores and also how many logical processors your machine has

  • @apoorvlokhande9868
    @apoorvlokhande9868 4 роки тому +6

    An alternate way to know number of cores and number of logical processors is to open Task Manager in Windows and navigate to performance tab.

  • @kattaaarthi4285
    @kattaaarthi4285 3 роки тому

    Simply marvalous explanation

  • @goravjattfitness
    @goravjattfitness 8 місяців тому

    So beautiful so elegant class

  • @josefinamagallanes8451
    @josefinamagallanes8451 5 років тому +2

    Best explanation.

  • @allenixb.laurel3563
    @allenixb.laurel3563 4 місяці тому +1

    Thank you for this.

  • @MadhushreeSinha
    @MadhushreeSinha 4 роки тому +1

    clearly explained!!!! Thank you

  • @virtuososagar
    @virtuososagar 3 роки тому +1

    Love your videos.

  • @EvilSapphireR
    @EvilSapphireR 4 роки тому +1

    By Kernel threads do you mean hardware threads? So in an one to one user thread to kernel thread mapping it basically means in a system like that no software multithreading would be possible unless it has multiple cores/hyperthreading is enabled?

  • @ledapigeon
    @ledapigeon 4 роки тому

    thank man your video very easy to understand

  • @NicolaeCristian175
    @NicolaeCristian175 2 роки тому

    great explanation.

  • @mahtah-qm1sy
    @mahtah-qm1sy Рік тому

    Great series keep it up

  • @malazalzarrad6064
    @malazalzarrad6064 3 роки тому

    you are the man Love your videos

  • @josefinamagallanes8451
    @josefinamagallanes8451 5 років тому +1

    What does a thread pool do? What is it's function or purpose?

  • @parthgupta5058
    @parthgupta5058 4 роки тому

    very clearly explained

  • @subhanliaqat8
    @subhanliaqat8 8 місяців тому

    thank you

  • @ELearningwithWaqasAhmed
    @ELearningwithWaqasAhmed 3 роки тому

    excellent video thank you so much

  • @landryplacid4065
    @landryplacid4065 Рік тому +1

    Gil in python. (Many to one)

  • @madass
    @madass Рік тому

    So, according to my understanding
    1 processor, 2 cores (single processor) = can run 2 thread
    2 processor, each one core (multiprocessor) = can run 2 thread
    is my understanding correct? Pls answer this

  • @farahmohamed2104
    @farahmohamed2104 10 місяців тому

    amazing

  • @abdillahihussein1816
    @abdillahihussein1816 4 роки тому +2

    what is the equivalent command of WMIC in Macbook?

  • @gopikrishna1551
    @gopikrishna1551 3 роки тому +1

    sir i have learned that each processor has one core and a core have 1 or 2 threads depending whether it is a hyper threading or not BUT for a process they have many segment of threads to get executed.please clarify my doubt.

    • @gopikrishna1551
      @gopikrishna1551 3 роки тому

      i can see (2 cores and 4 logical processes it means 4 threads BESIDE that i can see 200 process and 2k threads)in task manager. please clarify my doubt .

    • @vasireddyganesh
      @vasireddyganesh 3 роки тому

      @@gopikrishna1551 I think even though there are 2k threads showing in Your task Manager ...there can be maximum of 4 active threads running since You have 4 logical cores and remaining threads are inactive . This is what I think . Correct Me If Iam Wrong .

  • @gauravchaudhari3843
    @gauravchaudhari3843 3 роки тому

    user level thread and kernel level thread what is use why user level thread depend on kernel level thread as you showed in diagram

  • @ShadowGAMER-fb6pv
    @ShadowGAMER-fb6pv 3 роки тому

    Amazing sir

  • @Terminator0512
    @Terminator0512 4 роки тому +2

    Bst very nice

  • @victoryosikwemhe3092
    @victoryosikwemhe3092 5 років тому +1

    Cool. You should have made a separate video for hyper-threading

  • @gouravdamor8001
    @gouravdamor8001 4 роки тому

    thankyou very much

  • @allaboutcs
    @allaboutcs 5 років тому +1

    Helpful 👍👍

  • @cocomoco902
    @cocomoco902 3 роки тому

    Hyperthreading in cmd shows error what should i do how to get number of cores of logical processors

  • @dhanushsivajaya1356
    @dhanushsivajaya1356 3 роки тому

    Thankyou sir

  • @akashsharma143
    @akashsharma143 3 роки тому

    use lscpu command for linux based OS

  • @jabamalaimary1234
    @jabamalaimary1234 4 роки тому

    Awesome thank u so much

  • @GutuAbeyaTefera
    @GutuAbeyaTefera Рік тому

    just you are special one!

  • @ritamchatterjee3307
    @ritamchatterjee3307 3 роки тому

    hey,,i have some kinda complaint about this operatiig system playlist
    in all other chapters videos are not soo lengthy as this chapter,
    ths operating system chapter makes mad

  • @AnkitTiwari-dq7qm
    @AnkitTiwari-dq7qm 2 роки тому +1

    How many threads we can run in single core processor ?

    • @orzAR26
      @orzAR26 2 роки тому

      One thread if hyper two

  • @kimjong-un4521
    @kimjong-un4521 3 місяці тому

    physical core = 4, logical core = 8.

  • @NoOneIsHereRightNow
    @NoOneIsHereRightNow 4 роки тому

    Thank you soo much!

    • @huseyincoban1214
      @huseyincoban1214 3 роки тому

      ne okuyosun özlem :)

    • @NoOneIsHereRightNow
      @NoOneIsHereRightNow 3 роки тому +1

      @@huseyincoban1214 bilgisayar mühendisliği

    • @huseyincoban1214
      @huseyincoban1214 3 роки тому

      @@NoOneIsHereRightNow ben de bilgisayar mühendisliği okuyorumm, nerede okuyorsun ?

    • @NoOneIsHereRightNow
      @NoOneIsHereRightNow 3 роки тому +1

      @@huseyincoban1214 İstanbul

    • @huseyincoban1214
      @huseyincoban1214 3 роки тому

      @@NoOneIsHereRightNow ya ne güzel ,bende muğladayımm :) peki kaçıncı senen orada?

  • @manshushivam295
    @manshushivam295 3 роки тому

    confused between core and thread !

  • @manshushivam295
    @manshushivam295 3 роки тому

    what is core ?

  • @ayanmandal8257
    @ayanmandal8257 3 роки тому

    when i typed wmic:root\cli>CPU Get NumberOfCores.NumberOfLogicallProcessors ,it shows error...can anyone help

    • @donquic
      @donquic 3 роки тому

      just use task manager to find out if you have hyperthreading ALT+CTRL+DELETE

    • @kollidayakar7363
      @kollidayakar7363 3 роки тому

      You have to click on:
      ALT+CTRL+DEL
      then, it shows an some options,then go with task manager and maximize the screen which is newly opened and click on PERFORMANCE button which in top bar then u will see CPU curve below the CPU curve u will finally find that CORES: ---
      LOGICAL PROCESSORS: ---
      -Thank you

  • @theunknown_number
    @theunknown_number 3 роки тому

    Why are user threads and kernel threads relationship needed?
    Cpu only executes kernel threads. So mapping Between user threads and Kernel threads needs to execute user threads.

  • @josefinamagallanes8451
    @josefinamagallanes8451 5 років тому +1

    How do I follow you on Instagram?

  • @josefinamagallanes8451
    @josefinamagallanes8451 5 років тому

    I'm a super super beginner. Ssb

  • @mohamedorabi7113
    @mohamedorabi7113 5 років тому

    how to put auto-generated subtitles in this video ?

  • @sandipdas5684
    @sandipdas5684 4 роки тому

    Sir I think your name is JAISON...

  • @mohinishendye1040
    @mohinishendye1040 2 роки тому

    👍👍

  • @ece_25_haniyabai.s83
    @ece_25_haniyabai.s83 4 місяці тому +1

    🥹🫶🏻

  • @gauravchaudhari3843
    @gauravchaudhari3843 3 роки тому

    windows xp lol

  • @Xoro162
    @Xoro162 3 роки тому

    no god but Allah

  • @sweetysingh6316
    @sweetysingh6316 7 місяців тому

    What is block g system @nesoacedemy

  • @TechnoyashBro
    @TechnoyashBro 3 роки тому +1

    I will get subscription of your neso app but there are nothing facility to discuss with faculty so please help me sir i have one question
    can a multithreaded solution using multiple user-level threads achieve better performance on a multiprocessor system than on single processor system
    Plzz sir explain me in detail