Fragmentation: As processes are loaded and removed from memory, the free
memory space is broken into little pieces. It happens after sometimes that
processes cannot be allocated to memory blocks considering their small size and
memory blocks remains unused. This problem is known as Fragmentation.
Fragmentation
is of two types
1
|
External
fragmentation
|
Total
memory space is enough to satisfy a request or to reside a process in it, but
it is not contiguous so it can not be used.
|
2
|
Internal
fragmentation
|
Memory
block assigned to process is bigger. Some portion of memory is left unused as
it can not be used by another process.
|
External
fragmentation can be reduced by compaction or shuffle memory contents to place
all free memory together in one large block. To make compaction feasible,
relocation should be dynamic.
Segmentation
: Segmentation is a technique to break
memory into logical pieces where each piece represents a group of related
information. For example ,data segments or code segment for each process, data
segment for operating system and so on. Segmentation can be implemented using
or without using paging. Unlike paging, segment are having varying sizes and
thus eliminates internal fragmentation. External fragmentation still exists but
to lesser extent.
- Segment number (s)
-- segment number is used as an index into a segment table which contains
base address of each segment in physical memory and a limit of segment.
- Segment offset (o)
-- segment offset is first checked against limit and then is combined with
base address to define the physical memory address.
The
Critical-Section Problem:
n
processes all competing to use some shared data. Each process has a code
segment, called critical section, in which the shared data is accessed.
•
Problem –
ensure that when one process is executing in its critical section, no other
process is allowed to execute in its critical section.
•
Structure
of process Pi
repeat
entry section
critical
section
exit section
reminder
section
until false
Solution to Critical-Section Problem
1. Mutual Exclusion: If process Pi is executing in its critical section, then no
other processes can be executing in their critical sections.
2. Progress: If no process is executing in its critical section and
there exist some processes that wish to enter their critical section, then the
selection of the processes that will enter the critical section next cannot
be
postponed indefinitely.
3. Bounded Waiting: A bound must exist on the number of times that their
processes are allowed to enter their critical sections after a process has made
a request to enter its critical section and before that request is granted.
Semaphores
Semaphore
is a synchronization tool which can be used to deal with the critical-section
problem. A semaphore is a protected variable whose value can be accessed and
altered only by the operations P (wait) and V (signal) and an initialization
operation we shall call semaphore-initialize.
Two Types of Semaphores
·
Counting
semaphore – integer value can range over an unrestricted domain.
·
Binary
semaphore – integer value can range only between 0 and 1; can be simpler to
implement.
Starvation – indefinite blocking. A process may never be removed from
the semaphore queue in which it is suspended.
THRASHING:
Working set: collection of memory currently
being used by a process .If all working sets do not fit in memory,
thrashing occurs.
– one page
replaces another
–
Percentage of accesses that generate page faults skyrockets
Typical solution: swap out the entire
processes
Thrashing ≡
a process is busy swapping pages in and out.
What is the cause of thrashing? How does the system detect
thrashing?
Once it detects thrashing, what can the system do to eliminate
this problem?
The thrashing is caused by mainly by the file indexing in vista
and not with your page file. Indexing usually happens in the first 15mins after
you boot up - it’s normal. Your page file seems very large - try to make it a
fixed size of about 1024Mb on a second HD if possible. Have you inserted a
spare USB memory stick for ready boost - it helps reduce thrashing later on.
How does the operating system detect thrashing?
An operating system would have no idea that thrashing is
happening. The OS would be responsible for making use of virtual memory to make
up for the lack of physical RAM during a particular computing session, but
would have no concept that this is causing issues with hardware.
Once thrashing is detected, what can the operating system do to
eliminate it?
Thrashing is usually a symptom of low memory in your system. To
minimize it, try adding more memory to your computer or try to cut down on use
interface elements that use extra memory
like complicated background images and detailed icons.
No comments:
Post a Comment
Post You Comment Here. Always Respect Others . . . . . .