0% found this document useful (0 votes)
22 views8 pages

OS 30 Q Assignment

ioau sdajivre hoivahjsdv v
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views8 pages

OS 30 Q Assignment

ioau sdajivre hoivahjsdv v
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Assignment: Operating Systems

1.1 What are the three main purposes of an operating system?


The three main purposes of an operating system are:

1. Resource Management: It allocates and manages resources such as CPU, memory, and I/O
devices efficiently.

2. Process Management: It manages the execution of processes, including multitasking,


scheduling, and synchronization.

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.

1.3 What is the main difficulty that a programmer must overcome in


writing an operating system for a real-time environment?
The main difficulty in writing an operating system for a real-time environment is ensuring predictable
and deterministic behavior. The system must meet strict timing requirements, making it challenging to
manage process scheduling and handle interrupts efficiently, avoiding delays that could lead to missed
deadlines or system failure.
1.4 Keeping in mind the various definitions of operating system, consider
whether the operating system should include applications such as web browsers
and mail programs. Argue both that it should and that it should not, and support
your answers.
• It should include: If the OS is seen as a complete environment for managing all computing
tasks, including networking and communication, then integrated applications like web
browsers or mail programs would provide seamless functionality and user experience.

• 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.

1.6 Which of the following instructions should be privileged?


• a. Set value of timer – Privileged (needed to prevent user programs from altering the timer).

• b. Read the clock – Not privileged (does not modify the system).

• c. Clear memory – Privileged (to prevent unauthorized memory access or corruption).

• d. Issue a trap instruction – Not privileged (part of program control).

• e. Turn off interrupts – Privileged (can affect system stability).

• f. Modify entries in device-status table – Privileged (critical for device management).

• g. Switch from user to kernel mode – Privileged (needed for context switching).

• h. Access I/O device – Privileged (can affect system resources).

1.7 Some early computers protected the operating system by placing it in a


memory partition that could not be modified by either the user job or the
operating system itself. Describe two difficulties that you think could arise with
such a scheme.
1. Limited flexibility: The OS could not be updated or modified dynamically, restricting the ability
to patch or upgrade the system.

2. Potential inefficiency: Allocating a fixed, protected memory partition could lead to


underutilization if the OS did not require all of the allocated space.

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.

2. Efficiency: Caches improve overall system performance by reducing the number of


slow memory accesses.

• 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.12 In a multiprogramming and time-sharing environment, several users share


the system simultaneously. This situation can result in various security
problems.
• a. Two security problems:

1. Unauthorized access: Users may gain access to other users' data or programs.

2. Resource contention: Malicious or faulty programs may monopolize resources or


interfere with others.

• b. Can we ensure the same degree of security in a time-shared machine as in a dedicated


machine? No, because a time-shared system has a higher risk of unauthorized access, resource
contention, and vulnerability to attacks due to shared resources. In a dedicated machine, only
one user has access, reducing these risks.

1.13 The issue of resource utilization shows up in different forms in different


types of operating systems. List what resources must be managed carefully in
the following settings:
• a. Mainframe or minicomputer systems: CPU time, memory, disk space, and I/O devices need
careful management to support multiple users and workloads.

• 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.

1.15 Describe the differences between symmetric and asymmetric


multiprocessing. What are three advantages and one disadvantage of
multiprocessor systems?
In Symmetric Multiprocessing (SMP), all processors are equal and share the same memory, while in
Asymmetric Multiprocessing (AMP), one processor acts as the master, controlling the system, while the
others perform specific tasks.
Advantages of multiprocessor systems include improved performance, fault tolerance, and better
resource utilization. A disadvantage is the increased complexity in system design due to the need for
synchronization.

1.16 How do clustered systems differ from multiprocessor systems? What is


required for two machines belonging to a cluster to cooperate to provide a
highly available service?
Clustered systems consist of independent machines connected together to provide fault tolerance and
high availability, while multiprocessor systems have multiple processors within the same machine
sharing a single memory space. For machines in a cluster to cooperate, they need to synchronize data
and manage workloads, often with shared storage and network protocols to ensure service availability.

1.17 Consider a computing cluster consisting of two nodes running a database.


Describe two ways in which the cluster software can manage access to the data
on the disk. Discuss the benefits and disadvantages of each.
Cluster software can manage data access through shared disk or distributed database systems.

• 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.21 Some computer systems do not provide a privileged mode of operation in


hardware. Is it possible to construct a secure operating system for these
computer systems?
It is possible to construct a secure operating system without a privileged mode, but it requires software-
based protection mechanisms like user-space isolation and software-enforced memory protection.
However, it would be less efficient and more prone to security risks compared to hardware-enforced
isolation.
1.22 Many SMP systems have different levels of caches; one level is local to each
processing core, and another level is shared among all processing cores. Why are
caching systems designed this way?
Local caches minimize access time by storing frequently used data close to the processor, while shared
caches facilitate coordination and data sharing between cores. This design balances fast local access with
effective data consistency management across multiple cores.

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.

1.24 Discuss, with examples, how the problem of maintaining coherence of


cached data manifests itself in the following processing environments:
• a. Single-processor systems: Cache coherence is not a concern since there is only one processor.

• b. Multiprocessor systems: Multiple processors accessing shared data can lead to inconsistency,
which requires protocols like MESI (Modified, Exclusive, Shared, Invalid).

• c. Distributed systems: Cache coherence in distributed systems is complicated by network


latency and data partitioning, requiring sophisticated synchronization mechanisms like
distributed locking or versioning.

1.25 Describe a mechanism for enforcing memory protection in order to prevent


a program from modifying the memory associated with other programs.
Memory protection is enforced using page tables and access control bits. The operating system ensures
each program is only allowed to access its own allocated memory space by mapping virtual addresses to
physical memory addresses and setting permission flags (read, write, execute).

1.26 Which network configuration—LAN or WAN—would best suit the following


environments?
• a. A campus student union: LAN is appropriate for its local networking needs.

• b. Several campus locations across a statewide university system: WAN is required to connect
geographically dispersed locations.

• c. A neighborhood: LAN is ideal for small-scale networking within a limited area.

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.

1.28 What are some advantages of peer-to-peer systems over client-server


systems?
Peer-to-peer systems are decentralized, meaning there is no single point of failure. They are also more
scalable and flexible since each participant can act as both a client and a server. This makes them cost-
effective for small-scale or collaborative applications.

1.29 Describe some distributed applications that would be appropriate for a


peer-to-peer system.
Distributed applications for peer-to-peer systems include file-sharing programs like BitTorrent,
distributed computation tasks, and messaging services. These applications benefit from the
decentralized nature of P2P systems, which avoids reliance on centralized servers.

1.30 Identify several advantages and several disadvantages of open-source


operating systems.
Advantages include cost-effectiveness, flexibility, and community-driven development. Open-source OSs
allow users to modify the software to meet their needs. Disadvantages include a lack of official support,
potential security vulnerabilities, and the need for technical expertise to manage the system.

You might also like