Thread: multithreading

  1. #1
    Registered User
    Join Date
    Mar 2004
    Posts
    19

    multithreading

    Hi All,
    what is the use of multithreading in a single processor(cpu) machine??

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    In C, literally, the answer is none - the C standard includes absolutely no support of multithreading.

    In practice, with an operating system that supports preemptive multitasking of threads, multithreading provides a convenient means of separating execution of functions that can logically occur in parallel. There is a reliance on the operating system to give each thread time slices of the processor so, although threads are executed in pieces and there is no true concurrency, each thread can be implemented as if it runs in parallel with other threads.

  3. #3
    Registered User
    Join Date
    Mar 2004
    Posts
    19
    Hi Friend..Thank you..
    You have explain about context switching..if it is a single processor then your words are absolutely correct...what about in case of multi processor system...You can achieve true concurrency there..am I correct??
    so you were answer is we cant achieve parrallel execution.in a single processor..may be you are correct may not be??

  4. #4
    Fear the Reaper...
    Join Date
    Aug 2005
    Location
    Toronto, Ontario, Canada
    Posts
    625
    That seems accurate.
    Teacher: "You connect with Internet Explorer, but what is your browser? You know, Yahoo, Webcrawler...?" It's great to see the educational system moving in the right direction

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    It is accurate, except that you are incorrectlu assuming parallel execution is the same as what you are calling "true concurrency". It is possible to achieve parallel execution with a single processor, in the sense that neither thread is specifically required to wait for the other before it does something.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multithreading (flag stopping a thread, ring buffer) volatile
    By ShwangShwing in forum C Programming
    Replies: 3
    Last Post: 05-19-2009, 07:27 AM
  2. multithreading in C++
    By manzoor in forum C++ Programming
    Replies: 19
    Last Post: 11-28-2008, 12:20 PM
  3. Question on Multithreading
    By ronan_40060 in forum C Programming
    Replies: 1
    Last Post: 08-23-2006, 07:58 AM
  4. Client/Server and Multithreading
    By osal in forum Windows Programming
    Replies: 2
    Last Post: 07-17-2004, 03:53 AM
  5. Multithreading
    By JaWiB in forum Game Programming
    Replies: 7
    Last Post: 08-24-2003, 09:28 PM