Chapter 1 Review Questions With Solutions Unprotected

Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

Electrical & Computer Engineering

EECE 432 Operating Systems


Chapter 1 Introduction
Review Questions with Solutions

Section 1.1
1.1 What are the four components of a computer system?
The four components of a computer system are:
1. Hardware: Physical components of the computer, including:
o Central Processing Unit (CPU)
o Memory (RAM and storage devices)
o Input/Output devices (keyboard, mouse, monitor, etc.)
o Motherboard and other internal components
2. Operating System: Software that manages hardware resources and provides services for
computer programs. Key functions include:
o Process management
o Memory management
o File system management
o I/O management
o Network management
o Security and protection
3. Application Programs: Software designed for specific tasks, such as:
o Word processors
o Web browsers
o Games
o Productivity tools
o Specialized software (e.g., graphic design tools, video editors)
4. Users: Individuals or entities interacting with the computer system, including:
o End-users
o Programmers

Imad Moukadem 1
o System administrators
o Hardware engineers
Each component plays a crucial role in the functioning of a computer system, interacting with
others to create a cohesive computing environment.
1.2 Provide at least three resources the operating system allocates.
Three key resources the operating system allocates are:
1. CPU Time:
o The OS manages which processes use the CPU and for how long.
o Implements scheduling algorithms to distribute CPU time fairly and efficiently.
o Ensures high-priority tasks get CPU time when needed.
2. Memory Space:
o Controls how much memory each process can use and where in memory it's stored.
o Implements memory management techniques like paging and segmentation.
o Manages virtual memory to extend available memory using disk space.
3. File Storage Space:
o Manages how files are stored and accessed on storage devices.
o Handles file allocation, deciding where to store files on the disk.
o Manages free space and implements file system structures.
Additionally, the OS allocates other resources like I/O devices, network bandwidth, and power
(especially in mobile devices).
1.3 What is the common name used to refer to the operating system program?
The common name for the core operating system program is the kernel. The kernel is the central
component of an operating system and performs several critical functions:
• Acts as a bridge between applications and hardware
• Manages system resources (CPU, memory, devices)
• Provides essential services to other parts of the operating system
• Implements security and protection mechanisms
• Handles interrupts and system calls
The kernel operates in a privileged mode (kernel mode) with full access to hardware resources. It's
the first program loaded on startup and remains in memory throughout the system's operation.

Imad Moukadem 2
1.4 What do mobile operating systems often include in addition to the core kernel?
Mobile operating systems often include middleware in addition to the core kernel. Middleware
plays a crucial role in the mobile ecosystem:
• Provides additional services and APIs (Application Programming Interfaces) to application
developers
• Bridges the gap between the low-level kernel functions and high-level application
development
• Offers pre-built components and services for efficient app development
Key functions of mobile OS middleware include:
• Hardware abstraction (e.g., camera, sensors, GPS)
• Application frameworks
• Runtime environments
• Communication services
• Security services
• Multimedia frameworks
• Location and context services
• Power management
Examples include Android Runtime (ART) in Android and various frameworks in iOS like Core
Services and Cocoa Touch.

Imad Moukadem 3
Section 1.2
1.5 What is an interrupt?
An interrupt is a signal to the CPU emitted by hardware or software to indicate an event that needs
immediate attention. Key aspects of interrupts include:
• Allows the CPU to suspend current operations and handle high-priority tasks
• Enables efficient multitasking and responsive handling of events
• Can be triggered by hardware (e.g., I/O devices) or software (e.g., exception handling)
• Involves an interrupt handler that processes the interrupt
• Utilizes an interrupt vector table to determine which code to execute for each type of
interrupt
Interrupts are crucial for system responsiveness and efficient I/O handling, allowing the CPU to
quickly react to external events or internal exceptions without constant polling.
1.6 What special operation triggers a software interrupt?
A trap instruction triggers a software interrupt. Trap instructions are crucial for implementing
system calls and other privileged operations:
• They are programmed requests for specific operating system services
• Allow controlled transition from user mode to kernel mode
• Enable user programs to access services that require higher privileges
• Commonly used for implementing system calls in various architectures (e.g., INT 0x80 in
x86, SVC in ARM)
• Provide a secure way for user programs to interact with the operating system kernel
Trap instructions are essential for maintaining system security while allowing user programs to
request necessary system services.
1.7 What is one advantage of using a solid-state disk over a magnetic disk?
A significant advantage of using a solid-state disk (SSD) over a magnetic disk (HDD) is faster access
time. This advantage stems from fundamental differences in technology:
• SSDs use flash memory with no moving parts
• HDDs rely on spinning platters and moving read/write heads
• SSDs can access data almost instantly
• HDDs need time for platters to spin and heads to move

Imad Moukadem 4
This results in:
• Much faster random-access operations for SSDs
• Quicker boot times and application launches
• Improved overall system responsiveness
• Better performance in environments requiring frequent random access to data
While SSDs are generally more expensive per gigabyte, their speed advantage has led to
widespread adoption, especially for boot drives and performance-critical applications.
1.8 What is the difference between volatile and non-volatile storage?
The main difference between volatile and non-volatile storage lies in their ability to retain data
when power is removed:
Volatile Storage:
• Loses contents when power is removed (e.g., RAM)
• Requires constant power to maintain stored data
• Typically, faster access times
• Used for temporary data storage during program execution
Non-volatile Storage:
• Retains contents even when power is removed (e.g., HDDs, SSDs, ROM)
• Can store data for long periods without power
• Generally slower access times (though SSDs are much faster than HDDs)
• Used for long-term data storage, operating systems, and applications
This distinction influences how these storage types are used in computer systems, with volatile
storage used for active data and program execution, and non-volatile storage for persistent data
and software storage.

Imad Moukadem 5
Section 1.3
1.9 What is another term for multiprocessor system?
Another term for a multiprocessor system is Symmetric Multiprocessing (SMP). Key characteristics
of SMP include:
• Multiple processors or cores share the same memory and I/O buses
• All processors are treated equally and can perform all tasks
• A single operating system instance manages all processors
• Processors share access to I/O devices
• Allows for true parallel execution of multiple tasks
SMP systems are common in modern computing, from multi-core CPUs in personal computers to
high-performance servers. They offer improved performance through parallel processing and
efficient resource sharing.
1.10 Provide at least two advantages of multiprocessor systems.
Two key advantages of multiprocessor systems are:
1. Increased Throughput:
o Multiple processors can work on tasks simultaneously
o Parallel execution of tasks improves overall system performance
o Particularly beneficial for multi-threaded applications and multitasking environments
o Can significantly reduce processing time for complex computations
2. Economy of Scale:
o Sharing resources (e.g., power supplies, cooling systems) is more cost-effective than
separate single-processor systems
o More efficient use of shared components like memory and I/O subsystems
o Can be more energy-efficient for the level of performance provided
o Allows for incremental system upgrades by adding processors
Additional advantages include improved reliability through redundancy and the ability to handle
more complex, computation-intensive tasks efficiently.
1.11 True or False? The most common multiple-processor system uses asymmetric
multiprocessing.
False. The most common multiple-processor system uses symmetric multiprocessing (SMP), not
asymmetric multiprocessing.

Imad Moukadem 6
In SMP:
• All processors are treated equally
• Any processor can perform any task
• Processors share access to memory and I/O
• A single OS instance manages all processors
This contrasts with asymmetric multiprocessing, where:
• Processors may have specific roles or hierarchies
• Not all processors are treated equally
• Often used in specialized or legacy systems
SMP is more common due to its flexibility, scalability, and easier programming model, making it the
preferred architecture for most modern multi-core and multi-processor systems.
1.12 What is the name of a multiprocessor system that uses multiple computing cores?
A multiprocessor system that uses multiple computing cores is called a multicore system. Key
features include:
• Multiple processor cores integrated on a single physical chip
• Cores typically share some hardware resources (e.g., cache levels, memory controller)
• Allows for efficient parallel processing within a compact physical space
• Managed by a single operating system instance
• Common in modern CPUs for personal computers, servers, and mobile devices
Multicore systems offer advantages like:
• Increased performance through parallel processing
• Improved energy efficiency compared to multiple single-core processors
• Reduced heat generation and power consumption
• More efficient inter-core communication due to proximity
Examples include dual-core, quad-core, and many-core processors used in various computing
devices.

Imad Moukadem 7
1.13 How does a clustered system differ from a multicore system?
A clustered system and a multicore system differ in several key aspects:
Clustered System:
• Connects multiple independent computers (nodes) through a network
• Each node has its own processor(s), memory, and often its own storage
• Nodes communicate via network interconnects
• Can span multiple physical machines, potentially in different locations
• Often runs multiple OS instances (one per node)
• Highly scalable by adding more nodes
• Used for high-performance computing, load balancing, and high-availability systems
Multicore System:
• Multiple processing cores on a single chip or chip package
• Cores share resources like memory and I/O within a single computer
• Inter-core communication is fast due to proximity
• Typically managed by a single OS instance
• Scalability limited by chip design and manufacturing constraints
• Common in personal computers, servers, and mobile devices
While both aim to improve performance through parallelism, they operate at different scales and
are suited for different types of tasks and environments.

Imad Moukadem 8
Section 1.4
1.14 How does multiprogramming increase CPU utilization?
Multiprogramming increases CPU utilization by organizing jobs (programs) so that the CPU always
has one to execute. This is achieved through:
• Loading multiple programs into memory simultaneously
• Rapidly switching between programs, giving each a slice of CPU time
• Utilizing CPU time that would otherwise be wasted during I/O operations
Key mechanisms:
• When one job is waiting for I/O, another can use the CPU
• The operating system manages job scheduling and context switching
• Implements time-sharing to give the illusion of parallel execution on single-core systems
Benefits:
• Reduces CPU idle time
• Improves overall system throughput
• Enhances responsiveness in interactive systems
Multiprogramming forms the basis for modern multitasking operating systems, enabling efficient
resource utilization and improved user experience.
1.15 What is the term for a program that has been loaded and is executing?
A program that has been loaded and is executing is called a process. Key aspects of a process
include:
• It's an instance of a program in execution, not just the code stored on disk
• Has its own memory space, including:
o Text segment (program code)
o Data segment (global variables)
o Stack (local variables, function calls)
o Heap (dynamically allocated memory)
• Possesses a process control block (PCB) containing:
o Process state
o Program counter
o CPU registers

Imad Moukadem 9
o CPU scheduling information
o Memory management information
o I/O status information
• Can be in various states: new, ready, running, waiting, terminated
• Managed by the operating system's process scheduler
• May contain multiple threads of execution
Processes are fundamental to modern operating systems, enabling multitasking, resource
allocation, and isolation between running programs.
1.16 What part of the operating system makes the decision with regards to which job will run?
The CPU scheduler (or process scheduler) part of the operating system makes the decision
regarding which job will run. Key aspects of the CPU scheduler include:
• Selects which ready process will be executed next on the CPU
• Aims to maximize CPU utilization, throughput, and fairness
• Implements various scheduling algorithms (e.g., Round Robin, Priority Scheduling)
• Manages context switching between processes
• Balances competing goals like responsiveness and efficiency
• May dynamically adjust process priorities based on behavior and system load
The scheduler is crucial for:
• Efficient multitasking
• Fair distribution of CPU time among processes
• System responsiveness
• Optimal use of system resources
In multi-core or multi-processor systems, the scheduler also decides which processor will run each
process, adding another layer of complexity to its decision-making process.

Imad Moukadem 10
Section 1.5
1.17 What are the two separate modes of operation?
The two separate modes of operation in modern computer systems are:
1. User Mode:
o Restricted mode where user programs and applications run
o Limited privileges and access to system resources
o Cannot directly access hardware or execute privileged instructions
o Each program runs in its own protected memory space
o Used for running application software
2. Kernel Mode (also known as Supervisor Mode or Privileged Mode):
o Privileged mode where the operating system kernel runs
o Full access to all system resources and hardware
o Can execute any CPU instruction and access any memory location
o Used for executing critical operating system functions
o Handles interrupts, system calls, and resource management
This separation is crucial for system security, stability, and resource protection, preventing user
programs from interfering with critical system operations or other programs.
1.18 What is the mode of the system at boot time?
The mode of the system at boot time is kernel mode. This is necessary because:
• The boot process requires full access to hardware and system resources
• Critical system initialization tasks need to be performed
• The operating system kernel needs to be loaded and initialized
• Hardware devices need to be detected and configured
• Memory management systems need to be set up
• The system needs to transition from a basic state to a fully operational one
Only after the operating system is fully initialized does it start running user-level processes in user
mode. This ensures that the system is properly set up and secured before any user applications
begin execution.

Imad Moukadem 11
1.19 What is the mode of the system when the operating system gains control?
The mode of the system when the operating system gains control is kernel mode. This occurs in
various situations:
• During system boot and initialization
• When handling interrupts
• When executing system calls requested by user processes
• During context switches between processes
• When managing system resources (memory, I/O, etc.)
Kernel mode allows the OS to:
• Access all system memory and hardware directly
• Execute privileged CPU instructions
• Manage and protect system resources
• Perform critical operations that user processes are not allowed to do
The OS switches back to user mode when it returns control to user processes, ensuring that user
code runs with limited privileges for system security and stability.
1.20 What is the mode of the system when a user program is running?
The mode of the system when a user program is running is user mode. This restricted mode:
• Prevents user programs from directly accessing critical system resources
• Enhances system security and stability
• Limits the instruction set available to the program
• Restricts memory access to only the program's allocated space
Key aspects:
• User programs can't execute privileged instructions
• Access to hardware is mediated by the operating system
• System calls are used to request services from the OS
• If a user program attempts a privileged operation, it triggers a trap to the OS
This separation ensures that user programs can't interfere with other programs or the operating
system itself, maintaining system integrity and security.

Imad Moukadem 12
1.21 Name at least two activities the operating system is responsible for in connection with
memory management.
Two key activities the OS is responsible for in memory management are:
1. Keeping track of which parts of memory are currently being used and by whom:
o Maintains a memory map or table
o Tracks allocated and free memory regions
o Ensures processes only access their own memory space
o Implements memory protection mechanisms
2. Deciding which processes to load into memory when memory space becomes available:
o Implements memory allocation algorithms
o Manages the swapping of processes between memory and disk
o Handles virtual memory systems, including page tables and page replacement
policies
o Optimizes memory usage to improve system performance
These activities are crucial for efficient multitasking, protecting processes from each other, and
maximizing the use of available physical memory.
Additional memory management activities include:
• Allocating and deallocating memory as processes are created and terminated
• Implementing memory compression techniques
• Managing shared memory between processes
• Handling memory fragmentation
1.22 True or False? Managing files is one of the most visible aspects of an operating system.
True. Managing files is one of the most visible aspects of an operating system. This is because:
• Users interact with files and directories frequently
• File management is crucial for data storage and retrieval
• It's a key interface between users and the system's storage capabilities
Key aspects of file management visible to users:
• Organizing files in hierarchical directory structures
• Providing interfaces for file creation, deletion, and modification
• Implementing file permissions and access controls

Imad Moukadem 13
• Offering file search and indexing capabilities
• Managing file metadata (creation date, size, type, etc.)
The file system's design and functionality significantly impact user experience and system usability,
making it a highly visible component of the operating system.
1.23 Name at least two activities the operating system is responsible for in connection with file
management.
Two key activities the OS is responsible for in file management are:
1. Creating and deleting files:
o Allocates space on storage devices for new files
o Updates file system metadata and directory structures
o Manages file naming and organization
o Handles file deletion and space reclamation
2. Creating and deleting directories:
o Maintains the hierarchical structure of the file system
o Manages parent-child relationships between directories
o Updates directory entries when files or subdirectories are added or removed
o Implements directory-specific operations (e.g., changing current directory)
Additional file management activities include:
• Implementing file access methods and permissions
• Managing file attributes and metadata
• Providing APIs for file operations to applications
• Implementing file locking mechanisms for concurrent access
• Handling file system consistency and recovery
These activities ensure efficient, secure, and organized storage and retrieval of data on computer
systems.
1.24 Name at least two activities the operating system is responsible for in connection with disk
management.
Two key activities the OS is responsible for in disk management are:
1. Free space management:
o Keeps track of available storage space on disks
o Maintains data structures (e.g., bitmaps, linked lists) to record free and used blocks

Imad Moukadem 14
o Implements algorithms to efficiently allocate and deallocate disk space
o Handles disk fragmentation issues
2. Storage allocation:
o Decides where to store files on the disk
o Implements allocation strategies (e.g., contiguous, linked, indexed allocation)
o Optimizes file placement for performance (e.g., minimizing seek times)
o Manages disk quotas for users or groups
Additional disk management activities include:
• Scheduling disk I/O operations to minimize seek time and rotational latency
• Implementing disk caching to improve read/write performance
• Managing RAID configurations for improved performance or reliability
• Handling bad sector mapping and disk error recovery
• Providing disk partitioning and volume management capabilities
Effective disk management is crucial for system performance, data integrity, and efficient use of
storage resources.
1.25 Of the following five forms of storage, rank them from fastest to slowest in terms of access
time: (1) main memory, (2) magnetic disk, (3) registers, (4) solid state disk, (5) cache.
Ranking from fastest to slowest in terms of access time:
1. Registers
2. Cache
3. Main memory
4. Solid state disk
5. Magnetic disk
Explanation:
• Registers are the fastest, located directly on the CPU for immediate access
• Cache (assuming CPU cache) is very fast but slightly slower than registers
• Main memory (RAM) is fast but slower than cache
• Solid state disks are much faster than magnetic disks but slower than RAM
• Magnetic disks are the slowest due to mechanical components

Imad Moukadem 15
This hierarchy reflects the trade-off between speed and capacity in computer storage systems, with
faster storage typically being more expensive and having less capacity.

Imad Moukadem 16
Section 1.6
1.26 What is the difference between protection and security?
The difference between protection and security in operating systems:
Protection:
• Focuses on controlling access to resources within the system
• Deals with internal threats and managing resource usage
• Implements mechanisms to isolate processes from each other
• Ensures that processes only access resources they are authorized to use
• Examples: Memory protection, file access controls, CPU scheduling
Security:
• Defends the system against external threats
• Deals with unauthorized access attempts, malware, and other external risks
• Implements mechanisms to authenticate users and protect against attacks
• Focuses on maintaining confidentiality, integrity, and availability of data and resources
• Examples: User authentication, encryption, firewalls, intrusion detection systems
While protection is primarily concerned with managing internal resource access, security addresses
broader threats from both internal and external sources. Both are crucial for maintaining a safe and
stable computing environment.

Imad Moukadem 17
Section 1.9
1.27 List at least four common kernel data structures.
Four common kernel data structures are:
1. Lists:
o Used for maintaining collections of data elements
o Examples: linked lists for managing processes or memory blocks
2. Stacks:
o Used for managing function calls and program execution
o Examples: call stacks for processes, interrupt handling stacks
3. Queues:
o Used for ordering tasks or data for processing
o Examples: ready queues for process scheduling, I/O request queues
4. Trees:
o Used for hierarchical data representation
o Examples: file system directories, process hierarchy trees
Additional common kernel data structures include:
• Hash tables: For fast data lookup
• Bitmaps: For representing status of resources
• Heaps: For priority queues in scheduling
• Graphs: For representing complex relationships (e.g., in networking)
These data structures are crucial for efficient management of system resources and
implementation of various kernel functionalities.
1.28 True or False? A bitmap of length N can be used to represent the status of 2! items.
False. A bitmap of length N can represent the status of N items, not 2! items.
Explanation:
• Each bit in the bitmap represents the status of one item
• A bitmap with N bits can represent N distinct items
• For example, an 8-bit bitmap can represent the status of 8 items, not 2^8 (256) items
Bitmaps are commonly used in operating systems for:
• Representing free/allocated blocks in file systems

Imad Moukadem 18
• Managing free pages in memory management
• Indicating active/inactive processes in process management
They provide a compact and efficient way to represent binary status information for a set of items,
where the number of items is equal to the number of bits in the bitmap.

Imad Moukadem 19
Section 1.10
1.29 List at least five different types of computing environments.
Five different types of computing environments are:
1. Traditional Computing:
o Desktop and laptop computers running full-featured operating systems
o Used for a wide range of personal and professional tasks
2. Mobile Computing:
o Smartphones and tablets with specialized mobile operating systems
o Focused on portability, touch interfaces, and energy efficiency
3. Client-Server Computing:
o Distributed system where clients request services from centralized servers
o Common in web applications, database systems, and enterprise environments
4. Peer-to-Peer Computing:
o Decentralized system where nodes act as both clients and servers
o Used for file sharing, distributed computing, and blockchain applications
5. Cloud Computing:
o Computing resources provided as a service over the internet
o Includes models like IaaS, PaaS, and SaaS
Additional environments include:
• Edge Computing: Processing data near the source of data generation
• IoT (Internet of Things): Network of interconnected physical devices
• Grid Computing: Distributed computing for solving large-scale problems
Each environment has unique characteristics and is suited for different types of applications and
use cases.

Imad Moukadem 20
Section 1.11
1.30 Provide an example of an open-source operating system.
An example of an open-source operating system is Linux. Key aspects of Linux include:
• Developed collaboratively by a global community of developers
• Source code is freely available for viewing, modification, and distribution
• Used in a wide range of devices, from smartphones to supercomputers
• Forms the basis for many distributions (e.g., Ubuntu, Fedora, Debian)
• Powers the Android mobile operating system
• Widely used in server environments and embedded systems
Benefits of Linux as an open-source OS:
• Transparency and security through community review of code
• Flexibility and customizability for various use cases
• No licensing costs for the core operating system
• Continuous improvement and rapid bug fixing
Other examples of open-source operating systems include FreeBSD, OpenBSD, and ReactOS. These
systems provide alternatives to proprietary operating systems and play a significant role in the
computing ecosystem.

Imad Moukadem 21

You might also like