Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views30 pages

Lecture 8 - Operating Systems

An operating system (OS) is a set of programs that manage computer resources and provide a user-friendly interface. Its primary objectives include making systems convenient to use and efficiently managing resources like CPU and memory. Key functions of an OS encompass process management, memory management, file management, security, and command interpretation.

Uploaded by

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

Lecture 8 - Operating Systems

An operating system (OS) is a set of programs that manage computer resources and provide a user-friendly interface. Its primary objectives include making systems convenient to use and efficiently managing resources like CPU and memory. Key functions of an OS encompass process management, memory management, file management, security, and command interpretation.

Uploaded by

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

1

OPERATING SYSTEMS

LECTURE 9
09/11/25 Introduction to Computers
What is an operating
2
system?
 An operating system (OS), is an:
 integrated set of programs that control the
resources (CPU, memory, I/O devices etc)
of a computer system and
 provides its users with an interface that is
more convenient to use than the bare
machine.

09/11/25
OS primary objective 1
3

1. Making a computer system convenient


to use.
 An OS is a layer of software on top of the
bare hardware of a computer system,
which manages all parts of the system.
 It hides the details of the hardware
resources from the programmer and
provides the programmer with a
convenient interface for using the
computer system.

09/11/25
4

Us ers
O th er s y s tem
s o ftw are an d ap p lic atio n p ro g ram s
O p eratin g s y s tem

c o m p u ter
h ard w ar e

L o g ic al arc h itec tu re o f a c o m p u ter s y s tem .

09/11/25
OS primary objective 2
5

2. Managing the resources of a computer


system.
 This involves performing such tasks as
keeping track of who is using which
resource, granting resource requests,
accounting for resource usage, and
mediating conflicting requests from
different programs and users.
 The efficient and fair sharing of resources
among users and/or programs is a key goal
of most operating systems
09/11/25
Main functions of an OS
6

1. Process management: This module takes care of the


creation and deletion of processes, scheduling of various
system resources and providing mechanisms for
synchronization and communication among processes.
2. Memory management: Allocation and de-allocation of
memory space to programs
3. File management: This module of the OS takes care of file
related activities such as organization, storing and
protection of files.
4. Security: The security module protects the resources and
information of a computer system against destruction and
unauthorized access.
5. Command interpretation. This takes care of interpreting
user commands. With this mode of interaction with the
system, the user is not too concerned with hardware details.
09/11/25
Measuring system
7
performance
 The efficiency of an OS and the overall
performance of a computer system are usually
measured in:
 Throughput: Amount of work that the system is
able to do per unit time, measured as the
number of processes completed by the system
per unit time (processes/hour)
 Turnaround time: This is the interval from the
time of submission of a job to the system for
processing to the time of completion of the job.
 Response time: The interval from the time of
submission of a job to the system for processing
to the time the first response for the job is
produced by the system 09/11/25
Process management in
8
early years
 In early computer systems, a job was executed in the following manner:
1. A programmer would first write the program on paper.
2. It was then punched on cards along with its data.
3. The deck of cards was then submitted at the reception counter of the computer
centre.
4. An operator would then take the cards deck and manually load it into the
system, load any other software resource, set any hardware devices required
and clear main memory.
5. The operator would then set the appropriate switches in the front panel to run
the job.
6. The result of execution of the job was then printed out and be taken to the
reception counter for the programmer to collect later.

09/11/25
Batch processing
9

1. Programmers would prepare their programs and data


on decks of cards and submit them at the reception
counter.
2. The operator would periodically collect all the submitted
programs and would batch them together and load
them all into the input device of the system at one time.
3. The operator would then give a command to the system
to start executing jobs.
4. The jobs were then automatically loaded from the input
device and executed by the system one-by-one without
operator intervention.
5. When all the jobs in the submitted batch were
processed, the operator would separate and keep the
printed output of each job at the reception counter for
the programmers to collect.
09/11/25
Batch processing
10

 How is the computer able to separate one


job from another in a batch of jobs for
automatic job-to-job transition?
 How does the system know which compiler
or what hardware devices are to be used
by a particular job without operator
intervention?
 To facilitate all these, control statements
and job control languages were introduced
together with batch processing.
09/11/25
Control statements
11

 These were used by the operating system to


identify a new job and to determine what resources
are needed by the job during its execution.
 These control statements are written in a language
known as the job control language.
 Hence, each program has, besides the program
itself, a set of instructions called JCL instructions,
which tell the OS:
 The name of the job, the user’s name and acc no

 The i/o devices to be used during processing

 The assembler or compiler to be used if language

translation is required..etc.
09/11/25
Multiprogramming
12

 It was observed that a job does not need the CPU


for the entire duration of its processing.
 This is because in addition to doing computation, a
job often needs to perform I/O operations.
 In a uniprogramming system, the CPU will be idle
whenever the job that is currently being processed
by the system performs I/O operations.
 Multiprogramming is the name given to the
interleaved execution of two or more different and
independent programs by the same computer.

09/11/25
Multiprogramming
13

 With multiple user programs simultaneously


residing in the main memory, when a user
program that was using the CPU starts
performing I/O operations, the CPU is
allocated to another user program in the
main memory that is ready to use the CPU,
instead of allowing the CPU to be idle.
 The CPU switches from one program to
another almost instantaneously. Hence, in
multiprogramming, several user programs
share the time of the CPU to keep it busy.
09/11/25
The three different states in which
jobs may be after getting loaded in
the main memory in a
14 multiprogramming system.

Job is alloc ated the


Job proc essing
CP U for exec ution
N ew Job c om pleted
Ready Running

Job m ust w ait for


I/O
I/O c om pletion
c om pleted

Bloc ked

09/11/25
Requirements of
15
multiprogramming systems
1. Large memory to accommodate a good number of user
programs along with the OS.
2. Memory protection: to prevent a job in one memory
partition from changing information in another job’s
memory partition.
3. Job status preservation: which is preserving of a job’s
complete status information when the CPU is taken away
from it and restoring this info before the CPU is given back
to it.
4. Proper job mix: A proper mix of I/O bound and CPU bound
jobs is required.
5. CPU scheduling: If more than 1 process is in the ready
state, the OS must decide which of the ready jobs should
be allocated the CPU. This is done by the CPU scheduler
using the CPU scheduling algorithm.
09/11/25
Multiprocessing
16

 The term multiprocessing is used to


describe interconnected computer
configurations, or computers with two or
more CPUs, which have the ability to
simultaneously execute several programs.
 In such a system, instructions from
different and independent programs can
be processed simultaneously by different
CPUs or the CPUs may simultaneously
execute different instructions from the
same program.
09/11/25
Multiprocessing
17

CPU - 1 Main Memory CPU - 2

I/O Processors I/O Processors

I/O Units I/O Units

Basic organization of a typical multiprocessing system

09/11/25
Multiprocessing
18

 Multiprocessing systems are of two


types:
 Tightly coupled systems – there is a single,
system-wide primary memory, which is
shared by all processors.
 Loosely coupled systems – the processors
do not share memory and each processor
has its own local memory.

09/11/25
Advantages and Limitations of
Multiprocessing
19

 Advantages:
 Better performance: shorter response times and higher
throughput than single processor systems.
 Better reliability: if one processor breaks down, the other
processor automatically takes over the system workload
until repairs can be made.
 Limitations:
 Require a very sophisticated operating system to schedule,
balance and coordinate the input, output and processing
activities of multiple processors. The design of such an
operating system is a complex and time-taking job.
 Multiprocessing systems are expensive to procure and
maintain. In addition to the high charge paid initially, the
regular operation and maintenance of these systems is also
a costly affair.

09/11/25
Difference between
Multiprogramming and
20 Multiprocessing
 Multiprogramming – interleaved
execution of two or more processes by a
single CPU computer system.
 Multiprocessing – simultaneous
execution of two or more processes by a
computer system that has more than
one CPU.

09/11/25
Timesharing
21

 This is a mechanism to provide simultaneous


interactive use of a computer system by
many users in such a way that each user is
given the impression that he/she has his/her
own computer.
 It uses multiprogramming with a special CPU
scheduling algorithm to do this.
 A time-sharing system has many user
terminals connected to the same computer.
Using these terminals, multiple users can
simultaneously work on the system.
09/11/25
Timesharing
22

 The special CPU scheduling algorithm, used in


a time-sharing system, allocates a very short
period of CPU time one-by-one to each user
process, beginning from the first user process
till the last one, and then again beginning from
the first one.
 This short period is known as a time slice or
time slot.
 That is, when the CPU is allocated to a user
process, the user process will use the CPU until
the allotted time slice expires, or until the
process needs to perform some I/O operation,
or if the execution of the process is over
during this time period.
09/11/25
Timesharing
23

J o b is allo c ated th e
J o b p r o c es s in g
C P U fo r ex ec u tio n
N ew J o b c o m p leted
R ead y R u n n in g

Allo tted tim e s lic e is o v er


J o b m u s t w ait f o r
I /O
I /O c o m p letio n
c o m p leted

Blo c k ed

09/11/25
Virtual Memory
24

 Conventional memory management


schemes suffer from two main
limitations:
 A process cannot be loaded and has to
keep waiting for its execution to start until
sufficient free memory for loading the
entire process becomes available. This may
delay a process’s turnaround time.
 A process cannot be loaded (and hence
executed) in a system whose main memory
size is less than the total memory required
by the process.
09/11/25
Virtual Memory
25

 Virtual memory is a memory


management scheme which overcomes
those limitations by allowing the
execution of processes that might not be
completely loaded in main memory. i.e.
it does not require an entire process to
be in memory before its execution can
start.

09/11/25
How is Virtual Memory
26
Realized?
 The three basic concepts used for the
realization of virtual memory are:
 On-line secondary storage: a secondary storage
device whose capacity is much larger than the main
memory capacity and which is always kept on-line
to the system. High-speed disk storage is usually
used for this purpose.
 Swapping: this is the process of transferring a block
of data from the online secondary storage to main
memory and vice-versa. When data is transferred
from on-line secondary storage to main memory, it
is called swapping-in and vice versa.

09/11/25
How is Virtual Memory
27
Realized?
 Demand paging: In a virtual memory
system, all processes are partitioned into
pages and reside on the online secondary
storage. The physical memory is also
partitioned into page frames of the same
size. Now, instead of swapping in the entire
process before execution can start, a
swapping algorithm is used which swaps in
only those pages of a process that are
currently needed in the memory for
continuing the process’s execution.
09/11/25
Advantages of Virtual
28
Memory
 Provides a very large virtual memory to
programmers on a system that has small
physical memory.
 Enables execution of a process on a system
whose main memory size is less than the
total memory required by the process.
 Enables a process’s execution to start even
when sufficient free memory for loading the
entire process is not available.
 Makes programming much easier since a
programmer no longer needs to worry about
the size limitations of the physical memory
available.
09/11/25
Disadvantages
29

 It is difficult to implement because it


requires algorithms to support demand
paging.
 If used carelessly, it may substantially
decrease performance – this happens
when a process spends more time in
swapping in and out of pages rather than
in its execution.

09/11/25
Some Popular Operating
30
Systems
 Unix: a multi-user, time-sharing operating
system.
 MS-DOS: Microsoft Disk Operating System. It is a
single-user operating system.
 Microsoft Windows: has a graphical user
interface, it is a single-user multitasking
operating system (a user may run more than one
program at a time)
 Microsoft Windows NT: multi-user, time-sharing
operating system that supports
multiprogramming, and is also designed to take
advantage of multiprocessing on systems that
have multiple processors.
09/11/25

You might also like