Results 1 to 5 of 5

Thread: threads

  1. #1

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    I understand now. But how can that fit in the example of client/server application. How can the new thread stop the freezing when a client connects to it? Does that new thread handles to connection with the client, and the actuall thread does the other stuff?
    Baaaaaaaaah

  2. #2
    Zaei
    Guest
    Threads dont make the app execute faster, but they make it seem that way, by sharing processor time. Using Megatron's analogy, It would be more like you would move two or three apples, then move two or three oranges, and back to the apples again.

    As to the question of a server/client app, you could have the server create a new thread to handle each client.

    Z.

  3. #3

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    Ohh, I see...Keeping in mind the analogy of Megatron, is that the same way so you can write the text on one part of the screen with one thread, and write another text on the other part of the screen using another thread at EXACTLY the same time?

    I know that each process can have different threads and (I think) that each thread allocates its own memory. So, are threads usefull when making large applications?
    Baaaaaaaaah

  4. #4
    Fanatic Member gwdash's Avatar
    Join Date
    Aug 2000
    Location
    Minnesota
    Posts
    666
    not EXACTLY the same time unless you have multiple proccessors, your OS(windows, usually), does something called timeslicing in which it allocates each thread a certain amount of time to do stuff, before it gives control to another thread, this round-roubin appears to be happening simultainiously. thats why windows is called a preemtive multitasking enviroment. usually, one thread will handle UI(to prevent apparent freezing), and another connecting to the server. on the server side, one thread will be created for each client connection, and then deleted after done. or sometimes programs share a set number of threads, but thats getting complicated

    anyways,
    GWDASH
    [b]VB6, Perl, ASP, HTML, JavaScript, VBScript, SQL, C, C++, Linux , Java, PHP, MySQL, XML[b]

  5. #5

    Thread Starter
    PowerPoster abdul's Avatar
    Join Date
    Dec 2000
    Location
    Ontario,Canada
    Posts
    2,827
    I fully understand now. Thanks everybody
    Baaaaaaaaah

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width