CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

View Poll Results: Do you design for Parallel Processing?

Voters
14. You may not vote on this poll
  • Yes, and I have for more than 2 years

    4 28.57%
  • Yes, and I have for more than 1 year

    1 7.14%
  • Yes, and I have for more than 6 months

    1 7.14%
  • No, but I plan to start

    4 28.57%
  • No, I dont know how

    4 28.57%
  • What is Parallel Processing

    0 0%
Page 3 of 3 FirstFirst 123
Results 31 to 39 of 39
  1. #31
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Today is the day most software turned to "garbage"...

    Quote Originally Posted by TheCPUWizard View Post
    At a strategic level (large work items, a number of worker threads) it is not a "big deal".
    Agreed, but for some reason folks still tend to have alot of problems doing it.

    I hear quite a bit about people who find mt coding too hard, or don't see the benefits over st programming.

  2. #32
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Today is the day most software turned to "garbage"...

    Quote Originally Posted by Arjay View Post
    Agreed, but for some reason folks still tend to have alot of problems doing it.

    I hear quite a bit about people who find mt coding too hard, or don't see the benefits over st programming.
    I see you "ducked" answering the questions about a specific scenario in my previous post...
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  3. #33
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Today is the day most software turned to "garbage"...

    Quote Originally Posted by TheCPUWizard View Post
    I see you "ducked" answering the questions about a specific scenario in my previous post...
    No interest in answering.

  4. #34
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Today is the day most software turned to "garbage"...

    Well I've Voted Yes (past 6 months).. My current project is using mutiple cores, however only small sections of the application does so..

    Most of the application is linear and user speed dependent. but there are pieces that are CPU slaves .. IE ..

    Once a transaction has been completed, the following steps need to be completed

    1) Store Info Via Serial on a token.
    2) Save Transaction Info in Sql DB..
    3) Print Reciept.
    4) Adjust sales stats (sql)
    5) reset for new transactiion

    Well 1 - 4 can all be done together, #5 can be done when all are complete (or more specifically when #1 is done)

    My development system has a duo core, and starting a few worker threads at this point does show a marked increase in 2nd core usage..

    At the moment this is the only muticore code that i'm using, Implimented 2 months ago..

    Gremmy..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  5. #35
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Today is the day most software turned to "garbage"...

    Each can be done at the same time, if you send each task to a different message pump, running on multiple processors as available. The print receipt queue would only process when something was ready in the queue.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #36
    Join Date
    Mar 2002
    Location
    St. Petersburg, Florida, USA
    Posts
    12,125

    Re: Today is the day most software turned to "garbage"...

    Quote Originally Posted by GremlinSA View Post
    Well I've Voted Yes (past 6 months).. My current project is using mutiple cores, however only small sections of the application does so..
    That is at least a start, but what I have been referring to is MUCH finer grained. Lets look at the sample steps you posted and see what potentials there may be.

    Important disclaimer: Since I am using Gremmy's sample some of these are "contrived" and most likely would not make sense from a practical standpoint using current common hardware (but may make sense within a few years). I am going to pretend that this work is being done on the server side and that small improvements in time would have an impact that would not exist for a client application where a human was waiting...
    Lets look at the "Store Transaction into DB" step. This involves (typically)
    [indent]
    1) Create a Command Instance
    2) Create Parameter Instances
    3) Prepare the Command (often implicitly)
    4) Create a connection (from a pool)
    5) Execute the command
    [/quote]
    What would happen if there were alreat a number of (blocked) threads which had a command object already created and waiting for parameters. Then when it comes time to execute, the thread was awakened, and in parallel established the parameters whil the connection was being "refreshed" then executed the command, returned the result,and at a lower priority "freshened" itself before blocking.

    Or the printing the reciept, where multiple threads were queued and ready to do formatting of the appropriate sections/fields...

    ---
    On a 4,8,16 core machine (all currently available) these would (potentially) provide a benefit. But more importantly by controlling the number of threads processing specific types of work, the potential for blocking on a resource can be greatly reduced.

    This approach is very much in keeping with Scott Meyers comment from the early 1990's of "Program in the Future Tense". The current approach to parallel computing seems much more to be "I dont need it now, so I will not worry about it till I do". IMPO, this will result in many software application being delivered TODAY that will not effectively make use TOMORROW's hardware without a complete system re-write.
    TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
    2008, 2009,2010
    In theory, there is no difference between theory and practice; in practice there is.

    * Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
    * How NOT to post a question here
    * Of course you read this carefully before you posted
    * Need homework help? Read this first

  7. #37
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Today is the day most software turned to "garbage"...

    CpuWiz..

    I get exactly what your saying here..

    After reading this thread i was looking at the project and found at least 7 other places where i posibly speed things up a little, by using multiple cores..

    IE... Checking contents of previous mentioned Token ...

    1) Open View Form.
    2) Reset Treeview (used to show the 7 different groups of info stored on Token.)
    3) Read info from Token
    4) Parse and Load in to Treeview.

    This could also use a pre-prep'd (blocked)thread to proccess #3, while #1 & 2 proccess in the main thread .. at which time in the main thread we wait for the token read to complete, and then do #4....

    The Pre-Prep'd thread used in #3 would acctualy get alot of work, as 90% of the project relys on reading and writing these tokens..

    Comming from a VB background, I never really worked with threading, and now with .NET a lot of doors have opened..

    Unfortunatly with the very tight schedule that i'm sitting on, i dont have enough time to play with an idea, and see it all the way through to the end...

    However i do plan to take the time when the project is done, to further study multi-coring my applications..
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  8. #38
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Today is the day most software turned to "garbage"...

    Did a project last week using Powershell 2.0 CTP.

    I had to rename a file if it existed, then copy over a 100MB+ sized file.

    Every time I ran the script, I kept getting an error on the copy line, after the rename line.

    I tried setting flags to hold it back, but it kept crashing, saying PROCESS IN US.

    I woke up the next day, after thinking about it. PS must be using threads.

    I searched the docs online, and found a -force parameter on the rename line.

    It created the lock that I was trying to code the night before, and everything worked well.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  9. #39
    Join Date
    Jul 2002
    Location
    Portsmouth. United Kingdom
    Posts
    2,727

    Re: Today is the day most software turned to "garbage"...

    My current project would be an ideal candidate for parallel processing across multiple cores. The project looks for similar objects in four areas of the image. The same code base is used for each area and therefore it should be possible to farm each one off to a core. Our spec is highly time constrained and this could be useful in extracting more processing time for each area from the system.

    Unfortunately this is not going to happen until I get the chance remove all the 'static' variables the previous coder used in the analysis code. He had the habit of never to "Program in the Future Tense".

    On the theme of synchronisation, we don't use any mutexes/critical sections in our code as this can lead to priority inversions which muck up the carefully crafted timing and thread priorities. We generally rely on a combination message passing, state machines and positional tracking (on the conveyor) to ensure non-concurrent read/writes to data.
    "It doesn't matter how beautiful your theory is, it doesn't matter how smart you are. If it doesn't agree with experiment, it's wrong."
    Richard P. Feynman

Page 3 of 3 FirstFirst 123

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