|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
i have a questions that i don't quite understan and i would like some help.
Servers may be designed so that they limit the number of open connections. For example, a server may only wish to have N socket connections at any point and time. As soon as N connections are made, the server willnot except another incoming connection until an existing connection is released. how can semaphores be used by a server to limit the number of concurrent connecitons? |
|
#2
|
|||
|
|||
|
semaphores can count from 0 .... 100. When a connection is added, the sempahore is incrmented, and when a connection goes away, the semaphore is decremented.
When the semaphore value is 100, no more connections are allowed until it decrements to 99. |
|
#3
|
|||
|
|||
|
jim, i don't believe that limit of 100
on my solaris in /usr/include/limits.h i read #define _POSIX_SEM_VALUE_MAX 32767 |
|
#4
|
|||
|
|||
|
He wanted 100 connections - the limit for POSIX is 0xffff because the semaphore is a unsigned short word - 16 bits.
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > how semaphores can be used? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|