Multithreading Using pthreads in C language (Part 1)

  Рет қаралды 60,157

Tech and Beyond With Moss

Tech and Beyond With Moss

3 жыл бұрын

In this video I introduce you to pthreads, and walk you through writing a simple program that creates several pthreads using the C programming language! The code is available on my GitHub here: github.com/moss-n/multithread...
Documentation : man7.org/linux/man-pages/man7...
Other helpful resources: computing.llnl.gov/tutorials/...

Пікірлер: 47
@AYVYN
@AYVYN Жыл бұрын
The program that I had to make was far more complicated but this provided a great starting foundation and I’m finally done. Thank you.
@ji5387
@ji5387 3 жыл бұрын
Clear explanation and it is super easy to understand what you are saying! will def be watching more of your videos
@ManSuLuit
@ManSuLuit 3 жыл бұрын
Awesome video, loved it! More videos please on Parallel and Network programming in C, socket and openmp programs
@kandy5983
@kandy5983 3 жыл бұрын
you are the king of simple good explination
@reynaldosilva1115
@reynaldosilva1115 Жыл бұрын
Thank you for the great and simple explanation.
@vasilygushcha4942
@vasilygushcha4942 3 жыл бұрын
Very well explained. Thank you 🙏
@GolloS107
@GolloS107 3 жыл бұрын
Yea this the most helpful video i think. Definately i would continue the series all the way. Dropped a sub as well :D
@tech_with_moss
@tech_with_moss 3 жыл бұрын
Thank you! I appreciate that. I will definitely continue the series
@matinakorkontzelou9964
@matinakorkontzelou9964 2 жыл бұрын
amazing video. Very entertaining!!!! Just subscribed
@nadiavnn
@nadiavnn 3 жыл бұрын
This was cool. Thank you!
@arisyuhada4182
@arisyuhada4182 3 жыл бұрын
I like your video, keep it up mate.
@juliannafotheringham7101
@juliannafotheringham7101 Жыл бұрын
great explanation, thank you!
@mohammadadrees5263
@mohammadadrees5263 2 жыл бұрын
Beautifully explained. Thank you
@tech_with_moss
@tech_with_moss 2 жыл бұрын
Thanks! Glad it was helpful
@maraenache4734
@maraenache4734 Жыл бұрын
teacher material💕 thank you
@aashishshrestha8180
@aashishshrestha8180 3 жыл бұрын
i like each step explanation
@donyamunaque919
@donyamunaque919 3 жыл бұрын
Awesome!
@joaopedroviana7332
@joaopedroviana7332 3 жыл бұрын
nice my dude
@HriSri
@HriSri 2 жыл бұрын
Thank You!!
@janyehm4950
@janyehm4950 3 жыл бұрын
Good video. Please more!
@amanrai5285
@amanrai5285 2 жыл бұрын
Can we create threads without creatng a new function?
@lyshasilva8703
@lyshasilva8703 Жыл бұрын
Great video. can you create about prime numbers in pthread using C #.
@nehachalla4140
@nehachalla4140 2 жыл бұрын
How to synchronize two programs using multithreading?
@TheAidsaids
@TheAidsaids 3 жыл бұрын
Hi I am learning C pthreads lib from already being proficient in the C++17 threads STL and little knowledge of C idioms so just one question - what is the purpose of casting the pthread_t reference to void ptr and then casting to a long in the provided function? Specifically the void ptr part?
@tech_with_moss
@tech_with_moss 3 жыл бұрын
Hi Ayden! I'm not totally certain this is the answer, but I believe void* pointer here is being used like you might use a template/generic in C++, since C doesn't support templates/generics (www.geeksforgeeks.org/generics-in-c/). The function signature accepts a void pointer so that you can pass any data type as input to a worker thread function. Since you know what you're input is, then the worker function will cast it accordingly.
@ahmedghallab5342
@ahmedghallab5342 5 ай бұрын
شكرا Thanks
@CastleBomber
@CastleBomber 2 жыл бұрын
solid
@ForeverNils
@ForeverNils 11 ай бұрын
why not using pthread_join for each thread instead of pthread_exit, is it because performance?
@vincegelo4495
@vincegelo4495 2 жыл бұрын
Quick question, in the example shown in the video, do the threads run concurrently or parallel?
@ME0WMERE
@ME0WMERE Жыл бұрын
Those mean the same thing
@elhoussainefagrouche3267
@elhoussainefagrouche3267 2 жыл бұрын
thank you for the good work , but you lost me in the pthread_create function arguments and the WorkerThread function declaration, not well explained these two !
@aashishshrestha8180
@aashishshrestha8180 3 жыл бұрын
can you make more vedios on complex code on pthread
@tech_with_moss
@tech_with_moss 3 жыл бұрын
Hi Aashish! I am definitely making another video with a more advanced example as a part 2 to this initial video. Thanks for the feedback!
@AhmedElsayed-ur1iy
@AhmedElsayed-ur1iy 3 жыл бұрын
More plz ur waay better than this Brian Fraser guy is
@abolfazlaslani4323
@abolfazlaslani4323 3 жыл бұрын
this quality content worth more subs than this
@tech_with_moss
@tech_with_moss 3 жыл бұрын
Thank you for the kind words I appreciate it!
@monren92
@monren92 2 жыл бұрын
That keyboard sounds so shmexy...where did you get it?
@tech_with_moss
@tech_with_moss 2 жыл бұрын
This was a while ago and I've since updated my keyboards, but I believe it was a RedDragon K series from Amazon. I can't remember which specific model though.
@genkimichael7329
@genkimichael7329 3 жыл бұрын
Where is part 2?
@tech_with_moss
@tech_with_moss 3 жыл бұрын
Hi Michael. This video is part 2 of the series: kzbin.info/www/bejne/sKiblIGwjZp8ecU Its less focused on learning the pthread interfaces and more on fixing issues that might arise when working with pthreads
@akshaykokkad3673
@akshaykokkad3673 3 жыл бұрын
where is the second part bro can you upload full code for matrix multiplication using pthread in c?
@dmdm9269
@dmdm9269 3 жыл бұрын
you are not printing thread_id, but you are printing memory address of tid0,
@philipemarques9715
@philipemarques9715 3 жыл бұрын
vim pelo zebong
@faisalchowdhury1688
@faisalchowdhury1688 3 жыл бұрын
Yea this the most helpful video i think. Definately i would continue the series all the way. Dropped a sub as well :D
@tech_with_moss
@tech_with_moss 3 жыл бұрын
Thank you! I'm glad you like it, and thanks for the sub! I am going to continue this series in the near future for sure.
@GolloS107
@GolloS107 3 жыл бұрын
can you make more vedios on complex code on pthread
Multithreading in C Using Pthreads (part 2) - Order Violation Bugs
17:05
Tech and Beyond With Moss
Рет қаралды 17 М.
Introduction To Threads (pthreads) | C Programming Tutorial
13:39
Portfolio Courses
Рет қаралды 89 М.
Box jumping challenge, who stepped on the trap? #FunnyFamily #PartyGames
00:31
Family Games Media
Рет қаралды 23 МЛН
Jumping off balcony pulls her tooth! 🫣🦷
01:00
Justin Flom
Рет қаралды 29 МЛН
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 294 М.
Networking in C++
32:50
The Cherno
Рет қаралды 240 М.
Mutex Synchronization in Linux with Pthreads
25:07
Brian Fraser
Рет қаралды 160 М.
Fork and Pthreads - A Guide To Get You Started with Multiprocessing
17:28
Multithreading Code - Computerphile
15:54
Computerphile
Рет қаралды 381 М.
why do void* pointers even exist?
8:17
Low Level Learning
Рет қаралды 346 М.
BEST WAY to make Desktop Applications in C++
26:00
The Cherno
Рет қаралды 901 М.
Compilers, How They Work, And Writing Them From Scratch
23:53
Adam McDaniel
Рет қаралды 137 М.
why do header files even exist?
10:53
Low Level Learning
Рет қаралды 385 М.
Сколько реально стоит ПК Величайшего?
0:37
КРУТОЙ ТЕЛЕФОН
0:16
KINO KAIF
Рет қаралды 7 МЛН
Как удвоить напряжение? #электроника #умножитель
1:00
Hi Dev! – Электроника
Рет қаралды 1,1 МЛН
Tag him😳💕 #miniphone #iphone #samsung #smartphone #fy
0:11
Pockify™
Рет қаралды 4,9 МЛН
Частая ошибка геймеров? 😐 Dareu A710X
1:00
Вэйми
Рет қаралды 6 МЛН