From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,ccba21c3a09cd1b8 X-Google-Attributes: gidf678f,public X-Google-Thread: fee84,ccba21c3a09cd1b8 X-Google-Attributes: gidfee84,public From: curts@compgen.com (Curt Smith) Subject: Re: Speed comparison of Posix named and SysV semaphore operations Date: 1996/04/22 Message-ID: <4lg1j3$sns@nntp.atlanta.com>#1/1 X-Deja-AN: 150791621 references: <4ktur4$r5f@news.internetmci.com> cc: dyuan@win20.rch.mci.com followup-to: comp.unix.osf.osf1,comp.unix.osf.misc organization: Internet Atlanta newsgroups: comp.unix.osf.osf1,comp.unix.osf.misc David Yuan (dyuan@win20.rch.mci.com) wrote: : hi, : : I am using an Alphaserver 2100 4/275 which has 1 gb memory, : 1 21064 CPU. OS is Digital UNIX v3.2c. I found that P1003.1b : named semaphore operations (sem_create, sem_wait, sem_post) are : faster than System V implementation (semget,semop). The following : is the result of pure semaphore acquire and release operations : (at test time, the system load is very low, actually, only myself : was using the machine): : : iterations Posix Sys V : 1000000 3.544193 18.788549 # normal process : 1000000 3.867264 18.703296 # change priority to max priority If your multi-task application will have few lock collisions or you don't need the counting part of semaphores, then why not use spin locks on shared mem between all tasks? DEC Has a nice wrapper for test and set: _msem_tas(), and when combined with, memory barrier, mb(), makes for very fast SMP, multi-task binary lock. Curt Smith curts@compgen.com