Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: tlug: Multithreading, how to learn?
- To: tlug@example.com
- Subject: Re: tlug: Multithreading, how to learn?
- From: Hernando TANAKA <ktanaka@example.com>
- Date: Wed, 20 Jan 1999 15:42:07 -0700
- Content-Type: text/plain; charset=US-ASCII
- In-Reply-To: In your message of "Wed, 20 Jan 1999 21:41:39 +0100"<199901202041.VAA03247@example.com>
- References: <199901202041.VAA03247@example.com>
- Reply-To: tlug@example.com
- Sender: owner-tlug@example.com
- User-Agent: Wanderlust/0.9.2 (Addicted To Love) SEMI/1.12.0 (Nishi-Kanazawa) FLIM/1.12.1 (Nishinoky) Emacs/20.3 (i386-pc-linux-gnu) MULE/4.0 (HANANOEN)
At Wed, 20 Jan 1999 21:41:39 +0100, mike.fabian@example.com wrote: > What is a multithreaded C or C++ program, You need to know what multithread is? Thread is kinda "light-weight" process. Instead of creating a new process by fork(), you create a new "thread" by something like pthread_create(). The cost of creating a new thread is much lower than creating a new process, and it's way much easier to share data between thread than between processes. It's often used to have multiple execution points in the program, having several tasks running concurrently. > for what purposes is multithreading needed There are mainly two purposes for using multithread programing; 1. To make the program run faster. 2. To prevent the program to hang while doing some time-consuming calculation or operation. The first one is usually meaningful only if you have multi-CPUs and your OS supports multithreads running on different CPUs, AND your task is very heavy or time-consuming. The second one is perhaps the top most reason to use multithread. You can have the program calculate, say, the julian set, while enabling the user to interact with the GUI. > how does one write a multithreaded C or C++ program? I use pthread (POSIX-thead) library. Actually it comes with RedHat Linux. I'm sure they are also available for many other linux distributions. I think pthread was embeded in the new glibc2, but not sure. There're several books you can find about multithreading in any bookstore. I used "Multithreaded Programming with Pthreads," Sun Microsystems Press, A Prentice Hall Title, Bil Lewis and Daniel J. Berg, ISBN 0-13-680729-1. Covers not only pthread, but also OS/2, Windows, and Solaris. --- Kenichiro TANAKA ------------------------------------------------------------------- Next Technical Meeting: February 13 (Sat), 12:30 place: Temple Univ. ** presentation: XEmacs, by Steven Baur and Martin Buchholz Next Nomikai: March 19 (Fri), 19:30 Tengu TokyoEkiMae 03-3275-3691 ------------------------------------------------------------------- more info: http://tlug.linux.or.jp Sponsor: PHT
- Follow-Ups:
- Re: tlug: Multithreading, how to learn?
- From: Scott Stone <sstone@example.com>
- Re: tlug: Multithreading, how to learn?
- From: <mike.fabian@example.com>
- References:
- tlug: Multithreading, how to learn?
- From: <mike.fabian@example.com>
Home | Main Index | Thread Index
- Prev by Date: tlug: Multithreading, how to learn?
- Next by Date: Re: tlug: Multithreading, how to learn?
- Prev by thread: tlug: Multithreading, how to learn?
- Next by thread: Re: tlug: Multithreading, how to learn?
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links