Author Topic: What is a thread  (Read 313 times)

Offline ViZeen

  • Zinc Member
  • *
  • Posts: 50
What is a thread
« on: September 08, 2006, 05:20:18 PM »
And how many are there in this game. I have heard Skuzzy say it is multi threaded and will take advantage of dual core but what is a thread and how many threads will one cpu "thread" at a time?

Offline Spatula

  • Silver Member
  • ****
  • Posts: 1486
What is a thread
« Reply #1 on: September 08, 2006, 09:24:33 PM »
Think of a thread as a process running within a process. By process i mean 'application' eg AH2, Word, or Firefox etc. So a process can have many worker 'threads' all doing different things, apparently, simultaneously.

A good example would be say outlook express: outlook express is the process, and it has a thread to respond to user input (mouse, keys etc), and spawns other threads to check your mailbox 'in the background'. It does this so that when it checks for mail it doesnt block the responsiveness of the actaul application (eg stop responding to mouse clicks etc cause it is busy checking your mail). Its doing several things at once to make the user experience 'nicer'.

In fact most applications now days are multi-threaded (in a windows/GUI world) and can have as many threads to do as many seperate tasks it needs to do simultaneously without stopping the others.

To cloud the picture further, all this talk of simultaneous processing is actually a lie. Most PCs have a single processor (times are now changing) which has/is a single 'core'. A processor can only execute instructions in sequence (eg one after the other). There is no such thing as two processes or threads running at the same time. What actually happens is the operating system (windows) round-robins all of the 'running' applications and gives them a small slice of time on the processor while the others wait their turn. Then it stops that process and puts it to sleep and then gets the next out of the queue and gives that a turn. So on, and so on. It all happens so fast it gives us the illusion of many processes running simultaneously.

So, now with the advent of multi-core and multi-processor PCs becoming commonplace, their now exists the opportunity for REAL simultaneous processing - eg one processor services one process, another another, etc etc   up to as as many processors/cores you have.

Still with me? Good. Now the problem with true simultaneous execution is where two or more cores are competing over a shared resource (like a monitor, or memory, or disk etc). If the operating system doesnt enforce strict rules on how, who, and when resources can be accessed you can end up in a real sticky mess - to give a very simple explanation.

As for AH2 and its threading etc etc, i have no idea... Im sure HTC could fill in those details.
Airborne Kitchen Utensil Assault Group

Offline eagl

  • Platinum Member
  • ******
  • Posts: 6769
What is a thread
« Reply #2 on: September 08, 2006, 09:39:34 PM »
The short answer is if you're not a programmer, don't worry about it.

The slightly less short answer is if you run multi-threaded applications, a cpu with hyperthreading will help and a multi-core (dual core) cpu will help even more.

For the real answer, I suggest enrolling in a computer science degree program at your local university  :)
Everyone I know, goes away, in the end.

Offline Skuzzy

  • Support Member
  • Administrator
  • *****
  • Posts: 31462
      • HiTech Creations Home Page
What is a thread
« Reply #3 on: September 08, 2006, 10:15:46 PM »
A thread is a sub-program of the main running program.  Typically, it should be autonomous and asynchronous to the parent (main program).

Spatula, you can have 500 CPU's, and the only way any two of them can do anything at the same time is when a CPU cache hit happens.

Also, threading and multi-tasking are different.  Switching between applications is multi-tasking.  A thread runs under control of a parent application and stops executing when the parent is not the active application.
Not every application in Windows is threaded.  That is not to say there is not an associated thread with it as Windows itself runs threads (think of Windows as a big application which forks other applications), but the Windows threads run in protected mode.  The applications threads do not and the applications have no control over the Windows spawned threads.

Only one CPU/Core/HT can perform any I/O (RAM, HD, USB,.,,,,,) at a time.

There is also substantial overhead for threading.  Each time a thread or another application needs to become active a context switch must be performed.  This is where all the previous information about that application is loaded into the CPU to allow the CPU to continue froim its last service point.
Roy "Skuzzy" Neese
support@hitechcreations.com

Offline ViZeen

  • Zinc Member
  • *
  • Posts: 50
hello from safe mode
« Reply #4 on: September 10, 2006, 07:41:22 PM »
Thanks for telling me that helped me to understand this thing a little more.
I new PC should be here this week. And I just could not wait for  it to get here and get it up and runninh before screwing with this one. I have no clue what I did to mess it up or how to fix it. but I am about to make a call that might help. If not see yall soon I hope.

Offline ViZeen

  • Zinc Member
  • *
  • Posts: 50
update
« Reply #5 on: September 10, 2006, 09:28:58 PM »
It doesn't seem to have been my fault...My sound card seems to be it. It said no sound card so I jerked it up and windows booted right up. Now I tried to get onboard sound to work and haven't got it yet. I have a MSI kt3 ultra 6380e. I will be working on trying to get it to work.