Академический Документы
Профессиональный Документы
Культура Документы
1
Explain about the Memory allocation techniques?
Single contiguous allocation: Simplest allocation method used by MS-DOS. All memory (except
some reserved for OS) is available to a process.
i. First Fit:
The first hole that is big enough is allocated to the process.
Dynamic Loading
The advantage of dynamic loading is that an unused routine is never loaded. With
dynamic loading, a routine is not loaded until it is called.
Dynamic loading does not require special support from the operating system.
Dynamic Loading
The advantage of dynamic loading is that an unused routine is never loaded. With
dynamic loading, a routine is not loaded until it is called.
Dynamic loading does not require special support from the operating system.
2
Backing Store : It is a secondary memory disk (hard disk ) used to store the data.
Roll out and Roll in : In Roll out, the lower priority process is swapped out into backing Store.
In Roll in, the high priority process is swapped in to main memory for execution.
Major part of swap time is transfer time. Total transfer time is proportional to the amount of
memory swapped.
3
Explain about the Segmentation in detail?
Segmentation is another memory management scheme that supports the user-view of
memory.
A program is a collection of segments.
– A segment is a logical unit such as:
main program
procedure
function
method
object
local variables, global variables
common block
stack
symbol table
arrays
Each segment has a name and a length. The addresses specify both the segment name
and the offset within the segment.
The user therefore specifies each address by two quantities: a segment name and an
offset.
4
The details about each segment are stored in a table called as segment table. Segment
table is stored in one (or many) of the segments.
The use of a segment table is illustrated in Figure. A logical address consists of two parts: a
segment number s and an offset value d. The segment number is used as an index into the
segment table.
The offset d of the logical address must be between 0 and the segment limit.
The Intel 386 uses segmentation with paging for memory management with a two-level
paging scheme.
The logical-address space of a process is divided into two partitions. The first partition
consists of up to 8 KB segments that are private to that process.
The second partition consists of up to 8 KB segments that are shared among all the
processes. Information about the first partition is kept in the Local Descriptor Table
5
(LDT), information about the second partition is kept in the Global Descriptor Table
(GDT).
To improve the efficiency of physical-memory use, Intel 386 page tables can be swapped
to disk.
A demand paging technique is similar to the paging system with swapping feature.
The process of loading the page into memory on demand (whenever page fault occurs)
is known as demand paging.
6
The process includes the following steps :
1. If CPU try to refer a page that is currently not available in the main memory, it generates
an interrupt indicating memory access fault ((Page Fault).
2. The OS puts the interrupted process in a blocking state . For the execution to proceed
the OS must bring the required page into the memory.
3. The OS will search for the required page in the logical address space.
4. The required page will be brought from logical address space to physical address space.
The page replacement algorithms are used for the decision making of replacing the page
in physical address space.
5. The page table will updated accordingly (Please refer below Page Table).
7
6. The signal will be sent to the CPU to continue the program execution and it will place
the process back into ready state.
The job of the Page Replacement algorithm is to decide which page gets victimized/removed to
make room for a new page.
8
2.Least Recently Used Algorithm (LRU)
LRU chooses that page that has not been used for the longest period of time.
As processes are loaded and removed from memory, the free memory space is broken into
little pieces. After sometimes these broken memory blocks cannot allocate to the process due
to its small size. These memory blocks are remains unused due to its small size. This problem is
known as Fragmentation.
1. Internal fragmentation
2. External fragmentation
Internal fragmentation
Memory block assigned to process is bigger. Some portion of memory is left unused, as it
cannot be used by another process. The internal fragmentation can be reduced by effectively
assigning the smallest partition but large enough for the process.
External fragmentation
Total memory space is enough to satisfy a memory allocation request or to reside a process in
it, but it is not contiguous, so it cannot be used. External fragmentation can be reduced by
compaction or gather the free memory together in one large block.
9
Explain about the Thrashing?
A process that is spending more time paging than executing is said to be thrashing.
In other words it means, that the process doesn't have enough frames to hold all the
pages for its execution, so it is swapping pages in and out very frequently to keep
executing,
As the memory fills up, process starts to spend a lot of time for the required pages to be
swapped in, again leading to low CPU utilization because most of the proccesses are
waiting for pages.
Hence the scheduler loads more processes to increase CPU utilization, as this continues
at a point of time the complete system comes to a stop.
To prevent thrashing we must provide processes with as many frames as they really
need "right now".
10