Lecture Note2operating - System - I - For - HND1
Lecture Note2operating - System - I - For - HND1
System 1
For
(NBTE CURRICULLUM)
Table of Content
1 ,
1.7 List some examples of Batch, real-time, Time sharing and net working operating systems 1.8
Self Assessment Exercises
Chapter 2 -Function and philosophy of operating systems 7-12
2.1 State the functions of operating systems in relation to memory management, processor
management, device management and interrupt handling and information management. 2.2
Characteristics of operating systems: concurrency, sharing, long-term storage and non-
determinacy.
2.3 State the features of operating systems: efficiency, reliability, maintainability and size.
2.4 Carry out operating systems design techniques: top-down, bottom up.
2.5 Self Assessment Exercises
Chapter 3 -Components Of An Operating System 13-22
3.1 Define operating system files –IO.SYS, COMMAND.COM, CONFIG.SYS.
3.2 Describe the functions of the basic commands: i.e. FORMAT, DIR, CHKDSK, TYPE,
BACKUP, MODE, SYS, AUTOEXEC, DISCOMP, FDISK, etc.
3.3 Self Assessment Exercises
Chapter 4 -General Concept of Operating System 23-26
4.1 Define Systems Programming.
4.2 Define application programming
4.3 Differentiate between a systems program and an application program.
4.4 Identify areas involved in systems programming e.g. compilers, assemblers, operating
systems, device drivers, interrupt handlers.
4.5 Self Assessment Exercises
Chapter 5 -Understanding The Use Of Utilities And Libraries 27-29
5.1 Definition of Utilities.
5.2 Utilities.
5.3 Library.
5.5 Relationship between Utilities to Libraries.
5.6 How Libraries and Utility programs
Chapter 6 -Input / Output Devices Handlers 30-32
6.1 I/O processing 6.2
interrupts, Masking.
6.3 Traps.
6.4 Differences between traps and interrupts
6.5 CPU States.
6.6 Self Assessment Exercises
2 ,
Chapter 1 Concept Of Operating System
1.0 Introduction
The term “Operating System” is becoming a popular term in our world. The entirety of this
material is to delve more into the introductory aspects of what operating is. An operating system
(OS) is the program that, after being initially loaded into the computer by a boot program,
manages all of the other application programs in a computer. The application programs make use
of the operating system by making requests for services through a defined application program
interface (API).
3 ,
1. DOS (Disk Operating System): DOS was crucial for early personal computers, providing
a command-line interface for users to interact with the system.
2. Windows: Microsoft Windows is widely used for its user-friendly graphical interface and
support for a vast array of applications.
3. UNIX: UNIX is known for its stability, multiuser capabilities, and networking features,
making it popular in server environments.
1.3 Objectives of OS
The primary goals of an operating system are as follows:
1. Convenience – An operating system improves the use of a machine. Operating systems
enable users to get started on the things they wish to complete quickly without having to cope
with the stress of first configuring the system.
2. Efficiency – An operating system enables the efficient use of resources. This is due to less
time spent configuring the system.
3. Ability to evolve – An operating system should be designed in such a way that it allows for
the effective development, testing, and introduction of new features without interfering with
service.
4. Management of system resources – It guarantees that resources are shared fairly among
various processes and users.
4 ,
networks. The operating system continuously monitors the system to locate or recognize
problems and protects the system from them.
5. Coordination between other software and users – The operating system (OS) allows
hardware components to be coordinated and directs and allocates assemblers, interpreters,
compilers, and other software to different users of the computer system.
6. Booting process – The process of starting or restarting a computer is referred to as
Booting. Cold booting occurs when a computer is totally turned off and then turned back
on. Warm booting occurs when the computer is restarted. The operating system (OS) is in
charge of booting the computer.
5 ,
2. Real-time Operating System: Responds to events or data inputs instantly, critical for
applications like embedded systems and control systems. E,g QNX, VxWorks
3. Time-sharing Operating System: Time sharing operating system allows multiple users
to share the computer resources simultaneously, providing each user with a small time
slice without each user knowing of other users. Unix, Linux (when used in a multi-user
environment).
4. Networking Operating System: Manages network resources and provides services to
connected computers. E.g. Novell NetWare, Microsoft Windows Server.
5. Distributed Operating System: This type of operating system is one in which several
computer systems connected through a single communication channel E.g. Solaris in
SUN, Mach/OS, UNIX, IBMRS/100
6. Single-User Operating System: The type of operating system that allows a single user
at a time for the use processor. E.g. MS-Dos
7. Multi-Users Operating System: The Multi-Users Operating System allows many users
at the same time to interact with the processor. E.g., Unix, Linux (when used in a
multiuser environment).
2.0 Introduction
6 ,
The guiding principles of an operating system is based on how data should be handled, detection
and handling of errors, with how the devices are communicated with the computer are termed
“The philosophy of computer operating system”. In computer world, to allocate resources
(software and hardware) of the computer system and manage them efficiently is one of its
cardinal philosophies. Another philosophy has to do with how it controls execution of user
programs and operation of I/O devices.
At the end of this chapter, students should be able to;
State the functions of operating systems in relation to memory management, processor
management, device management and interrupt handling and information management,
State the characteristics of operating systems: concurrency, sharing, long-term storage and
non-determinacy,
State the features of operating systems: efficiency, reliability, maintainability and size. and
Carry out operating systems design techniques: top-down, bottom up.
7 ,
a) Authentication and Authorization: Controls user access to resources and ensures data
security.
b) Firewalls and Antivirus: Protects the system from external threats.
5. Error Detection and Handling:
Logging and Reporting: Records system events for troubleshooting and maintenance.
6. Networking:
a) Communication Protocols: Facilitates communication between devices on a network.
b) Network Resource Sharing: Manages shared resources in a networked environment.
7. Job Scheduling:
a) Task Scheduling: Allocates system resources to different tasks or processes.
b) Priority Management: Determines the order in which tasks are executed.
8 ,
a) System Scalability: Supports the addition of hardware resources as the system load
increases.
b) Application Scalability: Accommodates the growth of software applications.
7. User Empowerment:
a) Ease of Use: Provides a user-friendly environment, regardless of the user's technical
expertise.
b) Customization: Allows users to tailor settings and configurations to their preferences.
8. Adaptability:
a) Support for Diverse Applications: Accommodates various types of software
applications, from simple utilities to complex databases and multimedia tools.
Characteristics:
a) Resource Allocation: Fairly distributing resources like CPU time, memory, and devices.
b) Isolation: Ensuring that one user's actions do not interfere with another user's work.
c) Access Control: Managing permissions to prevent unauthorized access.
(3) Long-Term Storage:
Definition: Managing persistent data storage on non-volatile media (e.g., hard drives, SSDs).
Characteristics:
a) File System: Organizing and maintaining files on storage devices.
9 ,
b) Data Integrity: Ensuring the accuracy and consistency of stored data.
c) Backup and Recovery: Implementing mechanisms for data backup and restoration.
(4) Non-Determinacy:
Definition: The inability to predict the exact timing or order of events in a system.
Characteristics:
a) Interrupt Handling: Dealing with unpredictable external events that require immediate
attention.
b) Asynchronous Operations: Supporting operations that do not follow a predetermined
sequence.
c) Real-Time Constraints: Meeting timing requirements for critical tasks in real-time
systems.
1 ,
0
Features:
a) Footprint: Minimizing the amount of system resources (memory, storage) required.
b) Scalability: Adapting to varying workloads and system growth.
c) Code Optimizations: Efficiently written code to reduce size and improve performance.
Challenges:
i. Detailed Design Dependency: May encounter difficulties when trying to fit detailed designs
into the overall structure.
2. Bottom-Up Design:
Approach: ii. Start with Detailed Components: Begin with the design of individual, low-level
components.
iii. Build Higher-Level Abstractions: Assemble these components into higher-level
abstractions and subsystems.
iv. Iterative Process: Continue the process iteratively, combining components into larger
structures.
1 ,
1
Advantages:
i. Early Prototyping: Allows for the early development and testing of individual components.
ii. Incremental Development: Permits the gradual construction of the system, making it easier
to identify and address issues.
Challenges:
i. Integration Complexity: May encounter challenges when integrating diverse components
into a coherent system.
ii. Risk of Incomplete System Vision: The overall system vision might be less clear until all
components are integrated.
3.0 Introduction
1 ,
2
An operating system is a large and
complex system that can only be
created by partitioning into small
parts. These pieces should be a
well-defined part of the system,
carefully defining inputs, outputs,
and functions.
Although Windows, Mac, UNIX,
Linux, and other OS do not have
the same structure, most
operating systems share
similar OS system components,
such as file, memory, process, I/O Figure 3.1: Component of O/S
device management.
At the end of this chapter, students should be able to;
Define operating system files such as IO.SYS, COMMAND.COM, CONFIG.SYS, and
Describe the functions of the basic commands: i.e. FORMAT, DIR, CHKDSK, TYPE,
BACKUP, MODE, SYS, AUTOEXEC, DISCOMP, FDISK, etc.
Process management keeps processes running efficiently. It also uses memory allocated to them
and shutting them down when needed.
The execution of a process must be sequential so, at least one instruction should be executed on
behalf of the process.
1 ,
3
Figure 3.2: The execution of a process of O/S
1 ,
4
The operating system has the following important activities in connection with file management:
i. File and directory creation and deletion.
ii. For manipulating files and directories. iii.
Mapping files onto secondary storage.
iv. Backup files on stable storage media.
3. (a) Network Management
Network management is the process of administering and managing computer networks. It
includes performance management, provisioning of networks, fault analysis, and maintaining the
quality of service.
A distributed system is a collection of computers or processors that never share their memory and
clock. In this type of system, all the processors have their local memory, and the processors
communicate with each other using different communication cables, such as fibre optics or
telephone lines.
The computers in the network are connected through a communication network, which can
configure in many different ways. The network can fully or partially connect in network
management, which helps users design routing and connection strategies that overcome
connection and security issues.
(b) Functions of Network Management
Network management provides the following functions, such as:
i. Distributed systems help you to various computing resources in size and function. They may
involve minicomputers, microprocessors, and many general-purpose computer systems. ii. A
distributed system also offers the user access to the various resources the network shares.
1 ,
5
iii. It helps to access shared resources that help computation to speed up or offers data
availability and reliability.
4. (a) Main Memory Management
Main memory is a large array of storage or bytes, which has an address. The memory
management process is conducted by using a sequence of reads or writes of specific memory
addresses.
It should be mapped to absolute addresses and loaded inside the memory to execute a program.
The selection of a memory management method depends on several factors.
However, it is mainly based on the hardware design of the system. Each algorithm requires
corresponding hardware support. Main memory offers fast storage that can be accessed directly
by the CPU. It is costly and hence has a lower storage capacity. However, for a program to be
executed, it must be in the main memory.
1 ,
6
The most important task of a computer system is to execute programs. These programs help you
to access the data from the main memory during execution. This memory of the computer is very
small to store all data and programs permanently. The computer system offers secondary storage
to back up the main memory.
Today modern computers use hard drives/SSD as the primary storage of both programs and data.
However, the secondary storage management also works with storage devices, such as USB flash
drives and CD/DVD drives. Programs like assemblers and compilers are stored on the disk until
it is loaded into memory, and then use the disk is used as a source and destination for processing.
(b) Functions of Secondary storage management
Here are some major functions of secondary storage management in the operating system: i.
Storage allocation
ii. Free space management iii.
Disk scheduling
1 ,
7
Figure 3.7: I/O Device Management in O/S
1 ,
8
Figure 3.8: I/O Device Management in O/S.
For example, memory addressing hardware helps to confirm that a process can be executed
within its own address space. The time ensures that no process has control of the CPU without
renouncing it. Lastly, no process is allowed to do its own I/O to protect, which helps you to keep
the integrity of the various peripheral devices.
Security can improve reliability by detecting latent errors at the interfaces between component
subsystems. Early detection of interface errors can prevent the foulness of a healthy subsystem
by a malfunctioning subsystem. An unprotected resource cannot misuse by an unauthorized or
incompetent user.
1 ,
9
Figure 3.9: Command Interpreter System in O/S.
Many commands are given to the operating system by control statements. A program that reads
and interprets control statements is automatically executed when a new job is started in a batch
system or a user logs in to a time-shared system. This program is variously called.
i. The control card interpreter,
ii. The command-line interpreter,
iii. The shell (in UNIX), and so on.
Its function is quite simple, get the next command statement, and execute it. The command
statements deal with process management, I/O handling, secondary storage management, main
memory management, file system access, protection, and networking.
2 ,
0
Role: It plays a crucial role in initializing the system and providing essential I/O functions during
the boot process.
(2) COMMAND.COM:
Function: COMMAND.COM is the command interpreter for MS-DOS. It is responsible for
executing commands entered by the user.
Role: It provides the command prompt and processes batch files, which are sequences of
MSDOS commands.
(3) CONFIG.SYS:
Function: CONFIG.SYS is a system configuration file that is read during the boot process. It
contains configuration directives and settings for the operating system and device drivers. Role:
It initializes device drivers, sets system parameters, and configures memory management.
(6) MODE:
2 ,
1
Function: MODE is used to configure system devices like the display and the printer. Usage:
MODE [device] [n],[m]
(7) SYS:
Function: SYS is used to transfer the MS-DOS system files to a disk.
Usage: SYS [drive1:][drive2:]
(8) AUTOEXEC.BAT:
Function: AUTOEXEC.BAT is a batch file that contains commands to be executed
automatically when the system boots.
Role: It allows users to customize the system environment at startup.
(9) FDISK:
Function: FDISK is used to create and manage disk partitions on a hard disk.
Usage: FDISK [/STATUS] [/MBR] [/PARTN[:ON|OFF]] [/PRI[:ON|OFF]] [/EXT[:ON|OFF]]
10. DEL (Delete):
Function: DEL is used to delete one or more files from a specified location.
Usage: DEL [drive:][path]filename [/P]
Example: DEL C:\Example\file.txt
11. COPY:
Function: COPY is used to copy one or more files from one location to another.
Usage: COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/L] [/A | /B ] source [/A | /B] [+ source [/A | /B]
[+ ...]] [destination [/A | /B]]
Example: COPY C:\Source\file.txt D:\Destination\
These commands and files were fundamental in the MS-DOS operating system and are reflective
of the computing landscape during that era. Many of these commands have equivalents or similar
functionalities in modern operating systems.
3.4 Self Assessment Exercises
1. Define the following operating system files;
(i) IO.SYS, (ii) COMMAND.COM, (iii) CONFIG.SYS.
2. Describe the following functions of the basic commands:
(i) FORMAT, (ii) DIR, (iii) CHKDSK, (iv) TYPE, (v) BACKUP, (vi) MODE,
(vii) SYS (viii) AUTOEXEC (ix) DISCOMP (x) FDISK
2 ,
2
Chapter 4 General Concept of Operating System
4.0 Introduction
As earlier defined in Chapter One, an operating system (OS) is system software that manages
computer hardware and software resources, and provides common services for computer
programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also
include accounting software for cost allocation of processor time, mass storage, peripherals, and
other resources.
For hardware functions such as input / output and memory allocation, the operating system acts
as an intermediary between programs and the computer hardware, although the application code
is usually executed directly by the hardware and frequently makes system calls to an OS function
or is interrupted by it. Operating systems are found on many devices that contain a computer –
from cellular phones and video game consoles to web servers and supercomputers.
2 ,
3
Define Systems Programming,
Define Application Programming,
Differentiate between a systems program and an application program, and
Identify areas involved in systems programming e.g. compilers, assemblers, operating
systems, device drivers, interrupt handlers.
2 ,
4
Application Program: Interacts with the underlying systems software to access hardware
resources indirectly.
(3 Scope:
Systems Program: Focuses on low-level details, resource management, and system stability.
Application Program: Focuses on user requirements, functionality, and ease of use.
Examples:
Systems Program: Operating systems, device drivers, compilers, assemblers.
Application Program: Word processors, web browsers, games, spreadsheet software.
Systems programmers work in these areas to create the foundational software components that
enable application programs to run effectively on computer systems
2 ,
5
4.5 Self Assessment Exercises
1. Define Systems Programming.
2. Define application programming
3. Differentiate between a systems program and an application program.
4. What are the areas that are involved in systems programming?
5. Explain the following;
(i) Compilers, (ii) Assemblers, (iii) Operating Systems, (iv) Device Drivers, (v) interrupt
handlers (vi) Trap
2 ,
6
Chapter 5 Understanding The Use Of Utilities And Libraries
5.0 Introduction
The system libraries define a standard set of functions through which applications can interact
with the kernel, and which implement much of the operating system functionality that does not
need full privileges of kernel code; 3. The system utilities are programs that perform individual,
specialized management tasks.
At the end of this chapter, students should be able to;
Define utilities,
Explain utilities,
Define Library,
Explain Libraries,
Relate utilities to Libraries, and
Implement libraries and utility programs.
5.2 Utilities:
Utilities serve a variety of purposes, including:
System Maintenance: Utilities help in tasks such as disk cleanup, defragmentation, and system
optimization.
Security: Antivirus utilities, firewall tools, and encryption software are examples of utilities that
enhance system security.
File Management: Utilities assist in tasks like copying, moving, and deleting files, as well as
searching for specific files.
2 ,
7
Data Recovery: Utilities may help recover lost or deleted data from storage devices.
2 ,
8
Write and compile functions or routines to be included in the library.
Create the library file (either static or dynamic) using a linker.
Document the functions and their usage for developers.
(2) Utility Program Implementation:
Identify the specific task or functionality the utility will perform.
Utilize appropriate libraries to streamline development.
Implement the utility program, considering user interface design, error handling, and
performance optimization.
Test the utility to ensure it functions as intended.
Both libraries and utility programs contribute to efficient and effective software development,
providing modular and reusable components for different aspects of system management and
application functionality.
6.0 Introduction
In this chapter, we shall examine how operating system handles input and output devices. We
already know that Device Handlers are software that interface between OS and I/O devices.
When I/O instruction is received, Device Handler converts generic instruction and internal
character code into format required by specific device. At the end of this chapter, students should
be able to;
Describe I/O processing,
Describe interrupts, masking,
Describe traps,
2 ,
9
Differentiate between traps and interrupts and Explain CPU states.
6.3 Traps:
A trap is a software-generated interrupt caused by an error or a specific condition detected during
program execution. Traps are typically triggered by instructions within a program and are used
for error handling or to invoke operating system services.
3 ,
0
Interrupts:
Source: External hardware or devices.
Trigger: Events that require immediate attention, often asynchronous.
Usage: Used for hardware signaling, asynchronous events, and device communication.
Traps:
Source: Generated by the program itself (software).
Trigger: Specific conditions or errors detected during program execution.
Usage: Used for error handling, invoking system services, and interacting with the operating
system.
Understanding CPU states is crucial for managing multitasking, handling interrupts, and
optimizing overall system performance. The CPU efficiently switches between these states to
execute multiple tasks concurrently and respond to events.
3 ,
1
3. Describe traps.
4. Differentiate between traps and interrupts
5. Explain CPU states.
6. Why is it important to understand the CPU state.
3 ,
2