How to create threads in a loop (pthread_create)

How to create threads in a loop (pthread_create)

CodeVault

3 года назад

83,833 Просмотров

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


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

afro_rush
afro_rush - 30.09.2023 08:19

when checking for errors, do we always have to return different numbers or can we return the same number for our pthread_create and pthread_join ?

Ответить
Vamsi Sai Krishna
Vamsi Sai Krishna - 17.08.2023 12:36

your cpu has 8 cores. what happens if you create 12 threads. do all the 12 threads starts execute at same time?

Ответить
Çağlayan G
Çağlayan G - 31.07.2023 20:42

Hi, routine method must take void* parameter and must return NULL in my case, to build my code. Have a nice day :)

Ответить
Mon Coeur
Mon Coeur - 28.05.2023 19:27

Thank you for your quality videos, i love this playlist

Ответить
Ahmet Karakartal
Ahmet Karakartal - 21.05.2023 22:54

thank you

Ответить
Comp Sci Enthusiast
Comp Sci Enthusiast - 21.03.2023 18:06

I've loved your tutorials series on threads, and I'm currently using them to get caught up before re-attempting an Operating Systems course at University. However, I can't find an explanation for what "th + i" means in the context of what 'th' stands for. Is that just a way of giving providing a thread with a number to pthread_create? (Noticing it takes place of the normal &p#)

Ответить
Lam Nguyen
Lam Nguyen - 07.03.2023 08:57

You're a legend for those who are taking the Operating System Course.

Ответить
ME GO
ME GO - 21.01.2023 00:27

Thanks :,)

Ответить
MATEO MARTINEZ GARCIA
MATEO MARTINEZ GARCIA - 19.01.2023 06:35

you are a little bit too pedantic man, its not really that difficult

Ответить
Athmesh Nandakumar
Athmesh Nandakumar - 17.01.2023 12:43

My system is octal core. i was able to create 11 threads. Am i wrong or is there any particular calculation?

Ответить
Kondapalli Yoshita
Kondapalli Yoshita - 05.01.2023 19:32

What happens if more than 8 threads are created? More than the number of CPU cores?

Ответить
Pietraru Alfred
Pietraru Alfred - 25.11.2022 01:18

greatly appreciate your effort, i am currently studying threads and you are making my life easier !

Ответить
Sipos Tamas
Sipos Tamas - 28.10.2022 19:12

The simplest, fastest, yet slow enough for me to comprehend explanation. I did not face this issue myself but it helped me understand things more clearly. I am fairly new to threads. Thank you sir!

Ответить
Simply Maths ;)
Simply Maths ;) - 28.10.2022 15:09

Best lessons. Respect from India :)

Ответить
Omkar Rajabhau Kadam
Omkar Rajabhau Kadam - 08.10.2022 12:42

You are helping me in understanding and completing my systems assignments at IIT Bombay. Thank you sir.

Ответить
ThatNohrianScum
ThatNohrianScum - 16.08.2022 07:45

Really nice explanation! Makes lots of sense :)

Ответить
Eliane Bresser
Eliane Bresser - 15.06.2022 22:01

Wonderful! Thank you!

Ответить
徐兆鴻
徐兆鴻 - 01.06.2022 14:38

Hi! Thanks for your tutorial. I want to remind you about you put mutex into for loop. It will let CPU slower. Although this chapter won't discuss about Time,I think you can remind listener about this point!

Ответить
Maryam Ashraf
Maryam Ashraf - 12.04.2022 13:31

Thank youuuuu. I love you dude. So frekin helpful.

Ответить
Jyothi Bhat
Jyothi Bhat - 31.03.2022 20:47

Hi, I had a question on malloc and free implementation in your code. As an exercise, I am trying to allocate and deallocate the memory in main memory. In your previous video (return values from a thread), you are calling malloc for each thread creation and in this video, we are trying to free the memory after joining all the threads. When I try to combine these, I see the program perfectly works. But shouldn't the number of malloc creations be equal to the number of free operations? Shouldn't we be freeing the memory inside the for loop of join threads? Obviously, I tried this and the program still works fine. What's the puzzle piece is when I print out the memory allocated for all threads, they are all the same. How is that possible?

Ответить
Learn ForFree
Learn ForFree - 30.03.2022 15:08

Thank you sir , you saved my time

Ответить
Sorakann Ki
Sorakann Ki - 27.03.2022 19:35

Thanks a lot for your video its really helpfull.
Do you know how to use the debugger in VS code for debugging multiple thread?

Ответить
Abhay Gaikwad
Abhay Gaikwad - 26.03.2022 10:08

understood

Ответить
Jackyskan
Jackyskan - 24.03.2022 09:19

Thank for your clear explanation? Have you ever think to make your own ONLINE SCHOOL, you would be so successfull !

Ответить
Shabkaz
Shabkaz - 03.03.2022 08:50

love you dude and your explaination

Ответить
Luis Waldo
Luis Waldo - 04.02.2022 11:48

First half really had me on the edge of my seat haha, excellent video!

Ответить
anees zuberi
anees zuberi - 27.12.2021 14:21

Sir, you are great. You explain everything very well and make it so simple to understand. Keep making videos.

Ответить
Pierluigi Vasapolli
Pierluigi Vasapolli - 08.12.2021 18:14

Great example and lesson !!!! Thank you so much !!!

Ответить
tamil dev
tamil dev - 08.12.2021 01:40

thank you so much <3

Ответить
Ashutosh Kumar
Ashutosh Kumar - 15.11.2021 13:08

Thank you so much for these videos.

Ответить
Andreas Soteriou
Andreas Soteriou - 08.11.2021 23:34

Is there a way to create a thread inside a thread? and if yes in this example could we create two additional threads that one does pthread_create and the other one does pthread_join?

Ответить
Ross Ulbricht
Ross Ulbricht - 31.10.2021 13:50

Why do we have to join the threads?

Ответить
Karina Nosenko
Karina Nosenko - 09.09.2021 15:52

You really helped me! Thank you

Ответить
Toastuy
Toastuy - 26.08.2021 18:12

Thank you so much, my OS class confused me so much last semester and these videos help me so much

Ответить
Fernanda Eschallots
Fernanda Eschallots - 06.08.2021 07:31

Your video is the best. thx

Ответить
Мария АК
Мария АК - 07.07.2021 16:08

Best!

Ответить
LukeNotHere
LukeNotHere - 06.07.2021 09:40

Where were you when I took System programming? Thanks btw

Ответить
Miki Cerise
Miki Cerise - 22.06.2021 22:14

Is there any equivalent to waitpid with -1 to wait for 'any' completed thread? Like with processes I might use:
while (number_of_processes--)
pid = waitpid(-1, &stat_loc, 0);

Ответить
nav guest
nav guest - 29.05.2021 08:45

The good thing bout this channel is, he always wants to convey the right knowledge without caring about views and likes. No fancy thumbnails...only coding... really appreciate your efforts...

Ответить
Alexia Topalidou
Alexia Topalidou - 22.05.2021 23:04

You are so helpful! Thank you so much for your videos. You made my project implementation easier!

Ответить
Anthony de Silva
Anthony de Silva - 19.05.2021 19:05

Excellent content. I subscribed. Some of the most helpful videos I have found on the subject.

Ответить
🇺🇦 I love Ukraine-  subscribe 1k goal
🇺🇦 I love Ukraine- subscribe 1k goal - 05.05.2021 16:39

Thank you for the video..

Ответить
Tshegofatso Kungoane
Tshegofatso Kungoane - 23.04.2021 01:20

Can somebody please give this guy an Oscar?? This was wonderful. Thank you 🙌🏾🌸

Ответить
Liang Zhang
Liang Zhang - 27.03.2021 04:10

Gosh, I wish you could be my professor instead!

Ответить
TotallyNotFunny
TotallyNotFunny - 08.03.2021 00:28

Wish I had you as my Operating Systems professor. Excellent, excellent videos. I hope you succeed in your future educational endeavors!

Ответить
kostas rompokas
kostas rompokas - 28.12.2020 04:40

Most underrated channel ever.

Ответить
Enes Arat
Enes Arat - 13.12.2020 11:15

Thanks for video. Can come a 'semaphore with multithread' video today or tomorrow. I have an project about it until tomorrow 5pm :D

Ответить