Short introduction to threads (pthreads)

Short introduction to threads (pthreads)

CodeVault

3 года назад

259,570 Просмотров

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


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

@amirahmedhassan6087
@amirahmedhassan6087 - 04.12.2023 20:59

Hello
I'd like to report that the code did not work with me but I had to edit on the function declaration

void* routine(void* n)
{

}

This worked fine with the pthread_create

Ответить
@animeshkumarsinha5954
@animeshkumarsinha5954 - 13.11.2023 22:15

Is there any difference between posix threads & thread from std namespace?
Like performance or user friendly?
How to decide which one to use and when ?

Ответить
@dherendrasingh4761
@dherendrasingh4761 - 11.09.2023 13:50

Hi Sir,
could you please tell again how this if condition make safer our code and didn't understand this condition "!=0 " . Please reply anyone.

Ответить
@atTran-xv5iz
@atTran-xv5iz - 03.09.2023 14:51

This is helpfull, thank you I will watch it all. I have have a question, I'm learning Go it has routine, does it similar to thread in c? (because Go was build base on C, I believe)

Ответить
@onaecO
@onaecO - 30.08.2023 13:46

This course is a Mine gold 🏆, i promote every time in my yt channel!!!

Ответить
@FirstLast-jl1wc
@FirstLast-jl1wc - 23.08.2023 06:14

just took a year off from my degree and completely forgot about how to use P_threads and this basically caught me back up to speed, incredibly good explanation.

Ответить
@xiaoliu852
@xiaoliu852 - 07.08.2023 21:51

it's much more clear than my professor, thank you!

Ответить
@albanec4702
@albanec4702 - 03.08.2023 19:19

I can`t find right words to fully express how simple and great this lesson starts thread theme... like u`ve said that I`d heard, read, seen so many times, but in an absolutly clear way and now I`m starting to feel that threads aren`t that scary and wierd - thank u soooo much!👍

Ответить
@vaibhavsingh-fu1vg
@vaibhavsingh-fu1vg - 23.05.2023 16:46

Binging your videos like I binged Money Heist!! literal Bella Ciao feeling in my mind for my C rejuvenation!!

Ответить
@ahmetkarakartal9563
@ahmetkarakartal9563 - 21.05.2023 23:11

thank you so much <3

Ответить
@sergeyrykovanov6396
@sergeyrykovanov6396 - 04.04.2023 14:57

Thanks for tutorial!!! One comment (unless I am wrong): it would make it cleaner to return NULL in all the void* functions

Ответить
@milanstojiljkovic4802
@milanstojiljkovic4802 - 03.03.2023 15:39

Great video! Could you tell us what VSCode extension you are using for function descriptions when you hover over them? Thanks!

Ответить
@sakkamouid3343
@sakkamouid3343 - 17.01.2023 21:14

I saw in a tutorial comparision between user level threads and kernel level threads that Multithreading isn't possible in user level threads. First , I would like to make sure and classify the threads that we are creating here . They are probably user level Threads because according to their definition they are created by the user just like we did here. But the thing that I don't understand is , how multithreading not possible user level Threads? Isn't that we did in our case executing two threads end getting same output twice called multithreading?

Ответить
@AdiSings2023
@AdiSings2023 - 07.01.2023 15:47

As a little update: in the "void routine()" function you should add the parameter void *arg so there won't be any errors: void *routine(void *arg){...}

Ответить
@sakkamouid3343
@sakkamouid3343 - 25.12.2022 01:56

What I have understood about the function pthread_join() is that , it waits until the thread passed in its first argument is terminated. That logically means that removing the call of this function doesn't stop the thread from executing, because that's the job of the pthread_create() function . But when I tried so and removed the call of the pthread_join() function I didn't get an output, which means the thread t1 didn't execute. Why?

Ответить
@youneshaddad7390
@youneshaddad7390 - 10.12.2022 01:19

Thank you!

Ответить
@alanmenescal9871
@alanmenescal9871 - 07.12.2022 23:59

Dude u are very good I like your classes, thx for the content It will be such a greate help for me

Ответить
@spurthidantu6890
@spurthidantu6890 - 27.11.2022 23:09

How do i prevent memory leaks in Pthreads? The first time i execute the program, answer is right but if i add a while loop, it is providing incorrect values.Even after adding pthread_join, same thing is happening.

Ответить
@peterkong4273
@peterkong4273 - 16.11.2022 08:59

These videos are absolute gems, huge thanks from Hong Kong!

Ответить
@ruby-vn7sz
@ruby-vn7sz - 09.11.2022 20:39

thank you so much this really helped me a lot!!!

Ответить
@eduardotenes4615
@eduardotenes4615 - 07.11.2022 23:01

top!

Ответить
@soumikpattanayak3225
@soumikpattanayak3225 - 04.11.2022 01:31

Idk why but when I'm using sleep()
It is not stopping there :(
Plz help

Ответить
@vitorsergio8877
@vitorsergio8877 - 11.10.2022 05:43

i love you so muccchhhhh codevault <3 hugs from ecole 42

Ответить
@MatheusOliveira-ky5yj
@MatheusOliveira-ky5yj - 29.09.2022 01:25

Many thanks!

Ответить
@viniciuss.9250
@viniciuss.9250 - 26.09.2022 17:28

thank you, thank you, thank you 🚀🚀

Ответить
@JakeShuf
@JakeShuf - 22.09.2022 19:58

I know you get this a lot, but your videos on C are a godsend! You've really helped me and countless others to succeed in our education.

Ответить
@hamidkisha7328
@hamidkisha7328 - 22.09.2022 01:28

Great explanation! thanks very much

Ответить
@digitallova
@digitallova - 06.09.2022 21:08

How to print process Id and thread id knowing that threads are executing within the same process

Ответить
@freddy_hd_7073
@freddy_hd_7073 - 25.08.2022 22:38

sorry, why the function has a pointer?

Ответить
@copingforever6093
@copingforever6093 - 22.07.2022 03:26

thank you for the series I passed my exam on the second try after watching your videos, our professor didnt explain it well

Ответить
@video0607
@video0607 - 30.06.2022 22:58

How can I join to your Discord server?

Ответить
@Pixailz
@Pixailz - 19.06.2022 23:55

hello, everytime i got the learn somethings new for a project at 42, you are here with a video. the starting point for philosophers :) Are you a 42 students ? thanks you for all your stuff :)

Ответить
@rosehawk2041
@rosehawk2041 - 18.06.2022 18:02

you are better than most of professors teaching c in china

Ответить
@EdwinFairchild
@EdwinFairchild - 06.06.2022 00:11

is it possible to give a thread a timeout, so if my function is not done executing in some time ebcause it is hanging or something, have the thread return

Ответить
@ericz7881
@ericz7881 - 15.05.2022 23:07

Great video thanks. Can you please help explain why you only wrote if statement in pthread_create and pthread_join, but no else statement? I understand if pthread_create doesn't return 0 then it's an error, but I'd think there needs to be an else statement to tell the program what to do when there is no error.

Ответить
@KokoMbella
@KokoMbella - 11.05.2022 08:03

Hi, I am using Ubuntu 20.04.4 LTS. On VSCode I can't include the header <pthread.h>, only <threads.h> works. I can locate pthread.h in /usr/include/pthread.h. How do I include the header in VSCode?

Ответить
@mehdibenhariz3281
@mehdibenhariz3281 - 05.05.2022 11:44

you are a life saver

Ответить
@georgesheng6046
@georgesheng6046 - 29.04.2022 19:22

can you please make a video about sockets? my final exam is coming up and I have no idea how they work !!

Ответить
@mayelinespino2487
@mayelinespino2487 - 21.04.2022 15:20

Good morning. Do you have a video explaining function that return void *?

Ответить
@ruok1992
@ruok1992 - 12.04.2022 21:14

what is the API you talked about ? I've been searching in Google - can you help me with it ?

Ответить
@MuhammadAli-ve7mt
@MuhammadAli-ve7mt - 04.04.2022 20:10

I've tried adding pthread in tasks.json but it just doesn't seem to work when I run the program using vscode.
It works through the terminal but not vscode. It still gives the undefined reference error. Is anyone able to help?

Ответить
@nicholas10148
@nicholas10148 - 27.03.2022 18:37

How do you get VS code to show the pop up with the different arguments, for things such as pthread_create?

Ответить
@ismailcemtuzun9221
@ismailcemtuzun9221 - 27.03.2022 02:38

Amazing teaching !

Ответить
@abhaygaikwad6251
@abhaygaikwad6251 - 26.03.2022 10:35

understood

Ответить
@Jin-ec1vc
@Jin-ec1vc - 22.03.2022 11:05

nice and clear explanation!

Ответить
@nicholas10148
@nicholas10148 - 11.03.2022 02:47

Taking an Operating systems class, and you have been a great help throughout the course!

Ответить
@Fahodinho
@Fahodinho - 10.03.2022 20:08

where are you from?

Ответить
@nickst2797
@nickst2797 - 27.02.2022 17:05

Thank you! But is this only for Linux? Does it work in Windows as well?

Ответить
@amanvarshney51217
@amanvarshney51217 - 26.02.2022 21:59

Thank you sir, your videos are really very helpful for me.

Ответить