0% found this document useful (0 votes)
30 views

Lec 9

The document discusses operating systems and their key components. It defines an operating system as an interface between computer hardware and users that facilitates program execution and resource access. The main components of an operating system are the memory manager, process manager, device manager, and file manager. The memory manager implements techniques like multiprogramming and paging to manage limited memory among multiple programs. The process manager uses schedulers and state diagrams to coordinate the transition of programs from inactive to active processes running on the CPU.

Uploaded by

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

Lec 9

The document discusses operating systems and their key components. It defines an operating system as an interface between computer hardware and users that facilitates program execution and resource access. The main components of an operating system are the memory manager, process manager, device manager, and file manager. The memory manager implements techniques like multiprogramming and paging to manage limited memory among multiple programs. The process manager uses schedulers and state diagrams to coordinate the transition of programs from inactive to active processes running on the CPU.

Uploaded by

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

Faculty of

Computer and
Information
Sciences
Information
Technology
Department
Principles of Information &
Technology Systems
IT 201T

Lecture 9: Operating Systems


Outline
 Define the operating system
 Identify the components of an operating system
 Memory manager
 Process manager
 Device manager
 File manager
Computer System

 A computer is a system composed of 2 major


components:
 hardware and software.
 Computer hardware: is the physical equipment.
 Software is the collection of programs that
allows the hardware to do its job.
Computer System

 Computer software is divided into 2 broad


categories:
 The operating system and application
programs
 Application programs: use the computer
hardware to solve users’ problems.
 The operating system: controls the access to

hardware by users.
Operating System Introduction
Operating System
An operating system: is an interface between the
hardware of a computer and the user (programs or
humans) that facilitates the execution of other
programs and the access to hardware and software
resources.
Operating System Components
 A modern operating system has at least four
duties: memory manager, process manager,
device manager and file manager.
OS Components- User interface
 Each operating system has a :
user interface: a program that accepts requests
from users (processes) and interprets them for the
rest of the operating system.

 A user interface in some operating systems, such


as UNIX, is called a shell. In others, it is called a
window to denote that it is menu driven and has
a GUI (graphical user interface) component.
User Operating System Interface - CLI
 Command Line Interface (CLI) or command
interpreter allows direct command entry

 Which is an operating system shell that uses


alphanumeric characters typed on a keyboard to
provide instructions and data to the operating system,
interactively.
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)
OS Components- Memory manager
 Although the memory size of computers has
increased tremendously in recent years, so has the
size of the programs and data to be processed.
 Memory allocation must be managed to prevent
applications from running out of memory.
 Operating systems can be divided into two broad
categories of memory management:
monoprogramming and multiprogramming.
Monoprogramming
 In monoprogramming, most of the memory
capacity is dedicated to a single program.
 only a small part is needed to hold the
operating system.
 In this configuration, the whole program is in
memory for execution.
 When the program finishes running, the
program area is occupied by another
program.
Monoprogramming

Figure shows memory in


Monoprogramming a environment
Monoprogramming (Cont.)
 There are several problems with this technique:

If the size of memory is less than the size of the program,


can the program run?

 the program cannot be run


 Inefficient use of memory and CPU time
Multiprogramming
In multiprogramming:
 more than one program is in memory at the
same time and they are executed concurrently
 with the CPU switching rapidly between the

programs
Multiprogramming

Figure shows memory in a multiprogramming


environment
Categories of multiprogramming
Multiprogramming (Cont.)
Multiprogramming (Cont.)

 Nonswapping category:
 This
means that the program remains in
memory for the duration of execution
 Two techniques belong to the this category:
 Partitioning

 paging
Multiprogramming (Cont.)

 Swapping category:
 This
means that, during execution, the
program can be swapped between memory
and disk one or more times.
 Two techniques belong to the this category:
 Demand paging
 Demand segmentation
Partitioning

 The first technique used in multiprogramming.


 Memory is divided into variable length sections
 Each section or partition holds one program
 The CPU switches between programs
 With this technique, each program is entirely in
memory and occupying contiguous locations
Partitioning- how its work ?!
1. The CPU starts with one program, executing some
instructions until it either encounters an input/output
operation or the time allocated for that program has
expired
2. Then, it saves the address of the memory location
where the last instruction was executed and moves to
the next program.
3. The same procedure is repeated with the second
program
4. After all the programs have been served, the CPU
moves back to the first program
Partitioning- how its work ?! (Cont.)

Figure shows memory with


partitioning technique
Partitioning issues
 The size of the partitions has to be determined
beforehand by the memory manager

what will happen if partition sizes are small or large?!

 The memory manager can compact the partitions to


remove the holes and creates new partitions, but this
creates extra overhead on the system
Paging
 Paging improves the efficiency of partitioning
 Memory is divided into equally sized sections called
frames
 Programs are also divided, into equally sized
sections called pages
 The size of a page and frame is usually the same
and equal to the size of the block used by the
system to retrieve information from a storage
device
Paging - how its work!!

 A page is loaded into a frame in memory


 The program does not have to be contiguous in
memory
 There is no need for the new program to wait
until set of contiguous frames are free before
being loaded into memory
Paging - how its work!!

Figure shows memory with paging technique


Paging issues

 The whole program still needs to be in memory


before being executed

 Ex: A program has six pages, cannot be loaded into


memory if there are only four unoccupied frames
Demand paging

 In this technique the program is divided into


pages
 but the pages can be loaded into memory one
by one, executed, and replaced by another
page.
 In addition, a page can be loaded into any
free frame
Demand paging (Cont.)
 An example of demand paging is shown in figure
below. Two pages from program A, one page from
program B, and one page from program C are in
the memory
Demand segmentation
 A technique similar to paging is segmentation
 A programmer thinks in terms of modules
 A program is usually made up of a main program
and subprograms
 In demand segmentation, the program is divided into
segments that match the programmer’s view
 These are loaded into memory, executed, and
replaced by another module from the same or a
different program
 since segments in memory are of equal size, part of a
segment may remain empty
Demand segmentation

An example of demand
segmentation is shown in figure
Demand paging and segmentation
 Demand paging and segmentation can be
combined to further improve the efficiency of the
system
 A segment may be too large to fit any available
free space in memory
 Memory can be divided into frames, and module
can be divided into pages
 The pages of a module can then be loaded into
memory one by one and executed
OS Components- Process manager
 A second function of an operating system is process management,
but before discussing this concept, we need to define some terms.

 A program is a non-active set of instructions stored on disk. It may


or may not become a job
 A program becomes a job from the moment it is selected for
execution until it has finished running and becomes a program
again.
 A process is a program in execution. It is a program that has started
but has not finished.
State diagrams

 The relationship between a program, a job and


a process becomes clearer if we consider how
a program becomes a job and how a job
becomes a process.
 This can be illustrated with a state diagram

that shows the different states of each of these


entities.
State diagrams (Cont.)

Figure shows a State diagram with boundaries between program, job and process
State diagrams (Cont.)
 A program becomes a job when selected by the operating system
and brought to the hold state
 It remains in this state until it can be loaded into memory
 When there is memory space available to load the program totally
or partially, the job moves to the ready state. It now becomes a
process
 It remains in memory and in this state until the CPU can execute it,
moving it to the running state at this time
 When in the running state, one of three things can happen:
 The process executes until it needs I/O resources, it goes into the waiting
state
 The process exhausts its allocated time slot, it goes into the ready state
 The process terminates, it goes into the terminated state
Schedulers
 To move a job or process from one state to
another,
 The process manager uses two schedulers
 The job scheduler
 The process scheduler
Schedulers (Cont.)
 Job scheduler:
 Moves a job from the hold state to the ready state or
 from the running state to the terminated state
(Figure shows job scheduler)
Schedulers (Cont.)
 Process scheduler:
 Moves a process between the running, waiting, and
ready states many times before it goes to the
terminated state and is no longer a process
 As shown in the figure below
OS Components- Device manager
 The device manager, or input/output manager,
is responsible for access to input/ output
devices.
 There are limitations on the number and speed
of input/output devices in a computer system.
 The device manager is responsible for the
efficient use of input/output devices
Device manager responsibilities
 The device manager monitors every input/output
device constantly to ensure that the device is
functioning properly.
 The device manager maintains a queue for each
input/output device or one or more queues for
similar input/output devices.
 The device manager controls the different policies
for accessing input/output devices. i.e. it may use
FIFO for one device and shortest length first for
another
OS Components- File manager
 Operating systems today use a file manager to
control access to files. The responsibilities of a file
manager:
 Controls access to files. The type of access can vary
(read, write, execute)
 Supervises the creation, deletion, and modification of
files.
 Controls the naming of files.
 Supervises the storage of files. ( how, where,.. etc)
 is responsible for archiving and backups.
 Any Questions ?
References
 Behrouz Forouzan and Firouz Mosharraf,
“Foundations of computer science”, Second edition,
chapter7, pp. 187- 212
THANK
YOU

You might also like