Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Simultaneous tasks?
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
BigSams




PostPosted: Tue Jan 18, 2011 6:51 pm   Post subject: Simultaneous tasks?

Hey. So I'm wondering if it is possible to do some tasks simultaneously on VB6, similar to Turing's Processes. An example is that as soon as a certain form loads, the program "simultaneously" checks for collision between A and B, and also adds up the score, both until the end of the program (each process has a loop around it of course). Yeah I could put it all in a big loop but there are intentional delays here and there and they shouldn't have to slow everything else down as well. Any relevant syntax you know?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Tue Jan 18, 2011 7:16 pm   Post subject: RE:Simultaneous tasks?

Concurrency is hard. Just don't block on delays. (That is, don't use delays that pause; use timers that return right away)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
BigSams




PostPosted: Tue Jan 18, 2011 7:39 pm   Post subject: Re: Simultaneous tasks?

But it's so easy on Turing, simple Process+Fork...
I'm not sure what you mean by no block, and timer instead. Could you elaborate? What is the syntax for this?
Tony




PostPosted: Tue Jan 18, 2011 8:04 pm   Post subject: Re: Simultaneous tasks?

BigSams @ Tue Jan 18, 2011 7:39 pm wrote:
But it's so easy on Turing, simple Process+Fork...

You are being very mislead. You'll learn more at about 3rd year University level.

http://en.wikipedia.org/wiki/Thread_(computer_science)
Quote:

However, the use of blocking system calls in user threads (as opposed to kernel threads) or fibers can be problematic. If a user thread or a fiber performs a system call that blocks, the other user threads and fibers in the process are unable to run until the system call returns. A typical example of this problem is when performing I/O: most programs are written to perform I/O synchronously. When an I/O operation is initiated, a system call is made, and does not return until the I/O operation has been completed. In the intervening period, the entire process is "blocked" by the kernel and cannot run, which starves other user threads and fibers in the same process from executing.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: