multithreading.

M

mohangupta13

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
 
V

Victor Bazarov

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
 
M

Maarten Kronenburg

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.
 
G

Gianni Mariani

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.
 
J

James Kanze

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.)
 
A

Alexander Dong Back Kim

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
 
M

Maarten Kronenburg

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.
 
G

gpderetta

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:[email protected]
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 :)
 
I

Ioannis Vranos

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 is a platform-specific feature. Check the documentation
of the API you are going to use (e.g. MFC, .NET, QT, GTKMM, wxWidgets,
SDL, etc).
 
S

Szabolcs Ferenczi

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.

If you know some concepts of multi-threading from your operating
systems concepts, go ahead and apply them. Just pick up some canonical
examples, e.g. the producer-consumer problem, the dining philosophers
problem, or any other ones. Pick up Pthreads or Boost library and
adapt the examples in C/C++. Later on, you can also formulate the
algorithms in your favourite notation and hand-compile them into the
available library calls.

If you need further help, just let me know.

Best Regards,
Szabolcs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top