Thread: Threads Problem in Programming Multithreading

  1. #1
    Registered User
    Join Date
    Nov 2020
    Posts
    34

    Threads Problem in Programming Multithreading

    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:
    Top Multithreading Interview Question #full Answer - YouTube


    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).


    Doesn't matter for me what's the language about ; I need to understand the concept of concurrency and multithreading - Im new on this world and just started to study it recently.


    thanks.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,478
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Threads }multithreading.
    By barracuda in forum C Programming
    Replies: 5
    Last Post: 01-30-2015, 06:00 AM
  2. Need help with multithreading in win32 c programming
    By mlf in forum Windows Programming
    Replies: 8
    Last Post: 01-24-2013, 08:38 AM
  3. Replies: 5
    Last Post: 10-17-2008, 11:28 AM
  4. Replies: 2
    Last Post: 10-13-2004, 06:48 AM
  5. Multithreading problem
    By Bacardi34 in forum C Programming
    Replies: 5
    Last Post: 09-02-2004, 02:26 PM

Tags for this Thread