Tuesday, March 1, 2016

Dead Lock and Main Memory OS Assignment

Questions From Text book : Operating Systems Concept by Abraham,Peter and Greg (9th Edition)

a. No, Deadlock cannot occur because preemption exists.
b. Yes. A process may never acquire all the resources it needs if they are continuously preempted by a series of requests such as those of process p2.


8.9   When memory allocated to a process is larger than the requested memory, space at the end of a partition is wasted or unused. This space which is getting wasted within the partition is called internal fragmentation. When enough total memory space exists to satisfy a request, but it is not contiguous storage is fragmented to into a large number of small holes. This wasted space not allocated to any partition is called external fragmentation. Internal Fragmentation occurs when a fixed size memory allocation technique is used. External fragmentation occurs when a dynamic memory allocation technique is used.

Best fit uses the memory efficiently and then the first fit. Worst fit must wait.
Contiguous memory allocation suffers from external fragmentation as address spaces are allocated contiguously and holes develop as old processes dies and new processes are initiated. It also does not allow processes to share code , since a processes virtual memory segment is not broken into non-contiguous fine-grained segments. 
Pure segmentation also suffers from external fragmentation as a segment of a process is laid out contiguously in physical memory and fragmentation would occur as segments of dead processes are replaced by segments of new processes. Segmentation however enables processes to share code for instance two different processes could share a code segment but have distinct data segments.
Pure Paging doesn’t not suffer from external fragmentation, but instead it suffers from internal fragmentation. Processes are allocated in page granularity and if a page is not a completely utilized, it results in internal fragmentation and a corresponding wastage of space. Paging also enables processes to share code at granularity of pages.
Paging requires more memory overhead to maintain the translation structures. Segmentation requires just two registers per segment. One to maintain the base of the segment and the other to maintain the extent of the segment. Paging on the other hand requires one entry per page, and this entry provides the physical address in which page is located.
a. 100 nanoseconds, 50 ns to access the page table and 50ns to access the word in memory.
b. Effective access time = ( 0.75*50ns) + (0.25*100ns)+2=64.5ns


a. Virtual Address to Physical address
·        0xE12C à0x312C
·         0x3A9Dà0xAA9D
·         0xA9D9à0x59D9
·         0x7001à0xF001
·         0xACA1à0x5CA1
Below is the page table updated with reference bit.
Page                                       Page Frame                                      Reference Bit
0                                                          9                                                          0
1                                                          1                                                         0
2                                                          14                                                      0
3                                                          10                                                       1
4                                                          –                                                          0
5                                                          13                                                       0
6                                                          8                                                         0
7                                                          15                                                      1
8                                                          –                                                         0
9                                                          0                                                          0
10                                                       5                                                          1
11                                                       4                                                          0
12                                                       –                                                         0
13                                                       –                                                          0
14                                                       3                                                          1
15                                                       2                                                          0

b. Pages 4,8,12 and 13 result and page fault and their logical address in hexadecimal as follows 0x4… , 0x8… ,0xC… , 0xD…
c. In the above page table which has reference bit 0 those page frames will choose page replacement. They are {9,1,14,13,8,0,4,2}

No comments:

Post a Comment