Is it concurrent or parallel?

Sdílet
Vložit
  • čas přidán 5. 06. 2023
  • Patreon ➤ / jacobsorber
    Courses ➤ jacobsorber.thinkific.com
    Website ➤ www.jacobsorber.com
    ---
    Is it concurrent or parallel? Concurrency and parallelism confuse a lot of new programmers and students of computer science-especially when studying operating systems, high performance computing, threads, and similar systems topics. This video tries to clarify the difference. I hope it helps.
    ***
    Welcome! I post videos that help you learn to program and become a more confident software developer. I cover beginner-to-advanced systems topics ranging from network programming, threads, processes, operating systems, embedded systems and others. My goal is to help you get under-the-hood and better understand how computers work and how you can use them to become stronger students and more capable professional developers.
    About me: I'm a computer scientist, electrical engineer, researcher, and teacher. I specialize in embedded systems, mobile computing, sensor networks, and the Internet of Things. I teach systems and networking courses at Clemson University, where I also lead the PERSIST research lab.
    More about me and what I do:
    www.jacobsorber.com
    people.cs.clemson.edu/~jsorber/
    persist.cs.clemson.edu/
    To Support the Channel:
    + like, subscribe, spread the word
    + contribute via Patreon --- [ / jacobsorber ]
    Source code is also available to Patreon supporters. --- [jsorber-youtube-source.heroku...]

Komentáře • 46

  • @alancanalesmujica6878
    @alancanalesmujica6878 Před 7 měsíci +27

    I tried to keep this in mind “Concurrency is a software mechanism and parallelism is a hardware concern”

  • @shehabbadawy9523
    @shehabbadawy9523 Před rokem +21

    i know this is maybe off-topic, but can you make a video about distributed systems and perhaps MPI ?

  • @lucasheuman
    @lucasheuman Před 11 měsíci

    Glad to see you putting out more videos!

  • @samarthtandale9121
    @samarthtandale9121 Před rokem +1

    Keep uploading ... These videos are very insightful !

  • @sudharakafernando4391
    @sudharakafernando4391 Před měsícem

    Well explained... thank you !!!

  • @peterlin5857
    @peterlin5857 Před rokem +4

    Hey Jacob, really enjoy your videos, could you make a topic about RISC-V?

  • @remotetechie6910
    @remotetechie6910 Před 4 měsíci

    Loved this explanation

  • @johnpawlicki1184
    @johnpawlicki1184 Před rokem +6

    My interpretation has always been the same. I always think of "parallel processors" which requires more than one core. 🙂

  • @PetreRodan
    @PetreRodan Před rokem +5

    multiprocessor execution surely does not imply parallelism. while I have 16 physical cores, I also have 587 processes running, so the OS will have to resort to scheduling (what you define as concurrency).

    • @ricardoamendoeira3800
      @ricardoamendoeira3800 Před 6 měsíci +3

      Unless only one of the cores is working at each moment, surely you're executing more than one process at the same time, and thus have parallel execution?

  • @SpooningTreesap86
    @SpooningTreesap86 Před 11 měsíci +2

    This is the way I've learned and understood it as well, granted I've had to double check and google it a few times when I forgot 😁

  • @saurabhshinde1855
    @saurabhshinde1855 Před rokem +15

    These diagrams helped me to visualise it better
    Concurrency...
    _ _
    _ _ _
    Parallelism :
    _ _ _ _ _
    _ _ _ _ _

    • @sfa22
      @sfa22 Před 11 měsíci

      Both of them have "Concurency". First one has ("Concurency" without "Parallelism") and second one has both ("Concurrency" and implicitly "Paralelism"). I do like your representation with the lines :)

  • @brianb2308
    @brianb2308 Před rokem +2

    Could you do a video on atomics sometime? I've only ever used mutexes for making multithreaded code safe and it seems like it's a bit limiting in certain circumstances

    • @_voidpointer5447
      @_voidpointer5447 Před 11 měsíci

      They done it :)
      Check the last video «Making variables atomic in C»

  • @filips7158
    @filips7158 Před rokem +3

    You only get real parallelism in multicore bare metal processors and FPGA/ASIC. Everything else is concurrent or concurrently parallel. This is because there is a clear separation of concerns between the OS operation and software you develop on top of OS functionalities.

  • @DM-qm5sc
    @DM-qm5sc Před rokem +2

    An example would help me understand this better

  • @xhivo97
    @xhivo97 Před rokem +1

    Have you seen "Modern C and we can learn from it?" I wonder what you think on that as it's quite different from the usual way you'd use C.

  • @maxaafbackname5562
    @maxaafbackname5562 Před rokem +1

    If two completely independent tasks are run in parallel, is that (still) concurrent?
    (Referring to the last diagram.)

  • @kaiweiyeo4279
    @kaiweiyeo4279 Před 9 měsíci +1

    Hi Jacob,
    For the diagram at 3:25 , can an application be parallel and not concurrent? That would contradict the diagram.
    "An application can be parallel but not concurrent, which means that it processes multiple sub-tasks of a single task at the same time."

    • @givemecoffeeee42
      @givemecoffeeee42 Před 4 měsíci +1

      Great question! I think basically that's why threads were created, some tasks have multiple subtask inside so those are what actually interest you, not the big one. So you create threads of execution that run concurrently and ideally in parallel due to multithreaded processors.
      Now, i guess if you have multiple cores with multiple threads each, your processes are running in a parallel fashion, with threads running concurrently on each individual thread of the processor. For example, a processor with 2 cores with one thread of execution each can run one thread of one process on one core and another thread of another process on the other core, while threads are executed concurrently waiting for their turn on the core.

  • @meluobote7664
    @meluobote7664 Před rokem

    can two thread in the same process run in different cores and implement parallism?❤

    • @sfa22
      @sfa22 Před 11 měsíci

      Ofc they can. Since you wrote "different cores' I assume you have more than 1, else they are not different.

  • @artemetra3262
    @artemetra3262 Před rokem +2

    is async computation concurrency?

    • @The-Real-Jack
      @The-Real-Jack Před rokem

      Yes

    • @andrewporter1868
      @andrewporter1868 Před rokem +2

      @@The-Real-Jack This is incorrect. Asynchrony has nothing to do with concurrency in itself. Asynchrony is merely the absence or privation of synchrony.

    • @ohwow2074
      @ohwow2074 Před rokem

      It can be both based on the programmer's decision. It can run on a separate hardware thread or it can run on the same thread sequentially.

    • @The-Real-Jack
      @The-Real-Jack Před rokem +1

      Async isn't necessarily "true" concurrency in the sense of multithreaded concurrency (though it can be), but even in the case of single threaded async, it allows you to unblock further events and actions while your other instructions continue executing, practically allowing things to happen at the same time, even if they're not technically truely simultaneous. Whether you consider that concurrent or not is mostly semantic.

    • @meluobote7664
      @meluobote7664 Před rokem

      yes or not, bcause the distributed task don't have to be ran immediately

  • @FEFFeX
    @FEFFeX Před rokem

    Thank you so much for your awesome videos.
    Would you do some series on Rust.

    • @anon_y_mousse
      @anon_y_mousse Před 11 měsíci

      I hope not. No one should be using it.

  • @JustinCromer
    @JustinCromer Před rokem +2

    How do we get to redefine English words to mean what we want? The definition of ‘concurrent’ says “two or more things happening at the same time.” 10/10 would fail this quiz question and be okay with it.

    • @JacobSorber
      @JacobSorber  Před rokem +2

      Indeed. Redefining imprecise natural language to meet our specific needs is kind-of what we tech people do.

    • @JustinCromer
      @JustinCromer Před rokem

      @@JacobSorber :(

    • @Sakuraigi
      @Sakuraigi Před 4 měsíci

      ​@@JacobSorbertech language is so bad

  • @irispounsberry7917
    @irispounsberry7917 Před rokem +1

    Instead of using synonyms to confuse people, why didn't they just call "a single core juggling several processes" what it is: multitasking, as that is what it is called when a person does it. Or does that mean something else entirely in CS?

  • @bapi6060
    @bapi6060 Před rokem

    I'm downloading a file in my web browser and meanwhile I am watching your CZcams video. Are both happening parallelly or concurrently?

    • @ohwow2074
      @ohwow2074 Před rokem

      It depends on your hardware and OS. If you're using a modern multicore system then most probably they're running in parallel. Especially since those two processes have nothing to do with each other and are independent.

  • @yash1152
    @yash1152 Před 9 měsíci

    my summary of this video:
    * Concurrency means: overlap in their turning-around period
    * Parallelism means: overlap in their actively running time

  • @gloverelaxis
    @gloverelaxis Před 11 měsíci +3

    DO NOT USE THESE DEFINITIONS
    this is a REALLY, REALLY bad relationship of names and it causes everyone tangible harm to advocate these names for these concepts. "parallel" and "concurrent" in the context of time are synonymous in the English language, and so using "concurrent" as the name for something discretely different from "parallel" is REALLY, REALLY confusing and semantically misleading. call this concept of rapid OS context switching "scheduling", "round robin", "taking turns", "context switching", "time sharing", "time-slicing", "time-rationing", "focus-swapping", "pseudo-parallism", "virtual parallelism", "interleaving", "task dithering", "sequential sharing", or literally ANYTHING else.
    PLEASE stop giving things horrible names. PLEASE. computer science has way too fucking many bad names already. "concurrent" is literally THE word in the English language for when multiple things are happening at the same time. PLEASE do not use that word to refer to something where multiple things are explicitly NOT actually happening at the same time.
    this kind of thoughtless, rote repetition of extremely stupid traditions is exactly what's wrong with so much of programming.

    • @anon_y_mousse
      @anon_y_mousse Před 11 měsíci +1

      Programmers use terms in set X, mathematicians use set Y and "civilians" use set Z, and never the twain shall meet. That's life, get used to it and grow up or get out while you can. Another one that'll trip you up is thinking that terms stay the same for all time, because human beings can and will change the dictionary as often as they can. Go back to the 1950's and you'll more or less be able to have a casual conversation with someone, but go back another 70 years and you might not understand anyone. Something to ponder, if the average is at a specific level, then roughly half, give or take, will be below that average.

    • @sparkcodez
      @sparkcodez Před 9 měsíci +1

      TF

    • @Sakuraigi
      @Sakuraigi Před 4 měsíci

      Completely agree. Computer Science uses trash language