146 Operating Systems
Both logical and physical addresses are contiguous in nature, meaning that each
consecutive address refers to a cell. Physical addres tm. mode while
logical addresses are used in user mode. ithe sizeof physical memory is 4 megabytes
(2 bytes] then the physical adciresses will run from 0 to 22 ~ 1 under the issumption
thet physical memory is divided into small memory cells of size 1 byte (8 bit)
A computer system has only one physical address space, but can have served logical
address space (ig. 7.3). * a7
7.3 | MEMORY MANAGEMENT SCHEMES
Memory management schemes are broadly divided into following categories: (Figure 7.4)
7.3.1. Contiguous Memory Allocation
Contiguous allocation means that each logical object is placed in a set of memory locations
with strictly consecutive addresses, Bare machines, Resident monitor, Multiprogramming
are the further division of contiguous allocation. While multiprogramming is categorised
{nto two parts: Fixed partition and variable partition.
7.3.2 Non-Contiguous Memory Allocatjon
Non-contiguous allocation implies that a single logical abject may be place in non-
consecutive sets of memory location. Paging (System view) and Segmentation (user view)
are the two mechanisms that are used to manage non-contiguous memory allocation.
MEMORY MANAGEMENT SCHEME
oo —
Contiguous memory allocation Non-contiguous
memory allocation
Bare Residont Muti
machine imonitor} | programming
Food Varible
partion pariion
{
‘Segmentation Paging
{Oser view) (System view)
Fig. 7.4 Various Memory Management Schemes,
1 Bare Machine (Single User)
Itis one ofthe most simplest memory management method in which user has complete
control over the memory while in other methods operating system has complete control
over memory.Memory Management 147
tei 2 Bo eee ee
‘The advantages of using this method are: veel
{ Flexible
{i No hardware support is required,
{ii No software is needed for OS.
While the disadvantage of using this method is:
‘As OS has no control over the memory, it does not provide any services
to user. Such memory management method is used in user dedicated systems.
100K USER
se =,
cere |
oo ee eo
18.1.2 Resident Monitor (Single Process Monitor)
Vitis also a simplest memory management method in which memory is divided into two
contigdane aneas One of them la uouely the permanently allocated to the resident parion
ttansient processes, which are loaded and executed one at a time, in response towser
Commands: When a transient process is completed, the OS may load another one for
txecution, Both user processes and non-resident portions of the OS may be executed in
the transient process area. This form of memory management is commonly used by single
process microcomputer {PC} operating systems, such as CPM and PC-DOS,
“The operating systems expends little time and effort managing meméry in this way.
Basically, Operating systems needs to keep track of the frst and last locations available
for allocation to transient processes. The first location is commonly the one immediately
following the resident monitor, and the last one is determined by the capacity of memory
Used in & computer eystem. In order of provide free space for transient processes, operating
tystems is loaded at one extreme end of memory. Some portions of operating systems like
loader or command-line interpreter is placed at another extreme end of memory, thus
Jeaving & large contiguous area of free memory in the middle for loading the transient
process
At instant of time, only one transient process in this area, for its
gxecution; and after fon of jis execution, new process will take this place. The
Operating systems has to make sure that the size of the process image to be loaded is
Within the bounds of the available memory, Otherwise, loading cannot be completed and
tin exvor message is generated. Once in memory, the process receives control, from the
Gperatiag systems and executes until completion or abortion due to some error. The process
tthnounces its termination and transfers control to the operating systems by invoking the
BXIT service or its equivalent. At this time, another waiting process may be loaded.
1m general purpose applications, such as personal computer, this method is rarel
areata sn inaiity toatch and pate the operating systems
code.148 Operating Systems
With straight forward memory allocation and absence of multiprograrhminig
‘complexities, single process monitors are relatively simple to design. They wy often used
in system where little hardware support is required.
Processor and Memory utilization is reduced due to lack of multiprogramming Support.
Processor eyele are wasted because there ig no pending work that may be executed while
the process is waiting for completion of 1/0 operation.
7.3.1.3 Multiprogramming with Fixed Partition
‘The above two approaches sections 7.3.1.1 and 7.3.1.2 of memory management are
based on single user. That ia, at a single instant of time only one process is executed.
‘Since, CPU executes only those process which resides in our memory (main memory) So,
only one process resides in main memory at a time and other process at another time,
"To impeove the pextummansthe somarer ate, tv concegrat mas ‘
was introduced, which states that “more than one processes are accessed at a single
instant of time”, But only one pro< i a uniprocess:
‘System (PC) and at that particular time other processes may be accessed by I/O processor.
Heh proce is executed and in which oasis deccd GPU sebedue
To access more than one processes at a time, they must reside in our memory. For
this, we should know that how more than one processes can be allocated in our memory.
Various memory management policies are developed to provide the solution of this problem
ina inultiprogramming environment. Partitioned Memory Management for contiguous
memory allocation is one of that method in which physical memory is divided into various
sectors called ‘partitions’. cach of which may be allocated to a diferent process. Depending
on when and how partitions are created and modified, memor ioninig may be fixed
(static) or varlable (dynamic) Tm xed pariton method, thove pardons SULT Be of
ferent ees, But diss decided atthe tine of eyatem generation (at aome time prior tothe
execution of user programs), they could not be changed, Le, fixed. This method could be
perpen gamit
‘The number and sizeé of individual partitions are determined at the time of eystem
generation by gathering the statistical data about the capacity ofthe available (installed)
Styeical memory, desired degres of malliwrogramming, end the elses of Proocasea moet
frequently run on given installations. Individual partition sizes are adjusted to fit the
seuda of Reach ot froceswes, SiGe at rowan Frocowenay @cecuts iba» dec
Datiion at any tine, the mumaber of distinet partitions represents an upper limit on the
Bumnber of active processes in a system. This figure is sometimes eallod the degree af
multiprogramming.*
‘An example of partitioned memory is depicted in Figure 7.7. Out of six partitions, one
is azsumed to be occupied by the resident portion of OS and three parttigna are allocated
by the processes P, P,and P;,. The remaining two shaded partitions are free and available
for allocation of next process.
* Degree of Multiprogramming: CPU utilization can be improved by multiprogramming. Since
CPU is busy all time when many processes resides in memory for execution simultaneously.
Ifa process spends ‘t’ time waiting for I/O operation to complete and there are ‘n’ number of
processes residing in memory for their execution then the probability of waiting ‘n’ processes for 1/O
operation is given by (i)". So, CPU utilization = 1 ~ (¢)"
‘The CPU utilization for ‘n’ processes is called degree of multiprogramming.