Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

ZILKIFIL

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

SCHOOL OF APPLIED SCIENCE

DEPARTMENT OF COMPUTER SCIENCE

ASSIGNMENT ON

OPERATING SYSTEM II

BY

ZULKIFIL IBRAHIM

REGISTRATION NUMBER HCOM/2100156

1
Q1; USE a diagram to show SWAPPING ACTIVITY IN AN
OPERATING SYSTEM:

Here's an ASCII art representation of an operating system activity


diagram:
+-------------------+
| |
| Operating |
| System |
| |
| +-------+ |
| | | |
| | Process 1 |
| | | |
| +-------+ |
| |
| +-------+ |
| | | |
| | Process 2 |
| | | |
| +-------+ |
| |
| +-------+ |
| | | |
| | Process 3 |
| | | |
| +-------+ |
| |
+-------------------+

In this simple diagram, the "Operating System" is depicted as a


rectangular box. Inside the box, there are three smaller boxes
representing three processes (Process 1, Process 2, and Process
3) running within the operating system. The lines connecting the

2
processes to the operating system box represent the activity or
communication between the processes and the operating system.
Please note that this is a basic ASCII art representation and may
not accurately capture the complexity and dynamics of actual
activity in an operating system. For more detailed and
comprehensive diagrams, using specialized diagramming tools
would be more appropriate.

2.Memory Management System in UNIX:


UNIX, on the other hand, uses a different approach to memory
management known as the "UNIX file system" where all system
resources, including memory, are represented as files. UNIX treats
memory as a file, and processes read and write to this file to allocate and
deallocate memory. The memory management system in UNIX provides
protection through the file permissions mechanism.
File Permissions: In UNIX, each file has associated permissions that
determine the read, write, and execute permissions for the owner, group,
and others. These permissions are used to control the access to files,
including memory files, and prevent unauthorized access to memory
resources.
In summary, the main difference in memory management and protection
between OS and UNIX lies in the approach they use. OS typically uses
virtual memory, paging, and segmentation techniques to manage memory
and provides protection through access permissions and memory
segmentation. UNIX, on the other hand, treats memory as a file and uses
file permissions to control access to

3
Q3: SIMPLY STATE THE ADVANTAGE OF ANY OTHER
MEMORY MANAGEMENT TECHNIQUE OVER A SINGLE
CONTIGIOUS MEMORY MANAGEMENT USE DIAGRAM TO A
SUPPORT YOUR PRESENTATION.
One advantage of memory management techniques that do not rely on a
single contiguous memory block is the ability to utilize fragmented or
non-contiguous memory space more efficiently. One such technique is
the "Paging" memory management technique, where memory is divided
into fixed-size blocks called "pages," and processes are divided into
smaller fixed-size blocks called "pages" as well. Here's a diagram to
illustrate the advantage of paging over single contiguous memory
management:
_______________________________________
| |
| Process 1 |
| |
|_______________________________________|

Paging Memory Management:


_______________ _______________
_______________
| | | | | |
| Process 1 | | Process 2 | | Process 3 |
| ___________ | | ___________ | | ___________ |
| | Page 1 | | | | Page 1 | | | | Page 1 | |
| |___________| | | |___________| | | |
___________| |
| | Page 2 | | | | Page 2 | | | | Page 2 | |
| |___________| | | |___________| | | |
___________| |
| | ... | | | ... | | | ... | |
| |_____________| | |_____________| | |
_____________| |

4
|
______________________________________________
________|
As you can see, in the single contiguous memory management, the entire
memory space is occupied by Process 1, even if it does not fully utilize
all the memory. However, in the paging memory management, each
process is divided into smaller fixed-size pages, and these pages can be
scattered throughout the memory,
Allowing for more efficient use of memory space. This can help reduce
external fragmentation, as smaller chunks of free memory can be used to
accommodate processes that do not require contiguous memory blocks.
Additionally, paging allows for easy and efficient allocation and
deallocation of memory pages,
making it more flexible and adaptable to varying memory requirements of
different processes.

Q2;
Create a job say job 1 in a memory with 10 partitions having
5kbon the first with an increase of 6k on each of the
remaining partitions to the 10th one if the job has 15kb. use it
to show 1st fit-allocation 2nd show the best fit allocation.
Let's consider a job, Job 1, with a total size of 15 KB, and we
have a memory system with 10 partitions, each with an initial
size of 5 KB, increasing by 6 KB for each subsequent partition
up to the 10th one. We can use this information to
demonstrate both the First Fit and Best Fit allocation
algorithms. Here's how the memory allocation may look like:
Memory Partition Table:
Partition Initial Size Current Size
(KB) (KB)
1 5 0
2 11 0
3 17 0
4 23 0
5 29 0
6 35 0
7 41 0
8 47 0
5
9 53 0
10 59 0

Job 1: Size = 15 KB

C)
First Fit Allocation:
In the First Fit algorithm, the operating system allocates the
first available partition that is large enough to accommodate
the job.
Job 1 (15 KB) is allocated to Partition 2 (11 KB):

A)
Memory Partition Table:

Partition Initial Size Current Size


(KB) (KB)
1 5 0
2 11 15
3 17 15
4 23 0
5 29 0
6 35 0
7 41 0
8 47 0
9 53 0
10 59 0

B)
Best Fit Allocation:
In the Best Fit algorithm, the operating system allocates the
smallest available partition that is large enough to
accommodate the job.
Job 1 (15 KB) is allocated to Partition 3 (17 KB):

6
Memory Partition Table:

Partition Initial Size Current Size


(KB) (KB)
1 5 0
2 11 0
3 17 15
4 23 0
5 29 0
6 35 0
7 41 0
8 47 0
9 53 0
10 59 0
Note: The remaining partitions in both cases are not large
enough to accommodate Job 1, so they remain unallocated.
Please note that the memory allocation process and results
may vary depending on the specific implementation of the First
Fit and Best Fit algorithms in a particular operating system.

You might also like