Advanced OS 02

Download Report

Transcript Advanced OS 02

Operating Systems
Advanced OS – B
OS Advanced
Memory & Processor Management
OS Advanced
Memory Management
OS Advanced
Memory management is concerned
with managing the computer’s
available pool of memory, allocating
space to application routines and
making sure they do not interfere
with each other
OS Advanced
Because of the speed differences
between memory and other
hardware, the OS spends more
time waiting for Input/Output than
processing data
OS Advanced
Generally the more programs in
memory, the greater the utilization
of the CPU
OS Advanced
A single processor cannot execute
two or more programs
simultaneously (“at the same time”)
OS Advanced
A single processor can execute two
or more programs concurrently
(“over the same time period”)
OS Advanced
There are two ways of managing
multiple concurrent programs
Fixed-Partition Memory
Management &
Dynamic Memory Management
OS Advanced
Fixed-Partition Memory
Management
Dividing the available memory into
fixed size partitions which will hold
programs when they are loaded
OS Advanced
Fixed partitions are loaded upon
system startup, and if not sufficient
for the largest program to be loaded
wastes space and is inefficient.
However it is simple to do.
OS Advanced
Dynamic management allocates a
large pool of memory and makes it
available for programs as they are
loaded into memory
OS Advanced
When the program is loaded just
enough memory is allocated to fit
the size of the program from the
larger memory pool
OS Advanced
Dynamic memory management
wastes little space,
but is harder to do
OS Advanced
One problem with Dynamic memory
management is Fragmentation
OS Advanced
To keep two or more programs from
interfering with each other the OS
memory protection routine
intercepts the problem and
terminates the offending application
OS Advanced
Virtual Memory
Virtual = “not in actual fact”
Memory that acts like real memory
but is not real memory
OS Advanced
Real Memory – Physical memory
chips
Virtual Memory – Logical memory
chips
OS Advanced
Total memory is divided into the
Real Memory & Logical Memory
Total Memory = Physical Amount +
Virtual Memory. Allocated on
another disk (usually the HD)
OS Advanced
Programs are swapped to and from
virtual memory into physical
memory as needed by the current
processes
OS Advanced
This swapping process is
transparent to the user and done in
the background by the OS
OS Advanced
Page Faults
How programs are swapped into
physical memory
When a process points to a virtual
memory address a page fault is
recognized by the OS…
OS Advanced
Then the required swap-in occurs
and the operation can begin
OS Advanced
When a system spends to much
time swapping from virtual to
physical memory we have
Thrashing which degrades system
performance
OS Advanced
Processor Management
OS Advanced
Time-Slicing
is the approached used on most
modern computers to handle
concurrent program execution
OS Advanced
Program 1 gets 0.001 secs to
function, then Program 2 gets 0.001
secs to function, time-slice depends
on OS
OS Advanced
A program uses its time-slice until
one of two things happen:
It requests an I/O function
(wait state) or
It uses up its time-slice
End 02-04-05
OS Advanced
Scheduling & Queuing
Processor management is
concerned with internal priorities of
programs already in memory
OS Advanced
Determining which program runs
next is determined by the Queuing
Routine and a Scheduler
OS Advanced
Queuing Routine
As programs enter into memory
they are placed in a queue
OS Advanced
There are internal and external
priorities
OS Advanced
External priorities are concerned
with loading the program into
memory in the first place
OS Advanced
Internal priorities are concerned
with which program goes next in the
queue
OS Advanced
By this queuing and scheduling
system the applications we use can
be time-sliced and we are assured
that they will function
OS Advanced
Spooling
Freeing up memory when
performing jobs like printing. Data
is spooled to a HD and then sent to
a printer when the CPU or printer is
idle. This frees up Memory and
CPU cycles for other tasks
OS Advanced
Deadlock
The result of poor resource
management. Happens when two
processes require the same
resource, either physical or logical
(memory)
OS Advanced
Memory & Processor Management
is a key function of an OS, it
determines how useful the OS is.
OS Advanced
Questions?