Your computer can do many things at once. 

A computer can work on many jobs at once. 

A computer can work on many jobs at once. This is called multitasking. 
To do this, the computer uses a context switch. This is a way to stop one job and start another. The computer saves the state of the first job. The state includes things like memory and partial results. Then, it loads the saved state of a new job. 
There are two main ways to do this. In cooperative multitasking, a program chooses to give up its turn. If a program does not share, the whole system might hang. In preemptive multitasking, the system takes control. It gives each job a slice of time. This is more reliable.
Multitasking helps the computer stay busy. If one job is waiting for a user, the CPU can work on something else. This makes the hardware work much better. Some jobs are even broken into smaller parts called threads. Threads share the same memory to work together easily.
Multitasking is a way for a computer to work on many tasks at the same time. These tasks are often called processes. Even though it looks like everything is happening at once, the computer is actually doing something clever. It executes small segments of different tasks in an interleaved manner. This means it switches between them very quickly. The computer shares its main resources, like the central processing unit (CPU) and main memory, among all these jobs. This allows the computer to be much more efficient. 
To make this work, the computer performs a context switch. This is a step-by-step way to change which program is running. First, the system interrupts the current program. It saves the state of that program, including its memory and partial results. Then, it loads the saved state of a new program. This transfers control to the next task. There are two main ways this happens. In cooperative multitasking, a program is coded to signal when it can be interrupted. In preemptive multitasking, the system interrupts the program at fixed time intervals. 
Computers have used these ideas for a long time. Multitasking has been a common feature since at least the 1960s. Early computers used a technique called multiprogramming to keep the CPU busy. The Bull Gamma 60 was the first computer designed with multiprogramming in mind. It was designed in 1957 and released in 1960. Another early computer was the LEO III, which came out in 1961. These machines helped reduce wait times when many different programs were being processed. 
Different systems handle these tasks in different ways. Preemptive multitasking was used in the PDP-6 Monitor and Multics in 1964. It was also used in Unix in 1969. For home users, Microware's OS-9 was one of the earliest versions available. Later, the Commodore Amiga was released in 1985 with multitasking features. Microsoft made preemptive multitasking a core part of Windows in the early 1990s. They did this while developing Windows NT 3.1 and Windows 95. 
Multitasking is also used in special real-time systems. These systems might control industrial robots. A single processor might share its time between moving a machine and talking to a user. Some tasks are even broken into smaller parts called threads. Threads are like lightweight processes that share the same memory. This makes it easier for them to exchange data. This whole system works because of memory protection. This ensures that one task cannot accidentally change the memory of another task. 
Multitasking is the concurrent execution of multiple tasks, often called processes, over a specific period. In a multitasking system, new tasks can interrupt existing ones before they finish. Instead of waiting for one job to end, the computer executes segments of many tasks in an interleaved manner. This allows the system to share common processing resources, such as the central processing unit (CPU) and main memory. It is important to note that multitasking does not always require parallel execution at the exact same instant. Instead, it allows more than one task to advance over a given period of time. 
To manage these tasks, the computer performs a process known as a context switch. This mechanism automatically interrupts a running program to save its current state. The system preserves partial results, memory contents, and computer register contents. Once the state is saved, the computer loads the saved state of a different program and transfers control to it. This allows the CPU to remain productive even when one program is waiting for an external event. For example, if a program is waiting for user input or an input/output transfer with a peripheral, the CPU can switch to another task. 
There are two primary methods for managing these interruptions: cooperative and preemptive multitasking. In cooperative multitasking, the running program is coded to signal the supervisory software when it can be interrupted. This method was used by classic Mac OS and early versions of Microsoft Windows. However, if a poorly designed program refuses to give up control, it can cause the entire system to hang. In contrast, preemptive multitasking allows the system to interrupt programs at fixed time intervals. This ensures every process receives a regular "slice" of operating time. Preemptive multitasking is a core feature of modern Unix-like operating systems, such as Linux, and modern versions of Windows.
Multitasking has deep roots in computing history, beginning with the concept of multiprogramming. In the early days, CPU time was very expensive and peripheral devices were quite slow. Multiprogramming allowed multiple programs to be loaded into memory so the CPU could switch between them swiftly. The Bull Gamma 60, designed in 1957 and released in 1960, was the first computer built with multiprogramming in mind. Its architecture used a Program Distributor to feed up to twenty-five autonomous processing units. Another significant early machine was the LEO III, which was first released in 1961. 
As technology progressed, preemptive multitasking became more widely available. It was implemented in the PDP-6 Monitor and Multics in 1964, and in Unix in 1969. For home users, Microware's OS-9 was one of the earliest preemptive systems available. The Commodore Amiga, released in 1985, offered a combination of multitasking and multimedia capabilities. Microsoft later made preemptive multitasking a core feature of its flagship systems, starting with Windows NT 3.1 and Windows 95. Today, 64-bit editions of Windows provide preemptive multitasking for all supported applications. 
Modern systems also utilize threads to increase efficiency. A thread is a lightweight process that runs within the same memory context as its parent process. Because threads share the same memory space and resources, such as open files, they can exchange data very efficiently. Some operating systems also provide "fibers," which are a variant of threads that are scheduled cooperatively. Beyond standard computing, multitasking is vital for real-time systems. These systems, which might control industrial robots, use a hierarchical interrupt system. This ensures that critical tasks, like machine movement, receive priority over less urgent tasks like user interface updates.
To keep these multiple tasks safe, the system must use memory protection. This is the practice of strictly managing access to system resources to ensure stability and security. The operating system kernel and a hardware component called a Memory Management Unit (MMU) work together to manage this. The MMU ensures that a process cannot read or write to memory locations outside its own assigned address space. If a process attempts to access unauthorized memory, the MMU denies the request and signals the kernel. This often results in the process being terminated and an error like a "segmentation fault" being displayed. 
Finally, multitasking is often paired with memory swapping to manage limited resources. While the two techniques are unrelated, they are frequently used together to allow more tasks to be loaded. Memory swapping uses a swap file or partition to provide more memory than is physically available in the computer. The operating system keeps portions of the primary memory in secondary storage to free up space. This allows a multitasking system to continue functioning even when the total memory required by all active processes exceeds the physical hardware capacity.
🖼️ Images & Media (3)
More to explore
✨ What else?
Related topics you might enjoy
🔬 Go deeper
More advanced topics to explore
🪜 Step back
Simpler topics to build understanding
What is Nepedia?
A free, ad-free encyclopedia for children. Every article is written at five reading levels, so the same page works for a five-year-old and a fifteen-year-old — use the level switcher above to see this one change. No account needed to read.