b. Computer users always have the impression that multiple processes are running on their machine. With the aid of a diagram, briefly explain to a novice that this is actually not the case for non-multicore machines.

20 0

Get full Expert solution in seconds

$1.97 ONLY

Unlock Answer

EXPERT ANSWER

Multiple processes do not execute at the same time on a single-processor multitasking system because there is only one processor. Instead, the processor alternates among the processes running at any one time. Multiple processes do not execute at the same time on a single-processor multitasking system because there is only one processor. Instead, the processor alternates among the processes running at any one time.

So to make a single core cable to run multiple jobs(tasks or processes), a form of time-division multiplexing was used. To simplify things a bit: the OS sets up a timer that interrupts the system at a fixed interval. A single interval is known as a time slice. Every time this interrupt occurs, the OS runs the scheduling routine, which picks the next thread that is due to be executed. The context of the core is then switched from the currently running thread to the new thread, and execution continues.

Since these timeslices are usually very short, as a user you generally don’t even notice the switches. For example, if you play an mp3 file, the CPU has to decode the audio in small blocks, and send them to the sound card. The sound card will signal when it is done playing, and this will trigger the mp3 player to load new blocks from the mp3 file, decode them, and send them to the sound card. However, even a single-core CPU has no problem playing an mp3 in the background while you continue work in other applications. Your music will not skip, and your applications will run about as well as when no music is playing. On a modern system that is no surprise, as playing an mp3 takes < 1% CPU time, so its impact is negligible.