Module-1
Module-1
INTRODUCTION TO OPERATING
SYSTEMS
Program
A program is a collection or group or set of statements or instructions which performs a particular task.
Software
Types of software
System software
Application software
System software
System Software is installed on the computer when the operating system is installed.
The user does not interact with the system software because it works in the background.
Example system software are: Operating Systems, Compilers, Linkers, Loaders, Assemblers, debugger, driver
and so on.
Application software
Software which depends on other software for services is called as application software.
Application software can’t run independently. They can’t run without the presence of system software.
Example application software are: VLC player, web browser, word processor and so on.
Computer
Some of the hardware resources are: processor, HD, RAM, keyboard, monitor and so on.
Some of the software resources are: operating system, compiler, interpreter, loader, assembler and so on.
Operating System
It also provides a basis for application programs and acts as an intermediary between the computer user and
the computer hardware.
Some operating systems are designed to provide convenient communication between user and computer
system, others for efficient utilization of resources, and others to provide both.
Role of Operating System
A computer system can be logically divided into four components: the hardware, the operating system, the
application programs, and the users as shown in above figure.
The hardware (the central processing unit, the memory and the I/O devices) provides the computing
resources for the computer system.
The system programs (compilers, assemblers and so on) and application programs (word processors,
spreadsheets, web browsers and so on) help the user programs in their execution.
The operating system controls the hardware and coordinates the use of hardware among various user
programs.
The role of operating system is fully explained by considering two views: user view and system view.
User view
Computer systems are divided into four categories from user point of view.
1) Personal computers
Used by single person for home applications. The Operating System used in personal computers should focus
on the following
2) Thin clients
A thin client is a system which do not have any processing capability and storage capacity.
It is used for typing the program and displaying the output.
Thin clients are connected to a server system which has storage capacity and execution capability.
The programs typed in the thin clients are stored and executed in server system. The results of execution are
passed to client systems.
The operating system used in thin clients should concentrate on resource utilization.
The server system provides service to all client systems connected to it.
The Operating System used in client system should use resources of the client system as well as resources
available at the server system.
The Operating System used in home devices should work automatically without any intervention of user.
System view
From system point of view, the Operating System can be viewed as resource allocator.
The Operating System allocates the resources of the computer system to the programs that are currently running
in the system.
Computer System Organization
A modern computer system consists of one or more CPUs and number of devices.
The CPUs and devices are connected to the system bus as shown in diagram.
The devices are connected to the system bus through device controllers.
When the computer system is booted, a program called bootstrap program starts running.
Role of bootstrap program is locating the operating system, loading the operating system into RAM and starting
the execution of operating system.
When the operating system is started then the operating system controls the operations of computer system.
Operating System Operations
1. Process Management
2. Memory Management
3. File Management
4. I/O Management
5. Protection
6. Security
7. Networking
Process Management
3) providing synchronization
4) providing communication
5) handling deadlocks
Creating and deleting processes
To create a new process, the operating system has to do the following activities
To delete a process, the Operating System has to move the program form RAM to disk.
Before suspending the process, the Operating System has to save the status of the execution of the process.
Before resuming the process, the Operating System has to restore the saved status of the process.
Providing synchronization
Sharable resource
When number of processes requests a non sharable resource at the same time, then the Operating System has
to provide synchronous access to the resource by allocating the resource to only one process at a time.
Providing commutation
1) Shared memory
2) Message passing
Handling deadlocks
A set of processes is said to be in deadlock state if each process in the set is waiting for another process.
The Operating System has to allocate the resources to processes such that the system should not go into the
deadlock state.
Memory Management
Operating system has to manage both primary memory (RAM) and secondary memory (Hard disk).
RAM
For managing the primary memory, the Operating System is responsible for
3) Deciding which process needs to be moved between RAM and Hard disk
The hard disk contains number of storage blocks. At any time, some of the blocks contains programs and
remaining blocks are free.
For managing the secondary memory, the Operating System is responsible for
2) Storage allocation
3) Disk scheduling
File Management
The Operating System is responsible for the following activities for managing files
A computer system contains number of input and output devices like keyboard, mouse, monitor, printer and
so on.
Networking
The Operating System used in a computer which is connected to a network must provide support
Protection: restricting access to the resources of the system from the processes that are running in the system.
For example, if two or more processes request the CPU at the same time then the Operating System has to
restrict the access to the CPU by allocating the CPU to only one process at a time.
If the computer system is running with batch processing operating system then the execution of programs in
the computer system is as follows:
The programs that users want to execute and the input data required for executing the programs are
collected into a batch.
The batch of programs is then loaded into computer system for execution.
There is no interaction between users and computer during execution of the programs.
The outputs generated after execution of programs is collected into a batch and then distributed to users.
When only one program is loaded into main memory and if that program requires any i/o operation during its
execution then the CPU will be in idle state until the i/o operation is completed.
During execution of program, if the program requires any i/o operation then the CPU is switched to another
program so that the CPU is busy at all times.
Multiprogramming operating system allows loading of number of programs at a time into RAM.
Multiprogramming operating system switches the CPU from current program to another program when the
current process is completed or goes to the waiting state.
Time sharing operating system loads number of programs at a time into main memory.
Allow each program to execute for a certain amount of time only. After that the CPU is switched to another
program.
Timesharing operating system switches the CPU from current program to another program
A time-shared operating system allows many users to share the computer simultaneously.
Distributed operating system manages a group of independent computers and makes them appear to be a
single computer.
Resource sharing
For example, if a printer is connected to the network then all systems in the network can share the printer.
Reliability of resources
If any resource of any system fails then the resource of other system in the network can be used.
Speed up of computations
Programs can be executed in less amount of time by dividing the program into number of parts and executing
these parts on different systems in the network.
If more number of persons is involved in the development of any project then there should be some
communication between the systems that are being used by the persons.
Providing Transparency
The distributed operating system hides the details of execution of the program from the user.
Real time operating systems are used in computer systems which executes real time applications.
For example, if there is a satellite which sends some data for every 100 seconds and if a computer system
receives and stores that data then the operating system used in that computer system is a real time operating
system.
In this example, the operating system has to receive and store the data within 99 seconds.
Windows CE and Symbian are examples for real time operating systems.
Multi user operating system
Multi user operating system allows multiple users to access a computer system simultaneously.
Time-sharing systems can be classified as multi-user systems as they enable multiple user access to a
computer through time sharing.
UNIX and open VMS are examples for multi user operating systems.
Multi tasking operating system
In pre-emptive multitasking, the operating system slices the CPU time and dedicates one slot to each of the
programs.
Unix-like operating systems such as Solaris and Linux support pre-emptive multitasking.
In co-operative multi tasking, CPU is switched to another process when the current process is completed or
goes to the waiting state.
The operating systems designed for being used in embedded computer systems are known as embedded
operating systems.
Embedded operating systems are designed to operate on small machines like PDAs with less autonomy.
Embedded operating systems are able to operate with a limited number of resources.
A mobile operating system controls a mobile device and its design supports wireless communication and
mobile applications.
Blackberry OS, Google's Android and Apple's iOS are some of the most known names of mobile operating
systems.
System calls
The services provided by an operating system are made available to user programs through system calls.
Some system calls which directly interacts with hardware devices are developed in assembly language.
System calls are executed in kernel of operating system when a user program requests the operating system
for any service.
For example, when a user program calls a scanf() function for reading data from keyboard then the system
call ‘read()’ is invoked and executed in the kernel.
Number of system calls is invoked during execution of even a small program.
For example, assume that there is a program for copying data from one file to other file. Some of the system
calls invoked during the execution of this program are:
The API contains set of functions/methods using which the programmer develops programs.
The API also specifies the parameters that need to be passed to each function and also the values returned by
each function.
When any API function or method is executed in the program then the corresponding system call is invoked.
There are two main reasons for writing programs using API instead of system calls directly.
1. Program written using API can be executed on any system that supports the same API.
The run-time support system for most programming languages provides a system-call interface that serves as
the link to system calls made available by the operating system.
During execution of user program, when any API function is executed then the system-call interface identifies
the corresponding system call and activates that system call within the operating system
The system-call interface also returns the status of the system call and any return values.
Types of system calls
1. end, abort
2. load, execute
5. wait, signal
File management system calls
1. create, delete
2. open, close
2. read, write
protection