|
Deekay



Registered: 09/07/08
Posts: 3,220
Loc:
Last seen: 2 years, 5 months
|
Multi threaded programs
#14209295 - 03/30/11 12:23 PM (12 years, 9 months ago) |
|
|
Threading - implement before - or after?
|
Seuss
Error: divide byzero



Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 21 days
|
Re: Multi threaded programs [Re: Deekay]
#14210527 - 03/30/11 04:37 PM (12 years, 9 months ago) |
|
|
If you are going to thread a program, then it should be part of the design from the beginning.
-------------------- Just another spore in the wind.
|
CosmicJoke
happy mutant



Registered: 04/05/00
Posts: 10,848
Loc: Portland, OR
|
Re: Multi threaded programs [Re: Deekay]
#14211178 - 03/30/11 06:32 PM (12 years, 9 months ago) |
|
|
in apps that i've seen it implemented into via patch, the performance gains have been minimal at best... probably best to start ground up.
-------------------- Everything is better than it was the last time. I'm good. If we could look into each others hearts, and understand the unique challenges each of us faces, I think we would treat each other much more gently, with more love, patience, tolerance, and care. It takes a lot of courage to go out there and radiate your essence. I know you scared, you should ask us if we scared too. If you was there, and we just knew you cared too.
|
Deekay



Registered: 09/07/08
Posts: 3,220
Loc:
Last seen: 2 years, 5 months
|
Re: Multi threaded programs [Re: CosmicJoke]
#14212380 - 03/30/11 10:22 PM (12 years, 9 months ago) |
|
|
I'll let you know how it goes
|
Seuss
Error: divide byzero



Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 21 days
|
Re: Multi threaded programs [Re: Deekay]
#14212867 - 03/31/11 12:43 AM (12 years, 9 months ago) |
|
|
> I'll let you know how it goes
Unless you have a very good reason to thread a program, I wouldn't bother. In most cases (traditional pthreads), threading is very difficult to do and next to impossible to debug. Apple's introduction of GCD and blocks, along with language support in objective-C, have made threading much easier in both respects, but it still not a task to be taken lightly.
-------------------- Just another spore in the wind.
|
Deekay



Registered: 09/07/08
Posts: 3,220
Loc:
Last seen: 2 years, 5 months
|
Re: Multi threaded programs [Re: Seuss]
#14214114 - 03/31/11 10:22 AM (12 years, 9 months ago) |
|
|
Quote:
Seuss said: > I'll let you know how it goes
Unless you have a very good reason to thread a program, I wouldn't bother. In most cases (traditional pthreads), threading is very difficult to do and next to impossible to debug. Apple's introduction of GCD and blocks, along with language support in objective-C, have made threading much easier in both respects, but it still not a task to be taken lightly.
I don't have much choice in the matter and, I'll be using pthreads.
x2
|
Seuss
Error: divide byzero



Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 21 days
|
Re: Multi threaded programs [Re: Deekay]
#14219004 - 04/01/11 04:30 AM (12 years, 9 months ago) |
|
|
Have fun! 
Deadlocks and raceconditions are nasty to find, mainly because it is difficult to reproduce the problem in a controlled manner. Be certain that your design is correct before you start.
-------------------- Just another spore in the wind.
|
Chespirito
Stranger



Registered: 02/13/09
Posts: 3,259
|
Re: Multi threaded programs [Re: Seuss]
#14219404 - 04/01/11 07:40 AM (12 years, 9 months ago) |
|
|
Thats for sure, I've only dealt with that once back in undergrad. The Class was Operating Systems and it was a beast
|
Seuss
Error: divide byzero



Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 21 days
|
Re: Multi threaded programs [Re: Chespirito]
#14219429 - 04/01/11 07:50 AM (12 years, 9 months ago) |
|
|
> Thats for sure, I've only dealt with that once back in undergrad.
I've done quite a bit of threaded programming, but it isn't something that I enjoy. You really have to pay attention to detail. For example, it is really easy to forget to release a mutex on an error condition or in a block of code that prematurely returns from a function. Although I hate goto statements, I find myself using them a lot in threaded code to jump to a common exit point in order to avoid mutex unlock issues: Code:
function abc() { get_mutex(); if (some condition) do something; else goto done; // rather than a simple return do some more stuff;
done: release_mutex(); return; }
-------------------- Just another spore in the wind.
|
Deekay



Registered: 09/07/08
Posts: 3,220
Loc:
Last seen: 2 years, 5 months
|
Re: Multi threaded programs [Re: Seuss]
#14273019 - 04/11/11 03:31 PM (12 years, 9 months ago) |
|
|
Quote:
Seuss said: If you are going to thread a program, then it should be part of the design from the beginning.
Tell that to my professor 
I'm taking an incomplete in the course as of now
|
Seuss
Error: divide byzero



Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 2 months, 21 days
|
Re: Multi threaded programs [Re: Deekay]
#14274528 - 04/11/11 07:56 PM (12 years, 9 months ago) |
|
|
Unfortunately, I found that most academic computer science professors have a very limited understanding of real life programming. Threading sounds like a really neat concept until you sit down and actually do it, much the way that pulling out a tooth sounds like a really good way to get rid of a toothache until you actually try it. Granted, computer science is much more than simply programming, but that does not forgive the comp sci academics for having nothing beyond a theoretical understanding of programming.
> I'm taking an incomplete in the course as of now
Been there, done that. Just don't let it sit too long as an incomplete, or it will come back to bite you.
-------------------- Just another spore in the wind.
|
|