Page 2 of 2 FirstFirst 12
Results 11 to 13 of 13
  1. #11
    Senior Member
    Join Date
    Jul 2004
    The real difference between a process fork and a thread if the use of memory. Threads all have their own stack, but share a heap. New processes on the other hand don't share a heap or stack. Fork is the way this was done in the past, and threads is the newer way of doing things that make programming easier. Most of the same functionality can be accomplished in either case.

    What you really need is most likely what Katja described, just a simple for( ; ; ) loop that checks for conditions and branches based on those conditions. You cannot do multiple instructions at the same time (unless its an atomic operation), but you can repeatedly check for one condition and then the other.

    The use of multiple threads in your application does increase the risks of bugs in your code, some of which that can be real nasty. The most common error is when two threads are writing data to the same memory location. Or one is reading while the other is writing to some memlory location. This results in corrupt data that can crash your application.
    Threads and multiprocesses can definately create bugs, but its a little more complicated that just reading and writting. The issues you'll run into will be deadlock and race conditions. Usage of semophores, locks, and structured variable requests will alleviate these issues.

  2. #12
    Join Date
    Jul 2005
    Well, at least zENGER understands what I'm saying here. Fork was the old way (and is still used quite often) and threads are a more modern way. It also depends a bit on your preferences and even more on your operating system.

    Another useful link can be http://www.yolinux.com/TUTORIALS/#PROGRAMMING which is Linux-oriented and it has some good information about forks, threads and processes.

    But personally, it's easier to just handle messages from a messageloop, like the 'for( ; ; ) loop' suggested by zENGER.

  3. #13
    Junior Member
    Join Date
    Sep 2005
    i m using windows..
    anyways i solved that game problem using the kbhit() function..yes,u had told me about taking input from keyboard processes,only i didnt knew what it exactly meant then..

Posting Permissions

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

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.