*BSD News Article 81460


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!munnari.OZ.AU!news.ecn.uoknor.edu!feed1.news.erols.com!howland.erols.net!cs.utexas.edu!newshost.convex.com!newsgate.duke.edu!news-feed-1.peachnet.edu!paperboy.wellfleet.com!news-w.ans.net!newsfeeds.ans.net!lantana.singnet.com.sg!chenab.lums.edu.pk!chenab.lums.edu.pk!not-for-mail
From: aslam@lums.edu.pk (Sohail Aslam)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: programmer friendly synchronization primitives: locks, sema's etc.
Date: 24 Oct 1996 22:42:51 +0500
Organization: Lahore University of Management Sciences (LUMS)
Lines: 32
Message-ID: <54o9qr$rcl@chenab.lums.edu.pk>
NNTP-Posting-Host: chenab.lums.edu.pk

Is there a wrapper around the shared memory extension in FreeBSD that provides
simple synchronizations primitives like spin locks, semaphores and monitors?
What I would like is a library that undergraduates can use in their O.S
projects. The SYSV shared stuff is rather unnerving. I want to able to
write simple code as follows:

 Lock lock;
 Semaphore s;
 Shared resource;

 create_processes_that_will_access_shared_resource();

 while ( !acquire_lock(lock) ) ;  // busy wait
 // we have the lock. Critical section
  do_something();
 release_lock(lock);

 // same thing with semaphores
 P(s);
 do_something_else();
 V(s);

What I have in mind is something similar to Brown University's Threads package.
This was available from Encore on their multimax systems. All the necessary
details were hidden and what the user (programmer) had a simple and clean
set of synchronization primitives.

-- 
Sohail Aslam                   
Department of Computer Science, Lahore University of Management Sciences (LUMS)
Lahore, Pakistan    tel: 92-42-572-2670   fax: 92-42-572-2591
email: aslam@lums.edu.pk