05 Laboratory E1
05 Laboratory E1
DATE: 11/13/24
SECTION: BSIT A310 SUBJECT: OS
Objectives:
Instructions: Read the description of the memory configuration and analyze the given diagram. Then, answer the
following questions.
Memory Configuration: A computer implements a dynamic partitioning technique for memory management. A number
of allocation and swapping-out operations have been carried out while the computer is up and running. The diagram
below shows the computer's current memory configuration/allocation. The addresses go from left to right. The gray
areas represent blocks that are occupied by running processes, while the white areas indicate free memory blocks. The
last process that was loaded into the memory is marked with a red X in the diagram, and its size is 2MB. Only one
process was swapped out after that.
Questions
1. If you are to add a new 10MB process in the memory, where could it possibly be added and why? (5
points)
Yes, Virtual memory in this configuration because in the variable partition scheme initially, memory will be a single
continuous free block. Whenever the request by the process arrived according to particular will be made in the memory.
If the smaller process keeps on coming then the larger partition will be made into smaller partitions. To avoid the
problem of external fragmentation the following techniques are used compaction in which moving all the processes
towards the top or towards the bottom to make the free available memory in a single continuous place is called
compaction.
2. What could be the size of the free block just before it was partitioned by X? Rationalize your answer.
(5 points)
Yes, it is possible to add a new 7MB process using the first-fit placement algorithm without swapping out any process.
Because the first fit allocates the process in a partition which is the first sufficient process from left to right. So, the 8MB
while box which is free to placed 7MB.
3. Would you suggest the provisioning of virtual memory in this configuration? Why or why not?
Yes, Virtual memory uses both hardware and software to enable a computer to compensate for physical memory
shortages, temporarily transferring data from random access memory (RAM) to disk storage. Mapping chunks of memory
to disk files enables a computer to treat secondary memory as though it were main memory.
4. Is it possible to add a new 7MB process using the first-fit placement algorithm without swapping out
any process? Why or why not? (5 points)
Yes, it is possible to add a new 7MB process using the first-fit placement algorithm without swapping out any process.
Because the first fit allocates the process in a partition which is the first sufficient process from left to right. So the 8MB
while the box is free to placed 7MB.
5. A new process is requesting a 3MB allocation. Illustrate the possible memory configuration using a
horizontal segmented memory strip (like the diagram above), where a partition will be created for the
new process under the following placement algorithms: best-fit and first-fit. Label your illustration
clearly. (2 items x 5 points)
PART TWO
Virtual memory is a feature in Linux that helps your computer use hard drive space as extra memory. This means that
when your RAM (the memory your computer uses to run programs) gets full, the system can save some of that
information on the hard drive, freeing up space in RAM for other tasks. When the saved information is needed again, the
computer retrieves it from the hard drive.
This process happens automatically, so users don’t need to worry about it. Programs simply see more available memory
and don’t know that some of their data might be on the hard drive temporarily. However, accessing information from
the hard drive is much slower than from RAM—about a thousand times slower—so programs may not run as quickly.
The portion of the hard drive used for this extra memory is called swap space.
Linux can use either a standard file or a separate partition for swap space. A swap partition is faster, but a swap file’s
size can be easily adjusted without needing to repartition the hard drive. If you know how much swap space you need,
go with a swap partition. If you're unsure, start with a swap file, monitor your usage, and switch to a partition later if
necessary. Linux also allows multiple swap disks and files to be used simultaneously. This means you can create
additional swap files for occasional large swap needs instead of allocating a large amount continuously.
Lastly, the terms "swapping" and "paging" are often used in computer science: swapping refers to moving an entire
process to swap space, while paging involves writing fixed-size parts at a time. Though Linux typically uses paging for
efficiency, it still commonly refers to this process as swapping.
Virtual memory management in a Windows® system is generally straightforward but often unnecessary. Windows
automatically adjusts virtual memory based on your needs and installed RAM. For instance, a system with 8GB of RAM
typically defaults to 8GB of virtual memory, expandable up to 16GB if needed.
Some users believe they can forgo virtual memory due to sufficient RAM and attempt to free up disk space by lowering
its allocation. This is especially common among those with expensive SSDs who feel space is being wasted. However, this
can lead to errors or instability when more virtual memory is needed.
Instead of reducing virtual memory, upgrading RAM is a better solution. When a program's performance hinges on
virtual memory availability, having adequate RAM is crucial. RAM speeds far exceed those of virtual memory, so
upgrading your hardware is the most effective way to enhance system performance.
2. Between the operation and management of Linux and Windows virtual memory, which do you think is less
complex and why?
While Windows has established a consistent version structure over time by categorizing its versions and updates into
clear tiers, the variety of Linux distributions can present a unique challenge. This complexity offers users the
opportunity to explore different options and find a distribution that best meets their needs, making it a more engaging
experience compared to simply choosing between versions like Windows 7, 8, or 10.
Were you able to find similarities between Linux and Windows virtual memory?
Operating systems are essential components of all computers, serving users in personal, educational, and governmental
contexts. They function as a link between the end user and the hardware, providing insight into how computers operate.
Memory management is a critical element of an operating system; efficient memory management can enhance overall
system performance.
Understanding how Linux and Windows manage memory is important for recognizing their similarities and differences,
particularly in terms of page-swapping algorithms. This comparison can help users evaluate the objectives of each
operating system and make informed decisions regarding which one may be more suitable for their memory management
needs.
If the system is using virtual memory, applications may execute slower. Switching between applications is likely to take
longer. Allows you to use less hard drive space. It degrades the system's stability.
If you are to design a memory management system, would you incorporate virtual memory into your design? Why or
why not?
Yes, I would include virtual memory in the design of a memory management system since it offers the following
advantages: It can deal with twice as many locations as primary memory. It allows for the immediate use of new
applications. It removes the requirement for clients to add memory modules when RAM becomes constrained, and it
frees programs from maintaining shared memory.