Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Operating system
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Software that manages computer hardware resources}} {{pp-vandalism|small=yes}} {{pp-move}} {{Use dmy dates|date=July 2015}} {{OS}} An '''operating system''' ('''OS''') is [[system software]] that manages [[computer hardware]] and [[software]] resources, and provides common [[daemon (computing)|services]] for [[computer program]]s. [[Time-sharing]] operating systems [[scheduler (computing)|schedule tasks]] for efficient use of the system and may also include accounting software for cost allocation of [[Scheduling (computing)|processor time]], [[mass storage]], peripherals, and other resources. For hardware functions such as [[input and output]] and [[memory allocation]], the operating system acts as an intermediary between programs and the computer hardware,<ref>{{cite book | last = Stallings | title = Operating Systems, Internals and Design Principles | publisher = Prentice Hall | year = 2005 | location = Pearson |page=6}}</ref><ref>{{cite book | last = Dhotre| first = I.A.| title = Operating Systems. | publisher = Technical Publications | year = 2009 |page=1}}</ref> although the application code is usually executed directly by the hardware and frequently makes [[system call]]s to an OS function or is [[interrupt]]ed by it. Operating systems are found on many devices that contain a computer{{snd}}from cellular phones and video game consoles to [[web server]]s and [[supercomputer]]s. {{as of|2024|09|}}, [[Android (operating system)|Android]] is the most popular operating system with a 46% market share, followed by [[Microsoft Windows]] at 26%, [[iOS]] and [[iPadOS]] at 18%, [[macOS]] at 5%, and [[Linux]] at 1%. Android, iOS, and iPadOS are mobile operating systems, while Windows, macOS, and Linux are desktop operating systems.<ref name="gs.statcounter.com">{{Cite web |title=Operating System Market Share Worldwide |url=https://gs.statcounter.com/os-market-share |access-date=2024-12-20 |website=StatCounter Global Stats |language=en}}</ref> [[Linux distribution]]s are dominant in the server and supercomputing sectors. Other specialized classes of operating systems (special-purpose operating systems),<ref name="auto">{{Cite web|url=https://www.oreilly.com/library/view/operating-system-concepts/9780471694663/pt07.html|title=VII. Special-Purpose Systems - Operating System Concepts, Seventh Edition [Book]|website=www.oreilly.com|access-date=8 February 2021|archive-date=13 June 2021|archive-url=https://web.archive.org/web/20210613190049/https://www.oreilly.com/library/view/operating-system-concepts/9780471694663/pt07.html|url-status=live}}</ref><ref>{{Cite web|url=https://www.acs.eonerc.rwth-aachen.de/cms/E-ON-ERC-ACS/Studium/Lehrveranstaltungen/~lrhs/Spezial-Betriebssysteme/?lidx=1|title=Special-Purpose Operating Systems - RWTH AACHEN UNIVERSITY Institute for Automation of Complex Power Systems - English|website=www.acs.eonerc.rwth-aachen.de|access-date=8 February 2021|archive-date=14 June 2021|archive-url=https://web.archive.org/web/20210614034001/https://www.acs.eonerc.rwth-aachen.de/cms/E-ON-ERC-ACS/Studium/Lehrveranstaltungen/~lrhs/Spezial-Betriebssysteme/?lidx=1|url-status=live}}</ref> such as [[Embedded system|embedded]] and real-time systems, exist for many applications. [[Security-focused operating system]]s also exist. Some operating systems have low system requirements (e.g. [[light-weight Linux distribution]]). Others may have higher system requirements. Some operating systems require installation or may come pre-installed with purchased computers ([[OEM]]-installation), whereas others may run directly from media (i.e. [[live CD]]) or flash memory (i.e. a LiveUSB from a [[USB flash drive|USB]] stick). ==Definition and purpose== An operating system is difficult to define,{{sfn|Tanenbaum|Bos|2023|p=4}} but has been called "the [[abstraction layer|layer of software]] that manages a computer's resources for its users and their [[Application software|application]]s".{{sfn|Anderson|Dahlin|2014|p=6}} Operating systems include the software that is always running, called a [[Kernel (operating system)|kernel]]—but can include other software as well.{{sfn|Tanenbaum|Bos|2023|p=4}}{{sfn|Silberschatz et al.|2018|p=6}} The two other types of programs that can run on a computer are [[System software|system program]]s—which are associated with the operating system, but may not be part of the kernel—and applications—all other software.{{sfn|Silberschatz et al.|2018|p=6}} There are three main purposes that an operating system fulfills:{{sfn|Anderson|Dahlin|2014|p=7}} *Operating systems allocate resources between different applications, deciding when they will receive [[central processing unit]] (CPU) time or space in [[computer memory|memory]].{{sfn|Anderson|Dahlin|2014|p=7}} On modern [[personal computer]]s, users often want to run several applications at once. In order to ensure that one program cannot monopolize the computer's limited hardware resources, the operating system gives each application a share of the resource, either in time (CPU) or space (memory).{{sfn|Anderson|Dahlin|2014|pp=9–10}}{{sfn|Tanenbaum|Bos|2023|pp=6-7}} The operating system also must isolate applications from each other to protect them from errors and security vulnerabilities in another application's code, but enable communications between different applications.{{sfn|Anderson|Dahlin|2014|p=10}} *Operating systems provide an interface that abstracts the details of accessing [[Computer hardware|hardware]] details (such as physical memory) to make things easier for programmers.{{sfn|Anderson|Dahlin|2014|p=7}}{{sfn|Tanenbaum|Bos|2023|p=5}} [[Virtualization]] also enables the operating system to mask limited hardware resources; for example, [[virtual memory]] can provide a program with the illusion of nearly unlimited memory that exceeds the computer's actual memory.{{sfn|Anderson|Dahlin|2014|p=11}} *Operating systems provide common services, such as an interface for accessing network and disk devices. This enables an application to be run on different hardware without needing to be rewritten.{{sfn|Anderson|Dahlin|2014|pp=7, 9, 13}} Which services to include in an operating system varies greatly, and this functionality makes up the great majority of code for most operating systems.{{sfn|Anderson|Dahlin|2014|pp=12–13}} ==Types of operating systems== ===Multicomputer operating systems=== With [[multiprocessor]]s multiple CPUs share memory. A [[multicomputer]] or [[cluster computer]] has multiple CPUs, each of which [[distributed memory|has its own memory]]. Multicomputers were developed because large multiprocessors are difficult to engineer and prohibitively expensive;{{sfn|Tanenbaum|Bos|2023|p=557}} they are universal in [[cloud computing]] because of the size of the machine needed.{{sfn|Tanenbaum|Bos|2023|p=558}} The different CPUs often need to send and receive messages to each other;{{sfn|Tanenbaum|Bos|2023|p=565}} to ensure good performance, the operating systems for these machines need to minimize this copying of [[Network packet|packet]]s.{{sfn|Tanenbaum|Bos|2023|p=562}} Newer systems are often [[multiqueue]]—separating groups of users into separate [[Priority queue|queue]]s—to reduce the need for packet copying and support more concurrent users.{{sfn|Tanenbaum|Bos|2023|p=563}} Another technique is [[remote direct memory access]], which enables each CPU to access memory belonging to other CPUs.{{sfn|Tanenbaum|Bos|2023|p=565}} Multicomputer operating systems often support [[remote procedure call]]s where a CPU can call a [[Procedural programming|procedure]] on another CPU,{{sfn|Tanenbaum|Bos|2023|p=569}} or [[distributed shared memory]], in which the operating system uses [[virtualization]] to generate shared memory that does not physically exist.{{sfn|Tanenbaum|Bos|2023|p=571}} ===Distributed systems=== A [[distributed system]] is a group of distinct, [[Computer network|networked]] computers—each of which might have their own operating system and file system. Unlike multicomputers, they may be dispersed anywhere in the world.{{sfn|Tanenbaum|Bos|2023|p=579}} [[Middleware]], an additional software layer between the operating system and applications, is often used to improve consistency. Although it functions similarly to an operating system, it is not a true operating system.{{sfn|Tanenbaum|Bos|2023|p=581}} ===Embedded=== [[Embedded operating system]]s are designed to be used in [[Embedded system|embedded computer systems]], whether they are [[internet of things]] objects or not connected to a network. Embedded systems include many household appliances. The distinguishing factor is that they do not load user-installed software. Consequently, they do not need protection between different applications, enabling simpler designs. Very small operating systems might run in less than 10 [[kilobytes]],{{sfn|Tanenbaum|Bos|2023|pp=37-38}} and the smallest are for [[smart cards]].{{sfn|Tanenbaum|Bos|2023|p=39}} Examples include [[Embedded Linux]], [[QNX]], [[VxWorks]], and the extra-small systems [[RIOT (operating system)|RIOT]] and [[TinyOS]].{{sfn|Tanenbaum|Bos|2023|p=38}} ===Real-time=== A [[real-time operating system]] is an operating system that guarantees to process [[Event (computing)|events]] or data by or at a specific moment in time. Hard real-time systems require exact timing and are common in [[manufacturing]], [[avionics]], military, and other similar uses.{{sfn|Tanenbaum|Bos|2023|p=38}} With soft real-time systems, the occasional missed event is acceptable; this category often includes audio or multimedia systems, as well as smartphones.{{sfn|Tanenbaum|Bos|2023|p=38}} In order for hard real-time systems be sufficiently exact in their timing, often they are just a library with no protection between applications, such as [[eCos]].{{sfn|Tanenbaum|Bos|2023|p=38}} ===Hypervisor=== A [[hypervisor]] is an operating system that runs a [[virtual machine]]. The virtual machine is unaware that it is an application and operates as if it had its own hardware.{{sfn|Anderson|Dahlin|2014|p=11}}{{sfn|Silberschatz et al.|2018|pp=701}} Virtual machines can be paused, saved, and resumed, making them useful for operating systems research, development,{{sfn|Silberschatz et al.|2018|pp=705}} and debugging.{{sfn|Anderson|Dahlin|2014|p=12}} They also enhance portability by enabling applications to be run on a computer even if they are not compatible with the base operating system.{{sfn|Anderson|Dahlin|2014|p=11}} ===Library=== A ''library operating system'' (libOS) is one in which the services that a typical operating system provides, such as networking, are provided in the form of [[Library (computing)|libraries]] and composed with a single application and configuration code to construct a [[unikernel]]: <ref name="Unikernels">{{cite magazine |last1=Madhavapeddy |first1=Anil |last2=Scott |first2=David J |date=November 2013 |title=Unikernels: Rise of the Virtual Library Operating System: What if all the software layers in a virtual appliance were compiled within the same safe, high-level language framework? |magazine=Queue |volume=11 |issue=11 |pages=30–44 |location=New York, NY, USA |publisher=ACM |issn=1542-7730 |url=https://doi.org/10.1145/2557963.2566628 |doi=10.1145/2557963.2566628 |access-date=2024-08-07 }}</ref> a specialized (only the absolute necessary pieces of code are extracted from libraries and bound together <ref name="Unikraft-Build-Process">{{cite web |url=https://unikraft.org/docs/concepts/build-process |access-date=2024-08-08 |title=Build Process - Unikraft |archive-date=2024-04-22 |archive-url=https://web.archive.org/web/20240422183734/https://unikraft.org/docs/concepts/build-process |url-status=live }}</ref>), [[Single address space operating system|single address space]], machine image that can be deployed to cloud or embedded environments. The operating system code and application code are not executed in separated [[Protection ring|protection domains]] (there is only a single application running, at least conceptually, so there is no need to prevent interference between applications) and OS services are accessed via simple library calls (potentially [[Inline expansion|inlining]] them based on compiler thresholds), without the usual overhead of [[context switch]]es, <ref name="rise-of-libOS">{{cite web |url=https://www.sigarch.org/leave-your-os-at-home-the-rise-of-library-operating-systems/ |access-date=2024-08-07 |title=Leave your OS at home: the rise of library operating systems |date=2017-09-14 |publisher=[[ACM SIGARCH]] |archive-date=2024-03-01 |archive-url=https://web.archive.org/web/20240301072916/https://www.sigarch.org/leave-your-os-at-home-the-rise-of-library-operating-systems/ |url-status=live }}</ref> in a way similarly to embedded and real-time OSes. Note that this overhead is not negligible: to the direct cost of mode switching it's necessary to add the indirect pollution of important processor structures (like [[CPU cache]]s, the [[Instruction pipelining|instruction pipeline]], and so on) which affects both user-mode and kernel-mode performance. <ref name="FlexSC">{{cite conference |url=https://www.usenix.org/conference/osdi10/flexsc-flexible-system-call-scheduling-exception-less-system-calls |title=FlexSC: Flexible System Call Scheduling with Exception-Less System Calls |last1=Soares |first1=Livio Baldini <!-- https://liviosoares.github.io/ --> |last2=Stumm |first2=Michael <!-- https://www.eecg.toronto.edu/~stumm/index.html --> |date=2010-10-04 |conference=OSDI '10, 9th USENIX Symposium on Operating System Design and Implementation |conference-url=https://www.usenix.org/legacy/events/osdi10/ |publisher=[[USENIX]] |access-date=2024-08-09 |quote=Synchronous implementation of system calls negatively impacts the performance of system intensive workloads, both in terms of the ''direct'' costs of mode switching and, more interestingly, in terms of the ''indirect'' pollution of important processor structures which affects both user-mode and kernel-mode performance. A motivating example that quantifies the impact of system call pollution on application performance can be seen in Figure 1. It depicts the user-mode instructions per cycles (kernel cycles and instructions are ignored) of one of the SPEC CPU 2006 benchmarks (Xalan) immediately before and after a <code>pwrite</code> system call. There is a significant drop in instructions per cycle (IPC) due to the system call, and it takes up to 14,000 cycles of execution before the IPC of this application returns to its previous level. As we will show, this performance degradation is mainly due to interference caused by the kernel on key processor structures. |quote-page=2 }}</ref> ==History== {{Main|History of operating systems}} [[File:IBM system 360-50 console - MfK Bern.jpg|thumb|IBM System/360 Model 50 operator's console and CPU; the operator's console is a [[computer terminal|terminal]] used by the operating system to communicate with the operator.]] The first computers in the late 1940s and 1950s were directly programmed either with [[plugboard]]s or with [[machine code]] inputted on media such as [[punch card]]s, without [[programming language]]s or operating systems.{{sfn|Tanenbaum|Bos|2023|p=8}} After the introduction of the [[transistor]] in the mid-1950s, [[mainframe]]s began to be built. These still needed professional operators{{sfn|Tanenbaum|Bos|2023|p=8}} who manually do what a modern operating system would do, such as scheduling programs to run,<ref name="OSTEP book">{{cite book |last1=Arpaci-Dusseau |first1=Remzi |last2=Arpaci-Dusseau |first2=Andrea |year=2015 |url=http://pages.cs.wisc.edu/~remzi/OSTEP/ |title=Operating Systems: Three Easy Pieces |access-date=25 July 2016 |archive-date=25 July 2016 |archive-url=https://web.archive.org/web/20160725012948/http://pages.cs.wisc.edu/~remzi/OSTEP/ |url-status=live }}</ref> but mainframes still had rudimentary operating systems such as [[Fortran Monitor System]] (FMS) and [[IBSYS]].{{sfn|Tanenbaum|Bos|2023|p=10}} In the 1960s, [[IBM]] introduced the first series of intercompatible computers ([[System/360]]). All of them ran the same operating system—[[OS/360]]—which consisted of millions of lines of [[assembly language]] that had thousands of [[Software bug|bug]]s. The OS/360 also was the first popular operating system to support [[multiprogramming]], such that the CPU could be put to use on one job while another was waiting on [[input/output]] (I/O). Holding multiple jobs in [[memory (computing)|memory]] necessitated memory partitioning and safeguards against one job accessing the memory allocated to a different one.{{sfn|Tanenbaum|Bos|2023|pp=11–12}} Around the same time, [[teleprinter]]s began to be used as [[computer terminal|terminal]]s so multiple users could access the computer simultaneously. The operating system [[MULTICS]] was intended to allow hundreds of users to access a large computer. Despite its limited adoption, it can be considered the precursor to [[cloud computing]]. The [[UNIX]] operating system originated as a development of MULTICS for a single user.{{sfn|Tanenbaum|Bos|2023|pp=13–14}} Because UNIX's [[source code]] was available, it became the basis of other, incompatible operating systems, of which the most successful were [[AT&T]]'s [[System V]] and the [[University of California]]'s [[Berkeley Software Distribution]] (BSD).{{sfn|Tanenbaum|Bos|2023|pp=14–15}} To increase compatibility, the [[IEEE]] released the [[POSIX]] standard for operating system [[application programming interface]]s (APIs), which is supported by most UNIX systems. [[MINIX]] was a stripped-down version of UNIX, developed in 1987 for educational uses, that inspired the commercially available, [[free software]] [[Linux]]. Since 2008, MINIX is used in controllers of most [[Intel]] [[microchips]], while Linux is widespread in [[data center]]s and [[Android (operating system)|Android]] smartphones.{{sfn|Tanenbaum|Bos|2023|p=15}} ===Microcomputers=== [[File:MS-Dos screenshot.png|thumb|[[Command-line interface]] of the [[MS-DOS]] operating system]] [[File:System 1 File Edit.png|thumb|[[Graphical user interface]] of a [[Macintosh]]]] The invention of [[large scale integration]] enabled the production of [[personal computer]]s (initially called [[microcomputer]]s) from around 1980.{{sfn|Tanenbaum|Bos|2023|pp=15–16}} For around five years, the [[CP/M]] (Control Program for Microcomputers) was the most popular operating system for microcomputers.{{sfn|Tanenbaum|Bos|2023|p=16}} Later, IBM bought the [[DOS]] (Disk Operating System) from [[Microsoft]]. After modifications requested by IBM, the resulting system was called [[MS-DOS]] ({{not a typo|Micro|Soft}} Disk Operating System) and was widely used on IBM microcomputers. Later versions increased their sophistication, in part by borrowing features from UNIX.{{sfn|Tanenbaum|Bos|2023|p=16}} [[Apple Inc.|Apple]]'s [[Macintosh]] was the first popular computer to use a [[graphical user interface]] (GUI). The GUI proved much more [[user friendly]] than the text-only [[command-line interface]] earlier operating systems had used. Following the success of Macintosh, MS-DOS was updated with a GUI overlay called [[Windows]]. Windows later was rewritten as a stand-alone operating system, borrowing so many features from another ([[VAX VMS]]) that a large [[legal settlement]] was paid.{{sfn|Tanenbaum|Bos|2023|p=17}} In the twenty-first century, Windows continues to be popular on personal computers but has less [[market share]] of servers. UNIX operating systems, especially Linux, are the most popular on [[enterprise system]]s and servers but are also used on [[mobile device]]s and many other computer systems.{{sfn|Tanenbaum|Bos|2023|p=18}} On mobile devices, [[Symbian OS]] was dominant at first, being usurped by [[BlackBerry OS]] (introduced 2002) and [[iOS]] for [[iPhone]]s (from 2007). Later on, the open-source [[Android (operating system)|Android]] operating system (introduced 2008), with a Linux kernel and a C library ([[Bionic (software)|Bionic]]) partially based on BSD code, became most popular.{{sfn|Tanenbaum|Bos|2023|pp=19–20}} ==Components== The components of an operating system are designed to ensure that various parts of a computer function cohesively. With the de facto obsoletion of [[Disk Operating System|DOS]], all user [[software]] must interact with the operating system to access hardware. ===Kernel=== {{Main|Kernel (operating system)}} [[File:Kernel Layout.svg|thumb|A kernel connects the application software to the hardware of a computer.]] The kernel is the part of the operating system that provides [[protection ring|protection]] between different applications and users. This protection is key to improving reliability by keeping errors isolated to one program, as well as security by limiting the power of [[malicious software]] and protecting private data, and ensuring that one program cannot monopolize the computer's resources.{{sfn|Anderson|Dahlin|2014|pp=39–40}} Most operating systems have two modes of operation:{{sfn|Tanenbaum|Bos|2023|p=2}} in [[user mode]], the hardware checks that the software is only executing legal instructions, whereas the kernel has [[Privilege (computing)|unrestricted powers]] and is not subject to these checks.{{sfn|Anderson|Dahlin|2014|pp=41, 45}} The kernel also manages [[Random-access memory|memory]] for other processes and controls access to [[input/output]] devices.{{sfn|Anderson|Dahlin|2014|pp=52-53}} ====Program execution==== The operating system provides an interface between an application program and the computer hardware, so that an application program can interact with the hardware only by obeying rules and procedures programmed into the operating system. The operating system is also a set of services which simplify development and execution of application programs. Executing an application program typically involves the creation of a [[Process (computing)|process]] by the operating system [[kernel (operating system)|kernel]], which assigns memory space and other resources, establishes a priority for the process in multi-tasking systems, loads program binary code into memory, and initiates execution of the application program, which then interacts with the user and with hardware devices. However, in some systems an application can request that the operating system execute another application within the same process, either as a subroutine or in a separate thread, e.g., the '''LINK''' and '''ATTACH''' facilities of [[OS/360 and successors]]. ====Interrupts==== {{Main|Interrupt}} An [[interrupt]] (also known as an [[Abort (computing)|abort]], [[Exception handling|exception]], ''fault'', [[Signal (IPC)|signal]],<ref name="lpi-ch20-p388_quote1">{{cite book | last = Kerrisk | first = Michael | title = The Linux Programming Interface | publisher = No Starch Press | year = 2010 | page = 388 | isbn = 978-1-59327-220-3 | quote = A signal is a notification to a process that an event has occurred. Signals are sometimes described as software interrupts. }}</ref> or ''trap'')<ref name="Hyde_1996">{{cite book |last1 = Hyde |first1 = Randall |chapter-url = https://www.plantation-productions.com/Webster/www.artofasm.com/DOS/ch17/CH17-1.html#HEADING1-0 |access-date = 22 December 2021 |date = 1996 |title = The Art Of Assembly Language Programming |chapter = Chapter Seventeen: Interrupts, Traps and Exceptions (Part 1) |publisher = No Starch Press |quote = The concept of an interrupt is something that has expanded in scope over the years. The 80x86 family has only added to the confusion surrounding interrupts by introducing the int (software interrupt) instruction. Indeed, different manufacturers have used terms like exceptions, faults, aborts, traps and interrupts to describe the phenomena this chapter discusses. Unfortunately there is no clear consensus as to the exact meaning of these terms. Different authors adopt different terms to their own use. |archive-date = 22 December 2021 |archive-url = https://web.archive.org/web/20211222205623/https://www.plantation-productions.com/Webster/www.artofasm.com/DOS/ch17/CH17-1.html#HEADING1-0 |url-status = live }}</ref> provides an efficient way for most operating systems to react to the environment. Interrupts cause the [[central processing unit]] (CPU) to have a [[control flow]] change away from the currently running program to an [[interrupt handler]], also known as an interrupt service routine (ISR).<ref name="sco-ch5-p308_a">{{cite book | last = Tanenbaum | first = Andrew S. | title = Structured Computer Organization, Third Edition | publisher = Prentice Hall | year = 1990 | page = [https://archive.org/details/structuredcomput00tane/page/308 308] | isbn = 978-0-13-854662-5 | url = https://archive.org/details/structuredcomput00tane/page/308 | quote = Like the trap, the interrupt stops the running program and transfers control to an interrupt handler, which performs some appropriate action. When finished, the interrupt handler returns control to the interrupted program. }}</ref><ref name="osc-ch2-p32_a">{{cite book | last = Silberschatz | first = Abraham | title = Operating System Concepts, Fourth Edition | publisher = Addison-Wesley | year = 1994 | page = 32 | isbn = 978-0-201-50480-4 | quote = When an interrupt (or trap) occurs, the hardware transfers control to the operating system. First, the operating system preserves the state of the CPU by storing registers and the program counter. Then, it determines which type of interrupt has occurred. For each type of interrupt, separate segments of code in the operating system determine what action should be taken.}}</ref> An interrupt service routine may cause the [[central processing unit]] (CPU) to have a [[context switch]].<ref name="osc-ch4-p105">{{cite book | last = Silberschatz | first = Abraham | title = Operating System Concepts, Fourth Edition | publisher = Addison-Wesley | year = 1994 | page = 105 | isbn = 978-0-201-50480-4 | quote = Switching the CPU to another process requires saving the state of the old process and loading the saved state for the new process. This task is known as a context switch.}}</ref>{{efn|Modern CPUs provide instructions (e.g. SYSENTER) to invoke selected kernel services without an interrupts. Visit https://wiki.osdev.org/SYSENTER for more information.}} The details of how a computer processes an interrupt vary from architecture to architecture, and the details of how interrupt service routines behave vary from operating system to operating system.<ref name="osc-ch2-p31">{{cite book | last = Silberschatz | first = Abraham | title = Operating System Concepts, Fourth Edition | publisher = Addison-Wesley | year = 1994 | page = 31 | isbn = 978-0-201-50480-4 }}</ref> However, several interrupt functions are common.<ref name="osc-ch2-p31"/> The architecture and operating system must:<ref name="osc-ch2-p31"/> # transfer control to an interrupt service routine. # save the state of the currently running process. # restore the state after the interrupt is serviced. =====Software interrupt===== A software interrupt is a message to a [[Process (computing)|process]] that an event has occurred.<ref name="lpi-ch20-p388_quote1"/> This contrasts with a ''hardware interrupt'' — which is a message to the [[central processing unit]] (CPU) that an event has occurred.<ref name="osc-ch2-p30">{{cite book | last = Silberschatz | first = Abraham | title = Operating System Concepts, Fourth Edition | publisher = Addison-Wesley | year = 1994 | page = 30 | isbn = 978-0-201-50480-4 | quote = Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually by way of the system bus. }}</ref> Software interrupts are similar to hardware interrupts — there is a change away from the currently running process.<ref name="lpi-ch20-p388_quote2">{{cite book | last = Kerrisk | first = Michael | title = The Linux Programming Interface | publisher = No Starch Press | year = 2010 | page = 388 | isbn = 978-1-59327-220-3 | quote = Signals are analogous to hardware interrupts in that they interrupt the normal flow of execution of a program; in most cases, it is not possible to predict exactly when a signal will arrive. }}</ref> Similarly, both hardware and software interrupts execute an [[Interrupt handler|interrupt service routine]]. Software interrupts may be normally occurring events. It is expected that a [[Preemption (computing)#Time slice|time slice]] will occur, so the kernel will have to perform a [[context switch]].<ref name="lpi-ch20-p388_quote3">{{cite book | last = Kerrisk | first = Michael | title = The Linux Programming Interface | publisher = No Starch Press | year = 2010 | page = 388 | isbn = 978-1-59327-220-3 | quote = Among the types of events that cause the kernel to generate a signal for a process are the following: A software event occurred. For example, ... the process's CPU time limit was exceeded[.] }}</ref> A [[computer program]] may set a timer to go off after a few seconds in case too much data causes an algorithm to take too long.<ref name="lpi-ch20-p388">{{cite book | last = Kerrisk | first = Michael | title = The Linux Programming Interface | publisher = No Starch Press | year = 2010 | page = 388 | isbn = 978-1-59327-220-3 }}</ref> Software interrupts may be error conditions, such as a malformed [[machine code|machine instruction]].<ref name="lpi-ch20-p388"/> However, the most common error conditions are [[division by zero]] and [[segmentation fault|accessing an invalid memory address]].<ref name="lpi-ch20-p388"/> [[User (computing)|Users]] can send messages to the kernel to modify the behavior of a currently running process.<ref name="lpi-ch20-p388"/> For example, in the [[Command-line interface|command-line environment]], pressing the ''interrupt character'' (usually [[Control-C]]) might terminate the currently running process.<ref name="lpi-ch20-p388"/> To generate ''software interrupts'' for [[x86]] CPUs, the [[INT (x86 instruction)|INT]] [[assembly language]] instruction is available.<ref name="intel-developer">{{cite web |url=https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf |access-date=2022-05-05 |title=Intel® 64 and IA-32 Architectures Software Developer's Manual |volume=2 |date=September 2016 |publisher=[[Intel Corporation]] |page=610 |archive-date=23 March 2022 |archive-url=https://web.archive.org/web/20220323231921/https://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-instruction-set-reference-manual-325383.pdf |url-status=live }}</ref> The syntax is <code>INT X</code>, where <code>X</code> is the offset number (in [[hexadecimal]] format) to the [[interrupt vector table]]. =====Signal===== To generate ''software interrupts'' in [[Unix-like]] operating systems, the <code>kill(pid,signum)</code> [[system call]] will send a [[Signal (IPC)|signal]] to another process.<ref name="duos-p200">{{cite book | last = Bach | first = Maurice J. | title = The Design of the UNIX Operating System | publisher = Prentice-Hall | year = 1986 | page = 200 | isbn = 0-13-201799-7 }}</ref> <code>pid</code> is the [[process identifier]] of the receiving process. <code>signum</code> is the signal number (in [[mnemonic]] format){{efn|Examples include [[Signal (IPC)#SIGINT|SIGINT]], [[SIGSEGV]], and [[SIGBUS]].}} to be sent. (The abrasive name of <code>kill</code> was chosen because early implementations only terminated the process.)<ref name="lpi-ch20-p400">{{cite book | last = Kerrisk | first = Michael | title = The Linux Programming Interface | publisher = No Starch Press | year = 2010 | page = 400 | isbn = 978-1-59327-220-3 }}</ref> In Unix-like operating systems, ''signals'' inform processes of the occurrence of asynchronous events.<ref name="duos-p200"/> To communicate asynchronously, interrupts are required.<ref name="sco-ch5-p308_b">{{cite book | last = Tanenbaum | first = Andrew S. | title = Structured Computer Organization, Third Edition | publisher = Prentice Hall | year = 1990 | page = [https://archive.org/details/structuredcomput00tane/page/308 308] | isbn = 978-0-13-854662-5 | url = https://archive.org/details/structuredcomput00tane/page/308 }}</ref> One reason a process needs to asynchronously communicate to another process solves a variation of the classic [[Readers–writers problem|reader/writer problem]].<ref name="osc-p182">{{cite book | last = Silberschatz | first = Abraham | title = Operating System Concepts, Fourth Edition | publisher = Addison-Wesley | year = 1994 | page = 182 | isbn = 978-0-201-50480-4 }}</ref> The writer receives a pipe from the [[Shell (computing)|shell]] for its output to be sent to the reader's input stream.<ref name="usp-ch6-p153">{{cite book | last1 = Haviland | first1 = Keith | last2 = Salama | first2 = Ben | title = UNIX System Programming | publisher = Addison-Wesley Publishing Company | year = 1987 | page = 153 | isbn = 0-201-12919-1 }}</ref> The [[Command-line interface|command-line]] syntax is <code>alpha | bravo</code>. <code>alpha</code> will write to the pipe when its computation is ready and then sleep in the wait queue.<ref name="usp-ch6-p148">{{cite book | last1 = Haviland | first1 = Keith | last2 = Salama | first2 = Ben | title = UNIX System Programming | publisher = Addison-Wesley Publishing Company | year = 1987 | page = 148 | isbn = 0-201-12919-1 }}</ref> <code>bravo</code> will then be moved to the [[Multilevel feedback queue|ready queue]] and soon will read from its input stream.<ref name="usp-ch6-p149">{{cite book | last1 = Haviland | first1 = Keith | last2 = Salama | first2 = Ben | title = UNIX System Programming | publisher = Addison-Wesley Publishing Company | year = 1987 | page = 149 | isbn = 0-201-12919-1 }}</ref> The kernel will generate ''software interrupts'' to coordinate the piping.<ref name="usp-ch6-p149"/> ''Signals'' may be classified into 7 categories.<ref name="duos-p200"/> The categories are: # when a process finishes normally. # when a process has an error exception. # when a process runs out of a system resource. # when a process executes an illegal instruction. # when a process sets an alarm event. # when a process is aborted from the keyboard. # when a process has a tracing alert for debugging. =====Hardware interrupt===== [[Input/output]] (I/O) [[Peripheral|devices]] are slower than the CPU. Therefore, it would slow down the computer if the CPU had to [[Busy waiting|wait]] for each I/O to finish. Instead, a computer may implement interrupts for I/O completion, avoiding the need for [[Polling (computer science)|polling]] or busy waiting.<ref name="sco-ch5-p292">{{cite book | last = Tanenbaum | first = Andrew S. | title = Structured Computer Organization, Third Edition | publisher = Prentice Hall | year = 1990 | page = [https://archive.org/details/structuredcomput00tane/page/292 292] | isbn = 978-0-13-854662-5 | url = https://archive.org/details/structuredcomput00tane/page/292 }}</ref> Some computers require an interrupt for each character or word, costing a significant amount of CPU time. [[Direct memory access]] (DMA) is an architecture feature to allow devices to bypass the CPU and access [[random-access memory|main memory]] directly.<ref name=A22-6821-7-storage>{{cite book |author = IBM |title = IBM System/360 Principles of Operation |date = September 1968 |version = Eighth Edition |url = http://bitsavers.org/pdf/ibm/360/princOps/A22-6821-7_360PrincOpsDec67.pdf |section = Main Storage |section-url = http://bitsavers.org/pdf/ibm/360/princOps/A22-6821-7_360PrincOpsDec67.pdf#page=8 |mode = cs2 |page = 7 |access-date = 13 April 2022 |archive-date = 19 March 2022 |archive-url = https://web.archive.org/web/20220319083255/http://bitsavers.org/pdf/ibm/360/princOps/A22-6821-7_360PrincOpsDec67.pdf |url-status = live }}</ref> (Separate from the architecture, a device may perform direct memory access{{efn|often in the form of a DMA chip for smaller systems and I/O channels for larger systems}} to and from main memory either directly or via a bus.)<ref name="sco-ch5-p294"> {{cite book | last = Tanenbaum | first = Andrew S. | title = Structured Computer Organization, Third Edition | publisher = Prentice Hall | year = 1990 | page = [https://archive.org/details/structuredcomput00tane/page/294 294] | isbn = 978-0-13-854662-5 | url = https://archive.org/details/structuredcomput00tane/page/294 }}</ref>{{efn|Modern [[motherboard]]s have a DMA controller. Additionally, a device may also have one. Visit [[SCSI RDMA Protocol]].}} ====Input/output==== =====Interrupt-driven I/O===== {{Expand section|date=April 2022}} When a [[user (computing)|computer user]] types a key on the keyboard, typically the character appears immediately on the screen. Likewise, when a user moves a [[computer mouse|mouse]], the [[Cursor (user interface)|cursor]] immediately moves across the screen. Each keystroke and mouse movement generates an ''interrupt'' called ''Interrupt-driven I/O''. An interrupt-driven I/O occurs when a process causes an interrupt for every character<ref name="sco-ch5-p294"/> or word<ref>{{cite book |title = Users Handbook - PDP-7 |id = F-75 |year = 1965 |url = http://bitsavers.org/pdf/dec/pdp7/F-75_PDP-7userHbk_Jun65.pdf |section = Program Interrupt Controller (PIC) |section-url = http://bitsavers.org/pdf/dec/pdp7/F-75_PDP-7userHbk_Jun65.pdf#page=62 |pages = [http://bitsavers.org/pdf/dec/pdp7/F-75_PDP-7userHbk_Jun65.pdf#page=63 48] |publisher = [[Digital Equipment Corporation]] |access-date = April 20, 2022 |archive-date = 10 May 2022 |archive-url = https://web.archive.org/web/20220510164742/http://bitsavers.org/pdf/dec/pdp7/F-75_PDP-7userHbk_Jun65.pdf |url-status = live }}</ref> transmitted. =====Direct memory access===== Devices such as [[hard disk drive]]s, [[solid-state drive]]s, and [[magnetic tape]] drives can transfer data at a rate high enough that interrupting the CPU for every byte or word transferred, and having the CPU transfer the byte or word between the device and memory, would require too much CPU time. Data is, instead, transferred between the device and memory independently of the CPU by hardware such as a [[channel I/O|channel]] or a [[direct memory access]] controller; an interrupt is delivered only when all the data is transferred.<ref>{{cite book|url=http://bitsavers.org/pdf/dec/pdp1/F25_PDP1_IO.pdf|title=PDP-1 Input-Output Systems Manual|publisher=[[Digital Equipment Corporation]]|pages=19–20|access-date=16 August 2022|archive-date=25 January 2019|archive-url=https://web.archive.org/web/20190125050839/http://bitsavers.org/pdf/dec/pdp1/F25_PDP1_IO.pdf|url-status=live}}</ref> If a [[computer program]] executes a [[system call]] to perform a block I/O ''write'' operation, then the system call might execute the following instructions: * Set the contents of the CPU's [[Processor register|registers]] (including the [[program counter]]) into the [[process control block]].<ref name="osc-ch2-p32_b">{{cite book | last = Silberschatz | first = Abraham | title = Operating System Concepts, Fourth Edition | publisher = Addison-Wesley | year = 1994 | page = 32 | isbn = 978-0-201-50480-4 }}</ref> * Create an entry in the device-status table.<ref name="osc-ch2-p34">{{cite book | last = Silberschatz | first = Abraham | title = Operating System Concepts, Fourth Edition | publisher = Addison-Wesley | year = 1994 | page = 34 | isbn = 978-0-201-50480-4 }}</ref> The operating system maintains this table to keep track of which processes are waiting for which devices. One field in the table is the [[memory address]] of the process control block. * Place all the characters to be sent to the device into a [[random-access memory|memory buffer]].<ref name="sco-ch5-p308_b"/> * Set the memory address of the memory buffer to a predetermined device register.<ref name="sco-ch5-p295">{{cite book | last = Tanenbaum | first = Andrew S. | title = Structured Computer Organization, Third Edition | publisher = Prentice Hall | year = 1990 | page = [https://archive.org/details/structuredcomput00tane/page/295 295] | isbn = 978-0-13-854662-5 | url = https://archive.org/details/structuredcomput00tane/page/295 }}</ref> * Set the buffer size (an integer) to another predetermined register.<ref name="sco-ch5-p295"/> * Execute the [[machine code|machine instruction]] to begin the writing. * Perform a [[context switch]] to the next process in the [[multilevel feedback queue|ready queue]]. While the writing takes place, the operating system will context switch to other processes as normal. When the device finishes writing, the device will ''interrupt'' the currently running process by ''asserting'' an [[Interrupt request (PC architecture)|interrupt request]]. The device will also place an integer onto the data bus.<ref name="sco-ch5-p309">{{cite book | last = Tanenbaum | first = Andrew S. | title = Structured Computer Organization, Third Edition | publisher = Prentice Hall | year = 1990 | page = [https://archive.org/details/structuredcomput00tane/page/309 309] | isbn = 978-0-13-854662-5 | url = https://archive.org/details/structuredcomput00tane/page/309 }}</ref> Upon accepting the interrupt request, the operating system will: * Push the contents of the [[program counter]] (a register) followed by the [[status register]] onto the [[call stack]].<ref name="osc-ch2-p31"/> * Push the contents of the other registers onto the call stack. (Alternatively, the contents of the registers may be placed in a system table.)<ref name="sco-ch5-p309"/> * Read the integer from the data bus. The integer is an offset to the [[interrupt vector table]]. The vector table's instructions will then: :* Access the device-status table. :* Extract the process control block. :* Perform a context switch back to the writing process. When the writing process has its [[Preemption (computing)#time slice|time slice]] expired, the operating system will:<ref name="sco-ch5-p310">{{cite book | last = Tanenbaum | first = Andrew S. | title = Structured Computer Organization, Third Edition | publisher = Prentice Hall | year = 1990 | page = [https://archive.org/details/structuredcomput00tane/page/310 310] | isbn = 978-0-13-854662-5 | url = https://archive.org/details/structuredcomput00tane/page/310 }}</ref> * Pop from the call stack the registers other than the status register and program counter. * Pop from the call stack the status register. * Pop from the call stack the address of the next instruction, and set it back into the program counter. With the program counter now reset, the interrupted process will resume its time slice.<ref name="osc-ch2-p31"/> ====Memory management==== {{Main|Memory management}} Among other things, a multiprogramming operating system [[kernel (operating system)|kernel]] must be responsible for managing all system memory which is currently in use by the programs. This ensures that a program does not interfere with memory already in use by another program. Since programs time share, each program must have independent access to memory. Cooperative memory management, used by many early operating systems, assumes that all programs make voluntary use of the [[kernel (operating system)|kernel]]'s memory manager, and do not exceed their allocated memory. This system of memory management is almost never seen anymore, since programs often contain bugs which can cause them to exceed their allocated memory. If a program fails, it may cause memory used by one or more other programs to be affected or overwritten. Malicious programs or viruses may purposefully alter another program's memory, or may affect the operation of the operating system itself. With cooperative memory management, it takes only one misbehaved program to [[Crash (computing)|crash]] the system. [[Memory protection]] enables the [[kernel (operating system)|kernel]] to limit a process' access to the computer's memory. Various methods of memory protection exist, including [[memory segmentation]] and [[paging]]. All methods require some level of hardware support (such as the [[80286]] MMU), which does not exist in all computers. In both segmentation and paging, certain [[protected mode]] registers specify to the CPU what memory address it should allow a running program to access. Attempts to access other addresses trigger an interrupt, which causes the CPU to re-enter [[supervisor mode]], placing the [[kernel (operating system)|kernel]] in charge. This is called a [[segmentation violation]] or Seg-V for short, and since it is both difficult to assign a meaningful result to such an operation, and because it is usually a sign of a misbehaving program, the [[kernel (operating system)|kernel]] generally resorts to terminating the offending program, and reports the error. Windows versions 3.1 through ME had some level of memory protection, but programs could easily circumvent the need to use it. A [[general protection fault]] would be produced, indicating a segmentation violation had occurred; however, the system would often crash anyway. ====Virtual memory==== {{Main|Virtual memory}} {{Further|Page fault}} [[File:Virtual memory.svg|thumb|250px|Many operating systems can "trick" programs into using memory scattered around the hard disk and RAM as if it is one continuous chunk of memory, called virtual memory.]] The use of virtual memory addressing (such as paging or segmentation) means that the kernel can choose what memory each program may use at any given time, allowing the operating system to use the same memory locations for multiple tasks. If a program tries to access memory that is not accessible{{efn|There are several reasons that the memory might be inaccessible * The address might be out of range * The address might refer to a page or segment that has been moved to a backing store * The address might refer to memory that has restricted access due to, e.g., [[Memory protection#Protection keys|key]], [[Memory protection#Protection rings|ring]].}} memory, but nonetheless has been allocated to it, the kernel is interrupted {{See above|{{Section link||Memory management}}}}. This kind of interrupt is typically a [[page fault]]. When the kernel detects a page fault it generally adjusts the virtual memory range of the program which triggered it, granting it access to the memory requested. This gives the kernel discretionary power over where a particular application's memory is stored, or even whether or not it has been allocated yet. In modern operating systems, memory which is accessed less frequently can be temporarily stored on a disk or other media to make that space available for use by other programs. This is called [[paging|swapping]], as an area of memory can be used by multiple programs, and what that memory area contains can be swapped or exchanged on demand. Virtual memory provides the programmer or the user with the perception that there is a much larger amount of RAM in the computer than is really there.<ref name="Operating System">{{cite book|last=Stallings|first=William|title=Computer Organization & Architecture|year=2008|publisher=Prentice-Hall of India Private Limited|location=New Delhi|isbn=978-81-203-2962-1|page=267}}</ref> ===Concurrency=== {{see also|Computer multitasking|Process management (computing)}} [[Concurrency (computer science)|Concurrency]] refers to the operating system's ability to carry out multiple tasks simultaneously.{{sfn|Anderson|Dahlin|2014|p=129}} Virtually all modern operating systems support concurrency.{{sfn|Silberschatz et al.|2018|p=159}} [[Thread (computing)|Thread]]s enable splitting a process' work into multiple parts that can run simultaneously.{{sfn|Anderson|Dahlin|2014|p=130}} The number of threads is not limited by the number of processors available. If there are more threads than processors, the operating system [[kernel (operating system)|kernel]] schedules, suspends, and resumes threads, controlling when each thread runs and how much CPU time it receives.{{sfn|Anderson|Dahlin|2014|p=131}} During a [[context switch]] a running thread is suspended, its state is saved into the [[thread control block]] and stack, and the state of the new thread is loaded in.{{sfn|Anderson|Dahlin|2014|pp=157, 159}} Historically, on many systems a thread could run until it relinquished control ([[cooperative multitasking]]). Because this model can allow a single thread to monopolize the processor, most operating systems now can [[interrupt]] a thread ([[preemptive multitasking]]).{{sfn|Anderson|Dahlin|2014|p=139}} Threads have their own thread ID, [[program counter]] (PC), a [[Processor register|register]] set, and a [[Stack-based memory allocation|stack]], but share code, [[heap memory|heap]] data, and other resources with other threads of the same process.{{sfn|Silberschatz et al.|2018|p=160}}{{sfn|Anderson|Dahlin|2014|p=183}} Thus, there is less overhead to create a thread than a new process.{{sfn|Silberschatz et al.|2018|p=162}} On single-CPU systems, concurrency is switching between processes. Many computers have multiple CPUs.{{sfn|Silberschatz et al.|2018|pp=162–163}} [[Parallel computing|Parallelism]] with multiple threads running on different CPUs can speed up a program, depending on how much of it can be executed concurrently.{{sfn|Silberschatz et al.|2018|p=164}} ===File system=== {{Main|File system}} {{see also|Virtual file system}} [[File:Dolphin FileManager.png|thumb|[[File system]]s allow users and programs to organize and sort files on a computer, often through the use of [[Directory (computing)|directories]] (or folders).]] Permanent storage devices used in twenty-first century computers, unlike [[volatile memory|volatile]] [[dynamic random-access memory]] (DRAM), are still accessible after a [[Crash (computing)|crash]] or [[power failure]]. Permanent ([[non-volatile memory|non-volatile]]) storage is much cheaper per byte, but takes several orders of magnitude longer to access, read, and write.{{sfn|Anderson|Dahlin|2014|pp=492, 517}}{{sfn|Tanenbaum|Bos|2023|pp=259–260}} The two main technologies are a [[hard drive]] consisting of [[magnetic disk]]s, and [[flash memory]] (a [[solid-state drive]] that stores data in electrical circuits). The latter is more expensive but faster and more durable.{{sfn|Anderson|Dahlin|2014|pp=517, 530}}{{sfn|Tanenbaum|Bos|2023|p=260}} [[File system]]s are an [[abstraction]] used by the operating system to simplify access to permanent storage. They provide human-readable [[filenames]] and other [[metadata]], increase performance via [[Amortization (computer science)|amortization]] of accesses, prevent multiple threads from accessing the same section of memory, and include [[checksums]] to identify [[Data corruption|corruption]].{{sfn|Anderson|Dahlin|2014|pp=492–493}} File systems are composed of files (named collections of data, of an arbitrary size) and [[Directory (computing)|directories]] (also called folders) that list human-readable filenames and other directories.{{sfn|Anderson|Dahlin|2014|p=496}} An absolute [[file path]] begins at the [[root directory]] and lists [[subdirectories]] divided by punctuation, while a relative path defines the location of a file from a directory.{{sfn|Anderson|Dahlin|2014|pp=496–497}}{{sfn|Tanenbaum|Bos|2023|pp=274–275}} [[System call]]s (which are sometimes [[Wrapper function|wrapped]] by libraries) enable applications to create, delete, open, and close files, as well as link, read, and write to them. All these operations are carried out by the operating system on behalf of the application.{{sfn|Anderson|Dahlin|2014|pp=502–504}} The operating system's efforts to reduce latency include storing recently requested blocks of memory in a [[Cache (computing)|cache]] and [[prefetching]] data that the application has not asked for, but might need next.{{sfn|Anderson|Dahlin|2014|p=507}} [[Device driver]]s are software specific to each [[input/output]] (I/O) device that enables the operating system to work without modification over different hardware.{{sfn|Anderson|Dahlin|2014|p=508}}{{sfn|Tanenbaum|Bos|2023|p=359}} Another component of file systems is a [[Associative array|dictionary]] that maps a file's name and metadata to the [[data block]] where its contents are stored.{{sfn|Anderson|Dahlin|2014|p=545}} Most file systems use directories to convert file names to file numbers. To find the block number, the operating system uses an [[Database index|index]] (often implemented as a [[tree (data structure)|tree]]).{{sfn|Anderson|Dahlin|2014|p=546}} Separately, there is a free space [[map (data structure)|map]] to track free blocks, commonly implemented as a [[bitmap]].{{sfn|Anderson|Dahlin|2014|p=546}} Although any free block can be used to store a new file, many operating systems try to group together files in the same directory to maximize performance, or periodically reorganize files to reduce [[file system fragmentation|fragmentation]].{{sfn|Anderson|Dahlin|2014|p=547}} Maintaining data reliability in the face of a computer crash or hardware failure is another concern.{{sfn|Anderson|Dahlin|2014|pp=589, 591}} File writing protocols are designed with atomic operations so as not to leave permanent storage in a partially written, inconsistent state in the event of a crash at any point during writing.{{sfn|Anderson|Dahlin|2014|pp=591–592}} Data corruption is addressed by redundant storage (for example, RAID—[[redundant array of inexpensive disks]]){{sfn|Tanenbaum|Bos|2023|pp=385–386}}{{sfn|Anderson|Dahlin|2014|p=592}} and [[checksums]] to detect when data has been corrupted. With multiple layers of checksums and backups of a file, a system can recover from multiple hardware failures. Background processes are often used to detect and recover from data corruption.{{sfn|Anderson|Dahlin|2014|p=592}} ===Security=== {{Main|Computer security}} Security means protecting users from other users of the same computer, as well as from those who seeking remote access to it over a network.{{sfn|Tanenbaum|Bos|2023|pp=605-606}} <!-- A [[Vulnerability (computing)|vulnerability]] is when a bug can be exploited to compromise the system or its data; an [[Exploit (computer security)|exploit]] is the signal needed to trigger the bug causing the vulnerability.{{sfn|Tanenbaum|Bos|2023|p=606}} Often the goal of the attacker is to install [[malware]], whether in the form of a [[computer virus|virus]], [[computer worm|worm]], or [[Trojan (malware)|Trojan]].{{sfn|Tanenbaum|Bos|2023|p=607}} --> Operating systems security rests on achieving the [[CIA triad]]: confidentiality (unauthorized users cannot access data), integrity (unauthorized users cannot modify data), and availability (ensuring that the system remains available to authorized users, even in the event of a [[denial of service attack]]).{{sfn|Tanenbaum|Bos|2023|p=608}} As with other computer systems, isolating [[security domain]]s—in the case of operating systems, the kernel, processes, and [[virtual machine]]s—is key to achieving security.{{sfn|Tanenbaum|Bos|2023|p=609}} Other ways to increase security include simplicity to minimize the [[attack surface]], locking access to resources by default, checking all requests for authorization, [[principle of least authority]] (granting the minimum privilege essential for performing a task), [[privilege separation]], and reducing shared data.{{sfn|Tanenbaum|Bos|2023|pp=609–610}} Some operating system designs are more secure than others. Those with no isolation between the kernel and applications are least secure, while those with a [[monolithic kernel]] like most general-purpose operating systems are still vulnerable if any part of the kernel is compromised. A more secure design features [[microkernel]]s that separate the kernel's privileges into many separate security domains and reduce the consequences of a single kernel breach.{{sfn|Tanenbaum|Bos|2023|p=612}} [[Unikernel]]s are another approach that improves security by minimizing the kernel and separating out other operating systems functionality by application.{{sfn|Tanenbaum|Bos|2023|p=612}} Most operating systems are written in [[C (programming language)|C]] or [[C++]], which create potential vulnerabilities for exploitation. Despite attempts to protect against them, vulnerabilities are caused by [[buffer overflow]] attacks, which are enabled by the lack of [[bounds checking]].{{sfn|Tanenbaum|Bos|2023|pp=648, 657}} <!-- Other types of vulnerability in operating systems written in C and C++ include [[format string attack]]s, which exploit lack of [[type checking]] to [[code injection|inject malicious code]],{{sfn|Tanenbaum|Bos|2023|pp=658, 661}} [[use-after-free attack]]s that rely on [[C dynamic memory allocation|dynamically allocated memory]],{{sfn|Tanenbaum|Bos|2023|p=661}} and [[null pointer dereference attack]]s that an attacker can exploit to crash a computer.{{sfn|Tanenbaum|Bos|2023|p=664}} --> Hardware vulnerabilities, some of them [[Speculative execution CPU vulnerabilities|caused by CPU optimizations]], can also be used to compromise the operating system.{{sfn|Tanenbaum|Bos|2023|pp=668–669, 674}} There are known instances of operating system programmers deliberately implanting vulnerabilities, such as [[Backdoor (computing)|back door]]s.{{sfn|Tanenbaum|Bos|2023|pp=679–680}} Operating systems security is hampered by their increasing complexity and the resulting inevitability of bugs.{{sfn|Tanenbaum|Bos|2023|pp=605, 617–618}} Because [[formal verification]] of operating systems may not be feasible, developers use operating system [[Hardening (computing)|hardening]] to reduce vulnerabilities,{{sfn|Tanenbaum|Bos|2023|pp=681–682}} e.g. [[address space layout randomization]], [[control-flow integrity]],{{sfn|Tanenbaum|Bos|2023|p=683}} [[Access-control list|access restriction]]s,{{sfn|Tanenbaum|Bos|2023|p=685}} and other techniques.{{sfn|Tanenbaum|Bos|2023|p=689}} There are no restrictions on who can contribute code to open source operating systems; such operating systems have transparent change histories and distributed governance structures.{{sfn|Richet|Bouaynaya|2023|p=92}} Open source developers strive to work collaboratively to find and eliminate security vulnerabilities, using [[code review]] and [[type checking]] to expunge malicious code.{{sfn|Richet|Bouaynaya|2023|pp=92–93}}{{sfn|Berntsso|Strandén|Warg|2017|pp=130–131}} [[Andrew S. Tanenbaum]] advises releasing the [[source code]] of all operating systems, arguing that it prevents developers from placing trust in secrecy and thus relying on the unreliable practice of [[security by obscurity]].{{sfn|Tanenbaum|Bos|2023|p=611}} ===User interface=== {{Main|Shell (computing){{!}}Operating system user interface}} A [[user interface]] (UI) is essential to support human interaction with a computer. The two most common user interface types for any computer are *[[command-line interface]], where computer commands are typed, line-by-line, *[[graphical user interface]] (GUI) using a visual environment, most commonly a combination of the window, icon, menu, and pointer elements, also known as [[WIMP (computing)|WIMP]]. For personal computers, including [[smartphone]]s and [[tablet computer]]s, and for [[workstation]]s, user input is typically from a combination of [[Keyboard technology|keyboard]], [[mouse (computing)|mouse]], and [[trackpad]] or [[touchscreen]], all of which are connected to the operating system with specialized software.{{sfn|Tanenbaum|Bos|2023|pp=396, 402}} Personal computer users who are not software developers or coders often prefer GUIs for both input and output; GUIs are supported by most personal computers.{{sfn|Tanenbaum|Bos|2023|pp=395, 408}} The software to support GUIs is more complex than a command line for input and plain text output. Plain text output is often preferred by programmers, and is easy to support.{{sfn|Tanenbaum|Bos|2023|p=402}} ==Operating system development as a hobby== {{Main|Hobbyist operating system}} A hobby operating system may be classified as one whose code has not been directly derived from an existing operating system, and has few users and active developers.<ref>{{cite web |last1=Holwerda |first1=Thom |title=My OS Is Less Hobby than Yours |url=https://www.osnews.com/story/22638/my-os-is-less-hobby-than-yours/ |website=OS News |access-date=4 June 2024 |date=20 December 2009}}</ref> In some cases, hobby development is in support of a "[[Homebrew Computer Club|homebrew]]" computing device, for example, a simple [[single-board computer]] powered by a [[MOS Technology 6502|6502 microprocessor]]. Or, development may be for an architecture already in widespread use. Operating system development may come from entirely new concepts, or may commence by modeling an existing operating system. In either case, the hobbyist is her/his own developer, or may interact with a small and sometimes unstructured group of individuals who have like interests. Examples of hobby operating systems include [[Syllable Desktop|Syllable]] and [[TempleOS]]. ==Diversity of operating systems and portability== If an application is written for use on a specific operating system, and is [[ported]] to another OS, the functionality required by that application may be implemented differently by that OS (the names of functions, meaning of arguments, etc.) requiring the application to be adapted, changed, or otherwise [[software maintenance|maintained]].<!--There really ought to be a discussion of ''software modules'' somewhere, such as those that are neither API's nor Plug-Ins (not sure what those are), but which are either hard (on cartridge), soft (on diskette), or otherwise installable by downloading). --> This cost in supporting operating systems diversity can be avoided by instead writing applications against [[software platform]]s such as [[Java (software platform)|Java]] or [[Qt (software)|Qt]]. These abstractions have already borne the cost of adaptation to specific operating systems and their [[system library|system libraries]]. Another approach is for operating system vendors to adopt standards. For example, [[POSIX]] and [[operating system abstraction layer|OS abstraction layers]] provide commonalities that reduce porting costs. ==Popular operating systems== {{Further|Usage share of operating systems|Comparison of operating systems}} {{as of|2024|09|}}, [[Android (operating system)|Android]] (based on the Linux kernel) is the most popular operating system with a 46% market share, followed by [[Microsoft Windows]] at 26%, [[iOS]] and [[iPadOS]] at 18%, [[macOS]] at 5%, and [[Linux]] at 1%. Android, iOS, and iPadOS are [[mobile operating system]]s, while Windows, macOS, and Linux are desktop operating systems.<ref name="gs.statcounter.com"/> ===Linux=== {{Main|Linux}} [[File:Layers of a Linux system.png|thumb|upright=1.7|[[Abstraction layer|Layer]]s of a Linux system]] [[Linux]] is a [[free software]] distributed under the [[GNU General Public License]] (GPL), which means that all of its derivatives are legally required to release their [[source code]].{{sfn|Silberschatz et al.|2018|pp=779–780}} Linux was designed by programmers for their own use, thus emphasizing simplicity and consistency, with a small number of basic elements that can be combined in nearly unlimited ways, and avoiding redundancy.{{sfn|Tanenbaum|Bos|2023|pp=713–714}} Its design is similar to other UNIX systems not using a [[microkernel]].{{sfn|Silberschatz et al.|2018|p=780}} It is written in [[C (programming language)|C]]<ref>{{cite news |last1=Vaughan-Nichols |first1=Steven |title=Linus Torvalds prepares to move the Linux kernel to modern C |url=https://www.zdnet.com/article/linus-torvalds-prepares-to-move-the-linux-kernel-to-modern-c/ |access-date=7 February 2024 |work=ZDNET |date=2022 |language=en}}</ref> and uses [[UNIX System V]] syntax, but also supports [[BSD]] syntax. Linux supports standard UNIX networking features, as well as the full suite of UNIX tools, while [[multiuser|supporting multiple users]] and employing [[preemptive multitasking]]. Initially of a minimalist design, Linux is a flexible system that can work in under 16 [[megabytes|MB]] of [[RAM]], but still is used on large [[multiprocessor]] systems.{{sfn|Silberschatz et al.|2018|p=780}} Similar to other UNIX systems, Linux [[Linux distribution|distribution]]s are composed of a [[Linux kernel|kernel]], [[system library|system libraries]], and [[system utilities]].{{sfn|Silberschatz et al.|2018|p=781}} Linux has a [[graphical user interface]] (GUI) with a desktop, folder and file icons, as well as the option to access the operating system via a [[command line]].{{sfn|Tanenbaum|Bos|2023|pp=715–716}} [[Android (operating system)|Android]] is a partially open-source operating system closely based on Linux and has become the most widely used operating system by users, due to its popularity on [[smartphones]] and, to a lesser extent, [[embedded system]]s needing a GUI, such as "[[smart watch]]es, [[Android Automotive|automotive dashboard]]s, airplane seatbacks, [[medical devices]], and [[home appliance]]s".{{sfn|Tanenbaum|Bos|2023|pp=793–794}} Unlike Linux, much of Android is written in [[Java (programming language)|Java]] and uses [[object-oriented design]].{{sfn|Tanenbaum|Bos|2023|p=793}} ===Microsoft Windows=== {{Main|Microsoft Windows}} [[File:Diagram of a security descriptor for a file on Windows.png|thumb|upright=1.3|Security descriptor for a file that is read-only by default, specified no access for Elvis, read/write access for Cathy, and full access for Ida, the owner of the file{{sfn|Tanenbaum|Bos|2023|pp=1021-1022}}]] Windows is a [[proprietary]] operating system that is widely used on desktop computers, laptops, tablets, phones, [[workstation]]s, [[enterprise server]]s, and [[Xbox]] consoles.{{sfn|Tanenbaum|Bos|2023|p=871}} The operating system was designed for "security, reliability, compatibility, high performance, extensibility, portability, and international support"—later on, [[Energy efficiency in operating systems|energy efficiency]] and support for [[dynamic device]]s also became priorities.{{sfn|Silberschatz et al.|2018|p=826}} [[Windows Executive]] works via [[Object Manager (Windows)|kernel-mode objects]] for important data structures like processes, threads, and sections (memory objects, for example files).{{sfn|Tanenbaum|Bos|2023|p=1035}} The operating system supports [[demand paging]] of [[virtual memory]], which speeds up I/O for many applications. I/O [[device drivers]] use the [[Windows Driver Model]].{{sfn|Tanenbaum|Bos|2023|p=1035}} The [[NTFS]] file system has a master table and each file is represented as a [[Record (computer science)|record]] with [[metadata]].{{sfn|Tanenbaum|Bos|2023|p=1036}} The scheduling includes [[preemptive multitasking]].{{sfn|Silberschatz et al.|2018|p=821}} Windows has many security features;{{sfn|Silberschatz et al.|2018|p=827}} especially important are the use of [[access-control list]]s and [[safety integrity level|integrity levels]]. Every process has an authentication token and each object is given a security descriptor. Later releases have added even more security features.{{sfn|Tanenbaum|Bos|2023|p=1036}} ==See also== {{div col}} * [[Comparison of operating systems]] * [[DBOS]] * [[Interruptible operating system]] * [[List of operating systems]] * [[List of pioneers in computer science]] * [[Glossary of operating systems terms]] * [[Microcontroller]] * [[Network operating system]] * [[Object-oriented operating system]] * [[Lisp machine]] * [[Operating System Projects]] * [[System Commander]] * [[System image]] * [[Timeline of operating systems]] {{div col end}} ==Notes== {{Notelist}} ==References== {{Reflist|30em}} ==Further reading== {{Refbegin}} *{{cite book |last1=Anderson |first1=Thomas |last2=Dahlin |first2=Michael |author1-link=Thomas E. Anderson |title=Operating Systems: Principles and Practice |date=2014 |publisher=Recursive Books |isbn=978-0-9856735-2-9 |language=en}} * {{cite journal |last1=Auslander |first1=M. A. |last2=Larkin |first2=D. C. |last3=Scherr |first3=A. L. |title=The Evolution of the MVS Operating System |journal=IBM Journal of Research and Development |date=September 1981 |volume=25 |issue=5 |pages=471–482 |doi=10.1147/rd.255.0471|issn=0018-8646 }} *{{cite book |last1=Berntsson |first1=Petter Sainio |last2=Strandén |first2=Lars |last3=Warg |first3=Fredrik |title=Evaluation of Open Source Operating Systems for Safety-Critical Applications |date=2017 |publisher=Springer International Publishing |isbn=978-3-319-65948-0 |pages=117–132 |language=en}} * {{cite book | last = Deitel | first = Harvey M. | author2 = Deitel, Paul | author3 = Choffnes, David | title = Operating Systems | date = 25 December 2015 | publisher = Pearson/Prentice Hall | isbn = 978-0-13-092641-8 | url-access = registration | url = https://archive.org/details/modernoperatings00tane }} * {{cite book | last = Bic| first = Lubomur F. |author2=Shaw, Alan C. | title = Operating Systems | publisher = [[Prentice Hall]] | year = 2003 | location = Pearson }} * {{cite book | last = Silberschatz | first = Avi |author2=Galvin, Peter |author3=Gagne, Greg | title = Operating Systems Concepts | publisher = [[John Wiley & Sons]] | year = 2008 | isbn = 978-0-470-12872-5 }} * O'Brien, J. A., & Marakas, G. M.(2011). ''Management Information Systems''. 10e. McGraw-Hill Irwin. * {{cite book |last1=Leva |first1=Alberto |last2=Maggio |first2=Martina |last3=Papadopoulos |first3=Alessandro Vittorio |last4=Terraneo |first4=Federico |title=Control-based Operating System Design |publisher=[[Institution of Engineering and Technology|IET]] |year=2013 |isbn=978-1-84919-609-3}} *{{cite journal |last1=Richet |first1=Jean-Loup |last2=Bouaynaya |first2=Wafa |title=Understanding and Managing Complex Software Vulnerabilities: An Empirical Analysis of Open-Source Operating Systems |journal=Systèmes d'information & management |date=2023 |volume=28 |issue=1 |pages=87–114 |doi=10.54695/sim.28.1.0087 |doi-broken-date=1 November 2024 |url=https://www.cairn.info/revue-systemes-d-information-et-management-2023-1-page-87.htm.}} *{{cite book |last1=Silberschatz |first1=Abraham |last2=Galvin |first2=Peter B. |last3=Gagne |first3=Greg |title=Operating System Concepts |date=2018 |publisher=Wiley |isbn=978-1-119-32091-3 |edition=10 |url=https://archive.org/details/operating-system-concepts-10th |language=en-us|ref={{sfnref|Silberschatz et al.|2018}}}} *{{cite book |last1=Tanenbaum |first1=Andrew S. |last2=Bos |first2=Herbert |title=Modern Operating Systems, Global Edition |date=2023 |publisher=Pearson Higher Ed |isbn=978-1-292-72789-9 |language=en}} {{Refend}} ==External links== {{Wiktionary}} {{Commons category|Operating systems}} {{Wikiversity|Operating Systems}} * [http://www.cbi.umn.edu/iterations/haigh.html Multics History] and the history of operating systems {{Operating system}} {{Computer science}} {{Authority control}} [[Category:Operating systems| ]]
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:As of
(
edit
)
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite conference
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite magazine
(
edit
)
Template:Cite news
(
edit
)
Template:Cite web
(
edit
)
Template:Commons category
(
edit
)
Template:Computer science
(
edit
)
Template:Div col
(
edit
)
Template:Div col end
(
edit
)
Template:Efn
(
edit
)
Template:Expand section
(
edit
)
Template:Further
(
edit
)
Template:Main
(
edit
)
Template:Not a typo
(
edit
)
Template:Notelist
(
edit
)
Template:OS
(
edit
)
Template:Operating system
(
edit
)
Template:Pp-move
(
edit
)
Template:Pp-vandalism
(
edit
)
Template:Refbegin
(
edit
)
Template:Refend
(
edit
)
Template:Reflist
(
edit
)
Template:See above
(
edit
)
Template:See also
(
edit
)
Template:Sfn
(
edit
)
Template:Short description
(
edit
)
Template:Snd
(
edit
)
Template:Use dmy dates
(
edit
)
Template:Wikiversity
(
edit
)
Template:Wiktionary
(
edit
)
Search
Search
Editing
Operating system
Add topic