0% found this document useful (0 votes)
943 views23 pages

OS Unit-1 Notes

The document discusses operating systems from three perspectives: user view, system view, and functions. It describes how operating systems serve as an interface between users and computer hardware, managing resources and allowing users to run programs. Operating systems are designed for different environments, prioritizing either convenience, efficiency, or a balance. From the system view, the operating system allocates resources and controls I/O devices. Key functions include memory management, processor management, device management, and file management.

Uploaded by

anjali sowmya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
943 views23 pages

OS Unit-1 Notes

The document discusses operating systems from three perspectives: user view, system view, and functions. It describes how operating systems serve as an interface between users and computer hardware, managing resources and allowing users to run programs. Operating systems are designed for different environments, prioritizing either convenience, efficiency, or a balance. From the system view, the operating system allocates resources and controls I/O devices. Key functions include memory management, processor management, device management, and file management.

Uploaded by

anjali sowmya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 23

UNIT-1

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.

Operating System objectives:

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.

 Execute user programs and make solving user problems easier

 Make the computer system convenient to use

 Use the computer hardware in an efficient manner

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:

Following are some of important functions of an operating System.

 Memory Management

 Processor Management

 Device Management

 File Management

 Security

 Control over system performance

 Job accounting

 Error detecting and Prevention

 Coordination between other software and users

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 be 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.
 In multi-programming, OS decides which process will get memory when and how much.

 Allocates the memory when the process requests it to do so.

 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.

 Allocates the Processor (CPU) to a process.

 De-allocates processor when processor is no longer required.

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.

 Allocates the device in the efficient way.

 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.

 Decides who gets the resources.


 Allocates the resources.

 De-allocates the resources.

Following are some of the important activities that Operating System does:

 Security -- By means of password and similar other techniques, preventing unauthorized


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 Softwares and users -- Coordination and assignment of


compilers, interpreters, assemblers and other software to the various users of the
computer systems.
Computer System Architecture:

Computer system can be divided into four components

 Hardware – provides basic computing resources

 CPU, memory, I/O devices

 Operating system

 Controls and coordinates use of hardware among various applications and


users

 Application programs – define the ways in which the system resources are used to
solve the computing problems of the users

 Word processors, compilers, web browsers, database systems, video


games

 Users

 People, machines, other computers

Operating-System Operations

 Dual-mode operation allows OS to protect itself and other system components

 User mode and kernel mode

 Mode bit provided by hardware


1. Provides ability to distinguish when system is running user code or kernel
code
2. Some instructions designated as privileged, only executable in kernel
mode
3. System call changes mode to kernel, return from call resets it to user

Computing environments or Evolutions:

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.

1. Batch operating system

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.

The problems with Batch Systems are following.

 Lack of interaction between the user and job.

 CPU is often idle, because the speeds of mechanical I/O devices are slower than CPU.

 Difficult to provide the desired priority.

2. Multiprogramming operating system

 Multiprogramming needed for efficiency

 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

 A subset of total jobs in system is kept in memory

 One job selected and run via job scheduling

 When it has to wait (for I/O for example), OS switches to another job

 Timesharing (multitasking) is logical extension in which CPU switches jobs so


frequently that users can interact with each job while it is running, creating interactive
computing

 Response time should be < 1 second

 Each user has at least one program executing in memory [process]

 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

Virtual memory allows execution of processes not completely in memory

Memory Layout for Multi-programmed System

3. 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. 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.

Advantages of Timesharing operating systems are following

 Provide advantage of quick response.

 Avoids duplication of software.

 Reduces CPU idle time.

Disadvantages of Timesharing operating systems are following.

 Problem of reliability.

 Question of security and integrity of user programs and data.

 Problem of data communication.

4. Distributed operating System

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.

The advantages of distributed systems are following.

 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.

 Reduction of the load on the host computer.

 Reduction of delays in data processing.

5. Real Time operating System

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.

There are two types of real-time operating systems:

1. Hard real-time systems

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.

2. Soft real-time systems

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.

Operating System – Services

An Operating System provides services to both the users and to the programs.

 It provides programs, an environment to execute.


 It provides users, services to execute the programs in a convenient manner.

Following are few common services provided by operating systems:

 Program execution

 I/O operations

 File System manipulation

 Communication

 Error Detection and prevention

 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.

 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.

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.

 Program may require any I/O device while running.

 Operating system provides the access to the required I/O device when required.

3) File system manipulation

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.

 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) Communication

In case of Distributed systems which are a collection of processors that do not


share memory, peripheral devices, or a clock, Operating system manages communications
between processes. Multiple processes with one another through communication lines in the
network.

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.

 Two processes often require data to be transferred between them.


 Both the processes can be on the same computer or on different computer but are
connected through computer network.

 Communication may be implemented by two methods either by Shared Memory or by


Message Passing.

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.

 OS constantly remains aware of possible errors.

 OS takes the appropriate action to ensure correct and consistent computing.

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.

 OS manages all kind of resources using schedulers.

 CPU scheduling algorithms are used for better utilization of CPU.

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 all access to system resources is controlled.

 OS ensures that external I/O devices are protected from invalid access attempts.

 OS provides authentication feature for each user by means of a password.

Evolution of Operating Systems:


1. Batch processing

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

 Difficult to debug program.

 A job could enter an infinite loop.

 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.

 Multitasking Operating Systems are also known as Time-sharing systems.

 These Operating Systems were developed to provide interactive use of a computer system
at a reasonable cost.

 A time-shared operating system uses concept of CPU scheduling and multiprogramming


to provide each user with a small portion of a time-shared CPU.

 Each user has at least one separate program in memory.

 A program that is loaded into memory and is executing is commonly referred to as a


process.

 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.

Following figure shows the memory layout for a multiprogramming system.

User Operating System Interface - CLI

 Command Line Interface (CLI) or command interpreter allows direct command entry

Sometimes implemented in kernel, sometimes by systems program

Sometimes multiple flavors implemented – shells

Primarily fetches a command from user and executes it

 Sometimes commands built-in, sometimes just names of programs


 If the latter, adding new features doesn’t require shell modification

User Operating System Interface - GUI

 User-friendly desktop metaphor interface

 Usually mouse, keyboard, and monitor

 Icons represent files, programs, actions, etc

 Various mouse buttons over objects in the interface cause various actions (provide
information, options, execute function, open directory (known as a folder)

 Invented at Xerox PARC

 Many systems now include both CLI and GUI interfaces

 Microsoft Windows is GUI with CLI “command” shell

 Apple Mac OS X as “Aqua” GUI interface with UNIX kernel underneath and shells
available

 Solaris is CLI with optional GUI interfaces (Java Desktop, KDE)

System Calls

 Programming interface to the services provided by the OS

 Typically written in a high-level language (C or C++)

 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)

 Why use APIs rather than system calls?

 (Note that the system-call names used throughout this text are generic)

Example of System Calls


System Call Implementation

 Typically, a number associated with each system call

 System-call interface maintains a table indexed according to these

 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

 Most details of OS interface hidden from programmer by API

Managed by run-time support library (set of functions built into libraries included with
compiler)

Types of System Calls

 Process control

 File management

 Device management

 Information maintenance

 Communications

 Protection

Examples of Windows and Unix System Calls


System Programs

System programs provide a convenient environment for program development and execution.
The can be divided into:

 File manipulation

 Status information

 File modification

 Programming language support

 Program loading and execution

 Communications

 Application programs

Most users’ view of the operation system is defined by system programs, not the actual system
calls

 Provide a convenient environment for program development and execution

 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

 Others provide detailed performance, logging, and debugging information

 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

 Text editors to create and modify files

 Special commands to search contents of files or perform transformations of the text

 Programming-language support - Compilers, assemblers, debuggers and interpreters


sometimes provided

 Program loading and execution- Absolute loaders, relocatable loaders, linkage editors,
and overlay-loaders, debugging systems for higher-level and machine language

 Communications - Provide the mechanism for creating virtual connections among


processes, users, and computer systems

 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

Operating System Design and Implementation

 Design and Implementation of OS not “solvable”, but some approaches have proven
successful

 Internal structure of different Operating Systems can vary widely

 Start by defining goals and specifications

 Affected by choice of hardware, type of system

 User goals and System goals


 User goals – operating system should be convenient to use, easy to learn, reliable, safe,
and fast

 System goals – operating system should be easy to design, implement, and maintain, as
well as flexible, reliable, error-free, and efficient

 Important principle to separate

 Policy: What will be done?


Mechanism: How to do it?

 Mechanisms determine how to do something, policies decide what will be done

 The separation of policy from mechanism is a very important principle, it allows


maximum flexibility if policy decisions are to be changed later

Operating System Structure:

1. Simple Structure

 MS-DOS – written to provide the most functionality in the least space

 Not divided into modules

 Although MS-DOS has some structure, its interfaces and levels of Functionality are not
well separated

MS-DOS Layer Structure

Traditional UNIX System Structure

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

Layered Operating System

3. Micro kernel System Structure

 Moves as much from the kernel into “user” space

 Communication takes place between user modules using message passing

 Benefits:

 Easier to extend a microkernel

 Easier to port the operating system to new architectures


 More reliable (less code is running in kernel mode)

 More secure

 Detriments:

 Performance overhead of user space to kernel space communication

Mac OS X Structure

4. Module Structure

 Most modern operating systems implement kernel modules

 Uses object-oriented approach

 Each core component is separate

 Each talks to the others over known interfaces

 Each is loadable as needed within the kernel

 Overall, similar to layers but with more flexible

Solaris Modular Approach

You might also like