Design question

This is a discussion on Design question within the C Programming forums, part of the General Programming Boards category; I have to make an application and I have a doubt about its design. In the application it will be ...

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

    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
    Epy
    Epy is offline
    Fortran lover Epy's Avatar
    Join Date
    Sep 2009
    Location
    California, USA
    Posts
    949
    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, 07:20 AM
  2. Question about engine design.
    By Shamino in forum Game Programming
    Replies: 9
    Last Post: 01-29-2008, 09:53 AM
  3. question about class design and overloading
    By l2u in forum C++ Programming
    Replies: 7
    Last Post: 12-13-2007, 01:02 PM
  4. database app design question
    By MPSoutine in forum Windows Programming
    Replies: 4
    Last Post: 12-02-2003, 09:13 PM
  5. design question: opinion
    By ggs in forum C Programming
    Replies: 2
    Last Post: 01-29-2003, 10:59 AM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21