[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Single Vs MultiThreading 2

Posted on 2002-04-03
9
Medium Priority
?
161 Views
Last Modified: 2010-05-02
Is there any advantage to multi-threading if you are not using ASynchronous programming techniques?
0
Comment
Question by:Lisp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 2

Expert Comment

by:ronenr
ID: 6917423
Usually multi-threding is for performing several tasks at the "same time" or for balancing the work between several processors. If you have a tasks that must be sequencially I thing that multithreding will not give any advantage. In the other hand it will make the computer to work more, because now it has to maintaine 2 proccesses instead of one.

Hope it helps
0
 

Author Comment

by:Lisp
ID: 6917613
Wait a minute.  I'm not talking about using out of process components where you would have multiple processes.  I'm talking about using a single process, using many in-process add-ins.  Using a single process with multiple threads.
0
 
LVL 2

Expert Comment

by:ronenr
ID: 6917653
When you use multi-threading each thread is a separate process, you can call them lite processes, but they are independent proccesses they have their our process id you can give them priority, etc. But they do differ from out-proccess in many way, one the differences are the memory segment they use.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6917706
which version of VB are you using? if you are using VB6, be advised that there are no easy ways of doing multithread. VB.Net gives you the trhread object.

>>Is there any advantage to multi-threading

The classical example if the print option of Word is done in a separate thread to allow you to continue to work while the document is printed.
0
 
LVL 18

Expert Comment

by:mdougan
ID: 6918619
Another classical example is to use Multi-threading in Server type components.  So, if you have a Search Index component, and you want to allow multiple clients to search at the same time, without having each one run an instance of the conponent, or each request having to queue until the component is available, you can have one instance that farms each request out to a separate thread where the requests can process in parallel.

This also leads to resource "pooling", so, you might have a thread pool, where threads are already allocated, storage is already loaded, but the threads are idle.  Then, when a new request comes along, it's queued until there is an available thread, and then it gets to run, but this will be much faster than if threads have to be created and resources allocated for each request.

It is possible for threads to be used in a process that might be more or less sequential, but have certain components that can be multi-threaded.  Take the search index as an example.  Maybe one request comes in, you single-thread at first, maybe parse the search string, find that there are 5 search terms, then create 5 threads, send each search term to the search index component, and then wait for notification that all 5 threads have finished processing (using either callbacks or there is something called semaphores and mutexes) then single thread again to display the results to the user.  This would simply have the effect of speeding up the search by running it in parallel.  Many database management system already employ such techniques when running large queries.

As was already stated, it's also possible to assign different priorities to the threads.  Normally, the main process has a pretty high priority, but it's possible to bump a thread to a higher priority, and it will get more processor, and/or you can bump a thread to a lower priority if you want something to happen in the background, but not negatively affect the foreground process.
0
 

Author Comment

by:Lisp
ID: 6920036
I thought that multi-threading was as simple as choosing Apartment threading over single threading.  I know that its not ultra specific but is that not multiple threading? Yes I am using VB6.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 400 total points
ID: 6920526
Apartment thread is only there to be used when building MTS (or COM+) component. MTS requires a component to be compiled as apartment to be able to fully work correctly with MTS rules.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 6920532
You don't have any object from within VB to declare a thread, pass parameters to it, start it, synchronize it, abort it... This is the proof that mutli-threading is not implemented intrinsicly.
0
 
LVL 18

Expert Comment

by:mdougan
ID: 6921941
My understanding of "Apartment Threading" is that it is a euphamism for improved single-threading, the way "multi-tasking" was a euphamism for time-slicing under Windows 3X.

The concept was that you might have many people actively living in an apartment building, but only one can use the front door at any one time.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question