01-29-2009
Shouldn't the processes post on the semaphore when they're done? And what's so magical about ten, why can ten processes safely share it but not eleven?
semctl can tell you the last time a semop happened to something, but not who did it, or what. I don't think it 'remembers' who has 'access' beyond the normal scope of a sem either; it either suspends processes or not depending on its current value, and keeps a list or waiters to wake when posted on. Perhaps the sem's other access control features can be used to control what processes can wait on it, changing the process' group ID's and such.
Last edited by Corona688; 01-29-2009 at 12:39 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
Our Baan application has a server process bflusher which is activated automaticaly by another server process bmanager . These processes uses shared memory to carry out it's operations .
Through a baan application query command (tbase6.1 P d 3 ) , i can find the number of users (user process... (1 Reply)
Discussion started by: Hitesh Shah
1 Replies
2. Solaris
Is there a way to do this in Solaris?
For instance, suppose I run the following:
$ swap -l
swapfile dev swaplo blocks free
/dev/md/dsk/d501 85,501 16 16780208 16780208
$ swap -s
total: 3377368k bytes allocated + 519416k reserved = 3896784k used, 11011992k available... (1 Reply)
Discussion started by: lyonsd
1 Replies
3. UNIX for Advanced & Expert Users
Is there a way to monitor certain processes and if they hang too long to kill them, but certain scripts which are expected to take a long time to let them go?
Thank you
Richard (4 Replies)
Discussion started by: ukndoit
4 Replies
4. Solaris
Hi
Is there an easy way to identify and group currently running processes into OS processes and APP processes. Not all applications are installed as packages.
Any free tools or scripts to do this?
Many thanks. (2 Replies)
Discussion started by: wilsonee
2 Replies
5. Shell Programming and Scripting
Hi,
I am looking to use a semaphore for the first time in one of my scripts. I am just wondering if there are any simple examples or tutorials around?
I am a beginner so the simpler the better :)
Thanks
-Jaken (2 Replies)
Discussion started by: Jaken
2 Replies
6. Shell Programming and Scripting
A file named abc.txt being updated with date value by one process.
Say , today it s updating the file with value
01-09-2009
Fine. Tomorrow the process will override the file with tomorrow date (02-09-2009) .Insome case the process will overriding the file with empty string.
So I... (1 Reply)
Discussion started by: Gopal_Engg
1 Replies
7. Programming
In my server code there is a thread per client...
The server call accept() and after that start the thread.
So there is a thread for client that save in RAM the client's message, that will be send to other clients.
Now in RAM I have created a shared memory in which thread read and write(save)... (2 Replies)
Discussion started by: italian_boy
2 Replies
8. Shell Programming and Scripting
Hi,
Can any one tell me is their any "hold buffer" in perl similar to sed.
I have to find a pattern, once that pattern found then need to go backward and find another pattern and print.
Example:
Below are the contents present in a file
##
block
IPs
URLs
URL_IPs
Unblock
URLs
... (4 Replies)
Discussion started by: Anjan1
4 Replies
9. Shell Programming and Scripting
In end of https://www.unix.com/shell-programming-scripting/103227-while-read-loop-scope-variables-shell.html
mjd_tech gives script which can read some values directly without manually input, but if no value is the right one, my understand is, it will on hold for waiting the next input, but when I... (7 Replies)
Discussion started by: newoz
7 Replies
10. Shell Programming and Scripting
Hi Experts,
i have a file like below
****
table name is xyz
row count for previous day 10
row count for today 20
diff between previous and today 10
scan result PASSED
****
table name is abc
row count for previous day 90
row count for today 35
diff between previous and today 55... (4 Replies)
Discussion started by: Lakshman_Gupta
4 Replies
LEARN ABOUT HPUX
sem_init
sem_init(2) System Calls Manual sem_init(2)
NAME
sem_init - initialize an unnamed POSIX semaphore
SYNOPSIS
DESCRIPTION
is used to initialize an unnamed semaphore. A successful call to will create a new unnamed semaphore referred to by sem, if one does not
exist, initialize the unnamed semaphore descriptor, referred to by sem, to the non-negative value specified by value. If the unnamed sema-
phore already exists, i.e. created by a previous call to it is re-initialized only if its current value is equal to its initial value (set
by the last successful call to If so, the initial value of the unnamed semaphore is re-initialized to the value argument. Otherwise, the
call fails.
The argument pshared specifies if the unnamed semaphore is sharable with other processes. If pshared is equal to 0, the unnamed semaphore
is not shared with other processes. If pshared is non-zero, the unnamed semaphore is sharable with any processes that can access sem. The
access mode specified for the unnamed semaphore allows read and write permissions to all processes. If the calling process may attach to
the shared structure, it is assumed it may operate on the semaphore.
To use this function, link in the realtime library by specifying on the compiler or linker command line.
EXAMPLES
The following call to will create a new unnamed semaphore referred to by sem, if one does not exist, initialize the unnamed semaphore
descriptor, referred to by sem, to the non-negative value specified by value.
RETURN VALUE
If the semaphore was created and initialized, returns 0 to the caller.
If the semaphore could not be created/initialized, the call returns -1 and sets to indicate the error.
ERRORS
fails and does not perform the requested operation if any of the following conditions are encountered:
[EPERM] The calling process does not have the privileges necessary to initialize the semaphore.
[EBUSY] There are threads currently blocked on the semaphore or there are outstanding locks held on the semaphore.
[EINVAL] The argument value is greater than
[ENOSPC] There are insufficient resources to perform the operation or the upper limit on the number of semaphores is reached.
SEE ALSO
sem_destroy(2), sem_post(2), sem_trywait(2), sem_wait(2), <semaphore.h>.
STANDARDS CONFORMANCE
sem_init(2)