[comp.sys.sequent] Semaphores

andre@htsa.uucp (Andre van der Vlies) (03/01/89)

Roaming around in the directories I've found the file /usr/include/sys/mutex.h .
Some _very_ interesting routines are mentioned there. Are these routine for
public use, and if so, how are they called by. 
Could someone enlighten me please.



-- 
                    Andre v.d. Vlies
                    Algemene Hogeschool Amsterdam
                    Technische en Maritieme Faculteit
                    andre@htsa.uucp.nl or ...!hp4nl!htsa!andre

hanst@htsa.uucp (Fearfull Flambert) (03/02/89)

In article <778@htsa.uucp> andre@htsa.uucp (Andre van der Vlies) writes:
->Roaming around in the directories I've found the file /usr/include/sys/mutex.h .
->Some _very_ interesting routines are mentioned there. Are these routine for
->public use, and if so, how are they called by. 
->Could someone enlighten me please.
->

If you want to be enligtened, I can light you (auch auch) if you want !

-- 
                    Hans Trompert
                    Algemene Hogeschool Amsterdam
                    Technische en Maritieme Faculteit
                    hanst@htsa.uucp.nl or ...!mcvax!htsa!hanst

arosen@hawk.ulowell.edu (MFHorn) (03/04/89)

> Roaming around in the directories I've found the file
> /usr/include/sys/mutex.h .
> Some _very_ interesting routines are mentioned there. Are these routine
> for
> public use, and if so, how are they called by. 

I don't think you can call those routines from a user-level program.
I've seen most of the routines declared there in the kernel (being a
parallel architecture, you have to be very careful about resource
allocation; you're NOT the only process running).

Dynix does support user-level semaphores.  See /usr/include/sys/{sem,ipc}.h
and the man pages for semop, semget and semctl.

I also have a program written by Jim Pickering that was posted some time
ago which graphically (curses) illustrates the dining philosophers problem
using semaphores.

--
"The most valuable commodity that I can think of, is information."       
        -Gordon Gecko, Wall Street
--
Andy Rosen           | arosen@hawk.ulowell.edu | "I got this guitar and I
ULowell, Box #3031   | ulowell!arosen          |  learned how to make it
Lowell, Ma 01854     |                         |  talk" -Thunder Road
		RD in '88 - The way it should've been

andre@htsa.uucp (Andre van der Vlies) (03/06/89)

In article <11964@swan.ulowell.edu> arosen@hawk.ulowell.edu writes:
>> Roaming around in the directories I've found the file
>> /usr/include/sys/mutex.h .
>> Some _very_ interesting routines are mentioned there. Are these routine
>> for
>> public use, and if so, how are they called by. 
>
>I don't think you can call those routines from a user-level program.
>I've seen most of the routines declared there in the kernel (being a
>parallel architecture, you have to be very careful about resource
>allocation; you're NOT the only process running).
>
>Dynix does support user-level semaphores.  See /usr/include/sys/{sem,ipc}.h
>and the man pages for semop, semget and semctl.
>
>I also have a program written by Jim Pickering that was posted some time
>ago which graphically (curses) illustrates the dining philosophers problem
>using semaphores.

I know Dynix supports semop, semget, semctl. I find these routines very sluggish
and uncomprehensive. Besides that I often get a 'No space on device message' 
when I try to open/get a lot of semaphores. We're giving a course in parallel
programming , and the s_lock calls are a heavy burden on the system when 15
persons are trying to solve the producer-consumer problem (especially when
something goes wrong :-) ). The SYS-V (semget etc.) semaphores are slow and seem
to be not available for all the users at any one time ( one can only open a
certain number of semaphores (where does this depend on ?)). Above all, I want
to be SURE I cannot use the calls declared in /usr/include/sys/mutex.h.
I know it looks/sounds dangerous to use those routines, that's why I've posted
this question on the net.
BTW, I'm VERY interessed in Jim Pickering's program. Could you please mail it 
to me.

PS.
	I've written some user interfaces to handle semaphores, so a user can
	declare semaphores like this:

	semaphore {
		one,
		two,
		three,
		four
	};

	and handle them with initsem(one,10);
			     WAIT(one);
			     SIGNAL(one);




-- 
                    Andre v.d. Vlies
                    Algemene Hogeschool Amsterdam
                    Technische en Maritieme Faculteit
                    andre@htsa.uucp.nl or ...mcvax!hp4nl!htsa!andre