Multitasking means to be able to run more than one program simultaneously. In the past, computers with CLIs were unable to multitask - the operating systems of the day only allowed one program to run at a time.
Modern operating systems are multitasking in that they allow several programs to run side-by-side. It is not uncommon for a user to be streamingData that is sent in pieces. Each piece is viewed as it arrives, eg a streaming video is watched as it downloads. music while entering text into a word processorAn application used to write, edit and format text., or streaming a video while making a backupA copy of important files that is kept separately in case the original files are lost or damaged. of files.
Multitasking is possible only if:
the operating system can support multitasking
the computer has enough memory to hold more than one program in primary memory at the same time
Memory management
Computer memory must be managed to ensure that:
more than one program can run at the same time
more than one document can be opened at the same time
One method of memory management is known as pagingA method of memory management where memory is divided into pages.. Memory is broken up into fixed-size blocks, known as pageIn computing, a small portion of memory..
Different operating systems allocate their own size to pages. For example, memory pages in modern operating systems are typically 4 kilobytes (KB) in size.
When a program is run, it is loaded into memory. The operating system determines how much memory the program requires, and allocates enough pages to hold it and its documents. When the program is closed, the allocated pages are freed up for use by other programs.
The pages a program occupies may or may not be contiguousRunning together in sequence, one after another., but this does not matter. The operating system knows what each page occupies and fetches the data held in them when needed.
Example
Consider this example. Program A requires two pages. It is allocated pages 0 and 1. Program B requires three pages. It is allocated pages 2, 3 and 4.
Program A now closes, and Program C now runs. Program C requires three pages. Pages 0 and 1 are now free, so Program C is allocated pages 0, 1 and 5.