Is it concurrent or parallel?

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 ธ.ค. 2024

ความคิดเห็น • 49

  • @alancanalesmujica6878
    @alancanalesmujica6878 ปีที่แล้ว +44

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

    • @ibrahimfikry6624
      @ibrahimfikry6624 8 หลายเดือนก่อน +1

      thanks

    • @mindfulnessrock
      @mindfulnessrock 6 หลายเดือนก่อน +3

      They're both achieved through software

    • @laujimmy9282
      @laujimmy9282 5 หลายเดือนก่อน

      I think what he meant is that parallelism is done by CPU ​@@mindfulnessrock

    • @adambickford8720
      @adambickford8720 หลายเดือนก่อน

      @@mindfulnessrock If the hardware doesn't support it, no amount of software will help.

  • @saurabhshinde1855
    @saurabhshinde1855 ปีที่แล้ว +22

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

  • @shehabbadawy9523
    @shehabbadawy9523 ปีที่แล้ว +22

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

  • @samarthtandale9121
    @samarthtandale9121 ปีที่แล้ว +1

    Keep uploading ... These videos are very insightful !

  • @lucasheuman
    @lucasheuman ปีที่แล้ว

    Glad to see you putting out more videos!

  • @newbie8051
    @newbie8051 5 หลายเดือนก่อน

    Amazing, tried to understand this a few months ago when my friends were experimenting with go
    Finally understood it now, concurrency is achieved when the processor switches between tasks really quickly and parallel is basically when we do two tasks at the same time, could be me and my friend parallel writing down notes of different lectures.

  • @peterlin5857
    @peterlin5857 ปีที่แล้ว +5

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

  • @PetreRodan
    @PetreRodan ปีที่แล้ว +7

    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 ปีที่แล้ว +4

      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?

  • @filips7158
    @filips7158 ปีที่แล้ว +4

    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.

  • @johnpawlicki1184
    @johnpawlicki1184 ปีที่แล้ว +6

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

  • @remotetechie6910
    @remotetechie6910 11 หลายเดือนก่อน

    Loved this explanation

  • @SpooningTreesap86
    @SpooningTreesap86 ปีที่แล้ว +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 😁

  • @sudharakafernando4391
    @sudharakafernando4391 8 หลายเดือนก่อน

    Well explained... thank you !!!

  • @rmcgraw7943
    @rmcgraw7943 6 หลายเดือนก่อน

    The way I think of it is that Parallelism is the parent of concurrency. That is, parallelism deals with multi-threading, and is constrained by hardware implementations; to effectively process task in parallel, task run at the same time and should be divided to as atomic as possible, accessing no shared (or unprotected/locked) data simultaneously. Concurrency could or could not timeslice between task, depending on the Task Partitioner, hyperthreading, etc, but it does not concern itself with the partitioning of tasks/data; concurrency IS running things while parallel is the identification of how things can be run in a thread safe manner, concurrently.
    It’s been a while since I worked with System.Threading namespace, but that’s how I remember it.

  • @kaiweiyeo4279
    @kaiweiyeo4279 ปีที่แล้ว +2

    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 11 หลายเดือนก่อน +2

      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.

  • @DM-qm5sc
    @DM-qm5sc ปีที่แล้ว +3

    An example would help me understand this better

  • @yash1152
    @yash1152 ปีที่แล้ว

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

  • @xhivo97
    @xhivo97 ปีที่แล้ว +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.

  • @brianb2308
    @brianb2308 ปีที่แล้ว +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 ปีที่แล้ว

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

  • @maxaafbackname5562
    @maxaafbackname5562 ปีที่แล้ว +1

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

  • @JustinCromer
    @JustinCromer ปีที่แล้ว +3

    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  ปีที่แล้ว +2

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

    • @JustinCromer
      @JustinCromer ปีที่แล้ว

      @@JacobSorber :(

    • @Sakuraigi
      @Sakuraigi 10 หลายเดือนก่อน

      ​@@JacobSorbertech language is so bad

  • @artemetra3262
    @artemetra3262 ปีที่แล้ว +2

    is async computation concurrency?

    • @The-Real-Jack
      @The-Real-Jack ปีที่แล้ว

      Yes

    • @andrewporter1868
      @andrewporter1868 ปีที่แล้ว +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 ปีที่แล้ว

      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 ปีที่แล้ว +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 ปีที่แล้ว

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

  • @iridradiant
    @iridradiant ปีที่แล้ว +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?

  • @meluobote7664
    @meluobote7664 ปีที่แล้ว

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

  • @bapi6060
    @bapi6060 ปีที่แล้ว

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

    • @ohwow2074
      @ohwow2074 ปีที่แล้ว

      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.

  • @gloverelaxis
    @gloverelaxis ปีที่แล้ว +4

    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 ปีที่แล้ว +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 ปีที่แล้ว +1

      TF

    • @Sakuraigi
      @Sakuraigi 10 หลายเดือนก่อน

      Completely agree. Computer Science uses trash language

  • @FEFFeX
    @FEFFeX ปีที่แล้ว

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

    • @anon_y_mousse
      @anon_y_mousse ปีที่แล้ว

      I hope not. No one should be using it.