Computer Science - Operating Systems Concepts - Discussion
Discussion Forum : Operating Systems Concepts - Section 1 (Q.No. 16)
16.
Which of the following statements is false?
Discussion:
9 comments Page 1 of 1.
Shiva said:
5 years ago
Thank you for explaining.
Karishma said:
8 years ago
Thank you all.
Prateek said:
8 years ago
Compaction involves reallocation and is also known as Garbage Collection.
Mohammed Ramzan said:
9 years ago
Nice explanation, Thank you all.
Farheen gulzar said:
1 decade ago
Compaction : It means moving the "in-use" memory areas to eliminate holes caused by terminated processes. Suppose we have five processes A, B, C, D, E, allocated as |A|B|C|D|E| in memory. After sometime process B and D are terminated. Now we have memory layout as |A| |C| |E|.
After applying compaction we will have |A|C|E| | | i.e. instead of two one-block memory unit we have one two-block memory unit.
Defragmentation :- It means storing complete file in smallest number of contiguous regions. That is, it tries to store file as one complete unit if that size of contiguous memory is available.
Suppose process A has fragments A1, A2, A3, process B has fragments B1, B2. Now, suppose memory layout is |A1|B1|A2|A3|B2|, after defragmentation we have |A1|A2|A3|B1|B2|.
After applying compaction we will have |A|C|E| | | i.e. instead of two one-block memory unit we have one two-block memory unit.
Defragmentation :- It means storing complete file in smallest number of contiguous regions. That is, it tries to store file as one complete unit if that size of contiguous memory is available.
Suppose process A has fragments A1, A2, A3, process B has fragments B1, B2. Now, suppose memory layout is |A1|B1|A2|A3|B2|, after defragmentation we have |A1|A2|A3|B1|B2|.
(5)
Urvashi said:
1 decade ago
How can compaction be termed as garbage collection?
Naresh Purohit said:
1 decade ago
Can We call Compaction as Garbage Collection?
Is it true?
Is it true?
NISHAD MAGDUM said:
1 decade ago
Can anyone tell me what is exactly compaction and fragmentation?
Venu said:
1 decade ago
Compaction attacks the problem of fragmentation by moving all the allocated blocks to one end of memory, thus combining all the holes. Aside from the obvious cost of all that copying, there is an important limitation to compaction: Any pointers to a block need to be updated when the block is moved. Unless it is possible to find all such pointers, compaction is not possible. Pointers can stored in the allocated blocks themselves as well as other places in the client of the memory manager. In some situations, pointers can point not only to the start of blocks but also into their bodies. For example, if a block contains executable code, a branch instruction might be a pointer to another location in the same block. Compaction is performed in three phases. First, the new location of each block is calculated to determine the distance the block will be moved. Then each pointer is updated by adding to it the amount that the block it is pointing (in)to will be moved. Finally, the data is actually moved. There are various clever tricks possible to combine these operations.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers