Multi-threaded Task Under Windows
Nov 11, 2010
I've just completed my first multi-threaded task under windows. Historically I am a VMS Engineer. You could multithread in drivers in VMS but VMS never had formalized threads. Which means it never had applications threads. Threads will become increasing important in the future. I thought this maybe a good time to discuss them. Not having access to sources hurts in terms of the amount of depth one can achieve in Windows. Some of the topics for this thread might be...compute resource regulation, how to do multi-threading and of course things to watch out for.
View 1 Replies
ADVERTISEMENT
Jul 21, 2011
I'm trying to run a multi-threaded console app in VB and am having thread cross-over. Basically I want to run 5 threads, have them continually access a queue, process, and repeat until there's nothing left. When all threads have processed I want them to do something else.I'm attempting to use SyncLock to prevent multiple threads from accessing but it does not seem to be working.[code]
View 3 Replies
Jul 14, 2010
This is my attempt to create a ObservableCollection in VB that is WPF thread-safe. Can you think of any problems it may have?
[Code]...
View 2 Replies
Aug 10, 2011
I'm trying to teach myself how to create multi-threaded applications in Visual Basic Express 2008. I found a page headed "Creating Threads and Passing Data at Start Time" in the Library here -
[url]
However, I can't get any of the examples on that page to run. I pasted the code from an example into a new Project in my IDE but pressing F5 just gives me build errors which I have no idea how to resolve. It's probably something trivial but I can't progress with these examples. Please can somebody tell me what I need to add to get them to run
View 1 Replies
Apr 5, 2011
I am drawing five images in a row. The five are the same thing at five different zoom levels. Therefore, only one of the five will be displayed at any one time, but the others have to be there because there can be over 100 images being displayed on the screen at any one time, and each drawing is quite complicated. If I were to draw them all on the fly, then zooming would require that all 115 images be recreated and redrawn with each zoom. That's painful. To avoid that, I draw all five zoom levels of each image. When the user iteracts with the form, they will be interacting with, at most, two of the images, so when they interact with the form, only two of the 115 have to be redrawn, though those two have to have all five zoom levels drawn, for a total of 10 images.
[Code].....
View 14 Replies
Mar 12, 2011
I have written a rather complex dll for processing a large volume of data (~4,000,000 records) from an Oracle database. It works well, but takes about 23 hours to run.Since I wrote the code fairly compartmentalized I realized that there are 6 routines that should be able to run concurrently, and I have a multi core processor,I decided to try my first multi-threaded implementation.
In the routine I am working on I am doing no I/O everything is in memory in variables. My data is already in dataTables and hashTables. Most of the data is defined as private in the class scope, but no conflicting updates should happen because the code segments works very distinct portions of the dataTables.The concept is simple, I have 2 routines that need to complete before launching my threads, and one routine that needs to run after all of the threads have completed. Here is what I am trying;
ProcessDXDate()
ProcessHistology()
aryThreads(0) = New Threading.Thread(AddressOf ProcessLaterality)[code].....
View 7 Replies
Oct 22, 2009
I'm using VB.NET. I want to build a large List (Of MyClassOrStructure) that becomes static after its initial population.I'm going to have multiple threads that need to iterate through this list to read data (no writing, inserting, or deleting)
Are there any very bad things that I need to keep an eye out for?
View 3 Replies
Feb 1, 2011
I am trying to create a proxy checker. This is my first attempt at multithreading and it's not going so well, the threads seem to be waiting for one to complete before initializing the next.
[Code]...
View 2 Replies
Aug 27, 2009
Raising events in multithreaded classes?
I am running a class(gamepad handler) that uses many child threads to check for key input and the like then it raises events to my form to sort out the needed reaction, Is there a way to make the event raises on the same thread as the class itself.
View 3 Replies
Nov 14, 2009
I'm having some trouble creating a multi-client server / client thingy.So far, I've used Atheist's example and allowed the clients to successfully transmit information.However, whenever I send more than 1 message to the server at the same time, the server bugs up and does not receive the message at all. I suspect it has something to do with the DoRead method reading from both clients and stuffing it up or something.
View 13 Replies
Jul 23, 2009
how to re-write my application (http:[url]....) to be multi-threaded using the background worker. The use case is something like:
1. User opens a binary file, it can be several Gbytes in size so reading it into memory isn't practical.
2. User can then navigate through the file in 188byte chunks, data is read from disk, decoded, and displayed for each chunk in turn.
3. User may want to search for some data or build a report. This will involve repeating the read, decode, display, function multiple times. During this looping the GUI stops responding and there is no option to cancel so I want to make it multi-threaded. So, is it safe to open the file in the GUI thread and then read from the file in the background thread? I currently use something like this to open the file once:
Dim fi As New FileInfo(filepath)
fs = fi.OpenRead()
and then in a separate sub multiple calls to:[code]..........
View 4 Replies
Mar 19, 2012
I've got a multi-threaded app - that is using a global COLLECTION of objects.I'm starting to think that objects - when copied to objects - are really just reference pointers to the "single object" in memory - as they would be in JAVASCRIPT (too many languages At any rate - this code - when taking the object from the collection to work with is it making a new object to play with or is it working the single object that actually resides in the collection?
[Code]...
View 16 Replies
Jul 25, 2009
I have an application with 4 threads. (GUI, Controller, Producer, Consumer) The GUI is self-explanatory. The controller starts the producer and consumer threads after some intial setup. The producer creates items and places them in a free slot in a "ring buffer". The consumer takes items from the "ring buffer" and writes them to disk. The producer creates items at a much higher rate than the consumer. The consumer is IO heavy and IO bound. Currently I am checking a variable in each ring buffer slot to determine if it can be written to.
if Slot.Free then
Write Slot.Data To Disk
end if
I am not using lock/synclock instead I'm just reading / writing the value of the slot's "free" variable. I don't believe that is correct even though it is a volatile read/write. Is there a better method to read/write this variable? The variable is of type "integer" and is either 0 or 1.
View 5 Replies
Oct 1, 2011
I've been writing multi-threaded applications for a couple of years and have started reading about the Task class. It looks like it handles mutex and synchronous/asynchronous threading in an easier to follow fashion. I was just wondering if you the community likes writing threads the old way or the 4.0 tasking applications. Lastly, I thought multi-threading was parallel computing. But I was reading that there are special task etc. parallel functions.
View 2 Replies
Dec 4, 2009
I have a console application (VB.NET). When it is started, it spawns worker threads to find work in the database and do the task, then look for the next task (A workflow basically).
The problem that I have is that I have my Event Handler in the main thread that spawns the worker threads. Those workers, if they error, raise an event to a public delegate. However my main thread is not detecting these events, and I cannot figure out how to make it. My intention is to do all logging (text/database), email alerts, and restarting the worker to find another task that is not errored. (This will be expanded in the LogErrorMessage routine and such, for now I am just keeping it a simple Console.Writeline so that I can see if the method is being fired or not)
Here is the code around what I am trying to do:
Logger Class:
Public Delegate Sub LogDelegateError(ByVal Ex As Exception)
Public Class EventLogger
Public Event EventError As LogDelegateError
[Code].....
View 2 Replies
May 17, 2011
I am usng a multi threaded process to fire off a task, but when it is completed I want to make a label visible on the main form (form 1), eg "process completed", however the code I have in place comes up with the following error message;
Cross-thread operation not valid: Control 'lblCompleted' accessed from a thread other than the thread it was created on.
View 4 Replies
Feb 23, 2009
My application takes the currently logged-in user and uses an a DirectoryServices.DirectorySearcher to pull a few additional detail about them (some properties we have stored in a few custom AD fields, as well as their email address). This works great, though I've always though it was a little slow - my single-threaded code could only make about 2-3 requests/second to AD.
The real problem came when I moved this code to a web server. With multiple simultaneous users, the number of requests/second jumps greatly, and the LSASS.EXE process pegs on my server. I've checked the domain controllers, and they're just fine - the bottleneck is clearly on the application side. I suspect that what's slowing my down is the NTLM/Kerberos challenge/response, and the number of simultaneous requests pegs even the multi-core processor.
Our network policy doesn't allow anonymous reads from AD, so that choice is out. Also, I've tried every member of "AuthenticationTypes" (in the example, I'm using .FastBind), but they all seem to have about the same throughput rate with the same load on the processor.how I might work around this restriction and lower my demands on the processor? Here is the code I'm using - pretty straightforward:
Dim sPath As String = "LDAP://" & stringUserDN
Dim entry As New DirectoryEntry(sPath)
entry.AuthenticationType = AuthenticationTypes.FastBind[code]......
View 1 Replies
Jun 22, 2010
I have an Excel based algo-trading app that needs to take in lots of real-time data, and make trading decisions based on the calculations driven by the data. It is not one of those "read-only" stock ticker kinda spreadsheets.I created a COM object with VB.NET that runs in its own thread space which collects data from a socket, and when the data is read it raises an Event with data attached. In Excel VBA, the event handler parses the data, puts them to the right places on the spreadsheet to feed calculations (so far it sounds like a stock ticker app), and then, based on the results of the various calculations it does something.The problem is that when the user starts to click around the spreadsheet while there is large amount of data coming, the event handler's cell updating breaks apart. If the app is left alone without user action, it stands well. My frustration comes from not understanding what happens to the main thread when a user clicks around. Either the event handler blocks the user action, or the user action blocks the event handler (under which case I will put in some queuing facility). But I just don't see how user action can break the code (like causing VBA to stop executing)
View 9 Replies
Mar 5, 2009
I'm using the MAPI code by Dave Brooks.I am attempting to programatically send out a Crystal Report that is generated.When I run through the code without threading everything runs fine. The problem is when I use threading I get the return error "General MAPI failure [2]".I have never used threading before and understand that there are dangers involved. Can anyone provide any insight into this issue? NOTE: I've removed exception handling to make the code clearer.[code]
View 1 Replies
Mar 29, 2010
I have a solution in VS 2008 that creates a DLL. I then use that DLL in another application. If I go in to the DLL projects property pages and change the following configuration for a DEBUG build then the built dll no long provides the desired functionality. If I change it back and rebuild the DLL, then the DLL does provide the correct functionality:
[Code]...
View 3 Replies
Mar 19, 2009
I find it hard to manage tracking my time on multiple taks..esp when it comes time to charge How would i track time? ie if i click on a start button, then click on a stop button...how would i work out diff in hour mm secs....
View 3 Replies
Feb 27, 2009
i have a function to export data with some loops now the problem is that when he is exporting the data the program stop responding and only respond when the job is done, and i need a option to cancel the job when it is running but the problem simple block all forms that is opened how can i creat some multi task for fix that problem?
View 1 Replies
Feb 27, 2009
i have a function to export data with some loops now the problem is that when he is exporting the data the program stop responding and only respond when the job is done, and i need a option to cancel the job when it is running but the problem simple block all forms that is opened how can i creat some multi task for fix that problem?
View 1 Replies
Feb 27, 2009
i have a function to export data with some loops now the problem is that when he is exporting the data the program stop responding and onlyrespond when the job is done, and i need a option to cancel the jobwhen it is running but the problem simple block all forms that is openedhow can i creat some multi task for fix that problem?
View 2 Replies
Feb 19, 2011
I want to write a very simple application, containing a pop-up menu when user click on it, that will appear in windows task bar, exactly like language bar, this is the only need. it does not contain any more functionality at the time being. Does anybody know where to start or do you have any sample code for it.
View 5 Replies
Feb 24, 2010
How to create a task in windows xp pro 2002, Taking input as Date, Time, perform every after time(Hours,daily) and Username And Password.
I am using vs 2003 and 1.1 frmework. would u like to reply with some working code
View 12 Replies
Jul 27, 2009
I want to hide my application process in task manager using C# how it possible.
my code is
[/b][code]
Imports System.Runtime.InteropServices
Imports System.Diagnostics
[Code]....
But when i click the button to hide the process it gives an[b] IndexOutOfRange Exception for the call
View 4 Replies
Mar 7, 2012
How to hide your program from the Task Manager in windows 7?Did you have any answer .how to hide exe form the taskmanager in windows 7?
View 2 Replies
Sep 12, 2008
Has anyone here ever programmatically created a scheduled task in either VB or C# for Windows XP?
View 3 Replies
Mar 12, 2009
My MDI parent form sizes itself so that the activity field (with the start button etc) doesnt show. This happens every now and then and I cant figure out why.
Of course I want to see the activity field,
View 4 Replies