queue

How to find the processor queue length in linux

Trying to determine the Processor Queue Length (the number of processes that ready to run but currently aren't) on a linux machine. There is a WMI call in Windows for this metric, but not knowing much about linux I'm trying to mine /proc and 'top' for the information. Is there a way to determine the queue length for the cpu? Edit to add...

Connecting http request/response model with asynchronous queue

What's a good way to connect the synchronous http request/response model with an asynchronous queue based model? When the user's HTTP request comes it generates a work request that goes onto a queue (beanstalkd in this case). One of the workers picks up the request, does the work, and prepares a response. The queue model is not request...

C# thread pool limiting threads

Alright...I've given the site a fair search and have read over many posts about this topic. I found this question: http://stackoverflow.com/questions/435668/code-for-a-simple-thread-pool-in-c especially helpful. However, as it always seems, what I need varies slightly. I have looked over the MSDN example and adapted it to my needs some...

A priority queue which allows efficient priority update?

UPDATE: Here's my implementation of Hashed Timing Wheels. Please let me know if you have an idea to improve the performance and concurrency. (20-Jan-2009) // Sample usage: public static void main(String[] args) throws Exception { Timer timer = new HashedWheelTimer(); for (int i = 0; i < 100000; i ++) { timer.newTimeout(...

Working out the SQL to query a priority queue table

I am implementing a small queue to handle which process gets to run first. I am using a table in a database to do this. Here is the structure of the table (I'm mocking it up in SQLite): "id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL , "identifier" VARCHAR NOT NULL , "priority_number" INTEGER DEFAULT 15, ...

VB.NET Queue constructor Error: Queue grow factor must be between 1 and 10.

First some background: VB.NET 2005 Application that accesses a MS-SQL back-end, using multiple Web Services for data gathering/publishing. On to the error: Our application mysteriously crashes on one of our clients computers, it works fine on the other computers in their office, but not on the big whigs' computer, which now makes it my...

Why in C# is Queue scrambling the data in its elements?

I am completely perplexed with how my Queue is function. I am attempting (and failing) to write a small multi-threaded application to collect and display data in C#. After reading through Albahari's book and using the Consumer/Producer pattern he describes I got most of it to work except my data seems to get scrambled in the queue. B...

Creating a FIFO queue in C

Is it possible to create a FIFO 'stack' in C without using 2 stacks? Thanks! (Sorry to those who answered the previous one. I was thinking LIFO and meaning FIFO.) ...

jQuery animation queues across multiple elements

This question is similar to this one about animation queues, but the answers in that thread are very specific and not easily generalised. In my web application, messages are reported back to the user (info boxes, errors & warnings, etc) by outputting a div with class="alert" eg: <div class="alert">Login successful</div> <div class="ale...

Whats the best way to process an asynchronous queue continously in Java?

I'm having a hard time figuring out how to architect the final piece of my system. Currently I'm running a Tomcat server that has a servlet that responds to client requests. Each request in turn adds a processing message to an asynchronous queue (I'll probably be using JMS via Spring or more likely Amazon SQS). The sequence of events is...

C# Queue or ServiceBus with no dependencies?

Is there a product (ideally open source, but not necessary), that would enable a zero dependency deployment? every service bus or queue library I've been able to find has a dependency on one of the queue apps (like msmq), or a database. I would like a very lightweight solution that I can just add a reference to my application, build it...

Ensure uniform (ish) distribution with random number generation

I have a list of objects and I would like to access the objects in a random order continuously. I was wondering if there was a way of ensuring that the random value were not always similar. Example. My list is a list of Queues, and I am trying to interleave the values to produce a real-world scenario for testing. I don't particularly...

Queuing systems - what is a good way to start up multiple workers?

How have you set-up one or more worker scripts for queue-oriented systems? How do you arrange to startup - and restart if necessary - worker scripts as required? (I'm thinking about such tools as init.d/, Ruby-based 'god', DJB's Daemontools, etc, etc) I'm developing an asynchronous queue/worker system, in this case using PHP & Beansta...

Creating a blocking Queue<T> in .NET?

I have a scenario where I have multiple threads adding to a queue and multiple threads reading from the same queue. If the queue reaches a specific size all threads that are filling the queue will be blocked on add until an item is removed from the queue. The solution below is what I am using right now and my question is: How can this b...

c# Adding a Remove(int index) method to the .NET Queue class

I would like to use the generic queue class as described in the .NET framework (3.5) but I will need a Remove(int index) method to remove items from the queue. Can I achieve this functionality with an extension method? Anyone care to point me in the right direction? ...

C#: Triggering an Event when an object is added to a Queue

I need to be able to trigger a event whenever an object is added to a Queue<Delegate>. I created a new class that extends Queue: public delegate void ChangedEventHandler(object sender, EventArgs e); public class QueueWithChange<Delegate> : Queue<Delegate> { public event ChangedEventHandler Changed; protected virtual void OnC...

Disappearing Amf Remote Calls to ASP.NET WebORB Handler (IIS7)

In a project I'm doing I had severe problems in the weekend. Our application runs in a Custom Browser (.NET Console Application with IE component). At the end of the application Flex does three calls to Weborb.aspx. After this the application closes. There are some 300 sessions closing at the same time, so 900 requests to weborb.aspx at ...

How do I test a message queue client?

I am working on a java message queue client (beanstalk) and right now my tests look like this: //make sure our getJob can handle utf8 characters @Test public void testUTF8() { bean = new Beanstalk(); Job job = new Job(); bean.putJob("€"); job = bean.getJob(); assertEquals("€", job.msg); bean.close(); } ...

Problem with thread-safe queue?

I'm trying to write a thread-safe queue using pthreads in c++. My program works 93% of the time. The other 7% of the time it other spits out garbage, OR seems to fall asleep. I'm wondering if there is some flaw in my queue where a context-switch would break it? // thread-safe queue // inspired by http://msmvps.com/blogs/vandooren/archiv...

Are there any good work-queue-based frameworks?

I've been thinking about writing a web framework (think Struts, Ruby on Rails, Seaside) that is based on the idea of a work queue. I'm looking to see if anyone has done such a framework before. I'm happy to check out frameworks that are for processing requests and spitting back results, but aren't web (HTTP). I'm not looking for a wor...