Computer multitasking: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
imported>AnomieBOT
m Dating maintenance tags: {{Unsourced section}}
 
imported>Guy Harris
Multiprogramming: Use. A. Citation. Template.
 
Line 1: Line 1:
{{Short description|Concurrent execution of multiple processes}}
{{Short description|Concurrent execution of multiple processes}}
[[File:Desktop-Linux-Mint.png|thumb|right|360px|Modern desktop operating systems are capable of handling large numbers of different processes at the same time. This screenshot shows [[Linux Mint]] running simultaneously [[Xfce]] desktop environment, [[Firefox]], a calculator program, the built-in calendar, [[Vim (text editor)|Vim]], [[GIMP]], and [[VLC media player]].]]
[[File:Fedora Linux multitasking.png|thumb|360x360px|Modern desktop operating systems are capable of handling large numbers of different processes at the same time. This screenshot shows [[Fedora Linux]] running simultaneously with the [[KDE Plasma 6]] desktop environment, [[Firefox]], [[KCalc]], the built-in calendar, [[GNU nano]], [[GIMP]], and the [[VLC media player]].]]
[[File:Microsoft_Windows_1.01_multitasking.png|thumb|360px|Multitasking of [[Microsoft Windows 1.0|Microsoft Windows 1.01]] released in 1985, here shown running the MS-DOS Executive and Calculator programs]]
[[File:Microsoft_Windows_1.01_multitasking.png|thumb|360px|Multitasking of [[Microsoft Windows 1.0|Microsoft Windows 1.01]] released in 1985, here shown running the MS-DOS Executive and Calculator programs]]


In [[computing]], '''multitasking''' is the [[concurrent computing|concurrent]] execution of multiple tasks (also known as [[Process (computing)|processes]]) over a certain period of time.  New tasks can interrupt already started ones before they finish, instead of waiting for them to end. As a result, a computer executes segments of multiple tasks in an interleaved manner, while the tasks share common processing resources such as [[central processing unit]]s (CPUs) and [[main memory]]. Multitasking automatically interrupts the running program, saving its state (partial results, memory contents and computer register contents) and loading the saved state of another program and transferring control to it. This "[[context switch]]" may be initiated at fixed time intervals ([[pre-emptive multitasking]]), or the running program may be coded to signal to the supervisory software when it can be interrupted ([[cooperative multitasking]]).
In [[computing]], '''multitasking''' is the [[concurrent computing|concurrent]] execution of multiple tasks (also known as [[Process (computing)|processes]]) over a certain period of time.<ref>{{Cite web |title=What Is Multitasking? |url=https://www.computerhope.com/jargon/m/multtask.htm |access-date=2026-02-11 |website=Computer Hope |language=en}}</ref> New tasks can interrupt already started ones before they finish, instead of waiting for them to end. As a result, a computer executes segments of multiple tasks in an interleaved manner, while the tasks share common processing resources such as [[central processing unit]]s (CPUs) and [[main memory]]. Multitasking automatically interrupts the running program, saving its state (partial results, memory contents and computer register contents) and loading the saved state of another program and transferring control to it. This "[[context switch]]" may be initiated at fixed time intervals ([[pre-emptive multitasking]]), or the running program may be coded to signal to the supervisory software when it can be interrupted ([[cooperative multitasking]]).


Multitasking does not require [[Parallel computing|parallel execution]] of multiple tasks at exactly the same time; instead, it allows more than one task to advance over a given period of time.<ref>{{cite web |title=Concurrency vs Parallelism, Concurrent Programming vs Parallel Programming |url=https://blogs.oracle.com/yuanlin/entry/concurrency_vs_parallelism_concurrent_programming |publisher=Oracle |access-date=March 23, 2016 |archive-url=https://web.archive.org/web/20160407121734/https://blogs.oracle.com/yuanlin/entry/concurrency_vs_parallelism_concurrent_programming |archive-date=April 7, 2016 |url-status=dead }}</ref>  Even on [[multiprocessor]] computers, multitasking allows many more tasks to be run than there are CPUs.
Multitasking does not require [[Parallel computing|parallel execution]] of multiple tasks at exactly the same time; instead, it allows more than one task to advance over a given period of time.<ref>{{cite web |title=Concurrency vs Parallelism, Concurrent Programming vs Parallel Programming |url=https://blogs.oracle.com/yuanlin/entry/concurrency_vs_parallelism_concurrent_programming |publisher=Oracle |access-date=March 23, 2016 |archive-url=https://web.archive.org/web/20160407121734/https://blogs.oracle.com/yuanlin/entry/concurrency_vs_parallelism_concurrent_programming |archive-date=April 7, 2016 |url-status=dead }}</ref>  Even on [[multiprocessor]] computers, multitasking allows many more tasks to be run than there are CPUs.
Line 18: Line 18:
In the early days of computing, [[CPU time]] was expensive, and [[peripheral]]s were very slow. When the computer ran a program that needed access to a peripheral, the central processing unit (CPU) would have to stop executing program instructions while the peripheral processed the data. This was usually very inefficient. Multiprogramming is a computing technique that enables multiple programs to be concurrently loaded and executed into a computer's memory, allowing the CPU to switch between them swiftly. This optimizes CPU utilization by keeping it engaged with the execution of tasks, particularly useful when one program is waiting for I/O operations to complete.
In the early days of computing, [[CPU time]] was expensive, and [[peripheral]]s were very slow. When the computer ran a program that needed access to a peripheral, the central processing unit (CPU) would have to stop executing program instructions while the peripheral processed the data. This was usually very inefficient. Multiprogramming is a computing technique that enables multiple programs to be concurrently loaded and executed into a computer's memory, allowing the CPU to switch between them swiftly. This optimizes CPU utilization by keeping it engaged with the execution of tasks, particularly useful when one program is waiting for I/O operations to complete.


The [[Bull Gamma 60]], initially designed in 1957 and first released in 1960, was the first computer designed with multiprogramming in mind. Its architecture featured a central memory and a Program Distributor feeding up to twenty-five autonomous processing units with code and data, and allowing concurrent operation of multiple clusters.
The [[Bull Gamma 60]], initially designed in 1957 and first released in 1960, was the first computer designed with multiprogramming in mind. Its architecture featured a central memory and a Program Distributor feeding up to twenty-five autonomous processing units with code and data, and allowing concurrent operation of multiple clusters.<ref>{{cite journal |last=Bataille |first=M. |date=1972-04-01 |title=Something old: the Gamma 60 the computer that was ahead of its time |journal=ACM SIGARCH Computer Architecture News |volume=1 |issue=2 |pages=10–15 |doi=10.1145/641276.641278 |issn=0163-5964}}</ref>


Another such computer was the [[LEO (computer)#Applications and successors|LEO III]], first released in 1961. During [[batch processing]], several different programs were loaded in the computer memory, and the first one began to run. When the first program reached an instruction waiting for a peripheral, the context of this program was stored away, and the second program in memory was given a chance to run. The process continued until all programs finished running.<ref>{{cite book|url=http://settle.ddns.net/LeoMan/Vol4P1.htm|title=MASTER PROGRAME AND PROGRAMME TRIALS SYSTEM PART 1 MASTER PROGRAMME SPECIFICATION|at=section 6 "PRIORITY CONTROL ROUTINES"|date=February 1965}}</ref>
Another such computer was the [[LEO (computer)#Applications and successors|LEO III]], first released in 1961. During [[batch processing]], several different programs were loaded in the computer memory, and the first one began to run. When the first program reached an instruction waiting for a peripheral, the context of this program was stored away, and the second program in memory was given a chance to run. The process continued until all programs finished running.<ref>{{cite book|url=http://settle.ddns.net/LeoMan/Vol4P1.htm|title=MASTER PROGRAME AND PROGRAMME TRIALS SYSTEM PART 1 MASTER PROGRAMME SPECIFICATION|at=section 6 "PRIORITY CONTROL ROUTINES"|date=February 1965}}</ref>
Line 39: Line 39:
== Preemptive multitasking ==
== Preemptive multitasking ==
{{Main|Preemption (computing)#Preemptive multitasking}}
{{Main|Preemption (computing)#Preemptive multitasking}}
[[File:Kubuntu_21.04_(KDE_Plasma_5)_-_Virtual_Desktops.png|thumb|Kubuntu (KDE Plasma 5) four [[Virtual desktop]]s running multiple programs at the same time]]
[[File:Kubuntu_21.04_(KDE_Plasma_5)_-_Virtual_Desktops.png|thumb|Kubuntu (KDE Plasma 5) four [[Virtual desktop]]s running multiple programs at the same time]]
Preemptive multitasking allows the computer system to more reliably guarantee to each process a regular "slice" of operating time. It also allows the system to deal rapidly with important external events like incoming data, which might require the immediate attention of one or another process.  Operating systems were developed to take advantage of these hardware capabilities and run multiple processes preemptively. Preemptive multitasking was implemented in [[TOPS-10|the PDP-6 Monitor]] and [[Multics]] in 1964, in [[OS/360 and successors#MFT|OS/360 MFT]] in 1967, and in [[Unix]] in 1969, and was available in [[PDP-8#Programming facilities|some operating systems]] for computers as small as DEC's PDP-8; it is a core feature of all [[Unix-like]] operating systems, such as [[Linux]], [[Solaris (operating system)|Solaris]] and [[Berkeley Software Distribution|BSD]] with its [[Comparison of BSD operating systems|derivatives]],<ref>{{cite web
Preemptive multitasking allows the computer system to more reliably guarantee to each process a regular "slice" of operating time. It also allows the system to deal rapidly with important external events like incoming data, which might require the immediate attention of one or another process.  Operating systems were developed to take advantage of these hardware capabilities and run multiple processes preemptively. Preemptive multitasking was implemented in [[TOPS-10|the PDP-6 Monitor]] and [[Multics]] in 1964, in [[OS/360 and successors#MFT|OS/360 MFT]] in 1967, and in [[Unix]] in 1969, and was available in [[PDP-8#Programming facilities|some operating systems]] for computers as small as DEC's PDP-8; it is a core feature of all [[Unix-like]] operating systems, such as [[Linux]], [[Solaris (operating system)|Solaris]] and [[Berkeley Software Distribution|BSD]] with its [[Comparison of BSD operating systems|derivatives]],<ref>{{cite web
Line 93: Line 94:
== Memory protection ==
== Memory protection ==
{{Main|Memory protection}}
{{Main|Memory protection}}
{{unsourced section|date=March 2025}}
{{unsourced section|date=March 2025}}
Essential to any multitasking system is to safely and effectively share access to system resources. Access to memory must be strictly managed to ensure that no process can inadvertently or deliberately read or write to memory locations outside the process's address space. This is done for the purpose of general system stability and data integrity, as well as data security.
Essential to any multitasking system is to safely and effectively share access to system resources. Access to memory must be strictly managed to ensure that no process can inadvertently or deliberately read or write to memory locations outside the process's address space. This is done for the purpose of general system stability and data integrity, as well as data security.