Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Computer program
(section)
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!
===Operating system=== {{See also|Operating system}} [[File:Concepts- Program vs. Process vs. Thread.jpg|thumb|Program vs. [[Process (computing)|Process]] vs. [[Thread (computing)|Thread]] <br/>[[Scheduling (computing)|Scheduling]], [[Preemption (computing)|Preemption]], [[Context switch|Context Switching]]|upright=1.8]] An [[operating system]] is the low-level software that supports a computer's basic functions, such as [[Scheduling (computing)|scheduling]] [[Process (computing)|processes]] and controlling [[peripheral]]s.<ref name="osc-overview"/> In the 1950s, the programmer, who was also the operator, would write a program and run it. After the program finished executing, the output may have been printed, or it may have been punched onto paper tape or cards for later processing.<ref name="osc-ch1-p6"/> More often than not the program did not work. The programmer then looked at the console lights and fiddled with the console switches. If less fortunate, a memory printout was made for further study. In the 1960s, programmers reduced the amount of wasted time by automating the operator's job. A program called an ''operating system'' was kept in the computer at all times.<ref name="sco-ch1-p11">{{cite book |url=https://archive.org/details/structuredcomput00tane/page/11 |title=Structured Computer Organization, Third Edition |last=Tanenbaum |first=Andrew S. |publisher=Prentice Hall |year=1990 |isbn=978-0-13-854662-5 |page=[https://archive.org/details/structuredcomput00tane/page/11 11]}}</ref> The term ''operating system'' may refer to two levels of software.<ref name="lpi-ch2-p21">{{cite book |title=The Linux Programming Interface |last=Kerrisk |first=Michael |publisher=No Starch Press |year=2010 |isbn=978-1-59327-220-3 |page=21}}</ref> The operating system may refer to the [[Kernel (operating system)|kernel program]] that manages the [[Process (computing)|processes]], [[Computer memory|memory]], and [[Peripheral|devices]]. More broadly, the operating system may refer to the entire package of the central software. The package includes a kernel program, [[Command-line interface|command-line interpreter]], [[graphical user interface]], [[Utility software|utility programs]], and [[Source-code editor|editor]].<ref name="lpi-ch2-p21"/> ====Kernel Program==== [[File:Kernel Layout.svg|thumb|A kernel connects the application software to the hardware of a computer.]] The kernel's main purpose is to manage the limited resources of a computer: * The kernel program should perform [[process scheduling]],<ref name="lpi-ch2-p22">{{cite book |title=The Linux Programming Interface |last=Kerrisk |first=Michael |publisher=No Starch Press |year=2010 |isbn=978-1-59327-220-3 |page=22}}</ref> which is also known as a [[context switch]]. The kernel creates a [[process control block]] when a ''computer program'' is [[Loader (computing)|selected for execution]]. However, an executing program gets exclusive access to the [[central processing unit]] only for a [[Preemption (computing)#time slice|time slice]]. To provide each user with the [[Time-sharing|appearance of continuous access]], the kernel quickly [[Preemption (computing)|preempts]] each process control block to execute another one. The goal for [[Systems programming|system developers]] is to minimize [[dispatch latency]]. [[File:Virtual memory.svg|thumb|250px|Physical memory is scattered around RAM and the hard disk. Virtual memory is one continuous block.]] * The kernel program should perform [[memory management]]. :* When the kernel initially [[Loader (computing)|loads]] an executable into memory, it divides the address space logically into [[Region-based memory management|regions]].<ref name="duos-ch6-p152">{{cite book | last = Bach | first = Maurice J. | title = The Design of the UNIX Operating System | publisher = Prentice-Hall, Inc. | year = 1986 | page = 152 | isbn = 0-13-201799-7 }}</ref> The kernel maintains a master-region table and many per-process-region (pregion) tables—one for each running [[Process (computing)|process]].<ref name="duos-ch6-p152"/> These tables constitute the [[virtual address space]]. The master-region table is used to determine where its contents are located in [[physical memory]]. The pregion tables allow each process to have its own program (text) pregion, data pregion, and stack pregion. :*The program pregion stores machine instructions. Since machine instructions do not change, the program pregion may be shared by many processes of the same executable.<ref name="duos-ch6-p152"/> :* To save time and memory, the kernel may load only blocks of execution instructions from the disk drive, not the entire execution file completely.<ref name="lpi-ch2-p22"/> :*The kernel is responsible for translating virtual addresses into [[physical address]]es. The kernel may request data from the [[memory controller]] and, instead, receive a [[page fault]].<ref name="sco6th-ch6-p443">{{cite book | last = Tanenbaum | first = Andrew S. | title = Structured Computer Organization, Sixth Edition | publisher = Pearson | year = 2013 | page = 443 | isbn = 978-0-13-291652-3 }}</ref> If so, the kernel accesses the [[memory management unit]] to populate the physical data region and translate the address.<ref name="esa-ch1-p8">{{cite book | last = Lacamera | first = Daniele | title = Embedded Systems Architecture | publisher = Packt | year = 2018 | page = 8 | isbn = 978-1-78883-250-2 }}</ref> :* The kernel allocates memory from the ''heap'' upon request by a process.<ref name="cpl-ch8-p187"/> When the process is finished with the memory, the process may request for it to be [[Manual memory management|freed]]. If the process exits without requesting all allocated memory to be freed, then the kernel performs [[Garbage collection (computer science)|garbage collection]] to free the memory. :* The kernel also ensures that a process only accesses its own memory, and not that of the kernel or other processes.<ref name="lpi-ch2-p22"/> * The kernel program should perform [[File system|file system management]].<ref name="lpi-ch2-p22"/> The kernel has instructions to create, retrieve, update, and delete files. * The kernel program should perform [[Peripheral|device management]].<ref name="lpi-ch2-p22"/> The kernel provides programs to standardize and simplify the interface to the mouse, keyboard, disk drives, printers, and other devices. Moreover, the kernel should arbitrate access to a device if two processes request it at the same time. * The kernel program should perform [[network management]].<ref name="lpi-ch2-p23">{{cite book |title=The Linux Programming Interface |last=Kerrisk |first=Michael |publisher=No Starch Press |year=2010 |isbn=978-1-59327-220-3 |page=23}}</ref> The kernel transmits and receives [[Network packet|packets]] on behalf of processes. One key service is to find an efficient [[Routing table|route]] to the target system. * The kernel program should provide [[system calls|system level functions]] for programmers to use.<ref name="upe-ch7-p201">{{cite book |title=The Unix Programming Environment |last=Kernighan |first=Brian W. |publisher=Prentice Hall |year=1984 |isbn=0-13-937699-2 |page=201}}</ref> ** Programmers access files through a relatively simple interface that in turn executes a relatively complicated low-level I/O interface. The low-level interface includes file creation, [[file descriptor]]s, file seeking, physical reading, and physical writing. ** Programmers create processes through a relatively simple interface that in turn executes a relatively complicated low-level interface. ** Programmers perform date/time arithmetic through a relatively simple interface that in turn executes a relatively complicated low-level time interface.<ref name="lpi-ch10-p187">{{cite book |title=The Linux Programming Interface |last=Kerrisk |first=Michael |publisher=No Starch Press |year=2010 |isbn=978-1-59327-220-3 |page=187}}</ref> * The kernel program should provide a [[Inter-process communication|communication channel]] between executing processes.<ref name="usp-ch6-p121">{{cite book |title=Unix System Programming |last=Haviland |first=Keith |publisher=Addison-Wesley Publishing Company |year=1987 |isbn=0-201-12919-1 |page=121}}</ref> For a large software system, it may be desirable to [[Software engineering|engineer]] the system into smaller processes. Processes may communicate with one another by sending and receiving [[Signal (IPC)|signals]]. Originally, operating systems were programmed in [[assembly language|assembly]]; however, modern operating systems are typically written in higher-level languages like [[C (programming language)|C]], [[Objective-C]], and [[Swift (programming language)|Swift]].{{efn|The [[UNIX]] operating system was written in C, [[macOS]] was written in Objective-C, and Swift replaced Objective-C.}}
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)