OS 30 Q Assignment
OS 30 Q Assignment
1. Resource Management: It allocates and manages resources such as CPU, memory, and I/O
devices efficiently.
3. User Interface: It provides an interface for users to interact with the computer, whether
through command-line or graphical user interfaces.
1.2 We have stressed the need for an operating system to make efficient use of
the computing hardware. When is it appropriate for the operating system to
forsake this principle and to "waste" resources? Why is such a system not really
wasteful?
It is appropriate for an operating system to "waste" resources in cases like real-time systems or user
experience where responsiveness and simplicity are more critical than strict resource efficiency. For
example, reserving excess memory for faster performance is not wasteful when it provides better user
experience. Similarly, systems may intentionally leave resources idle to maintain system stability or
support background tasks.
• It should not include: Operating systems are primarily concerned with managing hardware and
providing fundamental services. Including applications could bloat the OS, reduce modularity,
and hinder the ability to use alternative or updated applications from other developers.
1.5 How does the distinction between kernel mode and user mode function as a
rudimentary form of protection (security) system?
The distinction between kernel mode and user mode provides a basic protection mechanism by
limiting access to critical system resources. In kernel mode, the OS has unrestricted access to all
hardware and memory, while in user mode, applications are restricted from accessing sensitive data
and hardware directly, preventing them from damaging the system or other processes.
• b. Read the clock – Not privileged (does not modify the system).
• g. Switch from user to kernel mode – Privileged (needed for context switching).
1.8 Some CPUs provide for more than two modes of operation. What are two
possible uses of these multiple modes?
1. User mode and supervisor mode: User mode is for running applications, while supervisor
mode (or kernel mode) provides unrestricted access to the hardware.
2. Debug mode: A special mode for debugging where additional system information and
monitoring can be done without affecting normal operation.
1.9 Timers could be used to compute the current time. Provide a short
description of how this could be accomplished.
Timers can count clock pulses, and the operating system can periodically read the timer to calculate
elapsed time. By incrementing the time in fixed intervals (e.g., every millisecond), the system can
calculate the current time by adding the elapsed time to a known starting point.
1.10 Give two reasons why caches are useful. What problems do they solve?
What problems do they cause? If a cache can be made as large as the device for
which it is caching (for instance, a cache as large as a disk), why not make it that
large and eliminate the device?
• Why caches are useful:
1. Speed: Caches reduce access time by storing frequently used data closer to the
processor.
• Problems solved: Caches solve the problem of slow access to main memory or I/O devices.
• Problems caused: Caches introduce complexity in maintaining data consistency and require
additional resources for management.
• Why not make cache the size of the device?: Large caches would be expensive and inefficient,
as cache management and coherence would become increasingly complex, and the time
benefit would decrease as the cache size grows.
1.11 Distinguish between the client-server and peer-to-peer models of
distributed systems.
• Client-server model: One server provides resources or services, and multiple clients request
them. The server is a central authority.
• Peer-to-peer model: Each node can act as both a client and a server, sharing resources directly
with other peers, without relying on a central authority.
1. Unauthorized access: Users may gain access to other users' data or programs.
• b. Workstations connected to servers: CPU, memory, network bandwidth, and I/O devices should
be managed, particularly for inter-process communication with the server.
• c. Mobile computers: Battery life, memory, CPU, and network bandwidth must be efficiently
managed to ensure performance and conserve power.
1.14 Under what circumstances would a user be better off using a time-sharing
system than a PC or a single-user workstation?
A time-sharing system is beneficial when multiple users need concurrent access to limited resources.
This is especially useful in environments where cost is a concern, such as universities or organizations
with multiple users who need to access powerful computing systems or specific software. In contrast,
a PC or single-user workstation is more suited for tasks requiring exclusive access to the machine, such
as gaming or intensive computational tasks.
• Shared disk allows both nodes to access the same physical storage, simplifying management but
introducing potential data consistency issues.
• Distributed databases store data on separate nodes, which reduces contention but may
introduce complexity in ensuring data synchronization and consistency.
1.18 How are network computers different from traditional personal computers?
Describe some usage scenarios in which it is advantageous to use network
computers.
Network computers rely on remote servers for processing and storage, whereas traditional PCs handle
tasks locally. This makes network computers ideal for environments where cost is a concern, such as
educational institutions or businesses that require simple terminals with internet access for accessing
cloud services.
1.19 What is the purpose of interrupts? How does an interrupt differ from a
trap? Can traps be generated intentionally by a user program? If so, for what
purpose?
Interrupts are used to signal the CPU to stop its current task and handle an event, like I/O completion. A
trap is a type of interrupt triggered by a program’s execution, usually for system calls or error handling.
Yes, traps can be intentionally generated by a user program to request services from the operating
system, such as input/output or memory management.
1.20 Direct memory access is used for high-speed I/O devices in order to avoid
increasing the CPU's execution load.
• a. The CPU coordinates the transfer by configuring the DMA controller with memory addresses
and transfer details.
• b. The CPU knows the transfer is complete through an interrupt from the DMA controller.
• c. The CPU is not directly interrupted by DMA operations but may experience slight delays due to
bus contention or the need to handle DMA interrupts.
1.23 Consider an SMP system similar to the one shown in Figure 1.6. Illustrate
with an example how data residing in memory could in fact have a different
value in each of the local caches.
In an SMP system, each processor may cache a copy of the same memory address. If one processor
updates the data, the other processors' caches may not immediately reflect the change, leading to data
inconsistency until a cache coherence protocol synchronizes them.
• b. Multiprocessor systems: Multiple processors accessing shared data can lead to inconsistency,
which requires protocols like MESI (Modified, Exclusive, Shared, Invalid).
• b. Several campus locations across a statewide university system: WAN is required to connect
geographically dispersed locations.
1.27 Describe some of the challenges of designing operating systems for mobile
devices compared with designing operating systems for traditional PCs.
Mobile operating systems must be optimized for limited resources (battery, memory), support varying
network conditions, and offer enhanced security for wireless communication. Unlike PCs, mobile OS
must handle device-specific features like GPS, touch screens, and sensor data.