Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Multithreading

Multithreading

Scheduled Pinned Locked Moved Visual Basic
csharpdatabasehelptutorial
12 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Muhammad Fahim Baloch
    wrote on last edited by
    #1

    Hi, I am Working on the VB.Net to perform a Multithreading to correct the invalid email addresses in Database. The problem is that I have 22,00,00,000 email addresses. So I want, Multiple threads do work on this process . I am Little bit confusion about how to create more threads and all the threads can work togather but not access the same IDs of Email Address from table . For doing this I ahve created a list box , in which I devided the IDs of email Addressses into many list items . I want that first thread do work on first list item , Second created thread do work on second list item and so on. But the problem is that when i created multithreading some list of item is missing and the threads cannot do work on some list of items. With Regards,

    J C 2 Replies Last reply
    0
    • M Muhammad Fahim Baloch

      Hi, I am Working on the VB.Net to perform a Multithreading to correct the invalid email addresses in Database. The problem is that I have 22,00,00,000 email addresses. So I want, Multiple threads do work on this process . I am Little bit confusion about how to create more threads and all the threads can work togather but not access the same IDs of Email Address from table . For doing this I ahve created a list box , in which I devided the IDs of email Addressses into many list items . I want that first thread do work on first list item , Second created thread do work on second list item and so on. But the problem is that when i created multithreading some list of item is missing and the threads cannot do work on some list of items. With Regards,

      J Offline
      J Offline
      Johan Hakkesteegt
      wrote on last edited by
      #2

      Multithreading will not actually make your application perform multiple updates at the same time. Instead it will just have the one thread perform one, then the second one, then the third one, then the first one again, etc. It will be much faster doing the whole thing with SQL. You wouldn't even need an application at all, just a stored procedure or an SQL job.

      My advice is free, and you may get what you paid for.

      M 1 Reply Last reply
      0
      • J Johan Hakkesteegt

        Multithreading will not actually make your application perform multiple updates at the same time. Instead it will just have the one thread perform one, then the second one, then the third one, then the first one again, etc. It will be much faster doing the whole thing with SQL. You wouldn't even need an application at all, just a stored procedure or an SQL job.

        My advice is free, and you may get what you paid for.

        M Offline
        M Offline
        Muhammad Fahim Baloch
        wrote on last edited by
        #3

        I think you do not understand the problems exactly. I ahve lots of email addresses in my database . and a single query take a lot of time of its execution. so in this satuation it will happns that may the whole prrocess take few days in completing which is not useful for me. thnks! with best wishes!!!!!

        J J D 3 Replies Last reply
        0
        • M Muhammad Fahim Baloch

          Hi, I am Working on the VB.Net to perform a Multithreading to correct the invalid email addresses in Database. The problem is that I have 22,00,00,000 email addresses. So I want, Multiple threads do work on this process . I am Little bit confusion about how to create more threads and all the threads can work togather but not access the same IDs of Email Address from table . For doing this I ahve created a list box , in which I devided the IDs of email Addressses into many list items . I want that first thread do work on first list item , Second created thread do work on second list item and so on. But the problem is that when i created multithreading some list of item is missing and the threads cannot do work on some list of items. With Regards,

          C Offline
          C Offline
          Chinners
          wrote on last edited by
          #4

          220 MILLION or 22 BILLION? Thats a lot of email addresses. Sort of like a list a spammer would have. Either way, its going to take a LONG time to process that lot.

          J 1 Reply Last reply
          0
          • M Muhammad Fahim Baloch

            I think you do not understand the problems exactly. I ahve lots of email addresses in my database . and a single query take a lot of time of its execution. so in this satuation it will happns that may the whole prrocess take few days in completing which is not useful for me. thnks! with best wishes!!!!!

            J Offline
            J Offline
            Johan Hakkesteegt
            wrote on last edited by
            #5

            I do understand what you mean. What I am trying to say, is that any application using threading, you write, will always use the capacity of your PC or server in a less efficient way than the database server program would. Again, multithreading in principle does not make the computer perform multiple actions at the same time. It only makes the computer perform these actions in rapid succession, so it looks like it is doing things at the same time. Your database server program however can and will (usually) readily use multicore CPU's or servers with multiple CPU's. So it will actually make your PC or server perform multiple actions at the same time. If you need to sort through that much data, you are going to have to be prepared for a lengthy process, although I seriously doubt it would take days. Hours maybe. So it would be best if you create one additional field in your table, where you can flag each email address when it has been checked. That way you can write your SQL so that it only checks unflagged addresses, and your sql job or stored procedure will only have to run for a long time the first time.

            My advice is free, and you may get what you paid for.

            1 Reply Last reply
            0
            • M Muhammad Fahim Baloch

              I think you do not understand the problems exactly. I ahve lots of email addresses in my database . and a single query take a lot of time of its execution. so in this satuation it will happns that may the whole prrocess take few days in completing which is not useful for me. thnks! with best wishes!!!!!

              J Offline
              J Offline
              Jay Royall
              wrote on last edited by
              #6

              But, as Johan quite rightly said, 2 threads wont perform the process twice as quick as 1 thread. Threading just means that you can have more than 1 process running independently of each other, but they still have to share processor time. EDIT : Actually, I could be wrong here, maybe multi-core processors can run threads concurrently? Maybe someone can shed a light on this?

              modified on Friday, April 17, 2009 8:15 AM

              D 1 Reply Last reply
              0
              • J Jay Royall

                But, as Johan quite rightly said, 2 threads wont perform the process twice as quick as 1 thread. Threading just means that you can have more than 1 process running independently of each other, but they still have to share processor time. EDIT : Actually, I could be wrong here, maybe multi-core processors can run threads concurrently? Maybe someone can shed a light on this?

                modified on Friday, April 17, 2009 8:15 AM

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                Liqz wrote:

                Actually, I could be wrong here, maybe multi-core processors can run threads concurrently?

                If they couldn't, what would be the point of multiple cores??

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007, 2008

                J 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  Liqz wrote:

                  Actually, I could be wrong here, maybe multi-core processors can run threads concurrently?

                  If they couldn't, what would be the point of multiple cores??

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007, 2008

                  J Offline
                  J Offline
                  Jay Royall
                  wrote on last edited by
                  #8

                  I realise that processes can be run concurrently using multi-core processors but wasn't sure about threads. Anyway, thanks for correcting my mistake :)

                  D 1 Reply Last reply
                  0
                  • M Muhammad Fahim Baloch

                    I think you do not understand the problems exactly. I ahve lots of email addresses in my database . and a single query take a lot of time of its execution. so in this satuation it will happns that may the whole prrocess take few days in completing which is not useful for me. thnks! with best wishes!!!!!

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    You're not getting it. The SQL Server is a better place to do this. You won't be wasting a ton of time transferring that much data TWICE acrossed the network to the PC doing the processing, plus, multi-threading will only buy you a performance benefit if the PC has multiple processors, or multiple cores. You can't start, say, 10 threads on a single core machine and expect it to go 10 times faster. It doesn't work that way. Starting more threads to process data than there are cores in the machine is a complete waste of time. In a single core machine, the processor can only execute one thread at a time, pausing all other threads until it can get around to each of them.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007, 2008

                    1 Reply Last reply
                    0
                    • J Jay Royall

                      I realise that processes can be run concurrently using multi-core processors but wasn't sure about threads. Anyway, thanks for correcting my mistake :)

                      D Offline
                      D Offline
                      Dave Kreskowiak
                      wrote on last edited by
                      #10

                      Processors don't execute processes, they execute threads. A process is an operating system concept, not a processor concept. A process is just an organized collection of threads.

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007, 2008

                      J 1 Reply Last reply
                      0
                      • D Dave Kreskowiak

                        Processors don't execute processes, they execute threads. A process is an operating system concept, not a processor concept. A process is just an organized collection of threads.

                        A guide to posting questions on CodeProject[^]
                        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                             2006, 2007, 2008

                        J Offline
                        J Offline
                        Jay Royall
                        wrote on last edited by
                        #11

                        Ah I see, thanks again :)

                        1 Reply Last reply
                        0
                        • C Chinners

                          220 MILLION or 22 BILLION? Thats a lot of email addresses. Sort of like a list a spammer would have. Either way, its going to take a LONG time to process that lot.

                          J Offline
                          J Offline
                          Jon_Boy
                          wrote on last edited by
                          #12

                          Given either number, I'm not helping this goof ball send spam. I purging my hotmail acct now - what a pain in the butt.

                          Any suggestions, ideas, or 'constructive criticism' are always welcome. "There's no such thing as a stupid question, only stupid people." - Mr. Garrison

                          1 Reply Last reply
                          0
                          Reply
                          • Reply as topic
                          Log in to reply
                          • Oldest to Newest
                          • Newest to Oldest
                          • Most Votes


                          • Login

                          • Don't have an account? Register

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • World
                          • Users
                          • Groups