Operating System NOTES
Operating System NOTES
1. Provides the facilities to create, modification of programs and data files using
an editor.
2. Access to the compiler for translating the user program from high-level
language to machine language.
3. Provide a loader program to move the compiled program code to the
computer’s memory for execution.
4. Provide routines that handle the details of I/O programming.
I/O System Management –
The module that keeps track of the status of devices is called the I/O traffic
controller. Each I/O device has a device handler that resides in a separate
process associated with that device. The I/O subsystem consists of
A memory Management component that includes buffering caching and
spooling.
A general device driver interface.
Drivers for specific hardware devices.
Assembler –
The input to an assembler is an assembly language program. The output is an
object program plus information that enables the loader to prepare the object
program for execution. At one time, the computer programmer had at his disposal a
basic machine that interpreted, through hardware, certain fundamental instructions.
He would program this computer by writing a series of ones and Zeros (Machine
language), place them into the memory of the machine.
Compiler –
The High-level languages- examples are FORTRAN, COBOL, ALGOL, and PL/I are
processed by compilers and interpreters. A compiler is a program that accepts a
source program in a “high-level language “and produces a corresponding object
program. An interpreter is a program that appears to execute a source program as
if it was machine language. The same name (FORTRAN, COBOL, etc.) is often used
to designate both a compiler and its associated language.
Loader –
A Loader is a routine that loads an object program and prepares it for execution.
There are various loading schemes: absolute, relocating, and direct-linking. In
general, the loader must load, relocate and link the object program. The loader is a
program that places programs into memory and prepares them for execution. In a
simple loading scheme, the assembler outputs the machine language translation of
a program on a secondary device and a loader places it in the core. The loader
places into memory the machine language version of the user’s program and
transfers control to it. Since the loader program is much smaller than the
assembler, those make more core available to the user’s program.
History of Operating system –
The operating system has been evolving through the years. The following table
shows the history of OS.
OSes provide environments in which programs run, and services for the users of the
system, including:
User Interfaces - Means by which users can issue commands to the system.
Depending on the system these may be a command-line interface ( e.g. sh,
csh, ksh, tcsh, etc. ), a GUI interface ( e.g. Windows, X-Windows, KDE,
Gnome, etc. ), or a batch command systems. The latter are generally older
systems using punch cards of job-control language, JCL, but may still be used
today for specialty systems designed for a single purpose.
Program Execution - The OS must be able to load a program into RAM, run
the program, and terminate the program, either normally or abnormally.
I/O Operations - The OS is responsible for transferring data to and from I/O
devices, including keyboards, terminals, printers, and storage devices.
File-System Manipulation - In addition to raw data storage, the OS is also
responsible for maintaining directory and subdirectory structures, mapping
file names to specific blocks of data storage, and providing tools for
navigating and utilizing the file system.
Communications - Inter-process communications, IPC, either between
processes running on the same processor, or between processes running on
separate processors or separate machines. May be implemented as either
shared memory or message passing, ( or some systems may offer both. )
Error Detection - Both hardware and software errors must be detected and
handled appropriately, with a minimum of harmful repercussions. Some
systems may include complex error avoidance or recovery systems, including
backups, RAID drives, and other redundant systems. Debugging and
diagnostic tools aid users and administrators in tracing down the cause of
problems.
Other systems aid in the efficient operation of the OS itself:
Resource Allocation - E.g. CPU cycles, main memory, storage space, and
peripheral devices. Some resources are managed with generic systems and
others with very carefully designed and specially tuned systems, customized
for a particular resource and operating environment.
Accounting - Keeping track of system activity and resource usage, either for
billing purposes or for statistical record keeping that can be used to optimize
future performance.
Protection and Security - Preventing harm to the system and to resources,
either through wayward internal processes or malicious outsiders.
Authentication, ownership, and restricted access are obvious parts of this
system. Highly secure systems may log all process activity down to
excruciating detail, and security regulation dictate the storage of those
records on permanent non-erasable medium for extended times in secure
( off-site ) facilities.
An Operating System provides services to both the users and to the
programs.
Program execution
I/O operations
File System manipulation
Communication
Error Detection
Resource Allocation
Protection
Program execution
Operating systems handle many kinds of activities from user programs to system
programs like printer spooler, name servers, file server, etc. Each of these activities
is encapsulated as a process.
It is better that operating systems have a modular structure, unlike MS-DOS. That
would lead to greater control over the computer system and its various applications.
The modular structure would also allow the programmers to hide information as
required and implement internal routines as they see fit without changing the outer
specifications.
Layered Structure
One way to achieve modularity in the operating system is the layered approach. In
this, the bottom layer is the hardware and the topmost layer is the user interface.
An image demonstrating the layered approach is as follows −
As seen from the image, each upper layer is built on the bottom layer. All the layers
hide some structures, operations etc from their upper layers.
One problem with the layered structure is that each layer needs to be carefully
defined. This is necessary because the upper layers can only use the functionalities
of the layers below them.
Microkernel in Operating Systems
Kernel is the core part of an operating system which manages system resources. It
also acts like a bridge between application and hardware of the computer. It is one
of the first programs loaded on start-up (after the Bootloader).
Kernel mode and User mode of CPU operation: The CPU can execute certain
instruction only when it is in the kernel mode. These instruction are called privilege
instruction. They allow implementation of special operation whose execution by the
user program could interface with the functioning of operating system or activity of
another user program. For example, instruction for managing memory protection.
The operating system puts the CPU in kernel mode when it is executing in the
kernel so, that kernel can execute some special operation.
The operating system puts the CPU in user mode when a user program is in
execution so, that user program cannot interface with the operating system
program.
User-level instruction does not require special privilege. Example are
ADD,PUSH,etc.
The concept of modes can be extended beyond two, requiring more than a single
mode bit CPUs that support virtualization use one of these extra bits to indicate
when the virtual machine manager, VMM, is in control of the system. The VMM has
more privileges than ordinary user programs, but not so many as the full kernel.
System calls are typically implemented in the form of software interrupts, which
causes the hardware’s interrupt handler to transfer control over to an appropriate
interrupt handler, which is part of the operating system, switching the mode bit to
kernel mode in the process. The interrupt handler checks exactly which interrupt
was generated, checks additional parameters (generally passed through registers) if
appropriate, and then calls the appropriate kernel service routine to handle the
service requested by the system call.
User programs’ attempts to execute illegal instructions ( privileged or non-existent
instructions ), or to access forbidden memory areas, also generate software
interrupts, which are trapped by the interrupt handler and control is transferred to
the OS, which issues an appropriate error message, possibly dumps data to a log
( core ) file for later analysis, and then terminates the offending program.
What is Microkernel?
Microkernel is one of the classifications of the kernel. Being a kernel it manages all
system resources. But in a microkernel, the user services and kernel
services are implemented in different address space. The user services are kept
in user address space, and kernel services are kept under kernel address
space, thus also reduces the size of kernel and size of operating system as well.