Multithreading Code - Computerphile

Computerphile · 412K views · 2018 · 15:54

Open on YouTube

Software architecture & designOperating systems & kernelsC, C++, Rust, Go & systems languagesexplainer

Why Stack Overflow recommends it

Stack Overflow users link it when explaining that threads are sequences of instructions scheduled by the OS and why shared resources need locks or mutexes.

Recommended by 1 people across 1 different months, 2019 to 2024.

What it is

A Computerphile explainer in which Dr Steve Bagley, with the help of a second Dr Steve Bagley, walks through what multithreaded code actually is and what is needed to make it work properly. It covers threads, interleaved instructions and synchronisation such as locking.

What people said

Recommends Ackdari · 2019-08 · Stack Overflow · on “Is possible backgroundworker DoWork in main thread?”

No it is not possible. A BackgroundWorker will always do its work on an seperate thread. To the point with an system with only one CPU. An OS runs many programs asynchronous and every program can have many threads. The OS will schedule all this threads to run at somepoint on any available CPU. This is crucial to maintain a smooth running system, especially when a system has only one CPU. If you want to know more you could look here [LINK] or here [LINK] and for a start I would recommend this [this video] video.

Cites Christopher · 2019-10 · Stack Overflow · on “Locking access to an object to edit it”

@Cheesegrater The same is true for Monitor. Indeed you have to pass something in to fullfill **Monitors** need. And that you need to share this between all the threads in involved in this is: Well, Duh! You need a single shared resoruce to lock on, to get this kind of coordination. That is how the Mutex kind of Synchronisation works. [this video]

Cites user1783484 · 2024-03 · Stack Overflow · on “Is a thread nothing but a sequence of machine instructions?”

I was watching this video [this video] from Computerphile and at 10:03 you can see this: [LINK] where T1 and T2 are threads, and under them are machine instructions. Does it mean a thread is basically made up of a sequence of machine instructions? Already tried to read online articles and watched youtube videos.