bogoserver

Fabio Fabbri fabio at llgp.org
Tue Aug 23 19:31:25 UTC 2005


martin f krafft wrote:

>also sprach Fabio Fabbri <fabio at llgp.org> [2005.08.23.1832 +0200]:
>  
>
>>>while [ ! -e/var/run/my_semaphore ]; do sleep 1; done
>>>      
>>>
>>I don't consider this a semaphore. A semaphore should avoid busy
>>waiting. Using my implementation, busy waiting is avoided, and the
>>script can go on immediately (when the task is scheduled), without the 1
>>second sleep. Exaggerating, using this kind of semaphores boot may
>>become slower...
>>    
>>
>
>What do you think the netcat process does underneath the hood?
>  
>
AFAIK, when a process uses the system call read(), the control goes to
the kernel. I don't know how the kernel handles read(), but I hope it
uses a better way than sleep(1)... maybe usleep(1) :-)




More information about the initscripts-ng-devel mailing list