OPERATING SYSTEM CHAPTER 01
OPERATING SYSTEM CHAPTER 01
Control Program:
Disadvantages of RTOS
Limited Tasks
Use heavy system resources
Complex Algorithms
Kernel in Operating
System:-
A kernel is the core part of an
operating system. It acts as a bridge between software applications and the
hardware of a computer.
The kernel manages system resources, such as the CPU, memory, and
devices, ensuring everything works together smoothly and efficiently.
It handles tasks like running programs, accessing files, and connecting to
devices like printers and keyboards.
An Operating System includes the kernel as its core, but also provides a
user interface, file system management, network services, and various
utility applications that allow users to interact with the system
System call
A system call is a way for a program to request services from the operating
system’s kernel. It allows user programs to interact with the OS through the
Application Program Interface (API). System calls are executed in kernel
mode and serve as the only entry points into the kernel.
Programs can request various services, and the OS responds by executing
system calls to fulfill them. These calls can be written in high-level languages
like C or Pascal or in assembly language. When a program executes a system
call, it switches to kernel mode, allowing the OS to handle the request and
return the result.
System calls are essential for accessing system resources efficiently. Without
them, programs would need to manage hardware and system services
independently, leading to inconsistencies and errors.
System calls are categorized based on the resources they manage, enabling
users to perform various operations through the operating system.
1. Process Control System Calls
These system calls manage processes, allowing users to:
Create and terminate processes
Suspend or resume processes
2. File Management System Calls
Files are essential for data storage and retrieval. Key system calls for file
management include:
Creating and deleting files
Opening and closing files
Reading from and writing to files
Managing directories
3. Device Management System Calls
To access I/O devices safely, system calls provide operations like:
Requesting and releasing devices
Performing read and write operations
Files are often treated as virtual devices, so many file system calls are
used for device access as well.
4. Information Maintenance System Calls
These system calls offer valuable system information, such as:
Process details
Memory usage
Device status
Disk space availability
5. Communication System Calls
Facilitate communication between processes, allowing them to:
Send and receive messages
Share data
6.Protection
Control access to resources
Get and set permissions
Allow and deny user access
General Structure of an Operating System (OS)
The OS resides in the main memory, but due to its increasing size, it is
divided into two parts:
1. Resident Part (Kernel) – Always present in memory, containing essential
programs.
2. Transient Part – Loaded only when needed to save memory.
4.Simple Structure OS
Early operating systems had a simple structure with minimal organization.
They were built as a collection of routines with no strict separation
between system components.
Characteristics:
Functions were loosely connected, leading to inefficiencies.
All system services (e.g., process management, I/O, memory management)
were combined into one layer.
Examples: MS-DOS, UNIX (early versions)
Advantages:
Easy to develop and modify.
Fast execution due to minimal layering.
Disadvantages:
Lack of modularity made debugging and maintenance difficult.
System crashes could affect the entire OS.
5.Microkernel OS Structure
A microkernel OS reduces the kernel size by moving non-essential
functions to user space, making the system more modular and secure.
Key Features:
The kernel handles only core functions like process scheduling and
interprocess communication.
Other services (e.g., file systems, device drivers) run in user mode as
separate processes.
Example: MINIX, QNX, macOS (partially), Windows NT
Advantages:
Better Security & Stability – A failure in one module does not crash
the whole system.
Modularity – Easier to update and extend.
Portability – Can be adapted to different hardware architectures.
Disadvantages:
Performance Overhead – More context switching and
communication between components can slow down execution.
Privileged and Non-Privileged Instructions in an Operating
System
Privileged Instructions
Privileged instructions can only be executed by the operating system (OS)
kernel or trusted processes. These instructions involve direct access to
hardware or critical system resources and can only run in Kernel Mode.
Characteristics:
If executed in User Mode, they are blocked and treated as illegal.
The OS ensures a timer is set before switching to a user program to
maintain control.
These instructions are crucial for system security and stability.
Examples:
I/O Operations & Halt Instructions – Controlling hardware devices.
Turning Off Interrupts – Prevents external disruptions.
Context Switching – Switching between processes.
Clearing Memory – Removing a process from memory.
Modifying Device-Status Table – Managing device access.
OS Role in Managing Privileged Instructions:
1. Access Control – Restricts use to authorized processes.
2. Memory Protection – Prevents unauthorized memory access.
Non-Privileged Instructions
Non-privileged instructions do not require direct hardware access and can be
executed by any process in User Mode. They perform general computing tasks
and ensure processes remain isolated for system stability.
Examples:
Reading Processor Status – Checking CPU state.
Reading System Time – Fetching the current time.
Generating a Trap Instruction – Requesting OS services.
Sending a Print Command – Printing output.
To switch from Kernel Mode to User Mode, a non-privileged instruction must
be used, ensuring smooth mode transitions without causing system
interruptions.