1
Comprehensive Review of Computer Organization and Operating Systems: Assignments
5–8
Arizona State University
Summer 2024
CSE 230 – Computer Organization and Assembly Language Programming
2
Homework 5
2. What are the advantages of using DRAM for main memory?
DRAM has a number of strengths that it possesses that make it the best choice of main
memory in a computer system. It has a high storage density, where a high density of memory
can be packed in a smaller physical space than with SRAM. DRAM is also much cheaper to
manufacture and thus it is economical in terms of supplying system memory in large
quantities. Though the performance of DRAM is slower than that of SRAM, its performance
is not too slow to be utilized as the main memory when it is implemented with the cache
memory to accelerate data retrieval speed. Moreover, the DRAM uses less power per bit
stored and is thus used in the modern computers that demand efficient use of power. It is also
easier to produce in larger capacities that meet the growing needs of the modern computer
systems due to its simple design and scalability.
4. Explain the concept of a memory hierarchy. Why did your authors choose to
represent it as a pyramid?
Memory hierarchy is a hierarchical system of various types of memories in a computer
system organized in terms of speed, cost, and capacity. Top of the list are the most expensive
and fastest memory systems including registers and cache that can store small data sets with
high levels of access. Beneath these are the main memory (DRAM) and the secondary
storage systems such as hard drives and SSDs, which are slower, but have a huge storage
capacity. The hierarchy provides access to the data effectively as the most frequently used
data are stored in the faster levels of memory. The memory hierarchy is also represented as a
3
pyramid by authors because it graphically illustrates the trade-off between the speed, the size,
and the cost the higher you rise the pyramid, the larger the memory and the lower the cost but
access time is slower.
6. What are the three forms of locality?
These three locality include locality in time, locality in space and locality in order. The
accessibility of the same memory locations multiple times in a brief duration of time is
known as temporal locality, e.g. the reuse of a loop variable, or a loop instruction. Spatial
locality is the concept that when memory location is recorded then adjacent memory
locations will soon follow suit as is typical when process arrays or sequential instructions.
Sequential locality is a particular form of spatial locality which happens when data or
instructions are used in a sequential fashion e.g. reading successive lines of code or data
blocks. The three types of locality are crucial in the design of efficient memory systems since
the three types enable the cache and memory hierarchy to make predictions and prefetches on
data that is likely to enhance the system performance.
8. Which of L1 or L2 cache is faster? Which is smaller? Why is it smaller?
The L2 cache is bigger and slower than an L1. It happens to be the closest to the CPU core
and therefore is capable of giving very fast access to the regularly accessed instructions and
data which in turn saves the processor waiting time. There is however, a size limit to L1
cache, due to the very high speed and much more expensive technology used- typically only
a few kilobytes to a few hundred kilobytes. The L2 cache is, however, a little bit slower yet
much larger (measured in megabytes) and acts as a secondary buffer when the CPU misses
4
the data in the L1 cache. L1 is smaller as a larger L1 would drastically reduce its access time
and cost to manufacture meaning it is its aim to offer the fastest access available to essential
data needed by the processor.
10. What are the three fields in a direct mapped cache address? How are they used to
access a word located in cache?
A direct-mapped cache address is further subdivided into three fields including, the tag, the
index, and the block offset. The index field indicates which line of the cache (or block) to
search in enabling the system to find the possible location of the desired data. This tag field is
then compared with the tag held in that cache line to see whether data being requested is
actually being held this process is called a cache hit when the tags match and the thing is
called a cache miss when they do not. Lastly, the block offset gives the precise position of
the target word in the block of the cache. These three areas combine to allow the processor to
efficiently and swiftly locate the data within the cache of stored information and strikes a
balance between speed and hardware simplicity in the direct-mapped cache structure.
12. Explain how fully associative cache is different from direct mapped cache.
A full associative cache is different in the manner of placement in the cache as compared
with a direct-mapped cache. In direct-mapped cache there are only one fixed number of
cache lines per memory block which are selected by the address index bits. This
deterministic mapping renders accessibility however easy and quick but may create a serious
contention when many blocks overlap with a single block. These are contrasted by a fully
associative cache which permits any memory block to be stored in any line of the cache. This
5
flexibility minimizes the misses of conflict largely since data may take any available space.
It, however, presupposes more sophisticated hardware, as all the tags in the cache have to be
searched at the same time to retrieve the match. Although fully associative caches are more
performance, they are costlier and require more time to implement, as the complexity is
incremented with this feature.
14. Direct mapped cache is a special case of set associative cache where the set size is 1.
So fully associative cache is a special case of set associative cache where the set size is _
A set-associative cache with a set size equal to the overall number of cache blocks is known
as fully associative cache. That is, every block is a part of one set and hence any block could
be stored at any location within the cache. This is the removal of the constraint of fixed
placement that exists in direct-mapped or smaller set-associative caches, and provides
maximum block placement flexibility and the least possible conflict misses.
16. Explain the four cache replacement policies presented in this chapter.
There are four popular policies to replace the cache, which are Least Recently Used (LRU),
First-In, First-Out (FIFO), Least Frequently Used (LFU) and Random Replacement. The
LRU policy will eliminate the block that is not accessed since a long time with an assumption
that recently accessed data will be required in the nearest future. FIFO removes the oldest
block in the cache, in the same sequence that the data was loaded onto the cache, and does
not understand how frequently the data was used. LFU finds the block with the least number
of accesses and puts it aside giving preference to data with high frequency of access. As the
name indicates, in Random Replacement a block is randomly selected to be replaced and
6
thereby requires simple hardware design and sometimes works surprisingly well with the
workload. The policies are in balance through complexity, speed and efficiency as related to
the needs of the system.
18. What is the worst-case cache behavior that can develop using LRU and FIFO cache
replacement policies?
Worst-case behavior for both LRU and FIFO is cache thrashing, where nearly every
reference misses. For LRU, the worst case occurs when the program repeatedly touches a
working set slightly larger than the cache (or associativity); each access evicts the block
you’ll need next, so you get a miss on almost every reference. Example: cycling through 4
distinct blocks with a 3-line cache gives a miss for every access. FIFO can also thrash in the
same way, but it has an additional pathology: Belady’s anomaly, increasing the number of
lines can increase misses for some reference patterns. A classic FIFO example (e.g.
1,2,3,4,1,2,5,1,2,3,4,5) shows more misses with 4 lines than with 3, so FIFO can behave
worse than LRU in pathological cases.
20. Explain how to derive an effective access time formula.
The effective access time (EAT) formula measures the average time required to access
memory, considering both cache hits and misses. To derive it, you start with the idea that
some memory accesses are fast (hits) and others are slow (misses). The formula is:
EAT = (Hit rate × Hit time) + (Miss rate × Miss penalty)
7
Here, the hit rate is the percentage of memory accesses found in the cache, and the miss rate
is 1 minus the hit rate. Hit time is the time to access data from the cache, while miss penalty
is the extra time needed to fetch data from the next memory level. This weighted average
reflects overall performance and helps designers evaluate how cache size, speed, and
efficiency affect total memory access time.
22. What is a dirty block?
A dirty block is a cache block that has been modified in the cache but not yet written back to
main memory. It differs from a clean block, which matches the data stored in main memory.
When a dirty block is replaced, the updated data must be written back to memory to ensure
data consistency.
24. What is the difference between a virtual memory address and a physical memory
address? Which is larger? Why?
Virtual memory address refers to the address given by a CPU when running a program,
whereas physical memory address refers to the whereabouts in main memory (RAM).
Address mapping involves the translation of the virtual address into a physical address with
the help of the Memory Management Unit (MMU). The virtual address space is bigger since
it enables programs to consume more memory than those that are physically allocated by
means of consequently increasing memory capacity through secondary storage (such as a
hard drive or SSD).
26. Discuss the pros and cons of paging.
8
Paging has some advantages and disadvantages in memory management. On the positive
side, paging removes the problem of external fragmentation by splitting the memory into
fixed-size blocks called pages, thus making memory usage very efficient. Besides that, it
permits non-contiguous allocation that allows processes to use scattered memory spaces and
hence, makes memory allocation and protection easier. In contrast, paging has a few
disadvantages. For example, it increases overhead because of the management of the page
table and the time for translation. Also, continuous page swapping may degrade performance,
thereby, if the system uses virtual memory heavily, it will be affected by thrashing.
Moreover, there still could be some internal fragmentation in the last page of a process.
Nevertheless, paging is still one of the most powerful methods to compromise between the
issues of flexibility, efficiency, and protection in present-day memory management systems.
28. What causes internal fragmentation?
Internal fragmentation is a situation where the memory blocks that have been allocated are
bigger than the actual amount of data, thus, there is some space left inside those blocks that is
not being used. The reason for such a situation is that memory is most of the time divided
into units of a fixed size, e.g. pages or partitions, and a process hardly fits them exactly.
Consequently, the rest of the unused fragments inside the allocated blocks cannot be given to
other processes, hence, there is an inefficient use of memory.
30. What is a TLB and how does it improve EAT?
A Translation Lookaside Buffer (TLB) is a limited, fast-storage unit that is a part of the
CPU’s memory management unit (MMU) and is designed to keep the most recent virtual-to-
9
physical address translations. On a memory access by the CPU, a TLB search is done for the
address mapping; if it is located (a TLB hit), the translation is immediate thus the page table
in the main memory which is slower is not accessed. What the TLB does is that it cuts down
on the number of times memory must be accessed for address translation and thus the
Effective Access Time (EAT) is greatly lowered which is a big factor for the overall system
performance to be increased.
32. When would a system ever need to page its page table?
A system must do this if it needs to page its page table in the case when the page table is so
large that it cannot fit wholly in main memory. The case is in systems with large virtual
address spaces or when many processes are running simultaneously, each of which requires
its own page table. When the page table is paged, the operating system can keep the
fragments of it on the secondary storage (such as a hard disk or SSD) and can take the
necessary parts into the memory from time to time, thus allowing the memory to be used
efficiently even in large or heavily multitasked environments.
E2. Suppose a computer using direct mapped cache has 2^32 words of main memory and a
cache of 1024 blocks, where each cache block contains 32 words.
a) How many blocks of main memory are there?
Number of main-memory blocks = (2^32 words) / (2^5 words per block) = 2^(32-5) = 2^27
blocks.
Answer (a): 2^27 main-memory blocks.
b) What is the format of a memory address as seen by the cache?
10
Given:
• Block size = 32 words = 2^5 ⇒ Word (offset) field = 5 bits
• Cache has 1024 blocks = 2^10 ⇒ Index (block) field = 10 bits
• Total address = 32 bits
Tag = 32 - (10 + 5) = 17 bits
Answer (b): Tag = 17 bits, Block (index) = 10 bits, Word (offset) = 5 bits.
Address format: [17-bit Tag | 10-bit Index | 5-bit Offset].
c) To which cache block will the memory reference 000063FA₁₆ map?
Given address: 000063FA₁₆ = 0x63FA = 25594₁₀
Remove offset (5 bits): shift right by 5 → (0x63FA >> 5)
Take next 10 bits for index: (0x63FA >> 5) & (2^10 - 1)
Result: Index = 799₁₀ = 0x31F₁₆
The address 000063FA₁₆ maps to cache block 799 (hex 0x31F).
E4. Suppose a computer using fully associative cache has 2^24 words of main memory and
a cache of 128 blocks, where each cache block contains 64 words.
Given / Useful facts
Main memory size (word-addressable) = 2^24 words → address length = 24 bits.
Block size = 64 words = 2^6 words → word (offset) field = 6 bits.
11
Cache has 128 blocks = 2^7 entries.
Cache is fully associative (no index field).
(a) Number of main-memory blocks
Number of blocks = (total words) / (words per block)
= 2^24 / 2^6 = 2^18 = 262,144 blocks.
(b) Address format (sizes of tag and word fields)
1. Word (offset) field = log₂(64) = 6 bits.
2. Total address bits = 24, so tag bits = 24 - 6 = 18 bits.
3. There is no index field for fully associative cache.
Thus, the address format is: [Tag: 18 bits] [Word/Offset: 6 bits].
(c) Mapping for memory reference 01DB72₁₆
1. Convert the 24-bit address to binary (pad to 24 bits): 01DB72₁₆ =
000000011101100001110010.
2. Split into tag (top 18 bits) and offset (bottom 6 bits):
- Tag (18 bits) = 000000011101100001 → decimal = 1889 (hex 0x761).
- Offset (6 bits) = 110010 → decimal = 50.
3. Memory block number = address >> 6 = 1889. Word-within-block = 50.
4. Since the cache is fully associative, this memory block can be placed in any of the 128 cache
blocks.
12
The cache stores the tag = 18-bit value (1889) along with the data for block 1889.
Summary for 01DB72₁₆
1. Memory block number = 1889.
2. Word offset within the block = 50.
3. Tag (stored in cache entry) = 18 bits = binary 000000011101100001 (decimal 1889).
4. It may occupy any of the 128 cache blocks (fully associative).
6. A 2-way set associative cache consists of four sets. Main memory contains 2^K blocks of
eight words each.
a) Show the main memory address format that allows us to map addresses from main
memory to cache. Be sure to include the fields as well as their sizes.
In this system, the main memory contains 2^K blocks, and each block holds eight words, which
equals 2^3 words. Therefore, three bits are needed to specify the word (or offset) within a block.
Since the cache is 2-way set associative and has four sets, there are 2^2 sets in total, meaning
two bits are needed to identify the set index. The total number of block bits in memory is K, so
the tag field will consist of the remaining (K - 2) bits. Consequently, the full memory address,
from the most significant to the least significant bits, consists of the tag field (K − 2 bits), the set
index field (2 bits), and the word or offset field (3 bits). The total address size is therefore (K +
3) bits.
b) Compute the hit ratio for a program that loops 3 times from locations 8 to 51 in main
memory. You may leave the hit ratio in terms of a fraction.
13
The program accesses word locations from 8 to 51, which gives a total of (51 - 8 + 1) = 44
memory references in each loop. Since the program loops three times, there are a total of 44 × 3
= 132 memory accesses. Each cache block contains eight words, so the corresponding block
numbers accessed range from 8 ÷ 8 = 1 to 51 ÷ 8 = 6, meaning that blocks 1 through 6 are
involved in the program’s execution. Because the cache is 2-way set associative with four sets,
each set can hold two blocks, allowing six different blocks to be distributed across the four sets.
During the first iteration, the cache will experience compulsory misses when each of the six
blocks is first brought in. Once all required blocks are loaded into the cache, the subsequent two
loops will result in cache hits for all accesses, since those blocks will already reside in the cache.
Therefore, the total number of misses will be 6 (all occurring during the first iteration), while the
total number of memory accesses is 132.
The hit ratio can thus be expressed as:
Hit Ratio = (Total References − Misses) / Total References = (132 − 6) / 132 = 126 / 132 = 21 /
22.
Hence, the hit ratio for the program is 21/22.
14
Homework 6
1. State Amdahl’s Law in your own words.
The Law of Amdahl claims that the maximum speed that can be increased in a system by
increasing a single component is bounded by the fraction of time that that one component is
utilised. It finds that raising the quality of a small portion of a process produces decreasing
marginal benefits, and it is critical to improve optimization by attending to activities with the
longest time durations.
2. What is speedup?
Speedup is a measure of how much faster a system performs when enhanced. It is defined as the
ratio of the time taken to complete a task on the original system to the time taken on the
improved system. Mathematically, it is expressed as: Speedup = Execution time (old) /
Execution time (new). A higher speedup value indicates greater performance improvement,
though in practice, speedup is often limited by the parts of the system that cannot be optimized.
3. What is a protocol, and why is it significant in I/O bus technology?
A protocol is a collection of rules and standards that determine the manner in which data is sent
and received between the devices of a computer system. Protocols are therefore an important
aspect in I/O bus technology since they guarantee effective interaction, coordination and
information security between various hardware devices enabling devices of different
manufacturers to communicate and interact effectively.
4. Name three types of durable storage.
15
Three types of durable storage are magnetic disks, optical discs, and solid-state drives (SSDs).
Magnetic disks store data using magnetic patterns and are reliable for long-term use. Optical
discs use laser technology for reading and writing. Solid-state drives use flash memory, offering
faster access speeds, lower power consumption, and no moving parts, enhancing durability and
reliability.
5. Describe how programmed I/O differs from interrupt-driven I/O.
Programmed I/O makes the CPU monitor the state of an I/O device continuously to decide when
the device is ready to receive data, which may be a waste of processing time. Conversely,
interrupt-driven I/O gives the device the capacity to signal the CPU when it is available, to
enable the processor to execute other activities effectively.
6. What is polling?
Polling is a method in which the CPU repeatedly checks the status of an I/O device to determine
whether it is ready for data transfer. While it provides simple control over devices, it can be
inefficient because the CPU wastes time continuously checking the device instead of performing
other tasks. Polling is best suited for systems with few devices or when real-time response is not
critical.
7. In what way are address vectors utilized in interrupt-driven I/O?
In interrupt-driven I/O address vectors are employed to determine what service routine is
required to deal with a given interrupt. Upon an interrupt being received, the address vector is
used by the system to find the appropriate interrupt service routine and execute it in order to
make sure that the request of every device is met in as short time as possible and in the most
appropriate manner.
16
8. How does direct memory access (DMA) work?
Direct Memory Access (DMA) allows data to be transferred directly between memory and an
I/O device without continuous CPU involvement. The CPU initiates the transfer by instructing
the DMA controller, which then manages the data exchange. Once the transfer is complete, the
DMA controller notifies the CPU through an interrupt. This process improves system efficiency
by freeing the CPU for other operations.
9. Define a bus master.
A computer bus master is a hardware component or device that controls the system bus and is
able to make data transfers without involvement of the CPU. It handles inter-machine
communication enabling devices to communicate directly in a manner like between memory and
peripherals. This enhances performance since it decreases the use of CPU in data transfer
operations.
10. Why does DMA require cycle stealing?
DMA requires cycle stealing because it temporarily takes control of the system bus from the
CPU to perform data transfers between memory and I/O devices. During this time, the CPU must
wait for bus access, effectively “stealing” one or more cycles from it. Although this causes brief
interruptions, the overall system performance improves since the CPU is relieved from managing
data transfers directly.
11. What does it mean when I/O is described as “bursty”?
When I/O is described as “bursty,” it means that data transfers occur in short, intense bursts of
activity followed by periods of little or no transfer. Instead of a constant flow, the input and
17
output operations happen irregularly, often depending on when the device or system has data
ready to send or receive.
12. What does it mean when someone refers to I/O as bursty?
When I/O is referred to as bursty, it means that data transfers occur in short, concentrated bursts
rather than at a constant rate. This happens because devices often gather or process data in
chunks before transmitting it. Bursty I/O patterns can cause irregular workloads, requiring
systems to have buffers and scheduling mechanisms to manage these high-activity periods
efficiently.
13. In what ways is channel I/O similar to DMA?
Channel I/O is similar to Direct Memory Access (DMA) because both methods allow data to be
transferred between memory and peripheral devices without constant CPU involvement. In both
cases, the CPU initiates the operation, but the actual data transfer is handled independently,
improving system efficiency and freeing the processor for other tasks.
14. What is multiplexing?
Multiplexing is the technique of transmitting multiple signals over a single communication
channel or bus to improve efficiency. It allows different data streams to share the same physical
medium without interference. There are various types of multiplexing, such as time-division,
frequency-division, and wavelength-division multiplexing, each suited for different applications
in computer networks and I/O systems.
15. What are the main differences between an asynchronous bus and a synchronous bus?
18
The main difference between an asynchronous bus and a synchronous bus lies in how they
manage timing. A synchronous bus uses a common clock signal to coordinate data transfers,
making communication faster but less flexible. An asynchronous bus, however, transfers data
using handshaking signals instead of a shared clock, allowing devices of different speeds to
communicate reliably.
16. What is settle time, and what can be done about it?
Settle time refers to the delay required for a system, such as a disk drive’s read/write head, to
stabilize over the correct position before reading or writing data. Excessive settle time can slow
performance. To reduce it, manufacturers use better head-positioning mechanisms, faster
actuators, and optimized control algorithms that allow quicker and more accurate head
placement.
17. Why are magnetic disks referred to as direct access devices?
Magnetic disks are called direct access devices because the read/write head can move directly to
the location of the required data instead of reading sequentially from the beginning. This allows
the system to quickly access any specific block of data on the disk, making it much faster than
sequential storage devices like magnetic tapes.
18. Explain the relationship among disk platters, tracks, sectors, and clusters.
A magnetic disk consists of circular platters coated with magnetic material. Each platter surface
contains concentric circles called tracks, which are divided into smaller units called sectors, each
storing a fixed amount of data. The operating system groups one or more sectors into clusters,
which serve as the smallest unit of storage for file management. This hierarchy organizes data for
efficient reading and writing.
19
19. Explain how disk platters, tracks, sectors, and clusters are related.
Magnificent disk Magnetic disk is a type of magnetic data storage on one or more circular disk
platters coated with a magnetic substance. The platter is further divided into lots of concentric
circles (called tracks) that systemize the data available in the platter. These tracks are again
broken into smaller units known as sectors where each of the sectors holds a set data, whose
average data is 512 bytes or more. In order to manage storage better and efficiently, the operating
systems cluster together a number of sectors and create clusters which are the smallest
addressable unit of file storage. The connection between platters, tracks, sectors and clusters
guarantees effective data structuring and retrieval.
20. What are the major physical components of a rigid disk drive?
The major components of a rigid disk drive include platters, spindle, read/write heads, actuator
arm, and controller electronics. The platters store data magnetically, while the spindle rotates
them at high speed. The read/write heads, mounted on the actuator arm, move across the platters
to access data. The controller electronics manage communication between the drive and the
computer system.
21. Define seek time.
Seek time is the amount of time it takes for a disk drive’s read/write head to move to the track
where the required data is located. It is one of the main factors affecting disk access speed.
Shorter seek times result in faster data retrieval and improved overall system performance.
22. What is the sum of rotational delay and seek time called?
20
The sum of rotational delay and seek time is known as access time. Seek time measures how
long it takes for the disk’s read/write head to move to the correct track, while rotational delay is
the time needed for the desired sector to rotate under the head. Access time therefore represents
the total delay before data transfer begins and is a key factor in disk performance.
23. What is a file allocation table (FAT), and where is it located on a floppy disk?
A File Allocation Table (FAT) is a data structure used by the operating system to keep track of
where files are stored on a disk. It records which clusters belong to each file and identifies
unused or damaged areas. On a floppy disk, the FAT is located near the beginning of the disk,
right after the boot sector, and is usually stored in duplicate for reliability.
24. By what order of magnitude does a rigid disk rotate more than a flexible disk?
A rigid disk (hard drive) typically rotates at speeds between 4,000 and 15,000 RPM, while a
flexible disk (floppy disk) rotates at around 300 RPM. This means a rigid disk spins about one
order of magnitude faster—approximately 10 to 50 times more. The higher rotational speed
allows hard drives to access and transfer data much faster than floppy disks.
25. What term is used to describe robotic optical disk library devices?
Robotic optical disk library devices are commonly referred to as jukeboxes. These systems use
robotic mechanisms to automatically load and unload optical disks, such as CDs, DVDs, or Blu-
ray discs, into drives as needed. Jukeboxes are typically used in environments requiring large-
scale data storage, backup, and archival with automated retrieval.
EXERCISES
21
E1. Your friend has just bought a new personal computer. She tells you that her new
system runs at 1GHz, which makes it over three times faster than her old 300MHz system.
What would you tell her?
I would explain to her that although the new computer’s clock speed of 1GHz is more than three
times higher than her old 300MHz system, this does not necessarily mean it will perform three
times faster. The actual speed of a computer depends on many additional factors besides clock
frequency. These include the processor’s architecture, the number of instructions it can execute
per cycle, cache size, memory speed, bus bandwidth, and the efficiency of the operating system
and software. A newer processor may also have improved design and instruction handling, which
contribute more to performance than just clock speed alone.
E11. Why do you think the term random access device is something of a misnomer for disk
drives?
The term random access device is somewhat misleading when applied to disk drives because,
unlike true random access memory (RAM), disk drives cannot access data instantly. To read or
write data, the disk’s read/write head must physically move to the correct track and wait for the
desired sector to rotate under it. This mechanical movement introduces seek time and rotational
delay, making access times much slower and dependent on data location. Therefore, while disk
drives allow access to any block of data without reading sequentially, the access is not truly
“random” in speed or uniformity due to the physical limitations of the device.
12. Why do differing systems place disk directories in different track locations on the disk?
What are the advantages of using each location that you cited?
22
Different systems place disk directories in various track locations to optimize performance and
reliability based on design priorities. Some systems store directories near the beginning of the
disk to reduce seek time for frequently accessed files, since the outer tracks offer higher data
transfer rates. Others place directories near the middle of the disk to minimize average seek time
when accessing files spread across the entire surface. A few systems even duplicate directories in
multiple locations to enhance fault tolerance and data recovery. Each placement strategy
balances speed, accessibility, and reliability depending on how the system manages file
operations and overall disk usage patterns.
13. Verify the average latency rate cited in the disk specification of Figure 7.11. Why is the
calculation divided by 2?
The disk in Figure 7.11 has a rotational speed of 4,464 revolutions per minute (RPM). To find
the average latency, we first calculate the time for one full revolution:
Time per revolution = 60 seconds / 4,464 revolutions = 0.01344 seconds = 13.44 milliseconds.
Since, on average, the disk head will wait for half a revolution to reach the desired sector, the
average latency is:
Average latency = 13.44 / 2 = 6.72 milliseconds.
The calculation is divided by 2 because, statistically, the desired data will be halfway around the
disk on average. This matches the 6.72 ms value shown in the specification table.
14. By inspection of the disk specification in Figure 7.11, what can you say about whether
the disk drive uses zoned-bit recording?
By examining the disk specification in Figure 7.11, it appears that the disk drive does not use
zoned-bit recording. The specification lists a single value for “Sectors per Track” as 132, which
23
suggests that every track on the disk contains the same number of sectors. In a zoned-bit
recording system, the number of sectors per track would vary, outer tracks would contain more
sectors than inner tracks to make efficient use of the disk’s surface area. Since only one uniform
value is provided, it indicates that this disk uses constant angular velocity (CAV) recording
rather than zoned-bit recording (ZBR).
24
Homework 7
26. What is the acronym for computer output that is written directly to optical media
rather than paper or microfiche?
Computer output to Laser Disc is the acronym COLD, meaning computer output direct to optical
media. COLD systems save vast amounts of data, e.g. reports or documents, on optical discs
rather than printing on paper. The approach offers rapid retrieval, long term storage and less cost
in physical storage of information and does not compromise the readability or integrity of
archived information.
27. Magnetic disks store bytes by changing the polarity of a magnetic medium. How do
optical disks store bytes?
Optical disks store bytes using patterns of pits and lands on their reflective surface. A laser beam
reads these patterns, pits scatter light while lands reflect it, to represent binary data (0s and 1s).
Unlike magnetic storage, optical media use light rather than magnetism, making them resistant to
electromagnetic interference and suitable for long-term data preservation.
28. How is the format of a CD that stores music different from the format of a CD that
stores data? How are the formats alike?
A music CD (CD-DA) and a data CD (CD-ROM) differ in how information and error correction
are handled. CD-DA uses a format optimized for continuous audio playback with minimal
interruption, while CD-ROM includes stronger error detection and correction to ensure accurate
data retrieval. Both formats, however, use the same physical structure of pits and lands and
similar optical technology for reading and writing data.
29. Why are CDs especially useful for long-term data storage?
The CDs are useful in long term storage of data since they are resistant to magnetic fields,
environmental conditions and data corruption that are experienced with other media. They have
the advantage of their optical reading mechanism; hence, little wear is experienced as no
physical contact is made between the disc and the laser. Also, CDs are durable with the ability to
provide data integrity of decades, thus making them appropriate in storing valuable files.
30. Do CDs that store data use recording sessions?
Indeed, data CDs have the ability to utilize recording sessions, which makes it possible for users
to add information step by step in several sessions instead of doing it all at once. Each session
contains its own directory structure, thus permitting the CD to be updated at any time. This
capability, referred to as multi-session recording, is quite handy for backups as well as for that
portion of the data which is saved incrementally and stored on writable CDs like CD-Rs.
31. How do DVDs store so much more data than regular CDs?
25
DVDs hold more data that CDs mostly due to higher data density. They employ a laser with a
shorter wavelength, which enables smaller pits and more closely spaced tracks. In fact, DVDs
may also have several layers on each side of the disc, thus drastically increasing the capacity.
Besides that, DVDs use advanced encoding techniques and more efficient error correction that
when combined, allow for a much larger storage volume in the same physical size.
32. Name the three methods for recording WORM disks.
The three main methods for recording Write Once, Read Many (WORM) disks are burning pits
using a laser, phase-change recording, and magneto-optical recording. In the first, a laser
permanently alters the reflective surface to encode data. In phase-change recording, heat changes
material states to represent bits. Magneto-optical recording combines heat and magnetic fields to
store information that can be read optically but not erased.
33. Why is magnetic tape a popular storage medium?
Magnetic tape remains a popular storage medium due to its high capacity, low cost per bit, and
durability for long-term archival storage. It is ideal for backups and data archives where
sequential access is acceptable. Modern tape technologies, such as LTO (Linear Tape-Open),
offer fast transfer rates and improved reliability, making tape storage a cost-effective solution for
enterprises managing large datasets.
34. Explain how serpentine recording differs from helical scan recording.
In serpentine recording, data is written in linear tracks along the length of the tape; when the end
is reached, the tape head reverses direction to write on adjacent tracks. Helical scan recording,
used in video and some data tapes, writes data diagonally using a rotating head. While helical
scan achieves higher data density, serpentine recording provides greater reliability and simpler
mechanical design.
35. What are two popular tape formats that use serpentine recording?
DLT (Digital Linear Tape) and LTO (Linear Tape-Open) are two well-known tape technologies
that employ serpentine recording to operate. Essentially, both devices inscribe information in
simple, parallel lines on the optical surface and change the direction of the read/write head at the
end the track. These formats are popular in enterprise scenarios due to the fact that they provide
large storage volume, high data rates and durable storage over time.
36. Which RAID levels offer the best performance?
RAID 0 and RAID 10 provide the best performance among RAID levels. RAID 0 stripes data
across multiple disks, significantly increasing read and write speeds but offering no redundancy.
RAID 10 combines mirroring and striping, providing both high performance and data protection.
However, RAID 10 requires more disks and is more expensive than RAID 0.
37. Which RAID levels offer the best economy while providing adequate redundancy?
RAID 5 offers the best balance between cost, performance, and redundancy. It stripes data and
parity information across all disks, allowing recovery from the failure of one drive without losing
26
data. RAID 5 provides efficient disk utilization since only one disk’s worth of space is used for
parity, making it a cost-effective solution for many business applications.
38. Which RAID level uses a mirror (shadow) set?
RAID 1 uses a mirror set, in which data is duplicated on two or more disks. Every write
operation is performed on both drives, ensuring that if one disk fails, an exact copy of the data is
available on the other. This provides excellent fault tolerance but doubles storage requirements,
as only half of the total disk space is usable.
39. What are hybrid RAID systems?
Hybrid RAID systems combine features of two or more RAID levels to enhance performance,
redundancy, or capacity. Common examples include RAID 10 (a combination of RAID 1 and
RAID 0) and RAID 50 (RAID 5 plus RAID 0). These systems leverage striping for speed and
mirroring or parity for fault tolerance, offering improved overall performance and data
protection.
27
Homwork 8
1. What was the main objective of early operating systems as compared to the goals of today’s
systems?
Early operating systems were mainly designed to manage hardware in an efficient manner and to
automate basic tasks such as job sequencing, input/output operations, and resource allocation
with the aim of maximizing hardware utilization. Such systems revolved around the idea of
increasing the computational speed and cutting down the time during which the machine would
be idle in a batch processing environment. Nowadays, operating systems have developed their
functionalities to focus more on factors like user-friendliness, multitasking, security, and
networking as well as distributed computing support.
Contemporary systems strive to deliver an interactive, smooth, and user-friendly experience
while handling complex hardware and software interactions. They focus on attributes such as
reliability, scalability, and real-time responsiveness in order to be able to serve a wide range of
applications which, in turn, include personal computing, large-scale enterprise, and cloud
environments and, thus, demonstrate the transition from efficiency to usability and connectivity.
2. What improvements to computer operations were brought about by resident monitors?
Resident monitors made a major impact on how computers operated by automating and
simplifying program execution, which was a manual task. In a manual operation, the operators
had to load each program, input data, and start execution, which was very time-consuming and
error-prone. Resident monitors came up with the concept of control programs permanently
residing in memory to automatically handle job sequencing. They did work like loading
programs, changing jobs, and handling input/output operations, thus it was a big time and human
28
help saving. This automation resulted in better CPU utilization as the system could switch from
one job to another without long waiting times. Resident monitors paved the way for more
complex operating systems by bringing in some of the concepts like job control languages,
buffering, and scheduling. These improvements were a major milestone in the direction of
efficient, reliable, and user-independent computing that made multiprogramming and interactive
operating systems of later generations possible.
3. With regard to printer output, how was the word spool derived?
The term "spool" comes from "Simultaneous Peripheral Operations On-Line." It was an idea that
came about in the times of the first computers when printers and other peripherals were very
slow compared to the central processing unit (CPU). If there were no spooling, the CPU would
still be able to wait among other things while a printer does its work, which leads to a waste of
the system resources. The concept of spooling was introduced as a solution to this problem. In
this operation, data going to output devices like printers is temporarily stored in a place - usually
on a disk - where it can be queued and handled without the need of the CPU. Once saved, the
data is fetched and printed at the peripheral's speed while the CPU can still work on other tasks.
This tool allowed overlapping of input, processing, and output operations, thus it was the most
efficient way of using the system. Spooling was one of the first ways of multiprogramming
coming from the past and it is still a basis for modern operating systems in handling print jobs
and other buffered I/O operations.
4. Describe how multiprogramming systems differ from timesharing systems.
Both multiprogramming and timesharing systems are intended to enhance the use of computer
resources, but their differences are quite substantial in terms of objective, architecture, and user
29
interaction. A multiprogramming system is a typical example of how to raise the efficiency of
the Central Processing Unit by ensuring that several programs can be kept in the main storage at
the same time. The OS selects one program to run while others are at the stage of I/O. When one
program is waiting for I/O, the CPU is changed to another one so that there is as little
consumable time as possible and the process goes continuously. Directly in multiprogramming
environments, users are usually not given access to the system during the run of their programs.
On the other hand, timesharing systems take the concept of multiprogramming further by
allowing many users to interact with the computer at the same time. The CPU's time is
segmented into very short intervals or "time slices," and every user or process is assigned a brief
period of computing time one after another in a very quick manner. As a result, the idea is
generated that each user is the sole possessor of the computer. The primary features of
timesharing are interactivity, low delay, and fairness thus real-time communication between
users, and the system is possible. Whereas in multiprogramming the main focus is on achieving
the maximum utilization of the CPU, timesharing just turns that attention to the efficiency of the
user interaction and response time, thus it is perfect for present multiuser environments like
servers, terminals, and interactive computing platforms.
5. What is the most critical factor in the operation of hard real-time systems?
Perhaps the most important aspect in the functioning of hard real-time systems is the capability
of the system to time its operations accurately and to less than a percent of the time in the case of
chance. It is a situation where it is required that tasks be achieved within a time frame which is
fixed beforehand; just a little delay can cause very severe consequences, for example in instances
of medical instruments, air traffic control, or industrial automation. Hence, the emphasis has
been laid on predictability and determinism rather than putting the system to work at higher
30
speeds of processing. The operating system thus must make it possible that the most urgent tasks
are carried out without delay, and resource allocation, scheduling, and interrupt handling are
tightly managed. Real-time schedulers are generally employing scheduling algorithms such as
Rate Monotonic or Earliest Deadline First to perform task execution timely. To safeguard the
continuation of a safe and sound operation, system stability and reliability, along with low
latency, and steady response time, are critical since any deadline missed can lead to the
breakdown of the whole system and consequently be fatal.
6. Multiprocessor systems can be classified by the way in which they communicate. How are
they classified in this chapter?
The chapter describes different types of multiprocessor systems. These systems can be either
tightly or loosely coupled systems based on how their processors communicate and share data
during operation. Tightly coupled systems mean that several processors share the same main
memory and one operating system controls the whole system. The processors can access the
shared memory directly so they can exchange data quickly and perform tasks in a coordinated
manner. Load balancing becomes easier, inter-process communication becomes faster, and
control through a single central unit becomes possible with this kind of architecture. That is why
these systems are the ones that scientific computations, large-scale simulations, or other
applications requiring high-speed processing and close synchronization use.
On the other hand, a loosely coupled system, which is also known as a distributed system, is a
collection of independent processors or computers connected by communication links like
networks. Each processor has its own local memory, and they all function under different
operating systems. Coordination is obtained through message passing, not by shared memory.
Such systems become more flexible and scalable because of this structure. Individual nodes can
31
work independently or they can cooperate. Loosely coupled systems find their use in places
where tasks can be easily split and assigned to different machines. Thus, data centers, clusters, or
cloud computing infrastructures are some examples of environments where these systems are
implemented.
The chapter elaborates that the main difference between these two groups of systems is their way
of communication and degree of integration. Tightly coupled systems have centralized control
and high-speed interconnectivity which make the parallel processing with low latency possible.
On the contrary, loosely coupled systems are characterized by modularity, fault tolerance, and
scalability features. They also suffer from slower communication since there is a network
overhead. Each architecture has its own advantages and disadvantages, and thus which one will
be selected depends on the performance, cost, system complexity, and other criteria of the
application. This classification is the basis for the understanding of today's multi-core processors
and distributed computing environments.
7. How is a distributed operating system different from a networked operating system?
A distributed operating system (DOS) is different from a networked operating system (NOS) in
the sense that it provides a higher degree of integration and transparency to users and
applications. A network operating system connects individual computers through a network, but
each machine still has its own operating system and resources. Users need to log into specific
machines and manually access remote files or resources. The resources of the system are
separate and the network is used as a means of communication between them, hence they are
visible and managed separately.
32
On the other hand, a distributed operating system organizes a set of linked computers as one
single system. It does not reveal the fact that the resources are distributed in different places but
creates the illusion of one machine for users. The DOS deals with communication, resource
sharing, and load balancing among all nodes without the user having to intervene. Users are
ignorant of the location of programs or data since the system is transparent in access and
management. Such a high level of integration is instrumental in improving efficiency, fault
tolerance, and scalability, as the execution of tasks can be split across multiple processors.
Hence, while a networked operating system is concerned with establishing connections, a
distributed operating system ensures uninterrupted cooperation, resource transparency, and
centralized control in the dispersed environment.
8. What is meant by transparency?
Transparency in computing means that a distributed system can show its resources and
operations as one single entity, without revealing the hardware and network details. Users and
applications can interact with files, processes, or devices in a straightforward manner, without
requiring them to be aware of the physical location or management.
9. Describe the two divergent philosophies concerning operating system kernel design.
The two different views of an operating system kernel are monolithic kernel and microkernel. A
monolithic kernel is one in which all the basic operating system services such as process
management, memory management, device drivers, and file systems are run in kernel mode as
one single large program. This architecture enables very fast communication between the system
components because the calls are done directly, hence, the system performs at a very high level.
33
Nonetheless, it also elevates the system to be very complex and exposes it to be highly
vulnerable; any other error in one of the modules can lead to a total system crash.
On the other hand, a microkernel attempts to reduce the tasks of the kernel by only including
those that are absolutely necessary such as interprocess communication and basic scheduling.
Other services like device drivers, file systems, and networking are user-level processes. Such a
division helps to improve the overall stability, adaptability, and safety of the system as faults in
one service will not affect the whole system. Although micro-kernels may have a slight
performance drop, they provide better modularity and easier maintenance.
10. What are the benefits and drawbacks to a GUI operating system interface?
A Graphical User Interface (GUI) operating system is packed with a multitude of benefits that
have propelled it to a modern computing standard; nevertheless, it has a few drawbacks as well.
Ease of use is one of the major strengths of GUI. GUI, by its very nature, is based on such visual
elements as icons, windows, buttons, and menus, and it thus enables users to communicate with
the system in an intuitive way, not requiring them to memorize complex command lines.
Consequently, users with a little or no background knowledge of the system and those coming
from non-technical fields are the most appropriate audience for a GUI. Moreover, GUIs allow
users to increase their output by giving them the opportunity to perform several tasks
simultaneously. i.e., users can open, move, and manage several applications at a time. Since GUI
is a visual medium, it also becomes very easy to learn, follow, and do the work very quickly,
thus cutting the training time and creating a friendly user environment.
On the contrary, GUIs are associated with some disadvantages when compared to command-line
or text-based interfaces. Their dependency on elaborate graphics and multiple background
34
processes results in GUI systems being the major users of computer resources such as memory,
processing power, and storage. Consequently, they are not the right choice for situations where
utmost efficiency is required or for gadgets with hardware of low capacity. Furthermore, while
GUIs make it easy to perform daily tasks, they usually have a lesser degree of user control and
flexibility. In fact, advanced users might encounter limitations in the sense that intricate settings
and system functionalities may be concealed or via graphical tools inaccessible. Additionally, the
speed at which repetitive or batch operations are done in GUIs is low when compared with
command-line interfaces, which can be automated through scripting.
To sum up, GUI operating systems have changed the face of computing by making technology
more user-friendly, interactive, and visually appealing. The use of these systems is highly
recommended in personal computing, education, and business environments where great
importance is attached to usability. Nevertheless, their heavy demand for resources, the limited
control for expert users, and the slower performance in certain tasks serve as pointers that, while
GUIs facilitate user experience, they do so at the expense of efficiency and simplification of the
system.
11. How is long-term process scheduling different from short-term process scheduling?
Long-term and short-term process scheduling mainly differ in their intent, frequency, and effect
on a system's performance. Long-term scheduling or job scheduling is the process that figures
out which programs get the green light to be run in the system. It regulates multiprogramming
level - how many processes can be in memory at the same time - by picking jobs from the job
pool kept on secondary storage and getting them ready in the main memory. Such scheduling is
rare and only concentrates on mixing I/O-bound and CPU-bound processes to achieve the best
system throughput.
35
On the other hand, short-term scheduling or CPU scheduling is a much more frequent operation
that selects the next process to be executed from the ready queue in memory. The primary
objective here is to keep the CPU busy and to provide very short waiting times especially in
interactive systems. Whereas long-term scheduling is about load and overall system performance
management, short-term scheduling is about immediate CPU allocation ventilating which tasks
get executed next.
12. What is meant by preemptive scheduling?
Preemptive scheduling is a CPU scheduling strategy addressed by an operating system when it
decides to take away a running process from the CPU forcibly and grant the CPU to another
process. The philosophy behind this method is that the CPU should be given to the process with
the highest priority or the shortest calculation time thus ensuring both fast interaction with the
user and system performance. The process in execution can be interrupted in preemptive
scheduling if there is a higher priority process in the queue or if the time given to the running
process has expired.
This scheduling method is still very important in multitasking and real-time systems found in
modern computers which are very sensitive to user actions and time. Preemptive scheduling
algorithms are such as Round Robin, Shortest Remaining Time First (SRTF), and Priority
Scheduling with a preemption feature. The leading edge of preemptive scheduling is that the
CPU can be used efficiently and the system can be responsive. The problem is that there is some
overhead caused by very frequent context switching which is a process of saving the state of the
interrupted process and loading the state of the new one. Being aware of this disadvantage, still,
preemptive scheduling is implemented in modern operating systems like Windows, Linux, and
macOS.
36
13. Which method of process scheduling is most useful in a timesharing environment?
Round Robin (RR) scheduling is generally regarded as the most efficient and popular method to
be implemented in a time-sharing environment. This kind of scheduling is aimed at preserving
fairness and promptness when multiple processes compete to be given CPU time in a
multitasking system. In the Round Robin scheduling, each process in the ready queue receives a
fixed time slice during which it is allowed to execute. When a process’s time slice comes to an
end, the process is forcibly removed and put at the end of the queue, while the CPU is given to
the next process. This loop goes on until all processes have been run.
What makes Round Robin scheduling so powerful is essentially its capacity to give each process
the same chance to make use of the CPU, thereby, no process is allowed to dominate the system
resources. Thus, it is the best choice for time-sharing systems, where users or tasks are many and
each CPU access is for a short period. Furthermore, it makes possible for interactive processes to
have good response times, e.g., those used in user terminals. It should, however, be mentioned
that the success of this technique is greatly influenced by the duration of the time quantum—i.e.,
if the time is too short, context-switching overhead will be high; if it is too long, the system will
not be very responsive. So, basically, Round Robin is a way to achieve balanced CPU allocation
in shared computing environments.
14. Which process scheduling method is provably optimal?
The Shortest Job Next (SJN) or Shortest Job First (SJF) is the one that is usually referred to as a
‘provable optimal’ type of process scheduling solution when it comes to the average waiting time
of processes in the system. To be more specific, this algorithm selects the process with the lowest
estimated CPU burst time to be executed next. Simply, the one is given priority over others
37
which is the process with the least amount of CPU time. The reasoning behind such an approach
is straightforward: by doing the shortest processes first, the overall waiting time in the ready
queue of all processes is minimized.
Non-preemptive and preemptive structures are the two basic categories of Shortest Job First
scheduling, with the latter being most commonly referred to as Shortest Remaining Time First
(SRTF). In the non-preemptive version, the process, which results in execution, is run to
completion. When talking about the preemptive version, the interruption of the current process
can be done by a newly arrived process with a shorter remaining burst time. Both variations are
designed to lead to optimal average waiting times if the conditions are ideal.
On the other hand, one can argue that while SJF is an optimal solution in theory, it is far from
being a practical one in reality of any modern computing environment since it demands an
accurate and upfront knowledge about the CPU burst of each process. To be more specific,
operating systems are now required to figure out the next CPU burst by looking at the past
average or by applying exponential averaging techniques, nevertheless, such predictions are
sometimes far away from the truth. Also, SJF can eventually be the cause of starvation for those
processes which are long enough in the case when it goes on this way that there always comes a
short process and thus these long ones may never be given CPU time.
Meanwhile, the Shortest Job First technique can still be regarded as a good instrument to
compare performance of various scheduling strategies besides showing its serious drawbacks.
This particular approach and its proof of optimality constitute one of the core concepts not only
in the design and performance evaluation of the operating system but also in coming up with
next generation of emerging scheduling strategies like multilevel feedback queues that are more
adaptive and equitable.
38
15. Describe the steps involved in performing a context switch.
The Shortest Job Next (SJN) or Shortest Job First (SJF) is the one that is usually referred to as a
‘provable optimal’ type of process scheduling solution when it comes to the average waiting time
of processes in the system. To be more specific, this algorithm selects the process with the lowest
estimated CPU burst time to be executed next. Simply, the one is given priority over others
which is the process with the least amount of CPU time. The reasoning behind such an approach
is straightforward: by doing the shortest processes first, the overall waiting time in the ready
queue of all processes is minimized.
Non-preemptive and preemptive structures are the two basic categories of Shortest Job First
scheduling, with the latter being most commonly referred to as Shortest Remaining Time First
(SRTF). In the non-preemptive version, the process, which results in execution, is run to
completion. When talking about the preemptive version, the interruption of the current process
can be done by a newly arrived process with a shorter remaining burst time. Both variations are
designed to lead to optimal average waiting times if the conditions are ideal.
On the other hand, one can argue that while SJF is an optimal solution in theory, it is far from
being a practical one in reality of any modern computing environment since it demands an
accurate and upfront knowledge about the CPU burst of each process. To be more specific,
operating systems are now required to figure out the next CPU burst by looking at the past
average or by applying exponential averaging techniques, nevertheless, such predictions are
sometimes far away from the truth. Also, SJF can eventually be the cause of starvation for those
39
processes which are long enough in the case when it goes on this way that there always comes a
short process and thus these long ones may never be given CPU time.
Meanwhile, the Shortest Job First technique can still be regarded as a good instrument to
compare performance of various scheduling strategies besides showing its serious drawbacks.
This particular approach and its proof of optimality constitute one of the core concepts not only
in the design and performance evaluation of the operating system but also in coming up with
next generation of emerging scheduling strategies like multilevel feedback queues that are more
adaptive and equitable.
16. Besides process management, what are the other two important functions of an operating
system?
In addition to process management, the two other major operating system (OS) functions which
are memory management and file management. These capabilities are vital to system
performance, resource sharing, and user accessibility.
Memory management is the one that first comes to mind when we think of controlling and
coordinating the computer's main memory (RAM). The system keeps a record of every byte of
memory, be it allocated or free, and decides how much memory each process should get. The OS
is the one which enables so many different processes to be executed concurrently without the
risk of so-called "inter-process interference" by separating their respective memory spaces. This
is done by the operating system to ensure that the system is executing programs that are larger
than the existing physical memory using such technologies as paging, segmentation, and virtual
memory. An adequate memory management system can track down memory leaks, maintain data
security, and increase the overall system performance and stability.
40
Another vital function, file management, is about the methods of data acquisition, retention,
retrieval, and protection from different storage devices. The operating system structures the data
storage in a way that suits human users and program users by means of directories and files. This
is to make the data easier to use and access. The OS takes care of the different stages of a file's
life-cycle such as the formation, deletion, control of access, and assigning of rights, thus ensuring
that files are not only stored efficiently but also protected from unauthorized access and
corruption. Moreover, file-management frees the users from the limitations of hardware and lets
them interact with data in the same way irrespective of the different storage technologies through
a very simple and uniform interface.
Memory and file management functions are co-workers with process management, together they
constitute the operating system's functional capacity. Memory management is the one which
optimizes the utilization of resources whereas file management is the one which ensures that the
data is well-organized and securely kept. All three core functions acting in tandem make it
possible for the OS to be efficient, reliable, and convenient for the users, thus constituting the
very foundation of the present-day computing environments.
17. What is an overlay? Why are overlays no longer needed in large computer systems?
An overlay is a method used in programming that was mainly implemented to enable the running
of large programs on a computer with a small amount of main memory. In the initial stages of
computing, memory was considered a limited and very costly resource, and in most cases, the
sizes of the programs were larger than that of the physical memory available. To erase this
drawback, programmers broke a program down into smaller, more manageable pieces called
overlays. Only the absolutely necessary part of the program to be used could be loaded into
memory, while the rest of the parts stayed on secondary storage like disk or tape.
41
Once another segment of the program was needed, the operating system or the program itself
would exchange the current overlay with the new one by unloading it from the memory and
loading it in the place of the new one. Thus, large applications could be run within the limits of
small memory systems and there was no need for the whole program to be in memory at the
same time.
Overlay structures have been mostly manually designed by programmers, which demanded a
thorough comprehension of both the program and the system’s memory layout. It was a
complicated and risky process because programmers had to make sure that overlays were not
overwriting the same memory areas and that the control was correctly passed to the next
segment. In spite of these difficulties, overlays were the lifeblood of early systems like
mainframes and minicomputers whose physical memory was counted in kilobytes. They made it
possible to use the limited resources efficiently and to run complex software applications such as
compilers, assemblers, and scientific programs.
On the other hand, overlays are not needed anymore in big computer systems because of the
hardware and operating system design have improved significantly. Today's computers are fitted
with a large amount of main memory and a virtual memory management that automatically
increases the physical memory by using disk storage. Virtual memory systems are able to do
what overlays used to do without human intervention by loading and unloading the parts of the
program that are needed. Furthermore, modern operating systems perform paging and
segmentation automatically, thus allowing multiple programs and processes to be run efficiently
at the same time.
18. The operating system and a user program hold two different perceptions of a virtual machine.
Explain how they differ.
42
The operating system and a user program see a virtual machine (VM) differently as they are at
different abstraction levels. To the operating system, a virtual machine is a new level of
abstraction that hides the real hardware and thus allows it to run multiple independent
environments on the same physical machine. The OS allocates CPU time, memory, storage, and
I/O devices and thus gives each virtual machine the impression that it has a full, dedicated
hardware platform. This abstraction is what makes isolation, security, and sharing of resources
possible in an efficient way among several users or processes.
However, a user program is in comparison an abstraction of an execution environment supplied
by the operating system. The program gets a uniform and simplified interface, consisting of
system calls, APIs, and virtual memory, without being aware of or having to deal directly with
the real hardware. The user program thinks of the virtual machine as the complete computing
system at its disposal, while the operating system considers it as a limited, simulated
environment built on top of the physical machine.
19. What is the difference between a subsystem and a logical partition?
A subsystem and a logical partition (LPAR) are both ways of managing resources and organizing
systems in the computing world, though essentially, these are different things in terms of their
purpose, structure, and the extent of isolation.
A subsystem refers to any one of several functional components or specially created
environments within an operating system, which are geared to handle specific jobs or provide
certain services. To accomplish this, it lives together with other parts in the whole system, and
hence resource-wise like CPU, memory, or I/O devices are shared among others but managed by
a single instance of the operating system. Some examples are file management subsystems,
43
networking subsystems, or database subsystems. JES is one subsystem in some big mainframe
systems which can on its own handle the packed job processing. Subsystems by themselves
provide the kind of specialized services that are generally considered under the broader system
and thereby make functionalities more modular and scalable within the system. However, they
cannot be considered as operating independently since they have to comply with the OS's
mechanisms for scheduling, memory management, and resource control which makes them
integrated yet dependent components.
A logical partition (LPAR) on the other hand is a method of virtualization at a hardware level
where a single physical machine can be divided into several isolated virtual systems( a situation
where each system is eligible to run its own OS independently) capable of doing the same task
separately. With this, basically the resources like processors, memory, and storage may be
dedicated or shared between some of these virtual machines thus each logical partition operates
like a separate computer. To mention a few, LPARs are what enable scalability, hardware-
efficient utilization, hack-resistance measures, and multi-environmental support on a single box
that is the case in technologies such as IBM Power Systems and other enterprise-grade servers.
This is where the difference lies between LPAR and subsystem, since the former can be totally
isolated from one another i.e. the dysfunction or reconfiguration of one unit doesn't have a
repercussion on the others that are operating normally.
20. Name some advantages of server consolidation. Is server consolidation a good idea for every
enterprise?
Server consolidation, in essence, provides a handful of benefits revolving mostly around
efficiency, cost savings, and ease of management. When multiple low-utilization servers are
merged into a smaller number of high-capacity ones — typically via virtualization — companies
44
can notably slash their hardware, energy, and cooling expenses. Moreover, the process of
consolidation makes the job of system administrators easier, as the reduction in the number of
physical servers leads to lowered maintenance, simpler updating, and centralized control. In fact,
it raises the utilization of resources, thus the CPU, memory, and storage spaces are put to more
efficient use. Besides that, it strengthens the capability of disaster recovery as well as expansion,
for instance, the virtualized environments can be backed up, migrated, or scaled effortlessly.
Nevertheless, server consolidation may not be the right choice for every company. Small
businesses with light workloads might not gain enough to cover the cost of the virtualization
infrastructure. On the other hand, consolidation could lead to single points of failure, that is, if
the consolidated server crashes, the services that run on it will be affected. In conclusion, a
server consolidation scheme, while packed with potential benefits, needs a rigorous planning
stage that takes into account the size, workload, and reliability requirements of the enterprise.
21. Describe the programming language hierarchy. Why is a triangle a suitable symbol for
representing this hierarchy?
The programming language hierarchy is the representation of the organization of programming
languages according to their level of abstraction from the lowest machine code and their
closeness to human understanding. The structure of this hierarchy is based on three main levels:
machine languages, assembly languages, and high-level languages. Additionally, there are
modern extensions such as very high-level, domain-specific, and fourth-generation languages
that can be considered as extra levels. Every level in the hierarchy marks a step further from the
one under it, providing greater abstraction, ease of use, and productivity, but generally
sacrificing the level of control and performance efficiency.
45
The hierarchy of programming languages is topped by the lowest level, the machine language.
Machine language is purely binary code (0s and 1s) that the computer’s hardware can understand
directly. Machine language is the set of instructions where the CPU can perform operations
directly. Machine language offers total control over the hardware, but it is a real nightmare for
humans to read, write, and debug and it takes a lot of time.
Assembly language is just one level higher than machine language. Assembly Language uses
symbols or mnemonics (like ADD, MOV, or SUB) to refer to machine instructions.
Programming thus becomes more readable and manageable, but hardware architecture still needs
to be known in great detail. An assembler translates assembly language programs into machine
code for execution. By using assembly one can have almost as much control and efficiency as
machine language and yet one cannot expect portability since a program written for one
processor will not work on another without modification.
High-level programming languages such as Python, Java, C++, and C# are at the top of the
hierarchy. The languages are developed to be closer to human logic by using natural language-
like syntax and hiding the hardware complexities. They need compilers or interpreters to convert
the source code into machine code. High-level languages include the features like data structures,
control flow, and modular design, thus giving the programmers the liberty to create complex
applications in less time and with fewer mistakes.
Besides high-level languages, very high-level and domain-specific languages like SQL for
databases or MATLAB for scientific computing offer even more abstraction. They are made only
for certain tasks and thus allow the users to do complex operations with just a few lines of code.
Fourth-generation languages (4GLs) and fifth-generation languages (5GLs) are concentrated on
46
problem-solving and automation, where the users only state what they want and not how, the
solution being mostly done by AI or declarative paradigms.
The hierarchy is well represented by the triangle figure because it shows the connection between
abstraction, control, and the number of users. The large top of the triangle contains high-level
and very high-level languages, those that are used by a great many programmers because of their
ease and efficiency. Going from the top to the bottom of the triangle, we find assembly and
machine languages, which are used by a smaller number of programmers who need more precise
control over the hardware. What is more, the triangle stands for the compromise between the
user's ease and the system's control: as one goes higher in abstraction, programming becomes
simpler, however, the direct control of the hardware lessens.
22. How does absolute code differ from relocatable code?
Absolute and relocatable code differ fundamentally in the way they address memory and handle
the placement of programs during execution. Absolute code is the output of an assembler or
compiler which has fixed memory addresses attached to all the instructions and data locations. It
has to be loaded into a certain memory location to work properly as its addresses are coded
directly. In case the program is loaded at a different location, it will not work properly because
the addresses will not be pointing to the correct memory locations anymore.
On the other hand, relocatable code is made to be loaded at any free memory location. It employs
symbolic or relative addressing which makes it possible for the operating system or linker to
change memory references on the fly during program loading. The availability of this feature
allows a number of programs to be efficient in coexisting in memory which, in turn, leads to
better resource utilization and easier memory management. To sum up, relocatable code is a
47
source of portability and adaptability whereas absolute code is a more straightforward solution
that is not flexible with different execution environments.
23. What is the purpose of a link editor? How is it different from a dynamic link library?
A link editor, which is generally referred to as a linker, is a system program that merges one or
more object modules produced by a compiler or assembler into a single executable file.
Basically, it helps to locate all functions and variables in the program by scanning through the
modules and records the addresses of the function calls and variables, it attaches the modules
together, it assigns the absolute memory locations, and it creates the final executable file ready
for loading and execution. The linker is the one that makes it possible for all parts of the program
to work together smoothly, it takes care of address relocation and symbol resolution as well.
Meanwhile, a Dynamic Link Library (DLL) is an assortment of procedures or functions that may
be linked during program execution time rather than at the time of program compilation. In
contrast to a statically linked program which is done by a link editor, DLLs enable several
programs to share the same code while executing, thus, memory and disk space consumption are
minimized. The use of such dynamic linking affords greater freedom, simpler updating, and
modularity, as opposed to the linker's output which is a fixed, standalone executable.
24. Describe the purpose of each phase of a compiler.
A compiler is basically a single large program that organizes and coordinates the translation of
high-level source codes to machine-executable codes by grouping the entire process into a
number of phases. What is important is that the programs are not only grammatically correct but
also make sense and are optimized for quick execution, and the latter is precisely what those
phases ensure.
48
First of all, the compiler attempts to perform lexical analysis: it reads the source code for the
purpose of dividing the code into a token sequence, that is a series of tokens which are the
smallest units, amongst them must be keywords, identifiers, operators, and literals. Comment and
white space are carefully taken away from the code, so it will be easier to be processed in the
follow up steps. After the task is completed, the data in terms of tokens are handed over to the
subsequent stage.
Syntax analysis or parsing is the second phase which, based on the grammar rules, looks at the
grammatical structure of the token sequence. It results in the production of a parse tree or
abstract syntax tree which structurally represents the code in a hierarchical manner. This stage,
for example, helps ensure proper nesting of the loops and expressions in the program.
Afterwards, the compiler carries out semantic analysis. Here the situation is checked for logical
sense and even though it is also checked for types of data, declaration of variables, and scope
rules so these to be used for validation of operations the compiler itself prevents the addition of
incompatible data types. The symbol table serves as a storage place of information about
variables and functions.
Next follows the step of conversion of the intermediate code generation syntax tree into the
intermediate language which is a simple and machine-independent but at the same time
understandable for the final part of the translator. The optimization phase refines the intermediate
code to improve its performance - functionality is not changed, but redundancies are eliminated,
and resource usage is improved.
The code generation phase is the one that actually brings the optimized code to the level of the
target processor. It turns the intermediate code into machine code or assembly language. Besides,
49
compilers may be capable of the linking and loading functions too, thus, object files and libraries
are combined into a single executable program.
25. How does an interpreter differ from a compiler?
An interpreter and a compiler both convert high-level languages into low-level languages that
machines can understand but they are fundamentally different in the way and time of conversion.
A compiler converts the whole source code into machine code or an executable file prior to
execution. In doing so, it goes through different stages, lexical, syntax, semantic analysis,
followed by optimization and code generation. Hence, compiled programs can be run several
times without the need of recompiling and runtime is therefore faster. On the other hand,
compilation may take a long time and debugging is more complicated as errors can only be
located after the entire program has been compiled.
Meanwhile, an interpreter translates and executes the program line by line or statement by
statement during runtime. It does not generate a separate executable file but works directly with
the source code which it reads and executes immediately. Thus, interpreters are perfect for quick
testing and debugging as errors can be detected and reported right away. Nevertheless, in
general, interpreted codes will still be slower than compiled ones because translation is
continuous during execution.
26. What is the salient feature of the Java programming language that provides for its portability
across disparate hardware environments?
The most important characteristic of the Java programming language that is able to keep it
portable over various hardware and operating system environments is certainly the Java Virtual
Machine (JVM) and the notion of “Write Once, Run Anywhere.” A Java application, when
50
compiled, is not transformed to a specific platform machine code. Rather, it is turned into a
halfway form called bytecode which is kept in .class files. This bytecode is a program that can be
done by the JVM which is a software-based interpreter that can be installed on any device or
operating system and is compatible with a Java runtime environment.
Therefore, different platforms have their own versions of the JVM so that a single Java bytecode
can be executed on Windows, macOS, Linux, or even iOS and Android without any change.
Such a design in effect separates Java programs from the hardware and operating system
differences. Besides that, Java’s standard libraries and APIs help portability even more by
providing the same interfaces for file handling, networking, and graphics on different platforms.
27. Assemblers produce machine code that is executable after it has been link edited. Java
compilers produce ________ that is interpreted during its execution.
Java compilers produce bytecode, an intermediate form that is interpreted or just-in-time
compiled by the Java Virtual Machine (JVM) during execution.
28. What is a magic number that identifies a Java class file?
A magic number in a Java class file identifies a class that is located at the very beginning of each
compiled .class file. In fact, it is a four-byte hexadecimal value 0xCAFEBABE, that helps Java
class files to be distinguished from any other types of files.
So, the Java Virtual Machine (JVM) when it wants to load a class it first goes and checks the
magic number in the file to be sure that it is actually a valid Java bytecode file. In case the magic
number is not there or it is not the right one then the JVM will throw an error and say that the
class file is invalid.
51
This method is used to maintain the integrity of the file, compatibility, and also it acts like a
shield against corrupted or non-Java files that might be there when the program is running.
29. How is a logical database schema different from a physical database schema?
A logical database schema can be compared to the architectural blueprint of a dream mansion - it
shows which rooms are there, how they are connected, and where the spiral staircase of
relationships beautifully turns. It explains the organization of data at a conceptual level: tables,
fields, relationships, constraints, and keys. However, at this point, it is still completely oblivious
to storage devices, file formats, or performance tuning.
On the other hand, the physical database schema is the point where the dream meets reality with
concrete and cables. It specifies how the logical design is carried out that which indexes are
created, where the data is stored on the disk, and how partitions and clusters are used to keep the
system running efficiently.
30. Which data structure is most commonly used to index databases?
The B-tree (Balanced Tree) data structure is the main indexing strategy that is generally
implemented in databases. B-tree preserves data in a sorted and hierarchical structure, thus it is
very fast to search, insert, delete, and also sequentially access. Since its nodes are balanced, the
lookup times are of logarithmic order even if the size of the dataset increases, thus it is very
suitable for big databases.
Several database systems like MySQL and Oracle implement a variant named B+ tree in which
only the leaf nodes store the actual data values while the internal nodes contain only the keys for
a quicker traversal. This structure is perfect for both random and range queries which in turn
leads to a better performance.
52
Reference
Null, L. (2024). The essentials of computer organization and architecture (6th ed.). Jones &
Bartlett Learning.