Implementing a Queue in a process

Abigail abigail at abigail.be
Tue Nov 22 07:23:41 GMT 2011


On Tue, Nov 22, 2011 at 03:16:13PM +0800, Shantanu Bhadoria wrote:
> Hey people,
> Here is a interesting problem that I am facing right now. I need to
> implement a process(in perl) that would sit and wait for someone to push
> tasks into its queue, each task consists of a set of information in its
> data structure w.r.t the task details.
> Now I need to figure out two things:
> 
> 
>    - How to implement this queue in a perl process. (remote shared
>    Database:mysql?, internal data structure, local SQLite?)
>    - How do I push new tasks into this queue ( i.e. interprocess
>    communication, Simpler(uglier) for a shared database, but I would prefer a
>    process like that to sit in isolation and accept requests and manage them
>    on its own so whats the ideal inter-process communication format for
>    it?named pipes?).
> 
> 
> I would really love to know your opinions on the best way to do it. The
> straightforward but ugly way to do this would probably be putting tasks
> into a database and have the other process ping the database for new tasks
> in queue every second. But I believe there has gotta be a better way to do
> it and what better place to figure it out then ask you folks. :)
> So what do you guys think is the best implementation for such a requirement?


My first idea is "named piped", but the devil is in the details. There's
way too little information in this post to even have an inkling of a
suggestion for "the best" implementation.

You don't even write which "best" you are looking for.



Abigail


More information about the london.pm mailing list