Unit 1
Unit 1
Page
1
Functions of Operating System:
Process Management
A process is a program in execution. A process needs certain resources, including CPU time,
memory, files, and I/O devices, to accomplish its task.
The operating system is responsible for the following activities in connection with process management.
✦ Process creation and deletion.
✦ process suspension and resumption.
✦ Provision of mechanisms for:
• process synchronization
• process communication
Main-Memory Management
Memory is a large array of words or bytes, each with its own address. It is a repository of
quickly accessible data shared by the CPU and I/O devices.
Main memory is a volatile storage device. It loses its contents in the case of system failure.
The operating system is responsible for the following activities in connections with memory
management:
¨ Keep track of which parts of memory are currently being used and by whom.
¨ Decide which processes to load when memory space becomes available.
¨ Allocate and de-allocate memory space as needed.
File Management
A file is a collection of related information defined by its creator. Commonly, files represent
programs (both source and object forms) and data.
The operating system is responsible for the following activities in connections with file management:
✦ File creation and deletion.
✦ Directory creation and deletion.
✦ Support of primitives for manipulating files and directories.
✦ Mapping files onto secondary storage.
✦ File backup on stable (nonvolatile) storage media.
I/O System Management
The I/O system consists of:
✦ A buffer-caching system
✦ A general device-driver interface
✦ Drivers for specific hardware devices
Secondary-Storage Management
Since main memory (primary storage) is volatile and too small to accommodate all data and
programs permanently, the computer system must provide secondary storage to back up main memory.
Most modern computer systems use disks as the principle on-line storage medium, for both programs and
data. The operating system is responsible for the following activities in connection with disk
management:
✦ Free space management
✦ Storage allocation
✦ Disk scheduling
Networking (Distributed Systems)
¨ A distributed system is a collection processors that do not share memory or a clock. Each
processor has its own local memory.
¨ The processors in the system are connected through a communication network.
¨ Communication takes place using a protocol.
¨ A distributed system provides user access to various system resources.
Page
2
¨ Access to a shared resource allows:
✦ Increased data availability
✦ Enhanced reliability
Protection System
¨ Protection refers to a mechanism for controlling access by programs, processes, or users to both
system and user resources.
¨ The protection mechanism must:
✦ distinguish between authorized and unauthorized usage.
✦ specify the controls to be imposed.
✦ provide a means of enforcement.
Command-Interpreter System
• Many commands are given to the operating system by control statements which deal with:
✦ process creation and management
✦ I/O handling
✦ secondary-storage management
✦ main-memory management
✦ file-system access
✦ protection
✦ networking
• The program that reads and interprets control statements is called variously:
✦ command-line interpreter
✦ shell (in UNIX)
• Its function is to get and execute the next command statement.
KERNEL
Page
3
Functions of a Kernel
A kernel of an OS is responsible for performing various functions and has control over the system. Some
main responsibilities of Kernel are given below:
o Device Management
To perform various actions, processes require access to peripheral devices such as a mouse,
keyboard, etc., that are connected to the computer. A kernel is responsible for controlling these
devices using device drivers. Here, a device driver is a computer program that helps or enables
the OS to communicate with any hardware device.
A kernel maintains a list of all the available devices, and this list may be already known, configured
by the user, or detected by OS at runtime.
o Memory Management
The kernel has full control for accessing the computer's memory. Each process requires some
memory to work, and the kernel enables the processes to safely access the memory. To allocate
the memory, the first step is known as virtual addressing, which is done by paging or
segmentation. Virtual addressing is a process of providing virtual address spaces to the
processes. This prevents the application from crashing into each other.
o Resource Management
One of the important functionalities of Kernel is to share the resources between various processes.
It must share the resources in a way that each process uniformly accesses the resource.
The kernel also provides a way for synchronization and inter-process communication (IPC). It is
responsible for context switching between processes.
o Accessing Computer Resources
A kernel is responsible for accessing computer resources such as RAM and I/O devices. RAM or
Random-Access Memory is used to contain both data and instructions. Each program needs to
access the memory to execute and mostly wants more memory than the available. For such a case,
Kernel plays its role and decides which memory each process will use and what to do if the required
memory is not available.
The kernel also allocates the request from applications to use I/O devices such as keyboards,
microphones, printers, etc.
Types of Kernel
A monolithic kernel is another classification of the kernel. In monolithic kernel-based systems, each
application has its own address space. Like microkernel, this one also manages system resources between
application and hardware, but user services and kernel services are implemented under the same address
space. It increases the size of the kernel, thus increases the size of the operating system as well.
Page
4
This kernel provides CPU scheduling, memory management, file management, and other system functions
through system calls. As both services are implemented under the same address space, this makes operating
system execution faster.
CONCEPTS OF OS
Multi-programming increases CPU utilisation by organising jobs (code and data) so that the CPU always
has one to execute. The idea is to keep multiple jobs in main memory. If one job gets occupied with IO,
CPU can be assigned to other job.
This type of OS is used to execute more than one jobs simultaneously by a single processor. it
increases CPUutilization by organizing jobs so that the CPU always has one job to execute.
The concept of multiprogramming is described as follows:
Ø All the jobs that enter the system are stored in the job pool( in disc). The operating system
loads a set of jobs from job pool into main memory and begins to execute.
Ø During execution, the job may have to wait for some task, such as an I/O operation, to
complete. In a multiprogramming system, the operating system simply switches to another
job and executes. When that job needs to wait, the CPU is switched to another job, and so on.
Ø When the first job finishes waiting and it gets the CPU back.
Ø As long as at least one job needs to execute, the CPU is never idle.
Multiprogramming operating systems use the mechanism of job scheduling and CPU scheduling.
Page
5
Time-Sharing/multitasking Operating Systems
Multi-tasking is a logical extension of multiprogramming. Multitasking is the ability of an OS to execute
more than one task simultaneously on a CPU machine. These multiple tasks share common resources
(like CPU and memory). In multi-tasking systems, the CPU executes multiple jobs by switching among
them typically using a small time quantum, and the switches occur so quickly that the users feel like
interact with each executing task at the same time.
Time sharing (or multitasking) OS is a logical extension of multiprogramming. It provides extra facilities
such as:
Faster switching between multiple jobs to make processing faster.
Allows multiple users to share computer system simultaneously.
The users can interact with each job while it is running.
These systems use a concept of virtual memory for effective utilization of memory space. Hence, in this
OS, no jobs are discarded. Each one is executed using virtual memory concept. It uses CPU scheduling,
memory management, disc management and security management. Examples: CTSS, MULTICS, CAL,
UNIX etc.
Page
7
4. Real-Time Operating Systems (RTOS)
A real-time operating system (RTOS) is a multitasking operating system intended for
applications with fixeddeadlines (real-time computing). Such applications include some small
embedded systems, automobile engine controllers, industrial robots, spacecraft, industrial control,
and some large-scale computing systems.
The real time operating system can be classified into two categories:
1. hard real time system and 2. soft real time system.
A hard real-time system guarantees that critical tasks be completed on time. This goal
requires that al delays in the system be bounded, from the retrieval of stored data to the time that
it takes the operating system to finish any request made of it. Such time constraints dictate the
facilities that are available in hard real-time systems.
A soft real-time system is a less restrictive type of real-time system. Here, a critical real-time task
gets priority over other tasks and retains that priority until it completes. Soft real time system can
be mixed with other types of systems. Due to less restriction, they are risky to use for industrial
control and robotics.
Page
8
Following are the five services provided by operating systems to the convenience of the
users.
1. Program Execution
The purpose of computer systems is to allow the user to execute programs. So the
operating system provides an environment where the user can conveniently run programs.
Running a program involves the allocating and deallocating memory, CPU scheduling in
case of multiprocessing.
2. I/O Operations
Each program requires an input and produces output. This involves the use of I/O.
So the operating systems are providing I/O makes it convenient for the users to run
programs.
3. File System Manipulation
The output of a program may need to be written into new files or input taken from
some files. The operating system provides this service.
4. Communications
The processes need to communicate with each other to exchange information
during execution. It may be between processes running on the same computer or running
on the different computers. Communications can be occur in two ways: (i) shared memory
or (ii) message passing
5. Error Detection
An error is one part of the system may cause malfunctioning of the complete
system. To avoid such a situation operating system constantly monitors the system for
detecting the errors. This relieves the user of the worry of errors propagating to various
part of the system and causing malfunctioning.
Following are the three services provided by operating systems for ensuring the
efficient operation of the system itself.
1. Resource allocation
When multiple users are logged on the system or multiple jobs are running at the
same time, resources must be allocated to each of them. Many different types of resources
are managed by the operating system.
2. Accounting
The operating systems keep track of which users use how many and which kinds
of computer resources. This record keeping may be used for accounting (so that users can
be billed) or simply for accumulating usage statistics.
3. Protection
When several disjointed processes execute concurrently, it should not be possible
for one process to interfere with the others, or with the operating system itself. Protection
involves ensuring that all access to system resources is controlled. Security of the system
from outsiders is also important. Such security starts with each user having to authenticate
him to the system, usually by means of a password, to be allowed access to the resources.
System Call:
Ø System calls provide an interface between the process and the operating system.
Ø System calls allow user-level processes to request some services from the operating
Page
system which process itself is not allowed to do. 9
Ø For example, for I/O a process involves a system call telling the operating system to
read or write particular area and this request is satisfied by the operating system.
BOOTSTRAP PROGRAM
A bootstrap program is the first code that is executed when the computer system is started.
The entire operating system depends on the bootstrap program to work correctly as it loads
the operating system.
the bootstrap program is a part of ROM which is the non-volatile memory. The operating
system is loaded into the RAM by the bootstrap program after the start of the computer system.
Then the operating system starts the device drivers.
Bootstrapping Process
The bootstrapping process does not require any outside input to start. Any software can be
loaded as required by the operating system rather than loading all the software automatically.
The bootstrapping process is performed as a chain i.e. at each stage, it is the responsibility of
the simpler and smaller program to load and execute the much more complicated and larger
program. This means that the computer system improves in increments by itself.
The booting procedure starts with the hardware procedures and then continues onto the
software procedures that are stored in the main memory. The bootstrapping process involves
self-tests, loading BIOS, configuration settings, hypervisor, operating system etc.
Page
10