Working with Multithreading with Printf?

Hi guys ;
I’m trying to solve as much as possible multithreading problems in regard of getting a job ; I’ve
seen this problem of multithreading:
https://www.youtube.com/watch?v=JT90KoarNjw

In the video explains the problem with complete solution but I didn’t really understand how printf will print those possibilities:
(in the video mentioned that printf maybe not atomic)

2 1
1 1
2 2
1 2

could anyone please help me to illustrate in simple words the explanation that’s found on the video? I already seen
the video but Im confused on his explanation and didn’t understand how do I solve correctly with understandings that problem that’s
found on the video (two threads racing over each other on print function).

thanks.

Any help guys?

Sorry but the question is blurry, I’m sure you can find plenty of vids on threading on YouTube, if you can describe problem more precise that would have a chance…

The only guess I have that you try to call method from another thread and the answer you could expect that you gonna get a fat crash since you access a protected mem…

1 Like

How exactly case 3 happen with print? Im not understanding how in the video arrives to those cases of printing …

Try stackoverflow for these kind of programming questions.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.