Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > multithreading.

Reply
Thread Tools

multithreading.

 
 
mohangupta13@gmail.com
Guest
Posts: n/a
 
      03-26-2008
hello everyone,
i want to use multithreading in c++,i have no previous experience of
implementing multithreading but from my operating system concepts i
know few concepts of multithreading .
can anyone please guide me how and were to begin from.
all help is apprecitated.
thank you
mohan gupta
 
Reply With Quote
 
 
 
 
Victor Bazarov
Guest
Posts: n/a
 
      03-26-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> i want to use multithreading in c++,i have no previous experience of
> implementing multithreading but from my operating system concepts i
> know few concepts of multithreading .
> can anyone please guide me how and were to begin from.


Begin with a good book. I recall that "Java Thread Programming" by
Paul Hyde gave me the needed push (never mind that it's for Java,
the principles are the same). I am sure that nowadays you can find
many a book on multithreading. Ask in 'comp.programming.threads'.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


 
Reply With Quote
 
 
 
 
Maarten Kronenburg
Guest
Posts: n/a
 
      03-26-2008

wrote in message
> hello everyone,
> i want to use multithreading in c++,i have no previous experience of
> implementing multithreading but from my operating system concepts i
> know few concepts of multithreading .
> can anyone please guide me how and were to begin from.
> all help is apprecitated.
> thank you
> mohan gupta


The book "Cross-Platform Development in C++" by Syd Logan has a section on
threads, where Win32 threads, pthreads and NSPR threads are introduced.


 
Reply With Quote
 
Juha Nieminen
Guest
Posts: n/a
 
      03-26-2008
(E-Mail Removed) wrote:
> i want to use multithreading in c++,i have no previous experience of
> implementing multithreading but from my operating system concepts i
> know few concepts of multithreading .
> can anyone please guide me how and were to begin from.
> all help is apprecitated.


http://bisqwit.iki.fi/story/howto/openmp/
 
Reply With Quote
 
Gianni Mariani
Guest
Posts: n/a
 
      03-26-2008
(E-Mail Removed) wrote:
> hello everyone,
> i want to use multithreading in c++,i have no previous experience of
> implementing multithreading but from my operating system concepts i
> know few concepts of multithreading .
> can anyone please guide me how and were to begin from.
> all help is apprecitated.
> thank you
> mohan gupta


Multithreading concepts can get very involved. Probably best to start
with a good book.

There are good cross platform C++ threading libraries though so try not
to use OS specific threading constructs, it will make your life much easier.
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      03-27-2008
On Mar 26, 8:28 pm, "Victor Bazarov" <(E-Mail Removed)> wrote:
> (E-Mail Removed) wrote:
> > i want to use multithreading in c++,i have no previous experience of
> > implementing multithreading but from my operating system concepts i
> > know few concepts of multithreading .
> > can anyone please guide me how and were to begin from.


> Begin with a good book. I recall that "Java Thread
> Programming" by Paul Hyde gave me the needed push (never mind
> that it's for Java, the principles are the same). I am sure
> that nowadays you can find many a book on multithreading. Ask
> in 'comp.programming.threads'.


Along the same lines, the Butendorf is an excellent introductory
text: even though it is for C and Posix, almost everything in it
holds for C++, and an awful lot holds for Windows as well.
(Obviously, not the API names, but all of the considerations as
to when you need to lock, etc.)

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
Alexander Dong Back Kim
Guest
Posts: n/a
 
      03-27-2008
On Mar 27, 6:24*am, (E-Mail Removed) wrote:
> hello everyone,
> i want to use multithreading in c++,i have no previous experience of
> implementing multithreading but from my operating system concepts i
> know few concepts of multithreading .
> can anyone please guide me how and were to begin from.
> all help is apprecitated.
> thank you
> mohan gupta


Hi Mohan,

As long as you know the concept of multithreading, then I would say
you are ready to write multithreading codes. Multithreading codes are
not that difficult as people think. Multithreading programming is, in
my opinion, a great fun to do allowing you to taste a bit of
programming.

However, there are a number of things you should know before you
start. First of all, when C++ was born, multithreading wasn't really
expected to be happened in programming world. In other words,
Multithreading is not supposed to be used in C++ world. BUT! don't
take this serisouly there are so many ways that you can deal with C++
multithreading programming. Second of all, according to some article(I
can't remember which one was...), when you design a multithreading
module, you should be extra careful about what you are really trying
to do. BUT! still just do fail few times and you will learn!!! so
don't give up =)

If you have bit of knowledge about algorithms, O-O concept and generic
programming, then I recommend you to look up a open source library C++
BOOST. Boost allows you to create multithreaded application so easily
and safely.

regards,
Alex D. B. Kim
 
Reply With Quote
 
Maarten Kronenburg
Guest
Posts: n/a
 
      03-27-2008

<> wrote in message
> hello everyone,
> i want to use multithreading in c++,i have no previous experience of
> implementing multithreading but from my operating system concepts i
> know few concepts of multithreading .
> can anyone please guide me how and were to begin from.
> all help is apprecitated.
> thank you
> mohan gupta


Multithreading has in my opinion two ways of applying C++ virtual functions:
(1) the thread caller function (e.g. in win32):
DWORD CALLBACK thread_call( void * arg )
{ base_thread * p = (base_thread *)arg;
( *p )();
}
where class base_thread has a pure virtual operator()():
virtual operator()() = 0;
and derive the different thread call classes from base_thread,
implementing different operator()(),
(2) the multi-threading class:
class multi_thread
{ base_thread * * the_threads;
public:
multi_thread( unsigned int );
~multi_thread();
void set_thread( unsigned int, base_thread * );
virtual void start_threads() = 0;
virtual void wait_threads() = 0;
virtual void close_threads() = 0;
}
multi_thread::multi_thread( unsigned int n )
{ the_threads = new base_thread * [ n ];
} etc.
and derive the different win32/pthread etc. implementations.
This way C++ runtime polymorphism is set to work in multithreading.
Maarten.


 
Reply With Quote
 
gpderetta
Guest
Posts: n/a
 
      03-27-2008
On Mar 27, 9:50 am, James Kanze <(E-Mail Removed)> wrote:
> On Mar 26, 8:28 pm, "Victor Bazarov" <(E-Mail Removed)> wrote:
>
> > (E-Mail Removed) wrote:
> > > i want to use multithreading in c++,i have no previous experience of
> > > implementing multithreading but from my operating system concepts i
> > > know few concepts of multithreading .
> > > can anyone please guide me how and were to begin from.

> > Begin with a good book. I recall that "Java Thread
> > Programming" by Paul Hyde gave me the needed push (never mind
> > that it's for Java, the principles are the same). I am sure
> > that nowadays you can find many a book on multithreading. Ask
> > in 'comp.programming.threads'.

>
> Along the same lines, the Butendorf is an excellent introductory
> text: even though it is for C and Posix, almost everything in it
> holds for C++, and an awful lot holds for Windows as well.
> (Obviously, not the API names, but all of the considerations as
> to when you need to lock, etc.)
>
> --
> James Kanze (GABI Software) email:(E-Mail Removed)
> Conseils en informatique orientée objet/
> Beratung in objektorientierter Datenverarbeitung
> 9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34


Just to clarify, I think you meant _Butenhof_ book 'Programming with
POSIX threads'.

Googling 'Butendorf thread' returns nothing

--
gpd
 
Reply With Quote
 
James Kanze
Guest
Posts: n/a
 
      03-28-2008
On Mar 27, 11:49 pm, gpderetta <(E-Mail Removed)> wrote:
> On Mar 27, 9:50 am, James Kanze <(E-Mail Removed)> wrote:
> > On Mar 26, 8:28 pm, "Victor Bazarov" <(E-Mail Removed)> wrote:


> > > (E-Mail Removed) wrote:
> > > > i want to use multithreading in c++,i have no previous experience of
> > > > implementing multithreading but from my operating system concepts i
> > > > know few concepts of multithreading .
> > > > can anyone please guide me how and were to begin from.
> > > Begin with a good book. I recall that "Java Thread
> > > Programming" by Paul Hyde gave me the needed push (never mind
> > > that it's for Java, the principles are the same). I am sure
> > > that nowadays you can find many a book on multithreading. Ask
> > > in 'comp.programming.threads'.


> > Along the same lines, the Butendorf is an excellent introductory
> > text: even though it is for C and Posix, almost everything in it
> > holds for C++, and an awful lot holds for Windows as well.
> > (Obviously, not the API names, but all of the considerations as
> > to when you need to lock, etc.)


> Just to clarify, I think you meant _Butenhof_ book
> 'Programming with POSIX threads'.


Yes. That's what comes of typing too quickly.

--
James Kanze (GABI Software) email:(E-Mail Removed)
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments