if i have a file contains 4000 bytes, can i have 4 threads read from the file at same time? and each thread access a different section of the file.
thread 1 read 0-999, thread 2 read 1000 - 2999, etc.
please give an example in java.
...
I've got an asp.net web page that is making 7 async requests to a WCF service on another service. Both boxes are clean with nothing else installed.
I've upped maxconnections in web.config to 20.
I run a single call through the system and the page returns in 800ms. The long is short of it is I think that the threadpool is being being ov...
I'm trying my hand at working with threads at an assembly language level. I'd like to store information about the current thread, including things like the thread ID, etc. My current thought is placing a pointer to the thread information structure at an aligned address, such as (ESP & 0xFFE00000) for a 1MB stack.
The immediate problem I...
I have a standalone threaded python application in which I use Django's ORM (Postgres). After I join all my threads and wait for the application to exit(sys.exit(0)), there is still an extra thread running, for which the sys.exit waits:
All the threads I started exited.
Does Django spawn threads to handle database connectivity?
This ...
I'm looking for a book or books about multicore, multithreaded programming. The perfect book should focus on best practices and maybe include a bit of theory background. I'm not interested in a book which only describes a single library and focuses on its API.
OS actually doesn't matter.
...
Hi all,
Basically, I have a python program which listens for DeviceAdded DBus events (e.g. when someone plugs in a USB drive), and when an event occurs, I want to create a thread which collects metadata on that newly connected device. However, I want to do this asynchronously - that is, allow one thread to keep collecting metadata on th...
all threads have its priority,so what is the integer value for main thread?
...
In Java, Die is one of the states on a thread.
What causes a thread to enter this state?
...
I read the Use AsyncCallback, there is this code snippet:
using System;
using System.Threading;
using System.Runtime.Remoting.Messaging;
class MainClass
{
delegate int MyDelegate(string s);
static void Main(string[] args)
{
MyDelegate X = new MyDelegate(DoSomething);
AsyncCallback cb = new AsyncCallback(DoSomething2);
...
Hello,
Jon Skeet's excellent article at http://www.yoda.arachsys.com/csharp/singleton.html and other articles I've read make it clear that that double-check locking doesn't work in both C# and Java unless one explicitly marks the instance as "volatile." If you don't, the check of comparing it to null could possibly return false even tho...
Hi,
I understand that there is no multithreading support in javascript. And i wanted some expert advice on the below scenario..
My requirement is to perform a AJAX call and upon successful completetion, i want to trigger set of events (to update the different parts of UI parallely)
I am planned to use Subscribe/Publish pattern, is i...
I've several writers(threads) and one reader on a stl vector.
Normal writes and reads are mutex protected, but I would like to avoid contention on a loop I have and I was wondering if vector::size would be safe enough, I suppose it depends on implementations, but since normally vector dynamic memory is for the stored items the memory wh...
The worry
Is it bad practice to create controls/forms on threads other than the main thread in WinForms? I thought the rule was just that one thread couldn't change something on a control created on another thread?
The scenario
I have an application with some worker threads. Those worker threads may each display their own instance o...
I'm sure this is a pretty straight forward question. I'm writing a small windows forms app using C++/CLI. When the form initializes, I start a thread that will process some code. When the code in the thread is executed, I want the thread to somehow update the text in a statusbar in the bottom of the window. So I was thinking something li...
I was always using JDBC in JavaSE on single-threaded environment. But now I need to use a connection pool and let many threads to have interaction with the database (MSSQL and Oracle) and I am having a hard time trying to make it as it seems that I am lacking some fundamental undestanding of the api.
AFAIK after connect and logging a Co...
I snaged this sub off the web to recursively search all the files including subdirectoires
If i point this sub to a large area ( ie mydocuments or C:) I get an error:
The CLR has been unable to transition
from COM context 0x1f6c48 to COM
context 0x1f6db8 for 60 seconds. The
thread that owns the destination
context/apartment ...
I have a list of threads, and I'm trying to get my main thread to wait for all of the threads in the list to terminate:
while (consumers.Count > 0) consumers[0].Join();
The problem is, this isn't atomic, and I can get an "Index was out of range" exception.
Is there any atomic way to check for the existence of consumers[0] and call co...
This page in the MS documentation, covering asynchrony in Windows Forms applications, states:
You can call EndInvoke to retrieve the return value from the delegate, if neccesary, but this is not required. (emphasis added)
This page covering the general case of asynchronous delegates, states something different:
No matter whic...
For some reason, this safe-looking method raises a classic exception.
Cross-thread operation not valid:
Control 'statusLabel' accessed from a
thread other than the thread it was
created on.
This code obviously should call an anonymous method through Invoke when invoke is required.
But the exception occurs every once in a whil...
I have three legacy applications that share a lot of source code and data. Multiple instances of each of these applications be executed by a user at any time, e.g. a dozen mixed application executions can be active at a time. These applications currently communicate through shared memory and messaging techniques so that they can maintain...