Computer Organization & Embedded System β Real-Time Operating and Control System, NEC licence examination syllabus (Nepal Engineering Council).
One CPU juggling many tasks vs many CPUs actually working simultaneously.
MultitaskingOne CPU switches rapidly between multiple tasks, giving the illusion of simultaneity.
MultiprocessingGenuinely multiple CPUs run tasks at the same time.
MultiprogrammingMultiple programs are kept in memory ready to run, so the CPU is never idle waiting for I/O.
When the OS switches from one task to another, it must save the current task's registers/PC/state (into its PCB) and load the next task's saved state β this overhead is called a context switch. Too many context switches waste CPU time on switching rather than real work.
CooperativeA task voluntarily gives up the CPU (yields). Simple, but one badly-behaved task can freeze everything.
PreemptiveThe OS can forcibly interrupt a running task (e.g. on a timer). Safer, and what virtually all modern/real-time systems use.
The three terms in the table describe two genuinely different things, and the distinction is worth being precise about.
ConcurrencySeveral tasks are in progress over the same period. On one CPU they take turns; at any single instant exactly one is running. This is multitasking.
ParallelismSeveral tasks execute at the same instant, which requires more than one processor. This is multiprocessing.
Switching between tasks is not free, and the cost is more than the obvious part.
DirectSaving registers and the program counter, loading the next task's β measured in microseconds.
IndirectThe new task's data is not in cache, so it runs slowly until the cache refills. This is usually the larger cost and is invisible in the switch itself.
Create a free account to tick topics off, take notes as you read, watch the video lessons and get a day-by-day study plan built around your exam date.
Loadingβ¦