Thursday, December 13, 2007

Assingment 3

Answer the Question:
1. What is the cause of thrashing?
Why does paging work?
*Locality model
-process migrates from one locality to another
-localities may overlap
Why does thrashing occur?
-locality > number of frames
-sum of localities > total memory size
How do we fix thrashing?
-Working Set Model
-Page Fault Frequency
2. How does the operating system detect thrashing?
-It doesn't. 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.
3. Once thrashing is detected, what can the operating systems 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.
Explain the Following:
A.Multiprogrammng. Why is it to use?
-Multiprogramming is the technique of running several programs at a time using timesharing. It allows a computer to do several things at the same time. Multiprogramming creates logical parallelism.
B. Internal Fragmentation.How does it occur?
-Internal fragmentation is the space wasted inside of allocated memory blocks because of restriction on the allowed sizes of allocated blocks. Allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used.
C. External Fragmentation. How does it occur?
-External Fragmentation happens when a dynamic memory allocation algorithm allocates some memory and a small piece is left over that cannot be effectively used. If too much external fragmentation occurs, the amount of usable memory is drastically reduced. Total memory space exists to satisfy a request, but it is not contiguous.
D. Compaction. Why is needed?
- In a data center, compaction is the reduction or consolidation of hardware to make better use of physical floor space. Although the goal of compaction is to be cost-effective and maximize real estate, increased hardware compaction puts more demands on power consumption and cooling requirements, two major cost elements in maintaining a large data center.-In storage area management (SAM), compaction is the automatic removal of expired data from a storage area network (SAN) to condense the existing archive and make room for new data.
E. Rellocation. How often should it be performed?
- Relocation is the process of replacing symbolic references or names of libraries with actual usable addresses in memory before running a program. It is typically done by the linker during compilation, although it can be done at run-time by a loader. Compilers or assemblers typically generate the executable with zero as the lower-most, starting address. Before the execution of object code, these addresses should be adjusted so that they denote the correct runtime addresses.
2. Describe the major disadvantages for each of the four memory allocation schemes presented in the chapter.
-The major disadvantage only 1 job per partition and waste of main storage.
3. Describe the major advantages for each of the memory allocation schemes presented in the chapter.
-The major advantage of this is operating system is easy to implement.
Virtual Memory:


A program instruction on an Intel 386 or later CPU can address up to 4GB of memory, using its full 32 bits. This is normally far more than the RAM of the machine. (The 32nd exponent of 2 is exactly 4,294,967,296, or 4 GB. 32 binary digits allow the representation of 4,294,967,296 numbers — counting 0.) So the hardware provides for programs to operate in terms of as much as they wish of this full 4GB space as Virtual Memory, those parts of the program and data which are currently active being loaded into Physical Random Access Memory (RAM). The processor itself then translates (‘maps’) the virtual addresses from an instruction into the correct physical equivalents, doing this on the fly as the instruction is executed. The processor manages the mapping in terms of pages of 4 Kilobytes each - a size that has implications for managing virtual memory by the system.

http://www.aumha.org/win5/a/xpvm.php


Virtual Memory in UNIX:

Virtual memory is an internal “trick” that relies on the fact that not every executing task is always referencing it’s RAM memory region. Since all RAM regions are not constantly in-use, UNIX has developed a paging algorithm that move RAM memory pages to the swap disk when it appears that they will not be needed in the immediate future.
As memory regions are created, UNIX will not refuse a new task whose RAM requests exceeds the amount of RAM. Rather, UNIX will page out the least recently referenced RAM memory page to the swap disk to make room for the incoming request. When the physical limit of the RAM is exceeded UNIX can wipe-out RAM regions because they have already been written to the swap disk.
When the RAM region is been removed to swap, any subsequent references by the originating program require UNIX copy page in the RAM region to make the memory accessible. UNIX page in operations involve disk I/O and are a source of slow performance. Hence, avoiding UNIX page in operations is an important concern for the Oracle DBA.

http://www.remote-dba.net/op_unix_44_paging_algorithm_swap_disk.htm