Number of threads waiting on a pthread mutex/rwlock


 
Thread Tools Search this Thread
Top Forums Programming Number of threads waiting on a pthread mutex/rwlock
# 1  
Old 04-19-2010
Number of threads waiting on a pthread mutex/rwlock

Using pthreads is there a way to determine how many threads are waiting on a locked resource? I mean, once a shared resource is protected using e.g. pthread_rwlock_t or pthread_mutex_t one thread grabs the lock and other threads will go to sleep waiting for the resource to be available again. Is there a way to see how many threads are waiting for a given lock?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. SuSE

Configuring Number Threads

I have this error message from the logs of Zimbra email running on SUSE 11.2 Is the thread maximum of 20 an operating system parameter, or is it part of the application code, or part of the java run time? Part two, how would I increase that number? (3 Replies)
Discussion started by: jgt
3 Replies

2. Programming

Question (pthread): How to Signal all threads w/o "broadcast"?

Hello all, Is there any way that I can signal (wake) all threads that I have created without using pthread_cond_broadcast? Cheers! Aaron (6 Replies)
Discussion started by: mobility
6 Replies

3. Shell Programming and Scripting

Waiting for an arbitrary background process (limiting number of jobs running)

Hi, I'm trying to write a script to decompress a directory full of files. The decompression commands can run in the background, so that many can run at once. But I want to limit the number running at any one time, so that I don't overload the machine. Something like this: n=0 for i in *.gz... (15 Replies)
Discussion started by: p.f.moore
15 Replies

4. Programming

pthread and mutex question

Hello, I have got some issue with the struct variable with passed arguments the variable in the sturct is only recognize the last value their assigned to I'm pretty confused why the mutex didn't work out here is my program: #include<stdio.h> #include<pthread.h> pthread_mutex_t lock... (3 Replies)
Discussion started by: michael23
3 Replies

5. Solaris

vmstat and waiting kernel threads

I am running Apache: # httpd -version Server version: Apache/1.3.26 (Unix) Server built: Jul 15 2002 03:27:01 On a V280: # uname -a SunOS bsmweb01 5.8 Generic_108528-23 sun4u sparc SUNW,Sun-Fire-280R # I am assessing the server for additional applications. I ran vmstat 10 and a... (9 Replies)
Discussion started by: jabberwocky
9 Replies

6. Solaris

Number of threads running

Is there any command to find 1) the number of threads running 2) kernel boot mode in solaris box (2 Replies)
Discussion started by: vickylife
2 Replies

7. HP-UX

Need help. Unable to create threads after a certain number

Hi, I have a process which creates pthreads to generate some reports. After creating the reports these threads return null. But after 1024 threads, the process is not able to create any threads further.,and at max 5 threads are existing simultaneously and are returning the control back after... (2 Replies)
Discussion started by: Krsh
2 Replies

8. Solaris

Maximum Number of threads suuported????

Hi, Anybody knows the maximum number of threads suuported by a process in solaris os. Please reply Thanks in advance :( (1 Reply)
Discussion started by: Agnello
1 Replies

9. Programming

Count Number Of Threads in a Process

I am trying to find out that how many number of threads are currently running or in any other state which is created by POSIX standard in a process. First I have defined a variable called proc_var of type proc defined in sys/proc.h.Next I open up the dir /proc and per directory wise I do an ioctl... (7 Replies)
Discussion started by: S.P.Prasad
7 Replies

10. Programming

Threads and Mutex

Hi all, I am working in a UNIX/C environment. I would like to understand more about MUTEX and Threads. Can someone explain me these concepts and how they are related. Vijay (2 Replies)
Discussion started by: vthasan
2 Replies
Login or Register to Ask a Question
pthread_rwlock_unlock(3)				     Library Functions Manual					  pthread_rwlock_unlock(3)

NAME
pthread_rwlock_unlock - Unlock a read-write lock. LIBRARY
DECthreads POSIX 1003.1c Library (libpthread.so) SYNOPSIS
#include <pthread.h> int pthread_rwlock_unlock( pthread_rwlock_t *rwlock); PARAMETERS
Address of the read-write lock to be unlocked. DESCRIPTION
This routine releases a lock acquisition held on the read-write lock object referenced by rwlock. Results are undefined if rwlock is not held by the calling thread. If this routine is called to release a lock for read access on rwlock and the calling thread also currently holds other locks for read access on rwlock, the read-write lock object remains in the read locked state. If this routine releases the calling thread's last lock for read access on rwlock, the calling thread is not longer one of the owners of the lock object. If this routine is called to release a lock for write access on rwlock, the lock object is put in the unlocked state with no owners. If a call to this routine results in the read-write lock object becoming unlocked and there are multiple thread waiting to acquire that lock for write access, DECthreads uses the scheduling policy of those waiting threads to determine which thread next acquires the lock object for write access. If there are multiple thread waiting to acquire the read-write lock object for read access, DECthreads uses the scheduling policy of those waiting threads to determine the order in which those threads acquire the lock for read access. If there are multiple threads waiting to acquire the read-write lock object for both read and write access, it is unspecified whether a thread waiting for read access or for write access next acquires the lock object. If the read-write lock object referenced by rwlock is not initialized, the results of calling this routine are undefined. 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 values specified by rwlock does not refer to an initialized read-write lock object. The current thread does not hold the read-write lock object. ERRORS
None RELATED INFORMATION
Functions: pthread_rwlock_init(3), pthread_rwlock_rdlock(3), pthread_rwlock_wrlock(3), pthread_rwlockattr_init(3) Manuals: Guide to DECthreads and Programmer's Guide delim off pthread_rwlock_unlock(3)