Unit 1
Unit 1
1.1 Introduction
An operating system is a program that manages the computer system.
It acts as an intermediatary between user and computer system. It is nothing, but a control
program that manages or controls all the activities that has been performed inside the
computer system.
Broadly, the computer system is divided into 4 parts.
i. Computer hardware- provides basic computing resources
ii. Operating system (system software)-controls and coordinates use of hardware among
applications and users.
iii. Application program- defines the way in which system resources are used to solve the
computing problem of the users
iv. User- people, machines and other computers.
1.1.2 Systems
User’s view of operating system
Operating system is designed for easy use of resources in the computer system with high
performance.
OS is designed to maximize the resource utilization to assure that all available resources
like CPU time, memory and I/O devices are used efficiently and effectively.
Memory
Advantages:
Performance: Computers work as a parallel unit this system, resulting in high
performance.
Fault tolerance: the loss of any node in system does not result in loss of system as the
nodes in standby takes the place of failed node.
Scalability: this system is quite scalable to add new node to system, no need to take down
entire cluster.
1.1.7 Real time System
Real time system means that the system is subjected to real time, i.e., response should be
guaranteed within a specified timing constraint or system should meet the specified deadline. For
example: flight control system, real time monitors etc.
Types of real time systems based on timing constraints:
1. Hard real time system –
This type of system can never miss its deadline. Missing the deadline may have disastrous
consequences. The usefulness of result produced by a hard real time system decreases
abruptly and may become negative if tardiness increases. Tardiness means how late a real
time system completes its task with respect to its deadline. Example: Flight controller
system.
2. Soft real time system –
This type of system can miss its deadline occasionally with some acceptably low probability.
Missing the deadline has no disastrous consequences. The usefulness of result produced by a
soft real time system decreases gradually with increase in tardiness. Example: Telephone
switches.
When the CPU is interrupted, it stops what it is doing and immediately transfers
execution to a fixed location. The fixed location usually contains the starting address
where the service routine of interrupt is located. The interrupt service routine executes.
On completion, the CPU resumes the interrupted computation.
To start an I/O operation, the device driver loads the appropriate registers within the
device controller. The device controller then examines the contents of registers to
determine what action to take i.e. transfers data from device to it’s local buffer.
Thread of execution
Cache Instructions and
Instruction
Data
CPU execution
cycle
Data Memory
movement
I/O request
Interrupt
Data
DMA
Device
As the transfer of data completes, the controller informs the device driver via interrupt. The
device driver then returns the control to OS. But can produce high overhead when used for
bulk data movement.
To solve this problem, Direct Memory Access (DMA) is used. After setting buffers,
pointers and counters for I/O device, the device controller transfers the entire block of data
directly to/from it’s own buffer storage to memory without any intervention of CPU.
1.2.4Storage Hierarchy
Storage systems organized in hierarchy based on:
Speed
Cost
Volatility
The top four levels of memory may be constructed using semi conductor memory. Volatile
storage loses it’s contents when power removed. Data must be written to non volatile storage for
safe keeping.
Solid state disk (SSD) is a large DRAM array during normal operation but also contains a
hidden magnetic disk and battery backup power. If external power interrupted, the SSD disk
controller copies the data from RAM to magnetic disk and when external power restored, the
controller copies data back to RAM.
Another SSD type is made of flash memory is slower than DRAM but needs no power to
retain its contents.
Caches can be installed to improve performance where a large disparity appears in access
time or transfer rate exists between two components.
Memory Management:
Primary memory is the direct access storage for CPU. Programs must be stored in
memory to execute. Under memory management OS does the following functions:
- It keeps track of free memory locations.
- It keeps track of programs loaded in memory locations.
- Keeps track of processes to be loaded in main memory and selects one process
whenever some memory space available.
- It allocates and de-allocates memory locations to processes.
File Management:
A file is a named collection of persistent information that can be read or written. The file
system provides logical objects and logical operations on those objects. File system also
supports directories. Under the file management OS does the following function:
- It takes care of creation and deletion of files and directories.
- It provides an option to assign various permissions to files and also map these files
in various storage medium.
- It allows user to access files and manipulate it.
- It also provides backup facilities.
I/O System Management:
Much of the OS kernel is connected with I/O. OS provides a standard interface between
programs (user or system) and devices.
- It provides a general purpose device driver.
- It provides device driver for specific hardware devices.
- It provides memory management component.
Network Services:
OS support for various protocols and communication facilities.
Network provides sharing of resources and improves speed of computation, data
availability and reliability. For example is WWW (World Wide Web).
Protection system:
Protection is a general mechanism throughout the OS helps to detect errors as well as to
prevent malicious destruction.
All resource objects need protection, such as:
- memory
- processes
- files
- devices
Virtual Memory Management: Maintain mapping from virtual to physical memory,
decide on size of memory to allocate to processes, enforce replacement policy
management.
Command Language Interpreter (CLI): interface to operator and users that gives them the
ability to give commands to the OS.
In other word, it’s simply a non-privileged process that interfaces to the user,
permitting replacement of interpreter with others.
Accounting Services:
General facility for keeping track of resource usage for all system objects. May be used to
enforce quotas, or to produce bill$.
There are two modes of operation that the program can execute (run) i.e. the user mode and
kernel mode. The user mode does not have direct access to memory, hardware and such
resources whereas the Kernel mode has access to all the resources. Hence the program running in
Kernel mode is in privileged mode. But user mode seems to be safer mode, if it crashes the rest
system remains in safe. When User mode needs access to resources it makes a call to OS,
switching occurs from user mode to kernel mode, known as context switching. The call made is
known as system call.
These calls are generally available as routines written in C and C++. For example a
system calls sequence for writing a simple program to read data from file and copy them to
another file.
All the steps above needs system call. After the input of input file output file system call, if
the file does not exit then abort must be done where error occurs. But is file exist then also
have to abort since we are creating new source file with new contents. But if destination file
exists then new file has to be created.
If the destination file is new then reading from input files and writing to output files
occurs where looping has to be done until the reading fails as there nothing remains to read.
Finally output file has to be closed by writing completion message to screen.
System calls are accessed by program through a high speed supplication program
interface (API). The three most common API’s are:
i. Win32: used for windows
ii. POSIX: used for Linux
iii. Java API: JVM (Java virtual machine)
1.3.3 System Programs
System program provides a convenient environment for program development and execution,
also known as system utilities. In figure of abstract computer system, the lowest level is
hardware, next is operating system, then is system program, and finally the application program.
Some of them are simply user interface to system calls, while others are more complex. Based on
task they perform they can be divided into following categories:
i. File management:
This program creates, delete, copy, rename, print, dump, list, and generally manipulate files
and directories.
ii. Status information:
This system program asks for status information, such as system asks for:
Date and time
Amount of available memory or disk space
Number of users
Detailed performance
Logging and debugging information etc.
iii. File modification:
It deals with modifying the inner contents of file; system program has to be used to fulfill the
file modification.
- Several text editors may be available to create and modify the contents of files stored on
disk or other storage devices.
- There may be also special commands to search contents of files or perform transformation
of the text.
iii. Programming language support:
System program must support several programming languages such as C, C++, Java,
Visual Basic, and Perl and so on. The system must compile the program written in different
languages. There are language processors such as compilers, assemblers, debuggers and
interpreters for common programming languages, are often provided to the user with the
operating system.
iv. program loading and execution
After the program compilation, it has to be loaded and executed, so some system program helps
in doing such things. The system may provide:
- Absolute loaders
- Relocatable loaders
- Linkage editors and
- Overlay loaders
If some problem appears in program, has to be solved called Debugging system called debugger
for either high level language or machine language.
v. Communication:
The system program helps communication between processes or users. These programs provide
the mechanism for:
- Creating virtual connections among processes, users, and computer system.
- Allowing users to send message to one another’s screen.
- To browse web pages.
- To send electronic mail messages.
- To log in remotely or to transfer files from one machine to another.
In addition to system programs, most operating systems are supplies with programs that are
useful in solving common problem or performing common operations.
Here the device drivers have access to basic hardware, resident program to access to device
driver as well as basic hardware. Even application program have access to resident system
program as well as basic hardware. Hence the basic hardware have been accessed by all the
things above.
Here the interpretation and levels of functionality are well separated. It looks like layered
but is not. For instance, application program are able to access the basic I/O routine to write
directly to display and disk drive. Such freedom can leave open to malicious program, causing
entire system crash when user program fails. Hence it is not well structured.
MS-DOS was written on Intel 8088 which do not provide dual mode or hardware
protection; hence it is not good structured.
2. Layered structure
In layered structure, the functionalities of operating system are broken down in to layers and
separated. Hence is easy to implement and debug, since each layer have different
functionalities.
3. Microkernel structure
In this approach non essential components are removed from Kernel and implement them
as system and user level program. Here the microkernel provides core functionalities and
other some other functionalities like device driver, file server, process server and virtual
memory are implemented as user level or system program on its top.
As the client program makes request for services the function of micro kernel is to provide
communication between client program and services. Hence the client program communicates
through message passing to services.
In this structure most of the functions available are executed in user mode as system program
and microkernel has core functionalities only. If the program is running in user mode crashes,
the entire system remains unaffected. But if particular running program fails in kernel mode
then entire system gets crashed. And since most of the functionalities runs in user mode, the
crash of entire system does not happen.
But the disadvantage as the overhead function increases, performance decreases.
Karnegie Mellon University developed an Operating System called Mach that used the
approach of Microkernel.
4. Modules
Here the core kernel has only the core functionalities and the other functionalities are present in
the form of module which will be loaded at boot time or at run time. These modules are loaded
dynamically to core kernel when required. It looks something like layered approach and
somewhat like micro kernel approach.
It resembles the layered system that each kernel section has defined protected interfaces which is
not accessible. But is flexible than layered system that any module can call any other module.
Modules can communicate through the core kernel hence is more flexible than layered approach.
Compared to micro kernel approach, no message passing is done her since are loaded
dynamically as and when needed, hence the system overhead is not here.
Hence module is the best structuring operating system and is used by most of the
operating system.