Misplaced Pages

KornShell

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.

KornShell ( ksh ) is a Unix shell which was developed by David Korn at Bell Labs in the early 1980s and announced at USENIX on July 14, 1983. The initial development was based on Bourne shell source code. Other early contributors were Bell Labs developers Mike Veach and Pat Sullivan, who wrote the Emacs and vi -style line editing modes' code, respectively. KornShell is backward-compatible with the Bourne shell and includes many features of the C shell , inspired by the requests of Bell Labs users.

#995004

66-492: KornShell complies with POSIX.2 , Shell and Utilities, Command Interpreter (IEEE Std 1003.2-1992.) Major differences between KornShell and the traditional Bourne shell include: KornShell was originally proprietary software . In 2000 the source code was released under a license particular to AT&T, but since the ksh93q release in early 2005 it has been licensed under the Eclipse Public License . KornShell

132-428: A system call to perform a block I/O write operation, then the system call might execute the following instructions: 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 . The device will also place an integer onto the data bus. Upon accepting

198-808: A POSIX standard when formally approved by the ISO. POSIX.1-2001 (or IEEE Std 1003.1-2001) equates to the Single UNIX Specification, version 3 minus X/Open Curses . This standard consisted of: IEEE Std 1003.1-2004 involved a minor update of POSIX.1-2001. It incorporated two minor updates or errata referred to as Technical Corrigenda (TCs). Its contents are available on the web. Base Specifications, Issue 7 (or IEEE Std 1003.1-2008 , 2016 Edition). This standard consists of: IEEE Std 1003.1-2017 (Revision of IEEE Std 1003.1-2008) - IEEE Standard for Information Technology—Portable Operating System Interface (POSIX(R)) Base Specifications, Issue 7

264-645: A computer even if they are not compatible with the base operating system. 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 libraries and composed with a single application and configuration code to construct a unikernel : a specialized (only the absolute necessary pieces of code are extracted from libraries and bound together ), 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 domains (there

330-585: A development of MULTICS for a single user. 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). To increase compatibility, the IEEE released the POSIX standard for operating system application programming interfaces (APIs), which

396-484: A large legal settlement was paid. 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 systems and servers but are also used on mobile devices and many other computer systems. On mobile devices, Symbian OS was dominant at first, being usurped by BlackBerry OS (introduced 2002) and iOS for iPhones (from 2007). Later on,

462-442: A library with no protection between applications, such as eCos . 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. Virtual machines can be paused, saved, and resumed, making them useful for operating systems research, development, and debugging. They also enhance portability by enabling applications to be run on

528-447: A malformed machine instruction . However, the most common error conditions are division by zero and accessing an invalid memory address . Users can send messages to the kernel to modify the behavior of a currently running process. For example, in the command-line environment , pressing the interrupt character (usually Control-C ) might terminate the currently running process. To generate software interrupts for x86 CPUs,

594-455: 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 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

660-503: 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 's memory manager, and do not exceed their allocated memory. This system of memory management is almost never seen any more, since programs often contain bugs which can cause them to exceed their allocated memory. If

726-408: 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 the system. Memory protection enables the kernel to limit a process' access to

SECTION 10

#1732780250996

792-440: A program tries to access memory that is not accessible memory, but nonetheless has been allocated to it, the kernel is interrupted (see § 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

858-436: A roughly ascending chronological order of their contributions: Besides the primary major contributing corporations (listed above), some companies have contributed free resources to the development of KSH. These are listed below (alphabetically ordered): There are several forks and clones of KornShell: POSIX#POSIX.2 The Portable Operating System Interface ( POSIX ; IPA : / ˈ p ɒ z . ɪ k s / )

924-470: A significant amount of CPU time. Direct memory access (DMA) is an architecture feature to allow devices to bypass the CPU and access main memory directly. (Separate from the architecture, a device may perform direct memory access to and from main memory either directly or via a bus.) When a computer user types a key on the keyboard, typically the character appears immediately on the screen. Likewise, when

990-402: A specific moment in time. Hard real-time systems require exact timing and are common in manufacturing , avionics , military, and other similar uses. With soft real-time systems, the occasional missed event is acceptable; this category often includes audio or multimedia systems, as well as smartphones. In order for hard real-time systems be sufficiently exact in their timing, often they are just

1056-417: A user moves a mouse , the 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 or word transmitted. Devices such as hard disk drives , solid-state drives , and magnetic tape drives can transfer data at a rate high enough that interrupting

1122-453: A variation of the classic reader/writer problem . The writer receives a pipe from the shell for its output to be sent to the reader's input stream. The command-line syntax is alpha | bravo . alpha will write to the pipe when its computation is ready and then sleep in the wait queue. bravo will then be moved to the ready queue and soon will read from its input stream. The kernel will generate software interrupts to coordinate

1188-489: Is ksh93 , which is supplied as /usr/bin/ksh , and the older version is available as /usr/bin/ksh88 . UnixWare also includes dtksh when CDE is installed. The ksh93 distribution underwent a less stable fate after the authors left AT&T around 2012 at stable version ksh93u+ . The primary authors continued working on a ksh93v- beta branch until around 2014. That work was eventually taken up primarily by Red Hat in 2017 (due to customer requests) and resulted in

1254-418: Is interrupted by it. Operating systems are found on many devices that contain a computer – from cellular phones and video game consoles to web servers and supercomputers . In the personal computer market, as of September 2024 , Microsoft Windows holds a dominant market share of around 73%. macOS by Apple Inc. is in second place (15%), Linux is in third place (5%), and ChromeOS

1320-562: Is remote direct memory access , which enables each CPU to access memory belonging to other CPUs. Multicomputer operating systems often support remote procedure calls where a CPU can call a procedure on another CPU, or distributed shared memory , in which the operating system uses virtualization to generate shared memory that does not physically exist. A distributed system is a group of distinct, networked computers—each of which might have their own operating system and file system. Unlike multicomputers, they may be dispersed anywhere in

1386-484: Is a change away from the currently running process. Similarly, both hardware and software interrupts execute an interrupt service routine . Software interrupts may be normally occurring events. It is expected that a time slice will occur, so the kernel will have to perform a context switch . 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. Software interrupts may be error conditions, such as

SECTION 20

#1732780250996

1452-591: Is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems . POSIX defines application programming interfaces (APIs), along with command line shells and utility interfaces, for software compatibility (portability) with variants of Unix and other operating systems. POSIX is also a trademark of the IEEE. POSIX is intended to be used by both application and system developers. Originally,

1518-572: Is available as part of the AT&;T Software Technology (AST) Open Source Software Collection. As KornShell was initially only available through a proprietary license from AT&T, a number of free and open source alternatives were created. These include pdksh , mksh , Bash , and Z shell . The functionality of the original KornShell, ksh88 , was used as a basis for the standard POSIX.2 , Shell and Utilities, Command Interpreter (IEEE Std 1003.2-1992). Some vendors still ship their own versions of

1584-441: Is available from either The Open Group or IEEE. It is technically identical to POSIX.1-2008 with Technical Corrigenda 1 and 2 applied. Its contents are available on the web. IEEE Std 1003.1-2024 - IEEE Standard for Information Technology—Portable Operating System Interface (POSIX(R)) Base Specifications, Issue 8 was published on 14 June 2024. Its contents are available on the web. POSIX mandates 512-byte default block sizes for

1650-422: Is difficult to define, but has been called "the layer of software that manages a computer's resources for its users and their applications ". Operating systems include the software that is always running, called a kernel —but can include other software as well. The two other types of programs that can run on a computer are system programs —which are associated with the operating system, but may not be part of

1716-574: Is divided into two parts: The development of the POSIX standard takes place in the Austin Group (a joint working group among the IEEE, The Open Group , and the ISO/IEC JTC 1/SC 22 /WG 15). Before 1997, POSIX comprised several standards: After 1997, the Austin Group developed the POSIX revisions. The specifications are known under the name Single UNIX Specification , before they become

1782-896: Is in fourth place (2%). In the mobile sector (including smartphones and tablets ), as of September 2023 , Android's share is 68.92%, followed by Apple's iOS and iPadOS with 30.42%, and other operating systems with .66%. Linux distributions are dominant in the server and supercomputing sectors. Other specialized classes of operating systems (special-purpose operating systems), such as embedded and real-time systems, exist for many applications. Security-focused operating systems 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. USB stick). An operating system

1848-443: 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 inlining them based on compiler thresholds), without the usual overhead of context switches , 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

1914-499: 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 centers and Android smartphones. The invention of large scale integration enabled the production of personal computers (initially called microcomputers ) from around 1980. For around five years,

1980-473: 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 , and the smallest are for smart cards . Examples include Embedded Linux , QNX , VxWorks , and the extra-small systems RIOT and TinyOS . A real-time operating system is an operating system that guarantees to process events or data by or at

2046-435: Is the part of the operating system that provides 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. Most operating systems have two modes of operation: in user mode ,

KornShell - Misplaced Pages Continue

2112-542: The CP/M (Control Program for Microcomputers) was the most popular operating system for microcomputers. Later, IBM bought the DOS (Disk Operating System) from Microsoft . After modifications requested by IBM, the resulting system was called MS-DOS (MicroSoft Disk Operating System) and was widely used on IBM microcomputers. Later versions increased their sophistication, in part by borrowing features from UNIX. Apple 's Macintosh

2178-504: The INT assembly language instruction is available. The syntax is INT X , where X is the offset number (in hexadecimal format) to the interrupt vector table . To generate software interrupts in Unix-like operating systems, the kill(pid,signum) system call will send a signal to another process. pid is the process identifier of the receiving process. signum is

2244-559: The UNIX System V shell. Many user-level programs, services, and utilities (including awk , echo , ed ) were also standardized, along with required program-level services (including basic I/O : file , terminal , and network ). POSIX also defines a standard threading library API which is supported by most modern operating systems. In 2008, most parts of POSIX were combined into a single standard (IEEE Std 1003.1-2008 , also known as POSIX.1-2008). As of 2014 , POSIX documentation

2310-466: The df and du utilities, reflecting the typical size of blocks on disks. When Richard Stallman and the GNU team were implementing POSIX for the GNU operating system , they objected to this on the grounds that most people think in terms of 1024 byte (or 1 KiB ) blocks. The environment variable POSIX_ME_HARDER was introduced to allow the user to force the standards-compliant behaviour. The variable name

2376-408: The ksh93u+m branch, based on the last stable AT&T release ( ksh93u+ 2012-08-01). ksh2020 was released as a "major release for several reasons" such as removal of EBCDIC support, dropping support for binary plugins written for ksh93u+ and removal of some broken math functions, but has never been maintained or supported by AT&T (not even on its initial release date). For the purposes of

2442-420: The transistor in the mid-1950s, mainframes began to be built. These still needed professional operators who manually do what a modern operating system would do, such as scheduling programs to run, but mainframes still had rudimentary operating systems such as Fortran Monitor System (FMS) and IBSYS . In the 1960s, IBM introduced the first series of intercompatible computers ( System/360 ). All of them ran

2508-410: 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 or a direct memory access controller; an interrupt is delivered only when all the data is transferred. If a computer program executes

2574-474: The CPU to re-enter supervisor mode , placing the 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 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

2640-538: 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 . An interrupt (also known as an abort , exception , fault , signal , or trap ) provides an efficient way for most operating systems to react to

2706-696: The automated conformance tests and their certification has not expired and the operating system has not been discontinued. Some versions of the following operating systems had been certified to conform to one or more of the various POSIX standards. This means that they passed the automated conformance tests. The certification has expired and some of the operating systems have been discontinued. The following are not certified as POSIX compliant yet comply in large part: Mostly POSIX compliant environments for OS/2 : Partially POSIX compliant environments for DOS include: The following are not officially certified as POSIX compatible, but they conform in large part to

KornShell - Misplaced Pages Continue

2772-453: 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

2838-471: The details of how interrupt service routines behave vary from operating system to operating system. However, several interrupt functions are common. The architecture and operating system must: A software interrupt is a message to a process that an event has occurred. This contrasts with a hardware interrupt — which is a message to the central processing unit (CPU) that an event has occurred. Software interrupts are similar to hardware interrupts — there

2904-422: 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). An interrupt service routine may cause the central processing unit (CPU) to have a context switch . The details of how a computer processes an interrupt vary from architecture to architecture, and

2970-453: The eventual initial release of ksh2020 in the fall of 2019. That initial release (although fixing several prior stability issues) introduced some minor breakage and compatibility issues. In March 2020, AT&T decided to roll back the community changes, stash them in a branch, and restart from ksh93u+ , as the changes were too broad and too ksh-focused for the company to absorb into a project in maintenance mode. Bugfix development continues on

3036-410: The hardware checks that the software is only executing legal instructions, whereas the kernel has unrestricted powers and is not subject to these checks. The kernel also manages memory for other processes and controls access to input/output devices. The operating system provides an interface between an application program and the computer hardware, so that an application program can interact with

3102-493: 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 by the 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

3168-418: The indirect pollution of important processor structures (like CPU caches , the instruction pipeline , and so on) which affects both user-mode and kernel-mode performance. The first computers in the late 1940s and 1950s were directly programmed either with plugboards or with machine code inputted on media such as punch cards , without programming languages or operating systems. After the introduction of

3234-404: The interrupt request, the operating system will: When the writing process has its time slice expired, the operating system will: With the program counter now reset, the interrupted process will resume its time slice. Among other things, a multiprogramming operating system kernel must be responsible for managing all system memory which is currently in use by the programs. This ensures that

3300-431: The kernel—and applications—all other software. There are three main purposes that an operating system fulfills: With multiprocessors multiple CPUs share memory. A multicomputer or cluster computer has multiple CPUs, each of which has its own memory . Multicomputers were developed because large multiprocessors are difficult to engineer and prohibitively expensive; they are universal in cloud computing because of

3366-431: The lists below, the main software branch of KSH is defined as the original program, dating from July 1983, up and through the release of KSH2020 in late 2019. Continuing development of follow-on versions (branches) of KSH have split into different groups starting in 2020 and are not elaborated on below. The following are listed in a roughly ascending chronological order of their contributions: The following are listed in

SECTION 50

#1732780250996

3432-400: The memory allocated to a different one. Around the same time, teleprinters began to be used as terminals 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

3498-563: The name "POSIX" referred to IEEE Std 1003.1-1988, released in 1988. The family of POSIX standards is formally designated as IEEE 1003 and the ISO/IEC standard number is ISO / IEC 9945. The standards emerged from a project that began in 1984 building on work from related activity in the /usr/group association. Richard Stallman suggested the name POSIX to the IEEE instead of the former IEEE-IX . The committee found it more easily pronounceable and memorable, and thus adopted it. Unix

3564-408: 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. 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

3630-596: The older ksh88 variant, sometimes with extensions. ksh93 is maintained on GitHub . As "Desktop KornShell" ( dtksh ), ksh93 is distributed as part of the Common Desktop Environment . This version also provides shell-level mappings for Motif widgets. It was intended as a competitor to Tcl / Tk . The original KornShell, ksh88 , became the default shell on AIX in version 4, with ksh93 being available separately. UnixWare 7 includes both ksh88 and ksh93 . The default Korn shell

3696-408: The open-source Android operating system (introduced 2008), with a Linux kernel and a C library ( Bionic ) partially based on BSD code, became most popular. The components of an operating system are designed to ensure that various parts of a computer function cohesively. With the de facto obsoletion of DOS , all user software must interact with the operating system to access hardware. The kernel

3762-421: The piping. Signals may be classified into 7 categories. The categories are: Input/output (I/O) devices are slower than the CPU. Therefore, it would slow down the computer if the CPU had to wait for each I/O to finish. Instead, a computer may implement interrupts for I/O completion, avoiding the need for polling or busy waiting. Some computers require an interrupt for each character or word, costing

3828-418: The same operating system— OS/360 —which consisted of millions of lines of assembly language that had thousands of bugs . 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 necessitated memory partitioning and safeguards against one job accessing

3894-400: The signal number (in mnemonic format) to be sent. (The abrasive name of kill was chosen because early implementations only terminated the process.) In Unix-like operating systems, signals inform processes of the occurrence of asynchronous events. To communicate asynchronously, interrupts are required. One reason a process needs to asynchronously communicate to another process solves

3960-400: The size of the machine needed. The different CPUs often need to send and receive messages to each other; to ensure good performance, the operating systems for these machines need to minimize this copying of packets . Newer systems are often multiqueue —separating groups of users into separate queues —to reduce the need for packet copying and support more concurrent users. Another technique

4026-468: The standards by implementing POSIX support via some sort of compatibility feature (usually translation libraries, or a layer atop the kernel). Without these features, they are usually non-compliant. Operating system An operating system ( OS ) is system software that manages computer hardware and software resources, and provides common services for computer programs . Time-sharing operating systems schedule tasks for efficient use of

SECTION 60

#1732780250996

4092-442: The system and may also include accounting software for cost allocation of 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, although the application code is usually executed directly by the hardware and frequently makes system calls to an OS function or

4158-473: The world. 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. Embedded operating systems are designed to be used in 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

4224-407: Was later changed to POSIXLY_CORRECT . This variable is now also used for a number of other behaviour quirks. Depending upon the degree of compliance with the standards, one can classify operating systems as fully or partly POSIX compatible. Current versions of the following operating systems have been certified to conform to one or more of the various POSIX standards. This means that they passed

4290-499: Was selected as the basis for a standard system interface partly because it was "manufacturer-neutral". However, several major versions of Unix existed—so there was a need to develop a common-denominator system. The POSIX specifications for Unix-like operating systems originally consisted of a single document for the core programming interface , but eventually grew to 19 separate documents (POSIX.1, POSIX.2, etc.). The standardized user command line and scripting interface were based on

4356-406: 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

#995004