multithreading

A programming strategy to bypass the os thread limit?

The scenario: We have a python script that checks thousands of proxys simultaneously. The program uses threads, 1 per proxy, to speed the process. When it reaches the 1007 thread, the script crashes because of the thread limit. My solution is: A global variable that gets incremented when a thread spawns and decrements when a thread finis...

Thread Safe Method Invoke doesnt work

Sup Guys, I Have a Function on my frmMain Class wich will update my control to something else after an invoke. When i type "?Label1.Text" on the Immediate Window, the text property IS updated, but when i go check the Form, nothing happened. The code is just like this Public Sub UpdateUI() If (Me.InvokeRequired = True) Then ...

Is the go map structure thread-safe?

Is the Go map type thread safe? I have a program that has many goroutines reading and writing to a map type. If I need to implement a protection mechanism, what's the best way to do it? ...

How to parallelize file reading and writing

Hi, all I have a program which reads data from 2 text files and then save the result to another file. Since there are many data to be read and written which cause a performance hit, I want to parallize the reading and writing operations. My initial thought is, use 2 threads as an example, one thread read/write from the beginning, and a...

Challenging Multithreading Problems

Is there some resource for challenging multi-threading problems? Would like to pose these to interviewees if possible. Tired of asking the same wait-notify questions that everyone gets right these days, but can't visualise a real scenario where multi-threading was employed. ...

how to start a thread when django runserver ?

I want to start a thread when django project runserver successfully. where can I put the create-thread-and-start code? Is there any hook for the django runserver? ...

threads and high level languages

can someone tell me why if i use threads it's better to use an low level languages like c++ and not c# and JAVA? someone asked me that in an interview and i did'nt know the answer ...

C# static method question

Hi, I do not understand what exactly happen behind the scenes when using static class with static members in multithread environment. I have a server application where clients very often read-write to SQL db. For that, I have created static class with static members SQLConnection,SLQDataReader etc. But as I understood, static class is ju...

Multithread server and communication with SQL

Hi, I would like to ask you for help, since my approach was not good. On the server side, there are clients connected (each client is represented by my Client class). Each client needs to comunicate with DB behind the server, also there is a need of multiple connections at the same time. I am considering to have SQLConnection and SQLRea...

How might I create and use a WebBrowser control on a worker thread?

I am creating an application that does screen shots of websites using the following method http://pietschsoft.com/post/2008/07/C-Generate-WebPage-Thumbmail-Screenshot-Image.aspx I tried to make the application multithreaded but I have run into the following error: [ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be i...

How to write a thread-safe and efficient, lock-free memory allocator in C?

How to write a thread-safe and efficient, lock-free memory allocator in C? By efficient I mean: Fast allocation & deallocation Optimal memory usage (minimal wastage and no external fragmentation) Minimal meta-data overhead ...

How do 2 or more threads get synchronized using a timer in the Windows kernel?

I have been reading about the kernel using timers for thread synchronization. I haven't been able to find a decent explanation on how thread sync with timers works, I wondered if anyone can help me? MSDN: Kernel Dispatcher objects DPCs and timer objects <-- here it talks about 'synchronization timers' Also reading book Windows Intern...

Concurrency and Multithreading

I'm not very experienced with subjects such as Concurrency and Multithreading. In fact, in most of my web-development career I had never needed to touch these subjects. I feel like it's an important concept, especially for Desktop applications and basically any other application that doesn't generate HTML :). After reading a bit on con...

How many cpus before Erlang faster than single threaded Java

I am currently using java and have read a lot about Erlang on the net and I have 2 big questions: How much slower (if any) will Erlang be over simple Java. I'm assuming here that Java is going to be faster from the shootout benchmarks on the net (Erlang doesn't do that well). i.e. How many more cpus am I going to need to make the Erl...

Controlling access to output in multi-threaded applications

I have an application that creates a job queue, and then multiple threads execute the jobs. By execute them, I mean they call system() with the job string. The problem is that output to stdout looks like the output at the bottom of the question. I would like each application run to be separated, so the output would look like: flac 1.2...

Deadlock situation in threads?

want to know what is deadlock condition in threads, because in many of the books i studied how to avoid deadlock situation, i just want to know what is deadlock situation and a example code for that? ...

implementaion independent communication within a process

is there any way two threads within the same process can communicate without knowing anything about each other's interface ? basically, one thread is a STOMP server, the other is a client. they're supposed to communicate in a direct manner (not via a socket) and it should be independent of the implementation so i can't assume either of ...

Static method and threads

Hi, I have put one question on MSDN forum but got two opposite answers. In general I am intersted how threading works with static classes. If my code calls this(below) static method from 10 threads at the same time, is it thread safe? I mean, how the code flows behind the scenes? Does every thread executes the code within itself (like I ...

c++ identify current thread in function?

Hi! let's say i have a singleton object with a static function: static int MySingletonObject::getInt() now i would like to return a different int depending on which workingthread (MFC threading) is calling the function. I know that i can pass parameters to the threadingfunction when creating the thread. But Is there a way to identif...

How to define threadsafe?

Threadsafe is a term that is thrown around documentation, however there is seldom an explanation of what it means, especially in a language that is understandable to someone learning threading for the first time. So how do you explain Threadsafe code to someone new to threading? My ideas for options are the moment are: Do you use a l...