Monday, June 25, 2007

assignment1

EXERCISES

Unit Name Absulote Size Exponential Form
byte 2 bytes 2
kilobytes 1,024 bytes 2^10
megabytes 1,048,576 bytes 2^20
gigabytes 1,073,741,824 2^30
terabytes 1,099,511,627,776 2^40
petabytes 1,125,899,906,842,624 2^50
Exer.2
1.Explain the following:
a. Multiprogramming. Why it is use?
=>Because multiprogramming system, multiple programs submitted by users were each allowed to use the processor for a short time. To users it appeared that all of the programs were executing at the same time. Problems of resource contention first arose in these systems. Explicit requests for resources led to the problem of the deadlock. Competition for resources on machines with no tie-breaking instructions lead to the critical section routine.
b. Internal Fragmentation.How does it occur?
=>Internal fragmentation occurs when storage is allocated without ever intending to use it. This space is wasted. While this seems foolish, it is often accepted in return for increased efficiency or simplicity. The term "internal" refers to the fact that the unusable storage is inside the allocated region but is not being used.
c. External Fragmentation.How does it occur?
=>External fragmentation is the phenomenon in which free storage becomes divided into many small pieces over time. It is a weakness of certain storage allocation algorithms, occurring when an application allocates and deallocates ("frees") regions of storage of varying sizes, and the allocation algorithm responds by leaving the allocated and deallocated regions interspersed. The result is that, although free storage is available, it is effectively unusable because it is divided into pieces that are too small to satisfy the demands of the application. The term "external" refers to the fact that the unusable storage is outside the allocated regions.
d. Compaction. Why is it needed?
=>Compaction is the process of a material being more closely packed together. A compactor is a device that performs compaction.
Compaction is often used to reduce the size of waste material. Garbage compactors and waste collection vehicles compress waste so that more of it can be stored in the same space. It is compacted again, more thoroughly, at the landfill to preserve valuable space
e. Relocation.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.Disadvantages of 4 memory allocation.

3. Advantages of 4 memory allocation.
=>Static memory allocation refers to the process of allocating memory at compile-time before the associated program is executed, unlike dynamic memory allocation or automatic memory allocation where memory is allocated as required at run-time.
An application of this technique involves a program module (e.g. function or subroutine) declaring static data locally, such that this data is inaccessible in other modules unless references to it are passed as parameters or returned. A single copy of static data is retained and accessible through many calls to the function in which it is declared. Static memory allocation therefore has the advantage of modularising data within a program design in the situation where this data must be retained through the runtime of the program.
The use of static variables within a class in object oriented programming enables a single copy of such data to be shared between all the objects of that class.
4.Given the following information:
Job list:
job number memory allocation
J1 740K
J2 500K
J3 700K
memory list:
memory block size
Block 1 610K(low-order memory)
Block 2 850K
Block 3 700K(high-order memory)
BEST-FIT
In the job list they have job 1, job 2, and job 3.In memory list also have block 1 to 3.The job 1 has a memory requested is 740K so that the job 1 will go to block 2 while the size is 850K.In job 2 the memory requested is 500 K and that's why they go to block 1 have a size of 610K.While the job 3 has memory requested of 700K will go to block 3 that have 700 K.
FIRST-FIT
The job 1 and the job 2 they not allocate in block 1 and 2.while the job 3 is fit to the block 3.
5.Given the following information:
Job list:
job number memory requested
J 1 700K
J 2 500K
J 3 740K
Memory list:
memory block size
block 1 610K(low-order memory)
block 2 850K
block 3 700K(high-order memory)
Best-fit:
Job 1 will go to block 3.The job 2 also go to block 1.And the last the job 3 goes to block 2.
First-fit:
6.
a.)Another variation of the free list algorithm is useful for very transient allocations of memory, especially when all allocation are about the same size
b.) It is compare by there size and memory requested.
7.Worst fit the memory manager placed a process in the largest block of unallocated memory available.The idea is this placement will create the largest hold after the allocations,thus increasing the possibility that compare to best fit,another process can use the remaining space.
8. Yes.The memory manager will know to adjust them by the value stored in relocation register. All of the other values(data values) are not marked and wont be changed after relocation.Other numbers in the program, those indicating instruction, registers,or constants use in the instruction,are also left alone.


I-lyn Capuyan
Grace Danlag
Myla Bair