2
$\begingroup$

I have a laptop with Intel dual core and it runs, the OS windows, and many application from Opera, age of empires, word, excel etc open at once just fine. If it only has 2 cores, how can so many programs work? How exactly does it manage to do all these? Does operating system have something to with it?

$\endgroup$
  • 2
    $\begingroup$ Yes, the OS has a lot to do with this. See context switching on Wikipedia. $\endgroup$ – Juho Dec 9 '19 at 19:18
  • $\begingroup$ @Juho so, in essence, the applications aren't "running" in the background but freezed in the state as they are? Then how do simultaneous downloads from two applications inthe "background" occur? $\endgroup$ – user163416 Dec 9 '19 at 19:24
  • 1
    $\begingroup$ I think it can be interrupt driven. This is also explained on Wikipedia. $\endgroup$ – Juho Dec 9 '19 at 19:34
4
$\begingroup$

It's great that you're curious. A simplified explanation follows with a few links to delve into:

All of the programs running in parallel is actually an illusion that is created by the OS.

  1. Even if we have a uniprocessor system, the OS can still achieve the same thing.
  2. For multiple programs running on the system, OS creates separate processes.
  3. Separate processes could then time-share the processor(s) available.

Since a processor is very fast (gauged by frequency), it can switch back and forth among multiple processes that may be active in a particular time period (we're talking about the span of time in microseconds/milliseconds). Overall, this gives the user an illusion that the programs are running in parallel. This technique is called Multi-tasking.

Now, adding more processors(let's say one in your case) allows the OS to also use the processors in parallel. In this case, let's say the OS chooses to run half of the programs on one processor and the other half on another processor (in reality, it's a little more complex). Individual processors are still used by the running processes in a time-sharing fashion but since there are two processors, overall the performance of your running programs improve. Using multiple processors in parallel is called Multi-processing.

Although the definitions can be a little confusing, this overall implementation idea remains the same.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.