DIT 122 OPERATING SYSTEMS
Fundamentals of Operating Systems
Presented by: MESHACK KORIR
What is an operating system
• An operating system (OS) is a fundamental software that manages a
computer's hardware and software resources, acting as an
intermediary between the user and the computer's hardware.
• It handles essential tasks like file and memory management, process
control, and input/output operations, allowing users to interact with
the computer and run application programs.
Operating System Definitions
• Resource allocator – manages and allocates resources.
• Control program – controls the execution of user programs and the
operations of I/O devices.
• Kernel – The one program running at all times (all else being
application programs).
Components of OS:
1. Kernel.
2. Shell.
• The kernel is the core and always-active part of an operating system. It
manages hardware resources and facilitates communication between
hardware and software.
• The shell is a command interpreter that provides a user interface to
the operating system. It reads and interprets commands entered by
the user and passes them to the OS kernel for execution. While it can
launch application programs, its core function is to facilitate
interaction with the OS.
Functions of the Operating System
Important functions of an operating system:
1. Security
The operating system uses password protection to protect user data and
similar other techniques. it also prevents unauthorized access to
programs and user data.
2. Control over system performance
Monitors overall system health to help improve performance. records
the response time between service requests and the system response to
have a complete view of the system health. This can help improve
performance by providing important information needed to
troubleshoot problems.
3. Job accounting
The operating system keeps track of time and resources used by various
tasks and users. This information can be used to track resource usage for
a particular user or a group of users.
4. Error-detecting aids
• The operating system constantly monitors the system to detect
errors and avoid the malfunctioning of the the computer system.
5. Coordination between other software and users
• Operating systems also coordinate and assign interpreters,
compilers, assemblers, and other software to the various users of
the computer systems.
6. Memory Management
• The OS allocates and deallocates memory to different programs,
ensuring they have the space they need to run without
conflicting.
• It manages the primary memory or main memory. Main memory
is made up of a large array of bytes where each byte is assigned a
certain address. Main memory is a fast storage and it can be
accessed directly by the CPU. For a program to be executed, it
should first be loaded into the main memory.
7. Processor Management
In a multi-programming environment, the OS decides the order in
which processes have access to the processor and how much
processing time each process has. This function of the OS is called
process scheduling.
8. Device Management
An OS manages device communication via their respective drivers.
It performs the following activities for device management. Keeps
tracks of all devices connected to system. designates a program
responsible for every device known as the Input/Output controller.
Decides which process gets access to a certain device and for how
long. Allocates devices in an effective and efficient way. Deallocates
devices when they are no longer required.
9. File Management
• The OS provides a structured way to organize, store, retrieve, and
manipulate data through files and folders on storage devices
• A file system is organized into directories for efficient or easy
navigation and usage. These directories may contain other
directories and other files.
Moreover, an operating system also provides certain services to
the computer system in one form or the other. The operating
system provides certain services to the users:
1. Program Execution
The operating system is responsible for the execution of all types of
programs, whether they be user programs or system programs. The
operating system utilizes various resources available for the
efficient running of all types of functionalities.
2. Handling Input/Output Operations
The operating system is responsible for handling all sorts of inputs,
i.e, from keyboard, mouse, desktop, etc. The operating system
does all interfacing in the most appropriate manner regarding all
kinds of inputs and outputs.
3. Manipulation of the File System
• The operating system is responsible for making decisions
regarding the storage of all types of data or files, i.e, floppy
disk/hard disk/pen drive, etc. The operating system decides how
the data should be manipulated and stored.
4. Error Detection and Handling
• The operating system is responsible for the detection of any types
of errors or bugs that can occur during any task. The well-secured
OS sometimes also acts as a countermeasure for preventing any
sort of breach to the computer system from any external source
and probably handling them.
5. Resource Allocation
The operating system ensures the proper use of all the resources
available by deciding which resource to be used by whom for how
much time. All the decisions are taken by the operating system.
6. Accounting
The operating system tracks an account of all the functionalities
taking place in the computer system at a time. All the details such
as the types of errors occurred are recorded by the operating
system.
7. Information and Resource Protection
The operating system is responsible for using all the information
and resources available on the machine in the most protected way.
The operating system must foil an attempt from any external
resource to hamper any sort of data or information.
Evolution of OS/TYPES OF OPERATING SYSTEMS
1. Batch Operating System - This type of operating system does
not interact with the computer directly. There is an operator that
takes similar jobs having the same requirements and groups them
into batches. It is the responsibility of the operator to sort the jobs
with similar needs.
Advantages of a Batch Operating System:
• Reduced Idle Time: By processing jobs continuously, batch
systems minimize the time the CPU spends idle, improving overall
system efficiency.
• Efficient Resource Usage: Large, long-running, and repetitive jobs
can be processed effectively, allowing the processor to be used
more fully.
• Cost-Effective: Multiple users can share the system, making it a
cost-effective way to handle large workloads.
• High Throughput: Batch systems are designed to handle a large
volume of jobs efficiently, leading to increased system
throughput.
Disadvantages of Batch Operating System:
• Difficult Debugging: If a job contains an error, it's often only detected
after the job has completed, making it harder to find and fix the issue
quickly.
• No User Interaction: Because there's no direct interaction, users
cannot intervene if a job takes too long or encounters an error, leading
to long delays for results.
• Long Turnaround Time: Users may have to wait a long time for their
jobs to be executed, especially if there are delays in the batch
submission or if a single job in the batch causes the entire batch to
stop.
• Need for Trained Operators: Batch systems require skilled operators to
manage the input of jobs and the overall operation of the system.
• Backlog on Failure: A failure in any single job can halt the entire batch,
creating a backlog and delaying the completion of all subsequent jobs.
Examples of Batch based Operating System: Payroll System, Bank
Statements etc.
2. Time-Sharing Operating Systems
• A time-sharing operating system allows multiple users to access a
single computer simultaneously by quickly allocating small "time
slices" of the CPU to each task, creating the illusion of exclusive
access for each user.
Advantages of Time-Sharing OS:
• Reduced Costs: Multiple users can share hardware resources,
lowering overall hardware and software costs.
• Improved Efficiency: Minimizes CPU idle time, as the processor is
kept busy with various tasks.
• Quick Response Time: Users receive a fast, interactive response
from the system, making it feel as if they have sole access.
• Resource Sharing: Enables efficient sharing of resources like the
CPU, memory, and peripheral devices among many users.
• Reduced Software Duplication: Less need for duplicate software
for each user, improving overall system performance.
Disadvantages of Time-Sharing OS:
• Increased Complexity: The need for complex algorithms for
scheduling, resource management, and context switching makes the
system more complicated to develop and maintain.
• Security Risks: Sharing resources among multiple users can create
vulnerabilities for data breaches or unauthorized access.
• System Overload: If too many users or processes are active
simultaneously, the system's performance can degrade significantly.
• Resource Conflicts: Users might compete for the same limited
resources, potentially leading to conflicts.
• Overhead from Context Switching: Frequent context switching
consumes system resources, which can reduce overall performance.
Examples of Time-Sharing OSs are: Linux, Unix etc.
3. Distributed Operating System
• A distributed operating system (DOS) manages multiple,
independent computers connected via a network, allowing them
to function as a single, unified system for resource sharing and
coordinated tasks.
• It manages and controls separate computer nodes, sharing
resources like printers and processing power, and presenting
them to the user as a single entity.
Advantages of Distributed Operating Systems:
• Scalability: The system can be easily expanded by adding more
nodes to meet specific needs.
• Resource Sharing: Allows numerous users to share resources
such as files, printers, and applications across different nodes.
• Fault Tolerance: If one system or node fails, it does not affect the
others, ensuring continuous operation.
• Performance: Distributes the workload across multiple
processors, leading to faster data processing and improved
overall system performance.
• Reliability: Multiple independent systems contribute to a more
stable and reliable platform, as the failure of one system doesn't
halt the entire network.
• Cost-Effectiveness: In some cases, it can be more affordable by
allowing users to share hardware resources rather than each
having individual hardware
Disadvantages of Distributed Operating Systems:
• Complexity: Managing and troubleshooting a distributed system is
more complex than a single-user system due to the multiple
interconnected components.
• Security Issues: Sharing resources over a network introduces
vulnerabilities, making it more challenging to secure the system and
protect data.
• High Cost: The initial setup, hardware, and software costs can be high,
requiring significant investment in servers and networking.
• Communication Overhead: The constant communication required
between nodes can lead to network latency and consume bandwidth,
potentially slowing down operations.
• Difficult Debugging: Identifying and resolving errors in a complex,
multi-node environment is a significant challenge.
• Data Consistency: Ensuring that data remains consistent across all the
different nodes in the system can be a complex task.
Examples of Distributed Operating System are- LOCUS .
4. Network Operating System
• A Network Operating System (NOS) is specialized software that
manages and controls network resources, allowing computers to
communicate and share files, printers, and other applications
Advantages of Network Operating System:
• Centralized Management and Control: NOS provides a central location
for managing and controlling network resources, making it easier to
administer the network.
• Enhanced Security: They offer robust security features, such as
password-protected logins, access control, and authentication, to
protect network resources and data.
• Remote Access: Users can access shared resources and applications
from remote locations, increasing flexibility and accessibility.
• Efficient Resource Sharing: NOS enables multiple users to share
resources like files, printers, and applications concurrently, improving
efficiency and productivity.
• Scalability: The architecture of a NOS allows for easier integration of
new hardware and technologies as the network grows.
• Centralized Data Backup: Networks with a NOS often have centralized
backup services, ensuring that data is backed up efficiently and
securely from a single location.
Disadvantages of Network Operating System:
• High Cost: Implementing a NOS requires purchasing expensive servers
and specialized software, which can be a significant initial investment.
• Dependency on the Central Server: The network's operations rely
heavily on the central server; if the server fails, it can lead to a
network outage and downtime.
• Complexity: Installing and managing a NOS can be complex, requiring
skilled technicians or administrators.
• Maintenance Requirements: Regular updates, maintenance, and
patches are necessary to ensure the network's security and
performance, adding to ongoing costs and effort.
• Potential for Overload: A high volume of requests from many clients
can overload the central server, leading to performance issues.
• Examples of Network Operating Systems are: Microsoft Windows
Server 2003, Microsoft Windows Server 2008, UNIX, Linux, Mac OS X,
Novell NetWare, and BSD, etc
5. Real-Time Operating System
• A real-time operating system (RTOS) is an OS designed for systems
with time-critical tasks that must complete within strict, predictable
deadlines, ensuring deterministic behavior and reliable execution for
applications like flight control systems and medical devices.
• We have two types of Real-Time Operating Systems:
1. Hard Real-Time Systems:
• These OSs are meant for applications where time constraints are very
strict and even the shortest possible delay is not acceptable. These
systems are built for saving life, like automatic parachutes or airbags,
which are required to be readily available in case of any accident.
Virtual memory is almost never found in these systems.
2. Soft Real-Time Systems:
• These OSs are for applications where the time constraint is less strict.
Advantages of RTOS:
• Predictable Performance: RTOSes ensure that critical tasks are
completed precisely within their defined deadlines, crucial for
safety and control systems.
• High Reliability & Availability: Designed for continuous
operation, RTOSes provide stable and error-free performance,
making them ideal for systems requiring 24/7 uptime.
• Efficient Resource Utilization: They are optimized to use system
resources effectively, maximizing performance and minimizing
overhead.
• Focus on Critical Tasks: RTOS prioritizes and manages time-
sensitive operations, ensuring that they are executed correctly
and without delay.
Disadvantages of RTOS:
• High Development Complexity: Developing and programming an
RTOS is significantly more challenging than working with
traditional operating systems, requiring specialized expertise.
• Increased Cost: The specialized hardware, software, and
development efforts required for an RTOS can result in higher
costs.
• Steep Learning Curve: Developers need to acquire specific
knowledge to effectively use, program, and debug RTOS-based
systems.
• Resource Constraints: For less complex applications or devices
with limited hardware, the overhead and specific requirements of
an RTOS might be too demanding.
Operating System(OS) Structures
• Operating systems have different structures, including monolithic (all
components in one large kernel), layered (OS divided into levels with strict
dependencies), microkernel (only essential services in the kernel, others in user
space), and modular (a core kernel with dynamically loadable modules added as
needed).
1. Monolithic Structure
• Description: All operating system services and code run in the same memory
space within a single, large binary file in kernel space.
• Pros: Fast execution due to minimal overhead, as all components have direct
access to each other. It is also simpler to design and implement initially.
• Cons: A single service failure can crash the entire operating system. The large
codebase can be complex and difficult to debug.
• Example: Early versions of Linux were monolithic.
2. Layered Structure
• Description: The OS is divided into multiple distinct layers, with hardware
at the bottom (layer 0) and the user interface at the top (layer N).
• Pros: Improved maintainability and easier debugging, as each layer
handles specific functionalities and only interacts with the layers
immediately above and below it.
• Cons: Can lead to a more complex design and slower performance due to
increased layers of abstraction and communication overhead.
•
• Example: A design that starts with hardware, then device drivers, then I/O
management, and so on, to the user interface.
3. Microkernel Structure
• Description: Only the essential functions, such as inter-process
communication (IPC) and scheduling, remain in the kernel. Other services,
like file systems and device drivers, are moved to user-space processes.
• Pros: Enhanced security and reliability, as the failure of a user-space
service does not directly affect the core kernel or other components.
• Cons: Requires more code to write and can have higher overhead due to
increased communication between user-space processes and the kernel.
• Example: Some modern operating systems use this approach for parts of
their architecture.
4. Modular Structure
• Description: A central kernel provides core services, and additional
functionality is added via dynamically loadable kernel modules
(LKMs). These modules can be loaded or unloaded as needed, either at
boot time or runtime.
• Pros: Offers a good balance between flexibility and performance. It allows
for the addition of new hardware support or features without modifying
the entire kernel, making it adaptable.
• Cons: Can introduce complexity in managing the interactions between the
core kernel and the various modules.
• Example: Sun Solaris is a well-known operating system that utilizes a
modular structure.