![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Threads and Threads Count ? | varungupta | UNIX for Advanced & Expert Users | 2 | 03-21-2008 06:23 PM |
| threads | vijlak | SUN Solaris | 3 | 01-29-2007 04:55 PM |
| threads | Gerry405 | UNIX for Dummies Questions & Answers | 2 | 06-29-2005 12:30 AM |
| old threads | norsk hedensk | Post Here to Contact Site Administrators and Moderators | 2 | 06-03-2003 02:16 PM |
| nfs threads | i2admin | UNIX for Advanced & Expert Users | 1 | 03-06-2003 08:28 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How many threads do I use ?
Hi,
I have a program that has two types of threads: 1) Reader threads 2) Worker Threads Readers: Their only job is to read files. They just read data from the files and put them into a buffer. They are obviously I/O intensive. Workers: These are CPU intensive. They do some computation on the data which has been put into these buffers. How many threads: 1) Worker: I think this answer is obvious. The number of worker threads should be equal to the number of CPUs in the sytem. 2) Reader: What about these? How can I determine the capability of I/O system ? Specifically, I want the user to be able to specify the number of Reader and Worker threads the would like the program to use. QUESTION: What guidelines should the user follow or use to determing this number ? How can they determine the capabilities of the I/O subsystem? (The program uses 1 reader and 4 worker threads by default) |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
I guess the best way would be to include some sort of short benchmark testing ability in your program: the user tweaks the number of threads, chooses to benchmark, then the program tries for say 30 seconds to do as much work as possible, then outputs how many work units each type of thread got through?
I guess the number of workers would be platform specific, so for example, on Linux 2.6 you probably want nCPUs+1, whereas on Solaris10 on a T2000 you only want nCPUs worth of workers. For readers, you probably don't want a hard disk to be in contention between 2 threads, but having a channel (SCSI or ATA) shared is probably a good move - to ensure that channel is saturated. So i guess readers boils down to the number of hard disk spindles you'll be touching. Cheers, -c p.s. i tried to find some material that backs up my assertion you want nCPUs+1 worker threads on Linux2.6 (i heard this somewhere before), but i couldn't find any, so maybe i'm wrong there? Anyone else know? |
|
#3
|
|||
|
|||
|
Quote:
If they are reading from files, do the files have to be read in parallel? |
|
#4
|
|||
|
|||
|
Thanks for the replies !
Not necessarily. They just have to read the files into a buffer. |
|
#5
|
|||
|
|||
|
Hey, I have another question. Lets say I start this program on one machine. Then while it is running, I open up another console, log into the same machine and run the same program. Now there are two programs running. So now these two processes will compete against each other for the system resources right. So, obviously the program will take more time to complete. Am I right ? In general, as system load increases.. more users log onto the same system and start their own programs, the time taken by my program will increase right ?
|
|
#6
|
|||
|
|||
|
Yes, no and maybe but not necessarily in that order
1. You can adjust processes priority with nice. 2. A multi-user system shares it's resources, that's what they do. 3. Different architectures scale differently, some linearly, some exponentially. 4. A multiple CPU machine will exhibit different characteristics to a single CPU system. |
|||
| Google The UNIX and Linux Forums |