Operating System Handout
Unit II – Services and Components of Operating System
Section 2.1 Different Services of Operating System
An Operating System provides different kinds of services to both the users and to the programs
as well. It also provides application programs (that run within an Operating system) an
environment to execute freely. It provides users the services to run various programs in a
convenient manner.
Following are a few common services provided by an operating system
1. User Interface
2. Program Execution
3. File system manipulation
4. Input / Output Operations
5. Communication
6. Resource Allocation
7. Error Detection
8. Accounting
9. Security and protection
1. User Interface:
Usually Operating system comes in three forms or types. Depending on the interface their types
have been further subdivided. These are:
Command line interface
Batch based interface
Graphical User Interface
Let's get to know in brief about each of them.
The Command Line Interface (CLI) usually deals with using text commands and a technique
for entering those commands.
The Batch interface (BI): commands and directives are used to manage those commands that
are entered into files and those files get executed.
Graphical user interface (GUI): which is a window system with a pointing device (like mouse
or trackball) to point to the I/O, choose from menus driven interface and to make choices
viewing from a number of lists and a keyboard to entry the texts.
2. Program Execution:
The operating system must have the capability to load a program into memory and execute that
program. Furthermore, the program must be able to end its execution, either normally or
abnormally / forcefully.
To run a program, the program is required to be loaded into the RAM first and then to assign
CPU time for its execution. Operating system performs this function for the convenience of
the user. It also performs other important tasks like allocation and de-allocation of memory,
CPU scheduling etc.
Mr. V.N.Kukre Page 1 of 6
Operating System Handout
Following are the major activities of an operating system with respect to program
management −
Loads a program into memory.
Executes the program.
Handles program's execution.
Provides a mechanism for process synchronization.
Provides a mechanism for process communication.
Provides a mechanism for deadlock handling.
3. File system manipulation:
A file represents a collection of related information. Computers can store files on the disk
(secondary storage), for long-term storage purpose. Examples of storage media include
magnetic tape, magnetic disk and optical disk drives like CD, DVD. Each of these media has
its own properties like speed, capacity, data transfer rate and data access methods.
A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions. Following are the major activities of an
operating system with respect to file management −
Program needs to read a file or write a file.
The operating system gives the permission to the program for operation on file.
Permission varies from read-only, read-write, denied and so on.
Operating System provides an interface to the user to create/delete files.
Operating System provides an interface to the user to create/delete directories.
Operating System provides an interface to create the backup of file system.
4. Input / Output Operations
Each program requires an input and after processing the input submitted by user it produces
output. This involves the use of I/O devices. The operating system hides the user from all these
details of underlying hardware for the I/O. So the operating system makes the users
convenient to run programs by providing I/O functions. The I/O service cannot be provided
by user-level programs and it must be provided by the operating system.
An Operating System manages the communication between user and device drivers.
I/O operation means read or write operation with any file or any specific I/O device.
Operating system provides the access to the required I/O device when required.
5. Communication
Operating system performs the communication among various types of processes in the form
of shared memory. In multitasking environment, the processes need to communicate with
each other and to exchange their information.
Following are the major activities of an operating system with respect to communication −
Two processes often require data to be transferred between them
Both the processes can be on one computer or on different computers, but are
connected through a computer network.
Communication may be implemented by two methods, either by Shared Memory or
by Message Passing.
Mr. V.N.Kukre Page 2 of 6
Operating System Handout
6. Resource Allocation:
In the multitasking environment, when multiple jobs are running at a time, it is the
responsibility of an operating system to allocate the required resources (like as CPU, main
memory, tape drive or secondary storage etc.) to each process for its better utilization. For this
purpose, various types of algorithms are implemented such as process scheduling, CPU
scheduling, disk scheduling etc.
Following are the major activities of an operating system with respect to resource
management −
The OS manages all kinds of resources using schedulers.
CPU scheduling algorithms are used for better utilization of CPU.
7. Error Detection:
Errors may occur within CPU, memory hardware, I/O devices and in the user program. For
each type of error, the OS takes adequate action for ensuring correct and consistent computing.
Operating system also deals with hardware problems. To avoid hardware problems, the
operating system constantly monitors the system for detecting the errors and fixing these
errors (if found). The main function of operating system is to detect the errors like bad sectors
on hard disk, memory overflow and errors related to I/O devices. After detecting the errors,
operating system takes an appropriate action for consistent computing.
8. Accounting:
Operating system keeps an account of all the resources accessed by each process or user. In
multitasking, accounting enhances the system performance with the allocation of resources
to each process ensuring the satisfaction to each process.
9. Security and protection
If a computer system has multiple users and allows the concurrent execution of multiple
processes, then the various processes must be protected from one another's activities.
Protection includes in ensuring all access to system resources in a controlled manner. For
making a system secure, the user needs to authenticate him or her to the system before using
Section 2.2 System calls
Concepts:
The system call provides an interface to the operating system services. The interface between
a process and an operating system is provided by system calls. In general, system calls are
available as assembly language instructions. System calls are usually made when a process in
user mode requires access to a resource. Then it requests the kernel to provide the resource
via a system call.
When a program in user mode requires access to RAM or a hardware resource, it must ask the
kernel to provide access to that resource. This is done via something called a system call.
When a program makes a system call, the mode is switched from user mode to kernel mode.
This is called a context switch.
Mr. V.N.Kukre Page 3 of 6
Operating System Handout
Then the kernel provides the resource which the program requested. After that, another context
switch happens which results in change of mode from kernel mode back to user mode.
Generally, system calls are made by the user level programs in the following situations:
Creating, opening, closing and deleting files in the file system.
Creating and managing new processes.
Creating a connection in the network, sending and receiving packets.
Requesting access to a hardware device, like a mouse or a printer.
A figure representing the execution of the system call is given as follows:
Services Provided by System Calls :
1. Process creation and management
2. Main memory management
3. File Access, Directory and File system management
4. Device handling(I/O)
5. Protection
6. Networking, etc.
Types of System Calls : There are 5 different categories of system calls –
1. Process control: end, abort, create, terminate, allocate and free memory.
2. File management: create, open, close, delete, read file etc.
3. Device management
4. Information maintenance
5. Communication
Examples of Windows and Unix System Calls –
Windows Unix
CreateProcess() fork()
Process Control ExitProcess() exit()
WaitForSingleObject() wait()
CreateFile() open()
ReadFile() read()
File Manipulation
WriteFile() write()
CloseHandle() close()
Mr. V.N.Kukre Page 4 of 6
Operating System Handout
SetConsoleMode() ioctl()
Device Manipulation ReadConsole() read()
WriteConsole() write()
GetCurrentProcessID() getpid()
Information Maintenance SetTimer() alarm()
Sleep() sleep()
CreatePipe() pipe()
Communication CreateFileMapping() shmget()
MapViewOfFile() mmap()
SetFileSecurity() chmod()
Protection InitlializeSecurityDescriptor() umask()
SetSecurityDescriptorGroup() chown()
2.3 Operating System Components
From the virtual machine point of view (also resource management)
These components reflect the services made available by the O.S.
1. Process Management
o Process is a program in execution --- numerous processes to choose from in a
multiprogrammed system,
o Process creation/deletion (bookkeeping)
o Process suspension/resumption (scheduling, system vs. user)
o Process synchronization
o Process communication
o Deadlock handling
2. Memory Management
1. Maintain bookkeeping information
2. Map processes to memory locations
3. Allocate/deallocate memory space as requested/required
3. I/O Device Management
0. Disk management functions such as free space management, storage
allocation, fragmentation removal, head scheduling
1. Consistent, convenient software to I/O device interface through
buffering/caching, custom drivers for each device.
4. File System
Built on top of disk management
0. File creation/deletion.
1. Support for hierarchical file systems
2. Update/retrieval operations: read, write, append, seek
3. Mapping of files to secondary storage
5. Protection
Controlling access to the system
0. Resources --- CPU cycles, memory, files, devices
1. Users --- authentication, communication
2. Mechanisms, not policies
6. Network Management
Often built on top of file system
0. TCP/IP, IPX, IPng
1. Connection/Routing strategies
Mr. V.N.Kukre Page 5 of 6
Operating System Handout
2. ``Circuit'' management --- circuit, message, packet switching
3. Communication mechanism
4. Data/Process migration
7. Network Services (Distributed Computing)
Built on top of networking
0. Email, messaging (GroupWise)
1. FTP
2. gopher, www
3. Distributed file systems --- NFS, AFS, LAN Manager
4. Name service --- DNS, YP, NIS
5. Replication --- gossip, ISIS
6. Security --- kerberos
8. User Interface
0. Character-Oriented shell --- sh, csh, command.com ( User replaceable)
1. GUI --- X, Windows 95
2.4 Use of Operating system tools
Users and groups management: Creation, deletion of users and group
Security policy: Permission to group and users , permission types, viewing the
permission, modify the permissions, user authentication
Device Management: loading of Device driver depending on its types such as
block, character or network device, partition of HDD, Checking the disk space
Monitor: Performance of CPU usage, Memory usage, Swap memory, Cache
size, buffer size, process ID, Users, Command etc.
Task Scheduler
Mr. V.N.Kukre Page 6 of 6