Multithreading Code - Computerphile

Multithreading Code - Computerphile

Computerphile

5 лет назад

379,716 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@testtest-co9hk
@testtest-co9hk - 15.09.2023 14:23

with adding a token isn't not equal to sequential processing because at a time one one operation can happen ( i don't see the usefulness of multithreading here)?

Ответить
@allmight9991
@allmight9991 - 13.09.2023 07:22

This is really helpful thank you Hussein.
Fan from egypt😊

Ответить
@woosukbyun2455
@woosukbyun2455 - 25.08.2023 18:06

is there a way to see threads stored in the code section of physical memory?

Ответить
@qwertyuiop-cu2ve
@qwertyuiop-cu2ve - 10.08.2023 19:50

The thing with the 2nd Steve is so funny😁

Ответить
@Ihavetoreturnsomevideotapes
@Ihavetoreturnsomevideotapes - 01.08.2023 18:52

can some share that code bit

Ответить
@shivamsood8385
@shivamsood8385 - 05.07.2023 14:44

really awesome explanation !!

Ответить
@Kavukamari
@Kavukamari - 21.06.2023 01:58

very helpful explanation for why mutex is necessary, I better understand now

Ответить
@fighterfighter2466
@fighterfighter2466 - 03.01.2023 20:54

I am allergic to that marker sound.

Ответить
@53nat0r
@53nat0r - 27.11.2022 08:38

Superbs explanation. Well done! Great editing too!

Ответить
@sagarabasavarajawalishetti3168
@sagarabasavarajawalishetti3168 - 31.10.2022 10:19

This is coolest explanation..

Ответить
@smergthedargon8974
@smergthedargon8974 - 04.08.2022 03:32

My solution instead of the token would've been to have a different variable for each thread, then adding them up at the end. Can't overwrite each other if they're not writing the same variable!

Ответить
@Olololsh
@Olololsh - 16.07.2022 13:22

Could it be that C++ compiler or processor is smart enough to move synchronization out of the loop? Guess we need to check assembly, otherwise we will never know if the computer is FAST or SMART =))

Ответить
@LeCyProductions
@LeCyProductions - 01.05.2022 13:48

Love the explanation, thanks other Steve!

Ответить
@jaffarbh
@jaffarbh - 13.04.2022 10:09

Write-after-write hazard. Perhaps a faster, more scalable (and more complex) solution is to Map-Reduce. C compiler directives can help

Ответить
@gracejenna9787
@gracejenna9787 - 30.03.2022 16:55

My husband works from home. He is a very intelligent programmer, he talks to me everyday. This stuff is one of them. I am just drinking coffee while listening to him. I had no idea what he is talking about every single day. Thanks for helpful video. I will watch this everyday.

Ответить
@jimjimx5418
@jimjimx5418 - 24.03.2022 22:43

You have 2 Apples in front of you, and you choose to use a Microsoft???

Ответить
@patrickgoetz
@patrickgoetz - 19.03.2022 03:25

The best explanation of threads that I've even seen -- great job! Oh, and of course brilliant video production.

Ответить
@dorgeshuun
@dorgeshuun - 13.03.2022 12:57

"This is getting out of hand, now there are two of them..."

Ответить
@pavelhassan7457
@pavelhassan7457 - 11.01.2022 17:40

Would you calculate how much electricity consumed in different experiments?

Ответить
@vinsonwei1306
@vinsonwei1306 - 16.12.2021 19:59

Learned a lot for this! Thanks!

Ответить
@jamesrivettcarnac
@jamesrivettcarnac - 02.12.2021 15:08

I'd love you to learn RISC V assembly

Ответить
@vickyanand5898
@vickyanand5898 - 01.12.2021 09:18

Can you just explain what happens to a service when multiple say 1000 requests are sent at the same time. how multithreading can be related here ? thanks

Ответить
@zxuiji
@zxuiji - 29.11.2021 16:00

Well I managed to find a way to do manual thread safety, here's a snippet from what I'm currently putting together, no mutexes or semaphores involved:

```
dint Send_AndWaitAll( THREAD *thread, OBJECT *object )
{
BRANCH *branch = GrabThreadBranch( thread );

if ( !thread )
return 0;

if ( thread != &main_thread )
{
SIGNAL *signal = GrabThreadSignal(thread);
OBJECT tmp = {0};
bool redo = false;

object->que = time(NULL);
signal->i = *object;

while ( 1 )
{
YieldOther();

/* Check if the thread sent us a signal */
if ( signal->o.que < object->que )
continue;

/* Check if the signal was the one we were expecting */
if ( signal.o.sig != SIGNAL_CONT )
{
tmp = signal->o;
redo = true;
continue;
}

break;
}

if ( redo )
{
tmp.que = object->que;
tmp.sig = SIGNAL_REDO;
signal->i = tmp;
}
}

Send_AndWaitAll( branch->Init, sig, object );
return Send_AndWaitAll( branch->Next, sig, object );
}
```

Ответить
@VV-om8vv
@VV-om8vv - 26.11.2021 21:51

Nice this was very helpful

Ответить
@bogulans2897
@bogulans2897 - 17.11.2021 16:50

Awesome video

Ответить
@StanislavPozdnyakov
@StanislavPozdnyakov - 16.11.2021 18:32

And at this moment I've found out that mutex stands for mutual exclusion

Ответить
@edilgin622
@edilgin622 - 15.11.2021 15:09

wowww the editing was superb! nice job computerphile nice job

Ответить
@Ovicron
@Ovicron - 14.11.2021 19:06

Why is this a race condition and not a data race?

Ответить
@Jkauppa
@Jkauppa - 13.11.2021 17:08

you dont need to have an os to do it, just have the first (boot) core to write to the program buffer of the other processors/core, assume bare metal multi core program

Ответить
@trestenpool9045
@trestenpool9045 - 19.10.2021 18:44

One of my favorite vids by yall guys. Thank you !

Ответить
@tiagoperes1631
@tiagoperes1631 - 12.10.2021 04:47

👏👏👏👏👏👏👏👏👏👏

Ответить
@CapyRescuer
@CapyRescuer - 30.09.2021 02:14

Amazingly explained !

Ответить
@mohan7490
@mohan7490 - 21.09.2021 21:30

Just blew my mind

Ответить
@0bhi
@0bhi - 13.08.2021 08:19

race conditions

Ответить
@wumbl3
@wumbl3 - 05.08.2021 23:29

Doesn't that just end up making both threads run as fast as a single thread?

Ответить
@codepoachers6870
@codepoachers6870 - 03.08.2021 17:28

Great video!

Ответить
@anindyasundarmanna6683
@anindyasundarmanna6683 - 27.07.2021 15:52

Loved the video! Absolutely great!

Ответить
@angelodeus8423
@angelodeus8423 - 20.07.2021 17:54

THis can be used to generate random numbers.

Ответить
@nazoj6462
@nazoj6462 - 16.05.2021 22:49

Steve literally divided himself like a cell just for this example
thats some true dedication

Ответить
@zuzannaczakon8402
@zuzannaczakon8402 - 22.04.2021 19:13

Can you explain what would be the difference to using different variables a1, a2 for the parts of the program and run on 2 different threads? As I understand there wouldn't be a need to lock, but what are the downsides? :)

Ответить
@B20C0
@B20C0 - 20.04.2021 13:35

The first time I felt smart watching a Computerphile video. I saw the code and the fact that both threads use the same variable and thought "That's not gonna work as intended.".

Ответить
@T-She-Go
@T-She-Go - 29.03.2021 23:53

I understand so much now 😌 Those visual effects helped a lot 🙌🏾

Ответить
@Shiunbird
@Shiunbird - 14.03.2021 14:08

Very helpful. I'm proficient in shell scripting and powershell overall for my work life, and recently started learning C. This helped me sort out a problem with one of my projects, so thank you for that. =)

Ответить
@jeffbellerpdx
@jeffbellerpdx - 10.03.2021 20:12

Dang, did he get that paper of ebay? ha.

Ответить