Thread: Design question

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    147

    Design question

    I have to make an application and I have a doubt about its design. In the application it will be very important the performance. The application has a console input interface and a core which make calculations.

    I have now two options:

    1) Create a new thread to do calculations and so the application will have two of them: one for input/output management and other for doing the staff.

    2) Only one thread which do all, and do periodic reads to the input console.

    My doubt is about the 1). will it be more costly to the performance of the appl.? (....as it is a resource managed by s.o.) which of both is better...?

  2. #2
    Make Fortran great again
    Join Date
    Sep 2009
    Posts
    1,413
    Not really familiar with threads, but if there's to be any output back to the console interface, there's no sense in having two threads as the output will be waiting for the calculations to finish.

  3. #3
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    It depends. How much I/O are you doing? If it is just a user interactive program WHO CARES? If you are being fed bunches of data and you have to spit that data out as quickly as possible, maybe go with two (or three) threads: one to get data, one to process data, and one to output data. If you are expected to quickly process lots of data, you'll need to buffer each layer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Game design question
    By h3ro in forum Game Programming
    Replies: 6
    Last Post: 02-28-2008, 08:20 AM
  2. Question about engine design.
    By Shamino in forum Game Programming
    Replies: 9
    Last Post: 01-29-2008, 10:53 AM
  3. question about class design and overloading
    By l2u in forum C++ Programming
    Replies: 7
    Last Post: 12-13-2007, 02:02 PM
  4. database app design question
    By MPSoutine in forum Windows Programming
    Replies: 4
    Last Post: 12-02-2003, 10:13 PM
  5. design question: opinion
    By ggs in forum C Programming
    Replies: 2
    Last Post: 01-29-2003, 11:59 AM

Tags for this Thread