3. 3
Operating System Definition
• OS is the software that acts as an intermediary
between user application and computer
hardware.
• An operating system is a program that manages
the computer hardware. It also provides a basis
for application programs and acts as an
intermediary between the computer user and
the computer hardware.
• It is the most important program that runs on a
computer.
4. 4
Cont..
• OS performs basic task such as:-
• recognizing input from keyboard,
• sending outputs to the display screen,
• keeping tracks of files and directories on the
disk
• controlling peripheral devices such as disk
drives and printers.
6. 6
Contd.
• The hardware— Provides basic computing
resources (The central processing unit (CPU),
the memory, and the input/output (I/O)
devices—provides the basic computing
resources for the system.
• The application programs—such as word
processors, spread sheets, compilers, and web
browsers—define the ways in which these
resources are used to solve users' computing
problems.
7. 7
Contd.
• The operating system controls and
coordinates the use of the hardware among the
various application programs for the various
users.
• Users – people, machine and other computers.
9. 9
• We can Explain operating system role from
two viewpoints –
• users view
• system view.
.
10. 10
Contd.
• User View
• The user's view of the computer varies
according to the interface being use.
• A personal computer is designed for one user
to use its resources.
• the operating system is designed mostly for
ease of use, with some attention paid to
performance and none paid to resource
utilization
11. 11
Contd.
• a user sits at a terminal connected to a
mainframe or minicomputer.
• 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/O
are used efficiently and that no individual user
takes more than her fair share.
12. 12
Contd.
• users sit at workstations connected to
networks of other workstations and servers.
They 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.
13. 13
Contd.
• Handheld computers -Most of these devices are
standalone units for individual users
• . Because of power, speed, and interface
limitations, they perform relatively few remote
operations.
• Their operating systems are designed mostly
for individual usability.
14. 14
Contd.
• Embedded computers in home devices and
automobiles may have numeric keypads and
may turn indicator lights on or off to show
status,
• their operating systems are designed primarily
to run without user intervention.
15. 15
System View
• From the computer's point of view, the
operating system is the program most
intimately involved with the hardware.
• 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/O devices,
and so on.
16. 16
Contd.
• 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.
17. 17
control program
• Different view of an operating system
• , 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.
18. 18
Defining Operating Systems
• The fundamental goal of computer systems is to execute
user programs and to make solving user problems easier.
Toward this goal, computer hardware is constructed. Since
bare hardware alone is not particularly easy to use,
application programs are developed. These programs
require certain common operations, such as those
controlling the I/O devices.
The common functions of controlling and allocating
resources are then brought together into one piece of
software: the operating system.
19. 19
Contd.
• In addition, we have no universally accepted
definition of what is part of the operating system.
• A simple viewpoint is that it includes everything a
vendor ships when you order "the operating
system."
• The operating system is the one program
running at all times on the computer (usually
called the kernel), with all else being systems
programs and application programs. This last
definition is the one that we generally follow.
20. 20
FUNCTION OF OS
. The various functions of OS are
• OS as a resource manager
• OS as a storage management
• Process management
• Memory Management
• File Management
• Device Management
• Security and Protection.
21. 21
OS as a Resource Manager
• OS is also known as the resource manager. It
means operating system will manage all
resources those are attached to the system.
• There are 4 major resources that are controlled
by OS.
• Memory (primary/secondary)
• Processors (CPU)
• Devices(Disk, printer, scanner)
• Information (Files, library routine)
22. 22
Task for resource management:-
• The operating system performs following task for resource
management:-
– Manages and protects multiple computer resources: CPU,
Processes, Internal/External memory, Tasks, Applications,
Users, Communication channels, etc…
– Handles and allocates resources to multiple users or
multiple programs running at the same time and space (e.g.,
processor time, memory, I/O devices).
– Decides between conflicting requests for efficient and fair
resource use (e.g., maximize throughput, minimize response
time).
23. 23
OS as a storage management
• OS also controls all the storage operations
which mean
• how the data or files will be stored into the
computer and
• how the files will be accessed by the user etc.
all the operations those are responsible for
storing and accessing the file is determined by
the OS.
24. 24
Process Management
• The OS also treats the process management
which means all the processes those are given
by the user or the process those are system own
processor are handled by the OS.
• The operating system will create the priorities
for the user and also start or stop the execution
of the process and also makes the child process
after dividing the large process into small
processes.
25. 25
Memory Management
• Memory management refers to management of
Primary Memory or Main Memory.
• Operating System also manages the memory of the
computer system which means provide the memory
for the process. OS does the following activities of
memory management.
• Main memory provides a fast storage that can be
accessed directly by the CPU. For a program to be
executed, it must be in the main memory. An
Operating System does the following activities for
memory management
26. 26
Contd.
• Keep track of primary memory
• In multiprogramming, the OS decides which
process will get memory when and how much.
• Allocate the memory when the process requests
it.
• De-allocate the memory when the process no
longer needs it or has been terminated.
27. 27
File Management
• It means managing data that reside on secondary
storage. Logically related data items on the secondary
storage are usually organized into named collections
called files. The function of files system are:-
• Keeping track of all files in the system.
• Control sharing and enforcing of file protection.
• Management of disk space
• Mapping of logical file addresses to physical disk
addresses.
28. 28
Device Management
• Operating System manages device communication
through their respective drivers.
• OS does the following activities of device
management
• Keep track of all devices programs responsible for this
task is known as I/O controllers.
• Decides which process gets the device when and for
how much time.
• Allocates the device in efficient way
• De-allocates device.
29. 29
Security and Protection
• The Processes in an OS that must be protected from one
another activities. For the purpose of protection and security we
use mechanism that ensure that only process that have gain
proper authorization from the operating system can operate on
the files, memory, CPU and other resources.
• Protection is a mechanism for controlling the access of
programs, processes or users to the resource defined by a
computer system.
• Security protects information stored in the system as well as the
physical resource of the computer system from unauthorized
access, malicious destruction or alteration and any
inconsistencies.
30. 30
Other Important Activities
• Security − By means of password and similar other techniques,
it prevents 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 software's and users −
Coordination and assignment of compilers, interpreters,
assemblers and other software to the various users of the
computer systems.
31. 31
Evolution of Operating System
• In the early computers there were no OS. The single processing
machine of 1940’s and 1950,s were not flexible or efficient.
• With the advancement of commercial services we have come
across a no of operation system software in 1960.
• Starting from the DOS a lot much operating system software
has got develop like window, Unix etc.
• The most commonly used OS for laptops and modern desktop
OS were the Microsoft windows.
32. 32
The processing is divided into:-
• 1) Serial Processing OS
• 2) Batch Processing OS
• 3) Multi-Programming OS
• 4)Time sharing OS
• 5)Real-Time OS
• 6)Distributed OS
• 7)Network OS
33. 33
Serial Processing OS
• Early computer from late 1940 to the mid 1950.
• The programmer interacted directly with the
computer hardware.
• These machines are called bare machine as
they don't have OS.
• Every computer system is programmed in its
machine language.
• Uses Punch Card, paper tapes and language
translator
36. 36
• These system presented two major problems.
• 1. Scheduling
• 2. Set up time:
37. 37
Scheduling:
• In this operating system the user have to
reserve timeslot in advance and during the
allotted period they occupy the computer.
• Used sign up sheet to reserve machine time.
• A user may sign up for an hour but finishes his
job in 45 minutes. This would result in wasted
computer idle time, also the user might run into
the problem not finish his job in allotted time.
38. 38
Set up time:
• A single program involves:
• ●Loading compiler and source program in memory
• ●Saving the compiled program (object code)
• ●Loading and linking together object program and
common function.
• Each of these steps involves the mounting or
dismounting tapes on setting up punch cards. If an
error occur user had to go the beginning of the set up
sequence. Thus, a considerable amount of time is
spent in setting up the program to run.
39. 39
• Serial processing is a form of data processing
where a processor is operating on one piece of
data or one instruction at a time.
40. 40
Advantages
• It is less costly to design
• It is processing that occurs sequentially
• There is an explicit order in which operation
occur and in general the result of one action is
known before a next action is considered.
• Serial processing is a form of data processing
where a processor is operating on one piece of
data or one instruction at a time.
41. 41
Batch Processing
• To avoid the problems of early systems the batch processing
systems were introduced.
• The problem of early systems was more setup time. So the
problem of more set up time was reduced by processing the
jobs in batches, known as batch processing system. In this
approach similar jobs were submitted to the CPU for
processing and were run together.
• This technique was possible due to the
invention of hard-disk drives and card readers.
42. 42
Cont.
• The main function of a batch processing
system is to automatically keep executing the
jobs in a batch. This is the important task of a
batch processing system i.e. performed by the
'Batch Monitor' resided in the low end of main
memory.
44. 44
Contd.
• Now the jobs could be stored on the disk to create the
pool of jobs for its execution as a batch.
• First the pooled jobs are read and executed by the
batch monitor, and then these jobs are grouped;
placing the identical jobs (jobs with the similar needs)
in the same batch,
• the batched jobs were executed automatically one
after another saving its time by performing the
activities (like loading of compiler) only for once.
• It resulted in improved system utilization due to
reduced turnaround time.
45. 45
Benefits
• It allows sharing of computer resources.
• It shifts the time of job processing to when the
computer resources are less busy.
• It better utilises the cost of a computer.
• Greater performance – performing a particular
operation automatically on a group of files all at once.
Rather than manually opening, editing and saving one
file at a time.
• Reduce the processing time – processing a group of
transaction at one time.
46. 46
Disadvantage
• Due to turn around delay and offline
debugging batch is not that much convenient
for program development.
• Turn around delay:-the length of time
between arriving at a point and being ready to
depart from that point.
• Offline debugging: - The amount of time a
polled device waits after reading a job before
transmitting any response to the controller.
A. Frank - P. Weisberg
47. 47
Multi-Programming
the Main Problem with batch processing was :-
if a process or job requires an Input and Output
Operation, then it is not possible and second there
will be the wastage of the Time.
• But With the help of Multi programming we
can Execute Multiple Programs on the System
at a Time and in the Multi-programming the
CPU will never get idle.
48. 48
Contd.
• Multiprogramming is a feature of OS which
allows running multiple programs
simultaneously on a CPU
• Actually program does not run simultaneously, but the OS
device slot the time for each device according to the priorities.
• With Multi-Programming we can Execute Many Programs on
the System.
• Specify our Input means
• A user can also interact with the System.
49. 49
Contd.
• Multiprogramming is a form of processing in
which several programs are run at the same
time on a unique processor.
50. 50
Time-sharing
• 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.
51. 51
Contd.
• The main difference between
Multiprogrammed Systems and Time-Sharing
Systems is that in case of
• Multiprogrammed systems, the objective is to
maximize processor use, whereas in
• Time-Sharing Systems, the objective is to
minimize response time.
52. 52
Contd.
• 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, the
processor executes each user program in a short burst
or quantum of computation. That is, if n users are
present, then each user can get a time quantum.
• When the user submits the command, the response
time is in few seconds at most.
53. 53
Features
• Good terminal response tie
• Follow round robin fashion
• Handle many task simultaneously
• Also possible in single user system, one can
open more than one program in running mode.
• Multiuser system – multiple users can submit a
request through his own terminal.
56. 56
Round Robin Fashion
• Here jobs are proceed in an order of p1,p2,p3,p4 .....
• If p1 is not completed in the specified time, it is again
place in the end of the queue and so on.
• This is for programs are executed in a rotating
priority.
• System designed time slice should be followed by
each program.
• Each job will get equal importance
• Time scheduling algorithm strictly followed
• To prevent program from monopolizing the processor.
58. 58
Advantages of Timesharing
• are as follows −
• Provides the advantage of quick response.
• Avoids duplication of software.
• Reduces CPU idle time.
59. 59
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.
60. 60
Real Time operating System
• 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.
• The time taken by the system to respond to an
input and display of required updated
information is termed as the response time.
• So in this method, the response time is very
less as compared to online processing.
A. Frank - P. Weisberg
61. 61
Contd.
• Real-time systems 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.
• 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.
62. 62
Key factors are
• :-
– Minimal interrupt latency
– Minimal thread switching latency.
• Chief goal is not high throughput.
63. 63
There are two types of real-time
operating systems
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 and the data is stored in ROM. In these systems, virtual
memory is almost never found. Example operating system
embedded
Soft real-time systems
• Soft real-time systems are less restrictive. A 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 likes
undersea exploration and planetary rovers, etc.
64. 64
Features of RTOS
• Well defined fixed time constraints
• Processing must be done within the defined
constraints or system will fail.
• Sensors bring data to the computer.
• Used to provide quick event response timing.
• User convenience and resource utilization is in
secondary concerned.
• Expected to process 1000s of interrupts per second
without missing a single event.
• Follows priority based pre-emptive scheduling
algorithm.
65. 65
Priority based pre-emptive
scheduling
• Each process is assigning a certain level of
priorities according to the importance of event.
• Higher priority process usually pre-empt the
execution of lower priority process called
priority based pre-emptive scheduling.
• The processor is normally allocated to the
highest priority process among those are ready
to execute.
66. 66
Memory management in RTOS
• Memory management is very less in demand.
Because many process per mentally reside in
memory in order to provide quick response
time according to the external event.
• I/O management follows time critical device
management
• Provide system calls to allow processes to
access the device directly.
67. 67
File Management in RTOS
• It provide file protection
• Provide access control
• Provide speed of access.
A. Frank - P. Weisberg
68. 68
Distributed operating System
• A distributed OS manages a group of independent
computer and makes them appear to be a single
computer.
• Distributed computations are carried out on more than
one machine.
• When computers in a group work in co-operation they
make a distributed system.
• 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.
69. 69
• In a distributed system the other processor and
their respective resource are remote where as
its own resource are local.
• Processors in a distributed system may vary in
size and function. These processors are referred
as sites, nodes, computers, and so on.
72. 72
Five major reasons
• Five major reasons for building distributed
system
• Resource sharing
• Computation speeding up
• load sharing
• Reliability
• Communication
A. Frank - P. Weisberg
73. 73
• Resource Sharing
• Resource sharing in a distributed system
provides mechanism for sharing files at remote
site.
• Information is processed in distributed
database.
A. Frank - P. Weisberg
74. 74
• Computation speedup
• We check if a particular computation can be
partitioned into sub computation that can run
concurrently
• Then a distributed system allows us to
distribute the sub computation among various
sites
• The sub computation can be run concurrently
and thus provide computation speedup.
A. Frank - P. Weisberg
75. 75
Load sharing
• If a particular site is currently overloaded with
jobs. Some of them may be moved to other
lightly loaded sites. This movement of job is
called load sharing.
A. Frank - P. Weisberg
76. 76
• Reliability
• If one site fails in a distributed site the
remaining sites can continue the operation,
giving the system better reliability.
• Communication
• When a communication network connects
several sites to one another, the user at
different size have the opportunity to exchange
information.
A. Frank - P. Weisberg
77. 77
advantages of distributed systems
• The 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.
A. Frank - P. Weisberg
78. 78
Type of Distributed system
• 1)Network operating system
• 2)Distributed operating system
A. Frank - P. Weisberg
79. 79
Network operating System
• A network OS provides an environment in
which users who are aware of multiplicity of
machines.
• They can access remote resource by either:-
• Remote log in:- Logging in to appropriate
remote machine
• Remote File transfer –Transfer data from the
remote machine to their own machine.
A. Frank - P. Weisberg
80. 80
Distributed OS
• In this ,the user access remote resource in the
same way they access local resource.
• Data and process migration from one site to
another is under control of distributed OS
A. Frank - P. Weisberg
81. 81
• CHOICES Distributed, object-oriented OS
featuring a high degree of customization. U. of
Idaho, 1990s [Campbell et al 1993].
• Clouds A distributed object-based operating
system developed at Georgia Institute of
Technology. Early 1990s. [DasGupta 1991]
• CMDS The Cambridge Model Distributed
System. U. of Cambridge (England). Late
1970s [Wilkes & Needham 1980].
A. Frank - P. Weisberg
82. 82
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.
• The primary purpose of the network operating
system is 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.
83. 83
• Examples of network operating systems
include Microsoft Windows Server 2003,
Microsoft Windows Server 2008, UNIX,
Linux, Mac OS X, Novell NetWare, and BSD.
84. 84
• 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.
85. 85
Contd.
• 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.
87. 87
Operating System Operations
• A trap (or an exception) is a software-generated
interrupt caused either by an error (for example,
division by zero or invalid memory access) or by a specific
request from a user program that an operating-system
service be performed.
• The interrupt-driven nature of an operating system
defines that system's general structure.
• For each type of interrupt, separate segments of code
in the operating system determine what action should
be taken. An interrupt service routine is provided
that is responsible for dealing with the interrupt.
88. 88
Dual-Mode Operation
• To ensure the proper execution of the operating system, we
must be able to distinguish between the execution of operating-
system code and user-defined code.
• The approach taken by most computer systems is to provide
hardware support that allows us to differentiate among various
modes of execution.
• We need two separate modes of operation: user mode and
kernel mode (also called supervisor mode, system mode, or
privileged mode).
• A bit, called the mode bit, is added to the hardware of the
computer to indicate the current mode: kernel (0) or user (1).
89. 89
Contd.
• With the mode bit, we are able to distinguish between
a task that is executed on behalf of the operating
system one that is executed on behalf of the user.
• When the computer system is executing on behalf of a
user application, the system is in user mode.
• when a user application requests a service from the
operating system (via a system call), it must transition
from user to kernel mode to fulfil the request.
91. 91
Contd.
• At system boot time, the hardware starts in kernel
mode.
• The operating system is then loaded and starts user
applications in user mode.
• Whenever a trap or interrupt occurs, the OS switches
from user mode to kernel mode (that is, changes the
state of the mode bit to 0).
• whenever the operating system gains control of the
computer, it is in kernel mode.
• The system always switches to user mode (by setting the mode
bit to 1) before passing control to a user program.
92. 92
Contd.
• The dual mode of operation provides us with
the means for protecting the OS errant
(unpredictable) users.
• We accomplish this protection by executing some of
the machine instruction called privileged instruction.
• The hardware allows privileged instruction to be
executed only in the kernel mode.
• If an attempt is made to execute a privileged instruction in user
mode the hardware doesn’t execute the instruction but rather
treats it as illegal and traps it to the operating system.
93. 93
Life cycle of instruction
• Life cycle of instruction execution in a
computer system
• Initial control is within the operating system,
where instructions are executed in kernel
mode. When control is given to a user
application, the mode is set to user mode.
Eventually, control is switched back via an
interrupt, a trap, or a system call.
94. 94
Contd.
• System calls provide the means for a user program to ask the
operating system to perform tasks reserved for the operating
system on the user program's behalf.
• A system call is invoked in a variety of ways, depending on
the functionality provided by the underlying processor. It is the
method used by a process to request action by the operating
system.
• The kernel examines the interrupting instruction to determine
what system call has occurred; a parameter indicates what type
of service the user program is requesting. Additional
information needed for the request may be passed in registers,
on the stack, or in memory (with pointers to the memory
locations passed in registers).
95. 95
Advantage
• Dual mode operations provide us with the
means of protecting those from errant user.
• If an attempt is made to execute a privileged
instruction in a user mode the hardware doesn’t
execute the instruction, rather it treat as a trap
and transition to the kernel mode.
96. 96
Timer
• A timer can be set to interrupt the computer after a specified
period
• The period may be fixed or variable
• Variable timer is generally implemented by a fixed rate clock
and a counter.
• The OS sets the counter
• Every time the clock ticks counter is decremented
• When the counter reaches zero, an interrupt occurs.
• Thus we can use the timer to present a user program from
running too long
• If the counter is +ve control is return to user program
• When the counter become –ve the OS terminates the program.
97. 97
Operating-System Services
1. User interface.
2. Program execution
3. I/O operations
4. File-system manipulation
5. Communications.
6. Error detection
7. Resource allocation
8. Accounting.
9. Protection and security.
98. 98
User interface.
• Command-line interface (CLI), which uses text commands and
a method for entering them (say, a program to allow entering
and editing of commands).
• Batch interface, in which commands and directives to control
those commands are entered into files, and those files are
executed.
• Graphical user interface (GUI) is used. Here, the interface is a
window system with a pointing device to direct I/O, choose
from menus, and make selections and a keyboard to enter text.
Some systems provide two or all three of these variations.
99. 99
Program execution
• The system must be able to load a program
into memory and to run that program.
• The program must be able to end its execution,
either normally or abnormally (indicating
error).
100. 10
0
I/O operations
• A running program may require I/O, which
may involve a file or an I/O device. For
specific devices, special functions may be
desired (such as recording to a CD or DVD
drive or blanking a CRT screen).
• For efficiency and protection, users usually
cannot control I/O devices directly. Therefore,
the operating system must provide a means to
do I/O.
101. 10
1
File-system manipulation.
• The file system is of particular interest.
• Programs need to read and write files and
directories. They also need to create and delete
them by name, search for a given file, and list
file information.
• Finally, some programs include permissions
management to allow or deny access to files or
directories based on file ownership.
102. 10
2
Communications.
• There are many circumstances in which one process
needs to exchange information with another process.
• communication may occur between processes that are
executing on the same computer or between processes
that are executing on different computer systems tied
together by a computer network.
• Communications may be implemented via shared
memory or through message passing, in which packets
of information are moved between processes by the
operating system.
103. 10
3
Error detection.
• The operating system needs to be constantly aware of
possible errors.
• Errors may occur in the CPU and memory hardware,
in I/O devices and in the user program.
• For each type of error, the operating system should
take the appropriate action to ensure correct and
consistent computing.
• Debugging facilities can greatly enhance the user's
and programmer's abilities to use the system
efficiently.
104. 10
4
Resource allocation.
• When there are multiple users or multiple jobs running at
the same time, resources must be allocated to each of
them.
• Many different types of resources are managed by the
operating system. Some (such as CPU cycles, main memory, and file
storage) may have special allocation code, whereas others (such as I/O devices)
may have much more general request and release code.
• In determining how best to use the CPU, operating systems have
CPU-scheduling routines that check and monitor the speed of the
CPU, the jobs that must be executed, the number of registers
available, and other factors.
• There may also be routines to allocate printers, modems, USB
105. 10
5
Accounting.
• We want to keep track of which users use how
much and what kinds of computer resources.
• This record keeping may be used for
accounting simply for accumulating usage
statistics.
• Usage statistics may be a valuable tool for
researchers who wish to reconfigure the system
to improve computing services.
106. 10
6
Protection and security
1. The owners of information stored in a multiuser or networked
computer system may want to control use of that information.
2. When several separate processes execute concurrently, it should
not be possible for one process to interfere with the others or
with the operating system itself.
3. Protection involves ensuring that all access to system resources
is controlled.
4. Security of the system from outsiders is also important. Such
security starts with requiring each user to authenticate himself or
herself to the system, usually by means of a password, to gain
access to system resources.
108. 10
8
Command line OS
• It provides a command prompt on the
computer screen. The commands are given to
the computer by typing on the keyboard. The
commands are type according to the pre-
defined format. The users have to memorise
commands and rules of writing these
commands. It is not an easy way to interface
with the computer.
• E.g.:- DOS (Disk Operating System), UNIX
109. 10
9
Features
• Interfacing –it provides a command prompt on the computer
screen. The user gives command to the computer by typing on
the keyboard. The user have to memorise the commands and
rules of writing these commands. Usually keyboard is used for
interfacing with the computer.
• Control-it provides full access to computer resources.
• Ease- it is difficult to learn and use.
• Multitasking- although many command line OS allow
multitasking but it is difficult in the OS to view multiple things
at a time on a computer screen.
• Speed – command line interface is faster than GUI to perform
different task.
111. 11
1
GUI OS
• It presents commands in graphical form.
Usually a command is given to the computer
by clicking with mouse on icon. GUI also
provides menus, buttons and other graphical
objects to the user to perform different task.
GUI is very easy to interact with the computer.
• E.g.:- windows, Linux
112. 11
2
Features
Interfacing – it provides commands in graphical form on the
computer screen. The user gives commands to computer by
clicking with mouse on the icon. The users have note to memorise
commands. Usually mouse is used for interfacing with computer.
Control- GUI offers a better control of file system and computer
resource but often users have to use command line to compute a
special task.
Ease- it is easy to learn and use.
Multi-tasking – GUI provides facility to open multiple programs
each in a separate window. So it enables a user to view and
manipulate multiple things at a time on a computer screen.
Speed – it is slower to perform different task.
114. 11
4
System Call
• It provides an interface to the service made
available by an OS.
• Each OS has its own name for each system
call.
115. 11
5
An example to illustrate how system
calls are used:
• Writing a simple program to read data from
one file and copy them to another file.
• The first input that the program will need is the
names of the two files:
• The input file and the output file.
117. 11
7
• For each of the example shown in the diagram to copy
source file to the destination file a system call is
generated. Even simple programs may make heavy
use of the operating system. Frequently, systems
execute thousands of system calls per second.
• Actual system calls can often be more detailed and
difficult to work. Do not support portability
architectural differences often make this more
difficult.
• So we make use of an application programming
interface (API).
118. 11
8
Contd.
• Application developers design programs
according to an application programming
interface (API). The API specifies a set of
functions that are available to an application
programmer, including the parameters that are
passed to each function and the return values
the programmer can expect.
• API is portable and easy to use
119. 11
9
• Three of the most common APIs available to
application programmers are the Win32 API
for Windows systems,
• the POSIX API for POSIX-based systems
(which includes virtually all versions of UNIX,
Linux, and Mac OS X),
• the Java API for designing programs that run
on the Java virtual machine
120. 12
0
Contd.
• The run-time support system (a set of functions
built into libraries) for most programming
languages provides a system-call interface that
serves as the link to system calls made
available by the operating system.
121. 12
1
Contd.
• Typically, a number is associated with each system
call, and the system-call interface maintains a table
indexed according to these numbers.
• The system call interface then invokes the intended
system call in the operating system kernel and returns
the status of the system call and any return values.
• Thus, most of the details of the operating-system
interface are hidden from the programmer by the API
and are managed by the run-time support library.
122. 12
2
• The relationship between an API, the system-
call interface, and the operating system is
shown in Figure 2.3, which illustrates how the
operating system handles a user application
invoking the open() system call.
124. 12
4
• System calls occur in different ways,
depending on the computer in use. More
information is required than simply the identity
of the desired system call. The exact type and
amount of information vary according to the
particular operating system and call.
125. 12
5
Passing Parameter to OS
• So we pass parameters with the system call to
provide more information on file or device to
use as the source, as well as the address, length
of the memory buffer into which the input
should be read.
• Two general methods are used to pass
parameters to the operating system.
126. 12
6
Pass the parameter by register
• The simplest approach is to pass the parameters
in registers
A. Frank - P. Weisberg
127. 12
7
2nd method.
• Parameters also can be placed, or pushed, onto
the stack by the program and popped off the
stack by the operating system. Some operating
systems prefer the block or stack method,
because those approaches do not limit the
number or length of parameters being passed
128. 12
8
Types of System Calls
• System calls can be grouped into 5 categories
1. Process control
2. File management
3. Device management
4. Information maintenance
5. Communications
129. 12
9
Process control
• A running program needs to be able to halt its
execution either normally (end) or abnormally
(abort).
• If the program runs into a problem and causes
an error trap, a dump of memory is sometimes
taken and an error message generated.
130. 13
0
Contd.
• If we create a new job or process, or perhaps even a
set of jobs or processes, we should be able to control
its execution.
• This control requires the ability to determine and
reset the attributes of a job or process, including the
job's priority, its maximum allowable execution time,
and so on (get process attributes and set process
attributes).
• We may also want to terminate a job or process that
we created (terminate process) if we find that it is
incorrect or is no longer needed
131. 13
1
Process control
• Following are the function of process control.
1. end, abort
2. load, execute
3. create process, terminate process
4. get process attributes, set process attributes
5. wait for time
6. wait event, signal event
7. allocate and free memory
132. 13
2
File Management.
1. create file, delete file
2. open, close
3. read, write, reposition
4. get file attributes, set file attributes
133. 13
3
File management
• We first need to be able to create and delete
files.
• Once the file is created, we need to open it and
to use it. We may also read, write, or reposition
(rewinding or skipping to the end of the file,
for example). Finally, we need to close the file,
indicating that we are no longer using it.
134. 13
4
Contd.
• Once the file is created, we need to open it and
to use it. We may also read, write, or reposition
(rewinding or skipping to the end of the file,
for example). Finally, we need to close the file,
indicating that we are no longer using it.
• System call requires the name of the file and
perhaps some of the file's attributes, File
attributes include the file name, a file type,
protection codes, accounting information, and
so on.
135. 13
5
Device management
1. request device, release device
2. read, write, reposition
3. get device attributes, set device attributes
4. logically attach or detach devices
136. 13
6
Contd.
• A process may need several resources to
execute—main memory, disk drives, access to
files, and so on.
• The various resources controlled by the
operating system can be thought of as devices.
Some of these devices are physical devices
(tapes, disk) and other are virtual devices
(example file).
137. 13
7
Contd.
• If there are multiple users of the system, the system
may require us to first request the device, to ensure
exclusive use of it. After we are finished with the
device, we release it.
• Once the device has been requested (and allocated),
we can read, write, and (possibly) reposition the
device, just as we can with files.
• In fact, the similarity between devices and files is so
great that many operating systems, including UNIX,
merge the two into a combined file-device structure.
• In this case, a set of system calls is used on files and devices-
get device attributes, set device attributes
138. 13
8
Information maintenance
• get time or date, set time or date
• get system data, set system data
• get process, file, or device attributes
• set process, file, or device attributes
140. 14
0
In the message-passing model
• the communicating processes exchange messages with
one another to transfer information.
• Before communication can take place, a connection
must be opened. The name of the other Process must
be known, it may be the process on the same system
or a process on another computer connected by a
communications network,
• Each process has a process name, and this name is
translated into an identifier by which the operating
system can refer to the process. The get process-id
system calls do this translation.
141. 14
1
In shared memory model
• memory is shared between processes.
• The operating system tries to prevent one process
from accessing another process's memory. Shared
memory requires that two or more processes agree to
remove this restriction. They can then exchange
information by reading and writing data in the shared
areas.
• The processes are also responsible for ensuring that
they are not writing to the same location
simultaneously.
142. 14
2
Contd.
• create, delete communication connection
• send, receive messages
• transfer status information
• attach or detach remote devices
144. 14
4
• Operating systems started as small, simple, and limited systems
and then grew beyond their original scope.
• MS-DOS is an example of such a system.
• It was originally designed and implemented by a few people
who had no idea that it would become so popular.
• It was written to provide the most functionality in the least
space, so it was not divided into modules carefully.
145. 14
5
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.
• The main advantage of the layered approach is
simplicity of construction and debugging.
146. 14
6
• The layers are selected so that each uses functions (operations)
and services of only lower-level layers. This approach
simplifies debugging and system verification
• Once the first layer is debugged, its correct functioning can be
assumed while the second layer is debugged, and so on.
• If an error is found during the debugging of a particular layer,
the error must be on that layer, because the layers below it are
already debugged. Thus, the design and implementation of the
system is simplified.
148. 14
8
Microkernels
• The basic idea behind micro kernels is to remove all non-
essential services from the kernel, and implement them as
system applications instead, thereby making the kernel as
small and efficient as possible.
• One benefit of the microkernel approach is ease of extending
the operating system. All new services are added to user
space and consequently do not require modification of the
kernel
• The main function of the microkernel is to provide a
communication facility between the client program and the
various services that are also running in user space.
Communication is provided by message passing
149. 14
9
• Security and protection can be enhanced, as
most services are performed in user mode, not
kernel mode.
• System expansion can also be easier, because it
only involves adding more system applications,
not rebuilding a new kernel.
• microkernel is easier to port from one hardware
design to another
151. 15
1
Modules
• Modern OS development is object-oriented,
with a relatively small core kernel and a set of
modules which can be linked in dynamically.
• Modules are similar to layers in that each
subsystem has clearly defined tasks and
interfaces, but any module is free to contact
any other module,
• eliminating the problems of going through
multiple intermediary layers
153. 15
3
Hybrid Systems
• Most operating systems used today do not
strictly follow one architecture, but are hybrids
of several.
• The Max OSX architecture relies on the
microkernel for basic system management
services, and the BSD kernel for additional
services.
154. 15
4
• The kernel is relatively small in this
architecture, similar to microkernels, but the
kernel does not have to implement message
passing since modules are free to contact each
other directly.
• Common in modern implementations of UNIX,
such as Solaris, Linux, and Mac OS X.
156. 15
6
• Operating System Structure-:
• Operating System Operation
• Operating System Services
• User Operating System Interface
• System Calls
• Types of System Calls
• Operating System Structure