Sie sind auf Seite 1von 6

Assignment 2 ECX 5235 Operating Systems

W.A.D.K.Gunawardhana 70864878

Q1
a).






Here all jobs memory usage is 2235 kB and available memory space is 2048 kB. If the single-
user contiguous scheme was used to execute the processes here, in this scheme only one process
executed in one time. If the Job1 is processed 700kB memory space allocated to it. According to
the memory management scheme whole 2048 kB memory space allocated to it. So the other
processes cant executed until the Job1 is frees the memory space. Then the Job2 allocated the
whole memory space to process its task. So one job must be waits until the previous job processed
and frees the memory. This is a problem because system efficiency dropped and reduced as a
result of this.
b).

Original State
Partition1
Partition2
Partition3

Best-fit usually makes the best use of memory space





Job No Memory Required(kB)
J1 700
J2 500
J3 740
J4 100
J5 100
J6 70
J7 25
610K
738K
700k
2235 kB
2048 kB
Assignment 2 ECX 5235 Operating Systems

W.A.D.K.Gunawardhana 70864878

In best-fit memory allocation scheme closest fits the smallest partition fitting the requirements. It
keeps the free/busy lists in order by size.

Partition 1
Partition 2
Partition 3






















610K
738K
700k
2048 kB
J2
500k
J1
700K
J3
740k
J4
J5
J6
J7
Assignment 2 ECX 5235 Operating Systems

W.A.D.K.Gunawardhana 70864878

Q2
i)
Page Segment
Purpose of paging is easily
allocating the physical memory.

Used to allocate address space.
Blocks of memory are assigned
differing base addresses.
Defines some object such as a data
area.

ii)
Page Memory Allocation Segment Memory Allocation
In page memory allocation scheme
each incoming job divided into
pages of equal sizes.
In a segment memory allocation
scheme each job is divided into
several segments in different sizes.
Here main memory used more
efficiently because an empty page
frame can be used by any page of
activated jobs, memory allocated
in fixed manner.
Here main memory not efficiently
used because it is not longer divided
into page frames. Size of each
segment is different sizes, memory
allocated in dynamic style
Offers advantage of noncontiguous
storage.
The contents of segments are in
contiguous manner.

iii) Virtual Memory
Windows OS

Unix OS
In Windows Operating Systems
virtual memory combines the
RAM in the computer with
temporary space in the hard disk.
In these operating systems virtual
memory moves data from RAM to
a space called a paging files.
Moving data from to RAM and
from the paging files frees up
RAM up to complete its work. The
virtual memory data are written to
the pagefile.sys in windows
systems.
In Unix OSs virtual memory is
divided up into pages, data packets
(chunks) that are usually either 4096
or 8192 bytes. Memory manager of
the Unix OS consider pages to be
the indivisible unit of the memory
here UNIX system uses a page table
for virtual memory management.
Swap partitions are allocated for
virtual memory.



Assignment 2 ECX 5235 Operating Systems

W.A.D.K.Gunawardhana 70864878

Q3.
i)
Race:-In an OS a synchronization process happened in two processes trying for the same
resource. Here it may be start of a data corruption because the order of the two processes finishing
cannot be controlled. Here Race occurred.

ii) a)






i) Firstcome,First-Served


0 10 12 15 16 21
ii)Shortest Job Next


0 1 3 6 11 21
iii)Shortest Remaining Time


0 1 2 3 4 9 18 19 21


Job No Arrival Time CPU Cycle
1 0 10
2 1 2
3 2 3
4 3 1
5 4 5
1 2 3 4 5
1 2 3 4 5 1 2 3
4 2 3 5 1
Assignment 2 ECX 5235 Operating Systems

W.A.D.K.Gunawardhana 70864878

iv)Round Robin


0 2 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
Q4.
Responsibilities of a file manager
File manager controls every file in the system.
It keeps track of where the files are stored.
Use a policy than can determine where and how file to be stored in the disks, evaluate and
send remainders how available storage space and provide efficient access to the files.
Allocate space to files when user has been cleared for access to it, after record is used
Deallocate space from files when they are returned to the storage.
ii) a)contiguous storage



b) Non-contiguous storage








File No Start End No;extents
1 2 12 3
Free
space

File 1
Record 1


File 1
Record 2

File 1
Record 3

File 1
Record 4

File 2
Record 1

File 2
Record 2

File 2
Record 3

.....

1

2
F1
3
F2
4 5 6
F1
7
F2
8

9
10
F1
11 12
F1
1 2 3 4
Assignment 2 ECX 5235 Operating Systems

W.A.D.K.Gunawardhana 70864878

c) Indexed Storage










File Index block
File 1 4
1 2
F1
3
4 2
7
9
6
5 6
F1
7
F1
8 9
F1

Das könnte Ihnen auch gefallen