Re: Inter process Semaphore possible?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Vishal Doshi (Vishal.Doshi_at_ntlworld.com)
Date: 07/27/04


Date: Tue, 27 Jul 2004 14:04:41 GMT


"Jack" <not@home.com> wrote in message
news:41064d6e$0$6448$cc9e4d1f@news-text.dial.pipex.com...
> Hi,
>
> I have several processes each with several threads potetially querying an
> on-line server.
>
> I ish to be able to limit the number of concurrent requests to the server.
>
> Clearly, within a process I can implement some form of semaphore to limit
> the requests per process, but how can I limit the total number of
concurrent
> requests across all processes?
>
> Is an "inter-process semaphore" possible in some way, perhaps through
shared
> memory?
>

Semaphores are named kernel objects. They can be used by many processes at
the same time.

Process A:
HANDLE hSem = CreateSemaphore(..., "Global\\TEST_SEMAPHORE");

Process B:
HANDLE hSem = CreateSemaphore(..., "Global\\TEST_SEMAPHORE");

Both Process A and Process B now have a handle to the same semaphore. Use a
GUID for the name if you want to be relatively sure that no other kernel
object has the same name.

You can hardcode the name in each process, use a shared header file, or
create a DLL which can be loaded into each process.

Vishal.



Relevant Pages

  • Re: What doesnt lend itself to OO?
    ... > system design within that context seriously). ... >>The first line exists in the server. ... > objects between client and server i.e. as far as the client code is ... the message data packet data in the server between requests, ...
    (comp.object)
  • Re: Client Server and Throttling
    ... Kernel paged pool is limited by the reserved area of address space, ... resources are allocated for the requests. ... When outlook PST files are located on a ... the server may run out of paged pool, ...
    (microsoft.public.vc.mfc)
  • Re: [patch 00/13] Syslets, "Threadlets", generic AIO support, v3
    ... I have an embedded server I ... I/O, audio, and child processes that handle VoIP signaling protocols ... want to throttle the concurrency of requests at the kernel level *for ...
    (Linux-Kernel)
  • Re: HttpListener BeginGetContext does not seem to handle more than 2 request simultaneously
    ... my server ran just fine and seemed to ... be aceepting/processing multiple requests simultaneously. ... System.OutOfMemoryException: Exception of type ... K> PR2 2 ...
    (microsoft.public.dotnet.framework)
  • httpd.conf apcahe2 how to make php5 module work ?
    ... # Based upon the NCSA server configuration files originally by Rob McCool. ... # configuration directives that give the server its instructions. ... Directives that control the operation of the Apache server process as a ... which allow Web requests to be sent to ...
    (freebsd-questions)