queue

What's the advantage of queues over pipes when communicating between processes?

What would be the advantage(s) (if any) of using 2 Queues over a Pipe to communicate between processes? I am planning on using the multiprocessing python module. ...

Problem with using Semaphore to protect queue

I am using following code to limit use of resources. Once in a while(after 3-4 days of successful run) I get queue empty exception or the returned object is found to be null. I am wondering if I am limiting only 5 threads to enter this Get method, how come this happens. The places where GetConnection is called, ReleaseConnection is al...

detection of communication failure when "put" in queue

I am using the multiprocessing python module with Queue for communication between processes. Some processes only send (i.e. queue.put) and I can't seem to find a way to detect when the receiving end gets terminated abruptly. Is there a way to detect if the process at the other end of the Queue gets terminated without having to get from...

Message queue system

Hi, I am in the process of writing a message queue system. My question is... Is it better to do this queue with files or in a database? If I were to choose the database, it needs to check for new jobs every second and that just seems a bit of an overhead to me? If it's files I guess you just constantly monitor the folder and execute ...

Python Thread/Queue issue..

I'm creating a threaded python script that has a collection of files that is put into a queue and then an unknown amount of threads (default is 3) to start downloading. When each of the threads complete it updates the stdout with the queue status and a percentage. All the files are being downloaded but the status information is wrong o...

A fast queue in Java

I am looking for a fast queue implementation in Java. I see that LinkedList implements the Queue interface, but it will only be as fast as a LinkedList right? Is there a way to have a queue that will be faster especially for add (I only need poll, add and check for empty). Down the line I may also need a PriorityQueue but not yet. ...

A Queue that ensure uniqueness of the elements?

Hi, I'm looking for a implementation of java.util.Queue or something in the Google collection who behave like a Queue, but also ensure that each element of the queue is unique. (all further insertion will have no effect) It's that possible, or will I have to do it by hand? For now I'm using a Queue, with a LinkedList implementation, a...

Producer/Consumer threads using a Queue

I'd like to create some sort of Producer/Consumer threading app. But I'm not sure what the best way to implement a queue between the two. So I've some up with two ideas (both of which could be entirely wrong). I would like to know which would be better and if they both suck then what would be the best way to implement the queue. It's mai...

.NET webservice - acknowledge quickly, but continue processing in background

I'm building a .NET web service that will be consumed by a vendor's application, and I'm not sure how to accomplish the following: The vendor will call my webserivce with some information, but wants an acknowledgement returned quickly, just stating that I received their info. They don't care what I do with it, and don't want acknowledg...

Get "next" row from SQL Server database and flag it in single transaction

I have a SQL Server table that I'm using as a queue, and it's being processed by a multi-threaded (and soon to be multi-server) application. I'd like a way for a process to claim the next row from the queue, flagging it as "in-process", without the possibility that multiple threads (or multiple servers) will claim the same row at the sam...

Using jQuery delay() with separate elements

I want to fake a simple animation on page load by sequentially revealing several pngs, each appearing instantly but with unique, precisely timed delay before the next one. Using the latest version of jQuery (1.4.2 at writing), which provides a delay method. My first (braindead) impulse was: $('#image1').show('fast').delay(800); $('#imag...

Help when SMTP server hangs when sending emails from Java

I use an external mail server to send SMTP mails, this server is effectively beyond my control. A couple of times recently this mail server has had issues and it's caused my Java (Struts/Spring) app to completely hang when waiting for a reply from the mail server. I'm using the Spring org.springframework.mail.javamail.JavaMailSender t...

Preventing grouping of Python socket.send data from Queue

I am currently making a network layer built that creates binary messages and then sends them to the appropriate network interface (this could be Ethernet, WiFi, Bluetooth, etc). In working on the TCP module, I'm using Python's socket module and everything works great except for when I try to send a series of messages quickly (such as a l...

[C++] Priority Queue Wrong Order

I am programming the huffman encoding. This is the beginning of my program: using namespace std; //Counting methods int *CountCharOccurence(string text) { int *charOccurrence = new int[127]; for(int i = 0; i < text.length(); i++) { charOccurrence[text[i]]++; } return charOccurrence; } void DisplayCharOccure...

Processing long-running operations from a windows service.

Edit (again): Let me simplify my problem. I have a Windows Service that exposes some WCF endpoints with methods like: int ExecuteQuery(string query) { // asynchronously execute query that may take 1 second to 20 minutes return queryId; } string GetStatus(int queryId) { // return the status of the query (# of results so far, e...

creating a list of queues

Hi, I am working on a simulation. For this simulation I need 20 nodes (static) and then each node has a queue associated with it. This queue could hold any number of values. What would be the best way to implement this in C? I was aiming at having each of the queues being a simple linked list, but how can I effectively create several qu...

What are practical applications of Queues?

What are practical applications of Queues in Computer Science. Where do we use them and why? I heard that we use them in Video Games and Computer Simulation programs, is that true? Why? Apart from these two areas what are other practical applications of Queues as a data structure? ...

Why does this python queue code process items multiple times?

The following is a testcase I created. Why does every process print the number 1 to 5 and are the numbers not divided over the processes? code: #!/usr/bin/python from subprocess import * from Queue import Queue from Queue import Empty import multiprocessing from multiprocessing import Process def main(): r = Runner() r.run()...

Deadlock in ruby code using SizedQueue

I think I'm running up against a fundamental misunderstanding on my part of how threading works in ruby and I'm hoping to get some insight. I'd like to have a simple producer and consumer. First, a producer thread that pulls lines from a file and sticks them into a SizedQueue; when those run out, stick some tokens on the end to let the...

StackOverFlowError in Java postfix calculator

---sorry i dont want my code to be here anymore until the deadline is over--- ...