CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Aug 2005
    Posts
    98

    advantage of using thread

    The key in using threads to simplify your code is to try to keep your functions and methods on one train of thought. Rather than turn your code into an arthritic mess trying to interleave multiple simple simultaneous tasks, code each task separately. Code each line block with one mind. Let the OS thread scheduler do the interleaving.


    http://marcja.wordpress.com/2007/04/...ultithreading/


    What do you understand from this?

  2. #2
    Join Date
    Aug 2005
    Posts
    98

    Re: advantage of using thread

    Quote Originally Posted by Abalfazl View Post
    The key in using threads to simplify your code is to try to keep your functions and methods on one train of thought. Rather than turn your code into an arthritic mess trying to interleave multiple simple simultaneous tasks, code each task separately. Code each line block with one mind. Let the OS thread scheduler do the interleaving.

    http://marcja.wordpress.com/2007/04/...ultithreading/


    What do you understand from this?

  3. #3
    Join Date
    Feb 2008
    Posts
    966

    Re: advantage of using thread

    Are you asking yourself what you understand from that, or trying to bump your thread?

    I understand it just fine, what do you not understand about it? Asking a question like "what do you understand from this" isn't a really good question to ask.

  4. #4
    Join Date
    Apr 2007
    Posts
    425

    Re: advantage of using thread

    Quote Originally Posted by ProgramThis View Post
    Are you asking yourself what you understand from that, or trying to bump your thread?

    I understand it just fine, what do you not understand about it? Asking a question like "what do you understand from this" isn't a really good question to ask.
    Future self arguing past self.
    ------
    If you are satisfied with the responses, add to the user's rep!

  5. #5
    Join Date
    Aug 2005
    Posts
    98

    Re: advantage of using thread

    Code each line block with one mind. Let the OS thread scheduler do the interleaving.


    1-Is it the Os or is it the JVM choose which thread to run?

    2- What is the relationship between JVM and OS thread scheduler ?

  6. #6
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: advantage of using thread

    Have you tried Googling for the answers to these questions? Have you tried searching this forum for the answers (hint) ?

    They sound very much like homework assignment questions that you're expected to discover for yourself.

    I might be inclined to help if you tell me what you've discovered for yourself and explain why it isn't enough for you, or what it is you don't understand.

    The outcome of any serious research can only be to make two questions grow where only one grew before...
    T. Veblen
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  7. #7
    Join Date
    Aug 2005
    Posts
    98

    Re: advantage of using thread

    http://www.cs.umd.edu/class/fall2007...Threads-6p.pdf

    Page 4

    Scheduler is part of OS or Java Virtual Machine (JVM)

    May you explain more about mechanism of Scheduler?

  8. #8
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: advantage of using thread

    Try this.

    One can think effectively only when one is willing to endure suspense and to undergo the trouble of searching...
    J. Dewey
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

  9. #9
    Join Date
    Aug 2005
    Posts
    98

    Re: advantage of using thread

    VM to OS Thread Mapping

    The way Java threads are mapped to OS threads is up to the JVM and its use of multiple processors on a machine. Different JVMs use different strategies:

    Some JVMs use green threads, running all Java threads in one native OS thread (called n-to-one mapping). Sun's HotSpot JVMA website external to this site uses native threads, which may execute in parallel on a multi-CPU machine. On Solaris, Java threads are not bound permanently to the same native threads but are remapped by the scheduler (in an n-to-m mapping).
    1-What is thread mapping?

    2-What is native thread?What its difference with green thread?

  10. #10
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999
    Location
    UK
    Posts
    10,163

    Re: advantage of using thread

    Quote Originally Posted by Abalfazl View Post
    1-What is thread mapping?

    2-What is native thread?What its difference with green thread?
    You really need to learn how to use search engines, and think for yourself - reread what you just quoted, and think about it.

    The Internet? Is that thing still around?
    Homer Simpson
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured