OS Unit-1 Notes
OS Unit-1 Notes
An operating System (OS) is an intermediary between users and computer hardware. It provides
an environment in which a user can execute programs conveniently and efficiently. In technical
terms, it is system software which manages hardware. An operating System controls the
allocation of resources and services such as memory, processors, devices and information.
An amazing aspect of operating systems is how varied they are in accomplishing these tasks.
Mainframe operating systems are designed primarily to optimize utilization of hardware.
Personal computer (PC) operating systems support complex games, business applications, and
everything in between. Operating systems for handheld computers are designed to provide an
environment in which a user can easily interface with the computer to execute programs. Thus,
some operating systems are designed to be convenient, others to be efficient, and others some
combination of the two.
User View:
The user's view of the computer varies according to the interface being used. Most computer
users sit in front of a PC, consisting of a monitor/ keyboard/ mouse, and system unit. Such a
system is designed for one user to monopolize its resources. The goal is to maximize the work
(or play) that the user is performing. In this case/ the operating system is designed mostly for
ease of use with some attention paid to performance and none paid to resource utilization various
hardware and software resources are shared. Performance is, of course, important to the user; but
such systems are optimized for the single-user experience rather than the requirements of
multiple users. In other cases, a user sits at a terminal connected to a mainframe or a
minicomputer. Other users are accessing the same computer through other terminals. These users
share resources and may exchange information. The operating system in such cases is designed
to maximize resource utilization to assure that all available CPU time, memory, and I/0 are used
efficiently and that no individual user takes more than her fair share.
In still other cases, users sit at workstations connected to networks of other workstations and
servers. These users have dedicated resources at their disposal, but they also share resources such
as networking and servers-file, compute, and print servers. Therefore, their operating system is
designed to compromise between individual usability and resource utilization. Recently, many
varieties of handheld computers have come into fashion. Most of these devices are standalone
units for individual users. Some are connected to networks, either directly by wire or (more
often) through wireless modems and networking. Because of power, speed, and interface
limitations, they perform relatively few remote operations. Their operating systems are designed
mostly for individual usability, but performance per unit of battery life is important as well.
Some computers have little or no user view. For example, embedded computers in home devices
and automobiles may have numeric keypads and may turn indicator lights on or off to show
status, but they and their operating systems are designed primarily to run without user
intervention.
System View:
From the computer's point of view, the operating system is the program most intimately involved
with the hardware. In this context, we can view an operating system as a resource allocator. A
computer system has many resources that may be required to solve a problem: CPU time,
memory space, file-storage space, I/0 devices, and so on. The operating system acts as the
manager of these resources. Facing numerous and possibly conflicting requests for resources, the
operating system must decide how to allocate them to specific programs and users so that it can
operate the computer system efficiently and fairly. As we have seen, resource allocation is
especially important where many users access the same mainframe or minicomputer. A slightly
different view of an operating system emphasizes the need to control the various I/0 devices and
user programs. An operating system is a control program. A control program manages the
execution of user programs to prevent errors and improper use of the computer. It is especially
concerned with the operation and control of I/O devices.
Definition
An operating system is a program that acts as an interface between the user and the computer
hardware and controls the execution of all kinds of programs.
OS Functions:
Memory Management
Processor Management
Device Management
File Management
Security
Job accounting
Memory Management
Keeps tracks of primary memory i.e. what part of it are in use by whom, what part are not
in use.
In multi-programming, OS decides which process will get memory when and how much.
De-allocates the memory when the process no longer needs it or has been terminated.
Processor Management
In multiprogramming 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.
Device Management
OS manages device communication via their respective drivers. Operating System does the
following activities for device management.
Keeps tracks of all devices. Program responsible for this task is known as the I/O
controller.
Decides which process gets the device when and for how much time.
De-allocates devices.
File Management
A file system is normally organized 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.
Following are some of the important activities that Operating System does:
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.
Operating system
Application programs – define the ways in which the system resources are used to
solve the computing problems of the users
Users
Operating-System Operations
Operating systems are there from the very first computer generation and keep evolving over
the period of time. Following are few of the important types of operating system which are most
commonly used.
The users of batch operating system do not interact with the computer directly. 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. Thus,
the programmers left their programs with the operator. The operator then sorts programs into
batches with similar requirements.
CPU is often idle, because the speeds of mechanical I/O devices are slower than CPU.
Single user cannot keep CPU and I/O devices busy at all times
Multiprogramming organizes jobs (code and data) so CPU always has one to Execute
When it has to wait (for I/O for example), OS switches to another job
If several jobs ready to run at the same time [CPU scheduling is used to select the job]
If processes don’t fit in memory, swapping moves them in and out to run
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. Processor's time which is shared among multiple users simultaneously is
termed as time-sharing. The main difference between Multi-programmed Batch Systems and
Time-Sharing Systems is that in case of Multi-programmed batch systems, objective is to
maximize processor use, whereas in Time-Sharing Systems objective is to minimize response
time.
Multiple jobs are executed by the CPU by switching between them, but the switches occur so
frequently. Thus, the user can receive an immediate response. For example, in a transaction
processing, processor execute each user program in a short burst or quantum of computation.
That is if ‘n’ users are present, each user can get time quantum. When the user submits the
command, the response time is in few seconds at most.
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.
Problem of reliability.
Distributed systems use multiple central processors to serve multiple real time application and
multiple users. Data processing jobs are distributed among the processors accordingly to which
one can perform each job most efficiently. 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.
With resource sharing facility 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.
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. Real time
processing is always on line whereas on line system need not be real time. The time taken by the
system to respond to an input and display of required updated information is termed as response
time. So in this method response time is very less as compared to the online processing. These
are used when there are rigid time requirements on the operation of a processor or the flow of
data and real-time systems can be used as a control device in a dedicated application. Real-time
operating system has well-defined, fixed time constraints otherwise system will fail.For example
Scientific experiments, medical imaging systems, industrial control systems, weapon systems,
robots, and home-applicance controllers, Air traffic control system etc.
Hard Real-time systems guarantee that critical tasks complete on time. In hard
real-time systems secondary storage is limited or missing with data stored in ROM. In these
systems virtual memory is almost never found.
Soft Real time systems are less restrictive. Critical real-time task gets priority
over other tasks and retains the priority until it completes. Soft real-time systems have limited
utility than hard real-time systems. For example, Multimedia, virtual reality, Advanced Scientific
Projects like undersea exploration and planetary rovers etc.
An Operating System provides services to both the users and to the programs.
Program execution
I/O operations
Communication
Resource Allocation
Protection
1) Program execution
Operating system handles many kinds of activities from user programs to system programs like
printer spooler, name servers, file server etc. Each of these activities is encapsulated as a process.
A process includes the complete execution context (code to execute, data to manipulate,
registers, OS resources in use). Following are the major activities of an operating system with
respect to program management.
2) I/O Operation
I/O subsystem comprises of I/O devices and their corresponding driver software.
Drivers hides the peculiarities of specific hardware devices from the user as the device driver
knows the peculiarities of the specific device.
Operating System manages the communication between user and device drivers. Following are
the major activities of an operating system with respect to I/O Operation.
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.
A file represents a collection of related information. Computer can store files on the disk
(secondary storage), for long term storage purpose. Few examples of storage media are 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.
The Operating system gives the permission to the program for operation on file.
4) Communication
OS handles routing and connection strategies, and the problems of contention and security.
Following are the major activities of an operating system with respect to communication.
5) Error handling
Error can occur anytime and anywhere. Error may occur in CPU, in I/O devices or in the
memory hardware. Following are the major activities of an operating system with respect to error
handling.
6) Resource Management
In case of multi-user or multi-tasking environment, resources such as main memory, CPU cycles
and files storage are to be allocated to each user or job.
Following are the major activities of an operating system with respect to resource management.
7) Protection
Considering computer systems having multiple users the concurrent execution of multiple
processes, then the various processes must be protected from each another's activities.
Protection refers to mechanism or a way to control the access of programs, processes, or users to
the resources defined by a computer system. Following are the major activities of an operating
system with respect to protection.
OS ensures that external I/O devices are protected from invalid access attempts.
Batch processing is a technique in which Operating System collects one programs and data
together in a batch before processing starts. Operating system does the following activities
related to batch processing.
OS defines a job which has pre-defined sequence of commands, programs and data as a
single unit.
OS keeps a number of jobs in memory and executes them without any manual
information.
Jobs are processed in the order of submission i.e., First Come First Served fashion.
When job completes its execution, its memory is released and the output for the job gets
copied into an output spool for later printing or processing.
Advantages
Batch processing takes much of the work of the operator to the computer.
Increased performance as a new job gets started as soon as the previous job finishes
without any manual intervention.
Disadvantages
Due to lack of protection scheme, one batch job can affect pending jobs.
2. Multitasking
Multitasking refers to the term where multiple jobs are executed by the CPU simultaneously by
switching between them.Switches occur so frequently that the users may interact with each
program while it is running. Operating system does the following activities related to
multitasking.
The user gives instructions to the operating system or to a program directly, and receives
an immediate response.
Operating System handles multitasking in the way that it can handle multiple operations /
executes multiple programs at a time.
These Operating Systems were developed to provide interactive use of a computer system
at a reasonable cost.
When a process executes, it typically executes for only a very short time before it either
finishes or needs to perform I/O.
Since interactive I/O typically runs at people speeds, it may take a long time to get
completed. During this time a CPU can be utilized by another process.
Operating system allows the users to share the computer simultaneously. Since each
action or command in a time-shared system tends to be short, only a little CPU time is
needed for each user.
As the system switches CPU rapidly from one user/program to the next, each user is
given the impression that he/she has his/her own CPU, whereas actually one CPU is
being shared among many users.
3. Multiprogramming
When two or more programs are residing in memory at the same time, then sharing the processor
is referred to multiprogramming. Multiprogramming assumes a single shared processor.
Multiprogramming increases CPU utilization by organizing jobs so that the CPU always has one
to execute.
Command Line Interface (CLI) or command interpreter allows direct command entry
Various mouse buttons over objects in the interface cause various actions (provide
information, options, execute function, open directory (known as a folder)
Apple Mac OS X as “Aqua” GUI interface with UNIX kernel underneath and shells
available
System Calls
Mostly accessed by programs via a high-level Application Program Interface (API) rather
than direct system call use
nThree most common APIs are Win32 API for Windows, POSIX API for POSIX-based
systems (including virtually all versions of UNIX, Linux, and Mac OS X), and Java API
for the Java virtual machine (JVM)
(Note that the system-call names used throughout this text are generic)
Numbers
The system call interface invokes intended system call in OS kernel and returns status of
the system call and any return values
The caller need know nothing about how the system call is implemented
Just needs to obey API and understand what OS will do as a result call
Managed by run-time support library (set of functions built into libraries included with
compiler)
Process control
File management
Device management
Information maintenance
Communications
Protection
System programs provide a convenient environment for program development and execution.
The can be divided into:
File manipulation
Status information
File modification
Communications
Application programs
Most users’ view of the operation system is defined by system programs, not the actual system
calls
Some of them are simply user interfaces to system calls; others are considerably more
complex
File management - Create, delete, copy, rename, print, dump, list, and generally
manipulate files and directories
Status information
Some ask the system for info - date, time, amount of available memory, disk space,
number of users
Typically, these programs format and print the output to the terminal or other output
devices
Some systems implement a registry - used to store and retrieve configuration information
File modification
Program loading and execution- Absolute loaders, relocatable loaders, linkage editors,
and overlay-loaders, debugging systems for higher-level and machine language
Allow users to send messages to one another’s screens, browse web pages, send
electronic-mail messages, log in remotely, transfer files from one machine to another
Design and Implementation of OS not “solvable”, but some approaches have proven
successful
System goals – operating system should be easy to design, implement, and maintain, as
well as flexible, reliable, error-free, and efficient
1. Simple Structure
Although MS-DOS has some structure, its interfaces and levels of Functionality are not
well separated
UNIX
UNIX – limited by hardware functionality, the original UNIX operating system had
limited structuring. The UNIX OS consists of two separable parts
Systems programs
The kernel
Consists of everything below the system-call interface and above the physical
hardware
Provides the file system, CPU scheduling, memory management, and other operating-
system functions; a large number of functions for one level
2. Layered Approach
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
Benefits:
More secure
Detriments:
Mac OS X Structure
4. Module Structure