Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!hp4nl!htsa!andre From: andre@htsa.uucp (Andre van der Vlies) Newsgroups: comp.sys.sequent Subject: Re: Semaphores Keywords: mutex.h Message-ID: <792@htsa.uucp> Date: 6 Mar 89 11:37:44 GMT References: <778@htsa.uucp> <11964@swan.ulowell.edu> Reply-To: andre@htsa.UUCP (Andre van der Vlies) Organization: AHA-TMF (Technical Institute), Amsterdam Netherlands Lines: 56 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