What's the official explanation for that one? I always seem to forget.
feedback
|
|
Multi-tasking, or multi-threading on a single processor is also called perceived multi-threading. Obviously with one CPU, it is not possible to execute commands simultaneously. Instead we interleave processes, giving the illusion of multi-threading. As @Journeyman Geek added, this uses preemption. This is where we have some sort of structure (think a queue) where the programs are stored and each process gets so many cycles to execute. Then the currently running program is preempted (or swapped out with another program) and then that program runs. There are many strategies to determining which programs execute when. We could be completely fair (ex: Round Robin) and each program receives a certain time-quantum or we could separate the programs by priority and only execute the lower priority program when there are no more higher-priority programs to execute (ex: Priority Queue). This is helpful when say you are writing a GUI application and running a long background-task. If this were to be written as a single threaded app, the front-end of the GUI would freeze. However, with two threads, the GUI remains responsive. Even if there is only one CPU, the interleaving of the processes means that the GUI remains responsive while the background-process continues to run and make progress. | ||||
|
feedback
|
|
hyperthreading most likely, with modern systems - in short, part of, but not whole core is duplicated so more threads can be run, per core | |||||||||
feedback
|
|
Basically the operating system takes each application (and each thread within each application) in turn and runs it for a few CPU cycles. So if you have 10 applications running, over a 10 second period each will get 1 second's worth of time actually running. It means that each application runs more slowly than it would if it were the only application running on the computer - but for the vast majority of applications most of their time is spent waiting for user input. See Wikipedia for more information. | |||
|
feedback
|
|
I'm not sure what you have in mind, but it brings to mind the user perception that applications are running in parallel. This effect is achieved by interleaving the demands of concurrent processes at such a rate that it looks like every, or at least most, processes are running at the same point in time. Incidentally, in Unix parlance the focus shifts to the perception that the system appears dedicated to each user's requests. We call this simply "multiuser." | |||
|
feedback
|