concurrency

Threads per Processor

In Java, is there a programmatic way to find out how many concurrent threads are supported by a CPU? Update To clarify, I'm not trying to hammer the CPU with threads and I am aware of Runtime.getRuntime().availableProcessors() function, which provides me part of the information I'm looking for. I want to find out if there's a way to a...

Locking NFS files in PHP

Part of my latest webapp needs to write to file a fair amount as part of its logging. One problem I've noticed is that if there are a few concurrent users, the writes can overwrite each other (instead of appending to file). I assume this is because of the destination file can be open in a number of places at the same time. flock(...) is...

Concurrent programming c++?

I keep on hearing about concurrent programing every where. Can you guys throw some light on what it's and how c++ new standards facilitate doing the same? ...

Java Concurrent and Parallel GC

This article here suggest to use -XX:+UseParNewGC 'To enable a parallel young generation GC with the concurrent GC'. My confusion is that to enable both parallel and concurrent gc do I just gotta use -XX:+UseParNewGC or do i gotta use both -XX:+UseParNewGC and -XX:+UseConcMarkSweepGC PS i am using jvm 6 ...

What is the C++ memory model for concurrency?

What is the C++ memory model for concurrency as defined by current standard? What about upcoming C++0x standard? Will it change the memory model to support concurrency better? ...

db4o client/server appears to only be able to process one query at a time?

We're evaluating db4o (an OO-DBMS from http://www.db4o.com). We've put together a performance test for client/server mode, where we spin up a server, then hammer it with several clients at once. It seems like the server can only process one client's query at a time. Have we missed a configuration switch somewhere that allows for this ...

What is a good pattern for using a Global Mutex in C#?

The Mutex class is very misunderstood, and Global mutexes even more so. What is good, safe pattern to use when creating Global mutexes? ...

Concurrent ASP.NET session best practices

User A logs into a ticket management system to edit content on "SomePage.aspx" User B logs in 30 seconds later to edit the same ticket on "SomePage.aspx" What are some of the best known practices(in a 3-tier architecture) for notifying each of the users that someone else is modifying the same content? ...

Measure Thread Expenses

Joe Duffy states in the MSDN article "Using concurrency for scalability" that the cost of creating a thread is approximately 200,000 cycles, and the cost of destroying is about 100,000 cycles. When I try to create a new thread to perform some calculations, I would like to be sure that the calculations themselves are more expensive than ...

Preventing Users from Working on the Same Row

I have a web application at work that is similar to a ticket working system. Some users enter new issues. Other workers choose and resolve issues. All of the data is maintained in MS SQL server 2005. The users working to resolve issues go to a page where they can view open issues. Because up to twenty people can be looking at this page ...

What classes from Jeffrey Richter's PowerThreading library are people using?

Jeffrey Richter is looking for some input on how people are using his PowerThreading library. If anyone out there is using this, what parts of it are you using? He is looking to clean up the library and wants to know what classes people are using. http://www.wintellect.com/PowerThreading.aspx EDIT: See http://tech.groups.yahoo.com/grou...

How can I wrap a method so that I can kill its execution if it exceeds a specified timeout?

I have a method that I would like to call. However, I'm looking for a clean, simple way to kill it or force it to return if it is taking too long to execute. I'm using Java. to illusrate: logger.info("sequentially executing all batches..."); for (TestExecutor executor : builder.getExecutors()) { logger.info("executing batch....

Threading issues in a Java HashMap

Something happened that I'm not sure should be possible. Obviously it is, because I've seen it, but I need to find the root cause & I was hoping you all could help. We have a system that looks up latitude & longitude for a zipcode. Rather than access it every time, we cache the results in a cheap in-memory HashTable cache, since the l...

Best programming approach/methodology to assure thread safety

When I was learning Java coming from a background of some 20 years of procedural programming with basic, Pascal, COBOL and C, I thought at the time that the hardest thing about it was wrapping my head around the OOP jargon and concepts. Now with about 8 years of solid Java under my belt, I have come to the conclusion that the single har...

Concurrency handling using the filesystem VS an RDMBS (MySQL)

I'm building an English web dictionary where users can type in words and get definitions. I thought about this for a while and since the data is 100% static and I was only to retrieve one word at a time I was better off using the filesystem (ext3) as the database system instead of opting to use MySQL to store definitions. I figured there...

SerialPort and the BSOD

I've written some C# code that checks whether a device is present on any SerialPort by issuing a command on the port and listening for a reply. When I just set the port speed, open the port, get the serial stream and start processing, it works 100% of the time. However, some of our devices work at different speeds and I am trying to prob...

Message Passing Concurrency Library for C?

I've been looking around, but I can't seem to find a message-passing concurrency (Actor) library for C (not C++). Ideally the candidate would be based on something like libevent underneath allowing for non-blocking I/O in most places. Does anyone know of such a library? ...

What is meant by "thread-safe" code?

Does it mean that two threads can't change the undelying data simultaneously? or does it mean that the given code component will run with unpredictable results when more than one thread are running it? ...

Concurrent data structure design

I am trying to come up with the best data structure for use in a high throughput C++ server. The data structure will be used to store anything from a few to several million objects, and no sorting is required (though a unique sort key can be provided very cheaply). The requirements are that it can support efficient insert, ideally O(1),...

When would you call java's thread.run() instead of thread.start()?

... the question says it all I believe! ...