04-02-2008
You could also spawn off a number of threads and have each one pull the next item off the entire range. I.E. have a "next range item" variable and a mutex that protects it.
Each thread (in a loop until all values in the range are processed) locks the mutex, take the current value, increments it, unlock the mutex, and computes on the current value. This does create a hot spot at the mutex, but if the computation takes significantly long then I don't see that being a big deal.
6 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi,
1) is logical partition the same as physical partition except that one is physical and the other is logical?
2) then it must a one to one ratio? (3 Replies)
Discussion started by: yls177
3 Replies
2. UNIX for Dummies Questions & Answers
I've created a partition with GNU Parted, how do I mount the partition?
The manual information at http://www.gnu.org/software/parted/manual/parted.html is good, but I am sure about how I mount the partition afterwards.
Thanks,
--Todd (1 Reply)
Discussion started by: jtp51
1 Replies
3. Shell Programming and Scripting
I want to print between the range two patterns if a particular pattern is present in between the two patterns. I am new to Unix. Any help would be greatly appreciated.
e.g.
Pattern1
Bombay
Calcutta
Delhi
Pattern2
Pattern1
Patna
Madras
Gwalior
Delhi
Pattern2
Pattern1... (2 Replies)
Discussion started by: joyan321
2 Replies
4. Solaris
hi all
while formatting hard disk i am getting following error.
Partition 1 ends at 266338338
It must be between 34 and 143374704.
label error: EFI Labels do not support overlapping partitions
Partition 8 overlaps partition 1.
Warning: error writing EFI.
Label failed.
I have formatted the... (2 Replies)
Discussion started by: nikhil kasar
2 Replies
5. Filesystems, Disks and Memory
Hi Experts
I would like to know different between soft partition concept and hard partition concept on solaris.
Here is little explanation between soft partition concept and hard partition concept on solaris.
Soft Partition:
1TB total space available in storage in all mapped to the OS to... (2 Replies)
Discussion started by: edydsuranta
2 Replies
6. Red Hat
Hello All,
I have a Red Hat Linux 5.9 Server installed with one hard disk & 2 Partitions created on it as follows,
/boot - Linux Partition & another is
LVM - One VG & under that 5-6 Logical volumes(var,opt,home etc).
Here my requirement is to take out 1GB of space from LVM ( Any logical... (5 Replies)
Discussion started by: gr8_usk
5 Replies
LEARN ABOUT OSF1
pthread_mutex_trylock
pthread_mutex_trylock(3) Library Functions Manual pthread_mutex_trylock(3)
NAME
pthread_mutex_trylock - Attempts to lock the specified mutex, without waiting if already locked.
LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so)
SYNOPSIS
#include <pthread.h>
int pthread_mutex_trylock(
pthread_mutex_t *mutex);
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
PARAMETERS
Mutex to be locked.
DESCRIPTION
This routine attempts to lock the mutex specified in the mutex argument. When a thread calls this routine, an attempt is made to immedi-
ately lock the mutex. If the mutex is successfully locked, this routine returns zero (0) and the calling thread becomes the mutex's current
owner. If the specified mutex is locked when a thread calls this routine, the calling thread does not wait for the mutex to become avail-
able.
The behavior of this routine is as follows: For a normal, default, or errorcheck mutex: if the mutex is locked by any thread (including the
calling thread) when this routine is called, this routine returns [EBUSY] and the calling thread does not wait to acquire the lock. For a
normal or errorcheck mutex: if the mutex is not owned, this routine returns zero (0) and the mutex becomes locked by the calling thread.
For a recursive mutex: if the mutex is owned by the calling thread, this routine returns zero (0) and the mutex lock count is incremented.
(To unlock a recursive mutex, each call to pthread_mutex_trylock(3) must be matched by a call to pthread_mutex_unlock(3).)
Use the pthread_mutexattr_settype(3) routine to set the mutex type attribute (normal, default, recursive, or errorcheck).
RETURN VALUES
If an error condition occurs, this routine returns an integer value indicating the type of error. Possible return values are as follows:
Successful completion. The mutex is already locked; therefore, it was not acquired. The value specified by mutex is not a valid mutex.
ERRORS
None
RELATED INFORMATION
Functions: pthread_mutexattr_settype(3), pthread_mutex_destroy(3), pthread_mutex_init(3), pthread_mutex_lock(3), pthread_mutex_unlock(3)
Manuals: Guide to DECthreads and Programmer's Guide
delim off
pthread_mutex_trylock(3)