2. What is an O.S.?
• A program that controls the execution of application programs
(applications).
• An interface between applications and hardware - acts as an
intermediary between the user(s) and the computer.
• Allows convenient usage; hides the tedious stuff
• Allows efficient usage
• Provides information protection
• Gives each user a slice of the resources
• Acts as a control program.
5. Why study Operating Systems?
• Need to understand interaction between the hardware and
software
• Need to understand basic principles in the design of
computer systems
- efficient resource management, security, flexibility
7. Functions of the Operating System
• Device Management
• File Management
• Memory management
• Process Management
• Provision of user interface
• Security
• Control over system performance
• Job accounting
• Error detecting aids
8. Device Management
• OS manages device communication via their respective drivers.
• Operating System does the following activities for device
management.
Keeps tracks of all devices.
Programs responsible for this task is known as the I/O controller.
Decides which process gets the device when and for how much time.
Allocates and de-allocates the device in the efficient way.
9. File Management
• A file system is normally organised into directories for easy navigation
and usage.
• These directories may contain files and other directions.
• Operating System does the following activities for file management:
keeps track of information, location, uses, status etc.
• The collective facilities are often known as file system.
• Decides who gets the resources.
• Allocates the resources.
10. Memory Management
• Memory management refers to management of Primary Memory or
Main Memory.
• Main memory is a large array of words or bytes where each word or
byte has its own address.
• Main memory provides a fast storage that can be access directly by the
CPU.
• So for a program to be executed, it must in the main memory.
• Operating System does the following activities for memory
management: keeps tracks of primary memory i.e. what part of it are in
use by whom, what part are not in use.
11. Processor Management
• In multi-programming environment, OS decides which process gets
the processor when and how much time.
• This function is called process scheduling.
• Operating System does the following activities for processor
management: keeps tracks of processor and status of process.
• Program responsible for this task is known as traffic controller.
• Allocates the processor (CPU) to a process.
• De-allocates processor when processor is no longer required.
12. Other Important Activities
Following are some of the important activities that an Operating System
performs:
• Security - By means of password and similar other techniques, it prevents
unauthorised access to programs and data.
• Control over system performance - Recording delays between request for a
service and response from the system.
• Job accounting - Keeping track of time and resources used by various jobs
and users.
• Error detecting aids - Production of dumps, traces, error messages, and other
debugging and error detecting aids.
• Coordination between other software and users -- Coordination and
assignment of compilers, interpreters, assemblers and other software to the
various users of the computer systems.
13. Types of Operating system
• Operating systems are there from the very first computer generation
and they keep evolving with time.
• Some of the important types of operating systems which are most
commonly used are as follows:
Batch Processing
Time-sharing
Distributed
Network
Real-time
14. Batch Operating System
• The users of a batch operating system do not interact with the computer
directly - there is no direct interaction between user and the computer.
• Each user prepares his job on an off-line device like punch cards and submits
it to the computer operator.
• To speed up processing, jobs with similar needs are batched together and run
as a group.
• The programmers leave their programs with the operator and the operator
then sorts the programs with similar requirements into batches.
• The problems with Batch Systems are as follows:
Lack of interaction between the user and the job.
CPU is often idle, because the speed of the mechanical I/O devices is slower
than the CPU.
Difficult to provide the desired priority.
15. Time-sharing Operating Systems
• Time-sharing is a technique which enables many people, located at various terminals, to use a
particular computer system at the same time. Time-sharing or multitasking is a logical
extension of multiprogramming.
• The operating system uses CPU scheduling and multiprogramming to provide each user with a
small portion of a time.
• Computer systems that were designed primarily as batch systems have been modified to time-
sharing systems.
• Advantages of Timesharing operating systems are as follows:
Provides the advantage of quick response
Avoids duplication of software
Reduces CPU idle time
• Disadvantages of Time-sharing operating systems are as follows:
Problem of reliability
Question of security and integrity of user programs and data
Problem of data communication
16. Distributed Operating System
• Distributed systems use multiple central processors to serve multiple real-time applications and
multiple users.
• Data processing jobs are distributed among the processors accordingly.
• The processors communicate with one another through various communication lines (such as high-
speed buses or telephone lines).
• These are referred as loosely coupled systems or distributed systems. Processors in a distributed
system may vary in size and function.
• These processors are referred as sites, nodes, computers and so on.
• The advantages of distributed systems are as follows:
With resource sharing facility, a user at one site may be able to use the resources available at another.
Speedup the exchange of data with one another via electronic mail.
If one site fails in a distributed system, the remaining sites can potentially continue operating.
Better service to the customers.
Reduction of the load on the host computer.
Reduction of delays in data processing.
17. Network Operating System
• A Network Operating System runs on a server and provides the server the capability to
manage data, users, groups, security, applications, and other networking functions.
• Primary purpose - to allow shared file and printer access among multiple computers in a
network, typically a local area network (LAN), a private network or to other networks.
• e.g. Microsoft Windows Server 2003/2008, UNIX, Linux, Mac OS X, Novell NetWare and BSD.
• The advantages of network operating systems are as follows:
• Centralized servers are highly stable.
• Security is server managed.
• Upgrades to new technologies and hardware can be easily integrated into the system.
• Remote access to servers is possible from different locations and types of systems.
• The disadvantages of network operating systems are as follows:
• High cost of buying and running a server.
• Dependency on a central location for most operations.
• Regular maintenance and updates are required.
18. Real-Time Operating System - RTOS
• A real-time system is defined as a data processing system in which the
time interval required to process and respond to inputs is so small that it
controls the environment.
• A very important part of an RTOS is managing the resources of the
computer so that a particular operation executes in precisely the same
amount of time, every time it occurs.
• A real-time operating system must have well-defined, fixed time
constraints, otherwise the system will fail.
• For example Scientific experiments, medical imaging systems, industrial
control systems, weapon systems, robots, air traffic control systems, etc.
19. USER INTERFACE
Character user interface
• CUI is another name for a command line. Sometimes referred to as
the command screen or a text interface, the command line is a user
interface that is navigated by typing commands prompts, as opposed
to using the mouse to perform a command.
• Unlike a GUI operating system, a command line only uses
a keyboard to navigate by entering commands and does not utilize
a mouse.
• Because a command line interface requires unique commands, this
interface is often more difficult to learn because of the need to
memorize different commands.
• Eg. Unix or MS-DOS
20. Graphical User Interface
• A GUI uses windows, icons, and menus to carry out commands, such
as opening, deleting, and moving files.
• Although many GUI operating systems are through the use of
a mouse, the keyboard can also be utilized by using keyboard
shortcuts or arrow keys.
• Unlike a command line operating system or CUI like Unix or MS-DOS,
GUI operating systems are much easier to learn and use because
commands do not need memorized.
• A few examples of a GUI operating system
• Microsoft Windows
• Linux
21. Computer Kernel
Definition - What does Kernel mean?
• A kernel is the core component of an operating system.
• Using inter-process communication and system calls, it acts as a bridge
between applications and the data processing performed at the hardware
level.
• When an operating system is loaded into memory, the kernel loads first and
remains in memory until the operating system is shut down again.
• The kernel is responsible for low-level tasks such as disk management, task
management and memory management.
• It manages memory access for programs in the RAM, it determines which
programs get access to which hardware resources, it sets up or resets the
CPU's operating states for optimal operation at all times, and it organizes the
data with File Systems.
22. Kernel in Operating System
“The one program
running at all times on
the computer” is the
kernel. Everything else
is either a system
program (ships with the
operating system) or an
application program
23. Computer Startup
• bootstrap program is loaded at power-up or reboot
• Typically stored in ROM or EEPROM, generally known as firmware
- Initialises all aspects of system
- Loads operating system kernel and starts execution
24. Operating System Components
• Even though not all systems have the same structure, operating systems share
the same goal of supporting the following types of system components:
Kernel
Program Execution
Interrupts
Process Management
Main Memory Management
Multitasking/ File Systems/ Secondary Management (Disk access)
I/O System Management
Protection System
25. Kernel
• the kernel provides the most basic level of control over all of the
computer's hardware devices.
• it manages memory access for programs in the RAM
• it determines which programs get access to which hardware
resources
• it sets up or resets the CPU's operating states for optimal operation at
all times
• it organizes the data with File Systems.
26. Process Management
• The operating system manages many kinds of activities ranging from user
programs to system programs like printer spooler, name servers, file server etc.
• Each of these activities is encapsulated in a process.
• A process includes the complete execution context (code, data, PC, registers, OS
resources in use etc.).
• It is important to note that a process is not a program. A process is only ONE
instant of a program in execution. There are many processes that can be running
the same program. The five major activities of an operating system in regard to
process management component are:
Creation and deletion of user and system processes.
Suspension and resumption of processes.
A mechanism for process synchronization.
A mechanism for process communication.
A mechanism for deadlock handling.
27. Interrupts
• Interrupts are central to operating systems, as they provide an
efficient way for the operating system to interact with and react to its
environment.
• Interrupts provide a computer with a way of automatically saving
local register contexts, and running specific code in response to
events.
• Even very basic computers support hardware interrupts, and allow
the programmer to specify code which may be run when that event
takes place.
28. Main-Memory Management
• Primary-Memory or Main-Memory is a large array of words or bytes.
• Each word or byte has its own address.
• Main-memory provides storage that can be access directly by the CPU.
That is to say for a program to be executed, it must in the main memory.
• The major activities of an operating in regard to memory-management
are:
Keep track of which part of memory are currently being used and by
whom.
Decide which process are loaded into memory when memory space
becomes available.
Allocate and de-allocate memory space as needed.
29. File Management
• A file is a collected of related information defined by its creator.
• Computer can store files on the disk (secondary storage), which provide long term storage.
• Some examples of storage media are magnetic tape, magnetic disk and optical disk. Each of
these media has its own properties like speed, capacity, data transfer rate and access
methods.
• A file systems normally organized into directories to ease their use. These directories may
contain files and other directions.
• The five main major activities of an operating system in regard to file management are
The creation and deletion of files.
The creation and deletion of directions.
The support of primitives for manipulating files and directions.
The mapping of files onto secondary storage.
The back up of files on stable storage media.
30. I/O System Management
Motivations:
• Provide an abstract level of H/W devices and keep the details from
applications to ensure proper use of devices, to prevent errors, and to
provide users with convenient and efficient programming environment.
Tasks of I/O Management of OS:
• Hide the details of H/W devices
• Manage main memory for the devices using cache, buffer, and spooling
• Maintain and provide device driver interfaces
31. File & Storage Management
Motivation:
o Almost everything is stored in the secondary storage. Therefore,
secondary storage accesses must be efficient (i.e., performance) and
convenient (i.e., easy to program I/O function in application level)
o Important data are duplicated and/or stored in tertiary storage.
Tasks of File Management
o Create, manipulate, delete files and directories
Tasks of Storage Management
o Allocate, de-allocate, and defrag blocks1
o Bad block marking
o Scheduling for multiple I/O request to optimize the performance
32. Networking
• A distributed systems is a collection of processors that do not share
memory, peripheral devices, or a clock.
• The processors communicate with one another through communication
lines called network.
• Allow communications between computers (more important for
Client/Server OS and Distributed OS).
Protection
• If a computer systems has multiple users and allows the concurrent
execution of multiple processes, then the various processes must be
protected from one another's activities.
• Protection refers to mechanism for controlling the access of programs,
processes, or users to the resources defined by a computer systems.
• Protect hardware resources, Kernel code, processes, files, and data from
erroneous programs and malicious programs.
33. Command Interpreter System
• A command interpreter is an interface of the operating system with the
user.
• It is a part that understands and executes commands that are entered
interactively by a human being or from a program.
• The user gives commands with are executed by operating system.
• The main function of a command interpreter is to get and execute the next
user specified command.
• The program that reads and interprets commands is the command-line
interpreter or shell
• In DOS, the command processor is usually COMMAND. COM
34. Operating System Services
Following are the services provided by operating systems to the convenience of the
users:
User interface - Almost all operating systems have a user interface (UI) Varies
between Command-Line Interface (CLI), Graphics User Interface (GUI), Batch
Program execution – system capability to load a program into memory and to run
it.
I/O operations – since user programs cannot execute I/O operations directly, the
operating system must provide some means to perform I/O.
File-system manipulation – program capability to read, write, create, and delete
files.
Communications – exchange of information between processes executing either
on the same computer or on different systems tied together by a network.
Implemented via shared memory or message passing.
Error detection – ensure correct computing by detecting errors in the CPU (such as
power failure) and memory hardware, in I/O devices (such as connection failure),
or in user programs.
35. System Calls
• System calls provide the interface between a running program and the
operating system.
– Generally available as assembly-language instructions.
– Languages defined to replace assembly language for systems
programming allow system calls to be made directly
• Three general methods are used to pass parameters between a running
program and the operating system.
– Pass parameters in registers.
– Store the parameters in a table in memory, and the table address is
passed as a parameter in a register.
– Push (store) the parameters onto the stack by the program, and pop
off the stack by operating system.
36.
37.
38.
39. System Programs
• System programs provide a convenient environment for program development
and execution. They can be divided into several categories:
– File manipulation: create, delete, copy, rename, print files.
– Status information: Some programs ask the system for date and time, disk
space, number of users.
– File modification: Text editors to create and modify the content of files stored
on disk.
– Programming language support: Compilers and assemblers are provided to the
user with the O.S.
– Program loading and execution: After a program is assembled or compiled, it
must be loaded into memory to be executed. The system may provide loaders,
linkage editors and debuggers.
– Communications: Programs provide mechanism for creating virtual connections
among processes, users, and computer systems, such as sending messages and
transferring files.
40. Layered Operating System Design
• The operating system is divided into a number of layers (levels), each
built on top of lower layers.
• The bottom layer (layer 0), is the hardware; the highest (layer N) is
the user interface.
• With modularity, layers are selected such that each uses functions
(operations) and services of only lower-level layers
41. • In this case the system is easier to debug and modify,
because changes affect only limited portions of the code,
and programmer does not have to know the details of the
other layers.
• Information is also kept only where it is needed and is
accessible only in certain ways, so bugs affecting that data
are limited to a specific module or layer.
42. Mechanisms and Policies
• The policies specifies what is to be done while the mechanism specifies
how it is to be done.
• For instance, the timer construct for ensuring CPU protection is a
mechanism.
• On the other hand, the decision of how long the timer is set for a
particular user is a policy decision.
• The separation of mechanism and policy is important to provide
flexibility to a system.
• If the interface between mechanism and policy is well defined, the
change of policy may affect only a few parameters.
• On the other hand, if interface between these two is vague or not well
defined, it might involve much deeper change to the system.
43. • Once the policy has been decided it gives the programmer the choice of
using his/her own implementation.
• Also, the underlying implementation may be changed for a more
efficient one without much trouble if the mechanism and policy are well
defined.
• Specifically, separating these two provides flexibility in a variety of ways.
• First, the same mechanism can be used to implement a variety of
policies, so changing the policy might not require the development of a
new mechanism, but just a change in parameters for that mechanism,
but just a change in parameters for that mechanism from a library of
mechanisms.
• Second, the mechanism can be changed for example, to increase its
efficiency or to move to a new platform, without changing the overall
policy.