Operating System
Unit 7: Operating System
Exam Focus: This unit is fundamentally important! Expect detailed questions on the functions and types of Operating Systems, the difference between GUI and TUI/CUI, and the booting process. Command-line questions are also common.
7.1 Introduction to Operating System (OS)
An Operating System (OS) is the most crucial piece of system software that manages computer hardware and software resources and provides common services for computer programs. It acts as an intermediary layer, shielding the user from the hardware's complexity and enabling efficient interaction with the machine.
-
Objectives of OS:
- Convenience: Makes the computer system user-friendly.
- Efficiency: Ensures optimal utilization of computer resources (CPU, Memory, I/O devices).
- Resource Management: Allocates and de-allocates hardware and software resources.
- Hiding Complexity: Abstract away the complexities of hardware interactions.
7.2 History and Evolution (Generations) of OS
Exam Question Alert: Understanding the evolution and generations of OS helps grasp their fundamental purposes. Questions often touch upon how OS capabilities advanced over time.
The evolution of operating systems has closely tracked advancements in computer hardware and user needs, leading to increasingly sophisticated and user-friendly systems. Each generation brought significant changes in how users interacted with computers and how resources were managed.
- First Generation (1940s-1950s - Vacuum Tubes): During this era, there was no true operating system as we know it today. Computers were massive machines, and programs were written in machine language (binary code) directly by programmers. Execution was a manual process, often involving plug boards and switches, with only one program running at a time. The primary focus was on performing complex calculations for scientific and military purposes.
- Second Generation (1950s-1960s - Transistors): The introduction of transistors led to smaller, faster, and more reliable computers. This period saw the emergence of rudimentary operating systems primarily for batch processing. Programmers would submit "jobs" (programs and data) on punched cards or magnetic tape, and the OS would execute them in batches without direct user interaction. The OS's main role was to handle job sequencing and basic I/O operations, improving efficiency over manual execution.
- Third Generation (1960s-1970s - Integrated Circuits): Integrated Circuits (ICs) brought further miniaturization and increased processing power. This generation marked the emergence of multiprogramming and time-sharing operating systems. Multiprogramming allowed the CPU to execute multiple jobs concurrently by switching between them when one job was waiting for I/O. Time-sharing enabled multiple users to share a single computer simultaneously, with the OS rapidly switching between users, giving each the illusion of having dedicated access. Examples include mainframe OS and early versions of UNIX.
- Fourth Generation (1970s-Present - Microprocessors): The invention of the microprocessor led to the development of personal computers (PCs), making computing accessible to individuals. This era saw the rise of user-friendly operating systems like MS-DOS, Windows, and Mac OS, which featured graphical user interfaces (GUIs). Distributed systems, client-server architectures, and network operating systems also became prominent, allowing computers to connect and share resources across networks.
- Fifth Generation (Present & Beyond - AI, Parallel Processing): This ongoing generation focuses on advanced computing paradigms. Operating systems are evolving to support intelligent systems (Artificial Intelligence), massive parallel processing, and distributed computing environments like cloud computing. Mobile operating systems (Android, iOS) have become dominant, and research continues into areas like quantum OS and advanced resource management for highly complex, interconnected systems.
7.3 Functions of OS
Exam Question Alert: Listing and explaining the major functions of an OS is a very frequent and high-scoring question.
The Operating System (OS) serves as the central coordinator and manager of all computer hardware and software resources. It performs several critical functions to ensure the efficient, reliable, and secure operation of the computer system, while also providing a user-friendly environment for applications and users.
-
Process Management: The OS is responsible for
managing the execution of all processes (programs in execution). This
involves:
- Process Creation and Termination: Creating new processes and ending existing ones.
- Scheduling: Allocating CPU time to different processes to ensure fair and efficient use of the processor.
- Synchronization: Coordinating the execution of multiple processes to prevent conflicts and ensure data integrity.
- Deadlock Handling: Detecting and resolving situations where processes are stuck waiting for each other.
-
Memory Management: The OS efficiently manages the
computer's primary memory (RAM). Key tasks include:
- Allocation and De-allocation: Assigning memory space to programs when they need it and reclaiming it when they are finished.
- Memory Protection: Ensuring that one program cannot interfere with the memory space of another.
- Virtual Memory: Using secondary storage to simulate larger primary memory, allowing programs to run even if they are larger than physical RAM.
-
File Management: The OS organizes, stores, retrieves,
and protects files and directories on storage devices. This includes:
- File Creation, Deletion, and Manipulation: Providing tools for users and applications to create, delete, copy, move, and modify files.
- Directory Management: Organizing files into a hierarchical directory structure for easy navigation and access.
- Access Control: Implementing permissions to control who can access, read, write, or execute specific files.
-
Device Management: The OS manages all input/output
(I/O) devices connected to the computer (e.g., keyboard, mouse,
printer, scanner, hard drive). It does this by:
- Device Drivers: Using specialized software (device drivers) to communicate with and control hardware devices.
- Allocation: Allocating devices to processes and managing their usage.
- Buffering and Spooling: Handling data transfer between devices and memory efficiently.
-
Security Management: Protecting system resources and
user information from unauthorized access and malicious activities.
This involves:
- Authentication: Verifying user identity (e.g., passwords, biometrics).
- Authorization: Granting specific permissions to users or processes based on their identity.
- Firewalls and Intrusion Detection: Protecting the system from external threats.
- Error Detection and Handling: The OS continuously monitors the system for errors, both hardware (e.g., memory errors, device failures) and software (e.g., application crashes). It takes appropriate corrective actions, such as displaying error messages, logging errors, or attempting to recover from failures, to ensure system stability and data integrity.
-
Command Interpretation (User Interface): The OS
provides an interface that allows users to interact with the computer
hardware and applications. This can be:
- Graphical User Interface (GUI): A visual interface using windows, icons, menus, and a pointer (mouse).
- Command Line Interface (CLI) / Text User Interface (TUI): A text-based interface where users type commands to interact with the system.
- Networking: Modern operating systems include networking capabilities, allowing computers to connect to other computers and share resources over a network. This involves managing network connections, protocols (like TCP/IP), and network devices.
7.4 Types of OS
Exam Question Alert: Be prepared to explain different types of Operating Systems with examples.
Operating Systems are categorized based on their working methodology, design principles, and the environment they are intended for. Each type is optimized for specific use cases, from single-user tasks to managing complex industrial systems or vast distributed networks.
| Type of OS | Description | Characteristics & Examples |
|---|---|---|
| Batch OS | Executes jobs in batches without direct user interaction. Tasks with similar requirements are grouped together and run sequentially. | Minimizes idle time of CPU. Suitable for large, repetitive tasks like payroll processing. Older mainframe systems. |
| Time-Sharing OS | Allows multiple users/tasks to share the computer simultaneously by allocating short CPU time slices to each. | Provides an interactive environment for multiple users, giving each the illusion of having a dedicated system. UNIX, mainframe OSs. |
| Multitasking OS | Allows a single user to run multiple programs concurrently on a single CPU by rapidly switching between processes. | Enhances user productivity by enabling simultaneous operation of various applications (e.g., browsing the web while editing a document). Windows, macOS, Linux desktops. |
| Multiprocessing OS | Manages multiple CPUs (processors) or CPU cores within a single computer system to execute multiple processes simultaneously. | Increases processing power and throughput. Used in servers and high-performance computing. Modern Windows, macOS, Linux. |
| Distributed OS | Manages a network of independent computers and makes them appear as a single, cohesive system to the user. | Enhances resource sharing, fault tolerance, and scalability. Used in network OSs, cloud computing environments, and clusters. |
| Network OS (NOS) | Runs on a server and provides the capability to manage network resources and services (e.g., security, file sharing, printer access) for connected clients. | Facilitates communication and resource sharing in a client-server environment. Windows Server, Ubuntu Server, Novell NetWare. |
| Real-Time OS (RTOS) | Designed for time-critical operations where tasks must be completed within strict deadlines, with minimal delay (guaranteed response times). | Used in embedded systems, industrial control, robotics, medical imaging systems, and aerospace systems where precision timing is critical. VxWorks, FreeRTOS. |
| Mobile OS | Specifically designed for mobile devices like smartphones and tablets, focusing on touch interfaces, power management, and connectivity. | Optimized for smaller screens, limited battery life, and often cloud integration. Android, iOS (Apple's mobile OS). |
| Embedded OS | Specialized operating systems designed to perform a dedicated function in a larger mechanical or electronic system. | Found in appliances, ATMs, traffic lights, smart devices. Often have limited resources and strict real-time requirements. |
| Multiprogramming OS | Allows multiple programs to reside in main memory simultaneously, with the CPU switching between them when one waits for I/O. | Maximizes CPU utilization by ensuring there's always a process to execute. Found in various modern OS implementations. |
7.5 System Architecture of OS
Exam Question Alert: Expect questions asking you to describe or draw the OS architecture and explain different architectural types.
The system architecture of an Operating System describes how its core components are structured internally and how they interact with each other and with the hardware. Different architectural designs offer various trade-offs in terms of performance, security, modularity, and ease of development.
-
Monolithic Architecture:
- Description: In a monolithic architecture, all OS services (process management, memory management, file system, device drivers, networking, etc.) run together in a single address space as one large program, known as the kernel. All components are tightly coupled and communicate directly.
- Advantages: Fast communication between services due to direct function calls, leading to high performance and efficiency. Simpler design for basic functionalities.
- Disadvantages: Lack of modularity makes it complex to develop, debug, and maintain. A bug in one service can crash the entire system. Difficult to extend or modify without recompiling the entire kernel.
- Examples: Early UNIX kernels, MS-DOS, Linux.
-
Microkernel Architecture:
- Description: A microkernel architecture keeps only the absolutely essential OS services (like inter-process communication, memory management, and basic process scheduling) within the kernel. Other services (such as file systems, device drivers, and network protocols) run as separate, isolated processes in user space. These services communicate with each other and the kernel via message passing.
- Advantages: More robust and reliable (a failure in a user-space service doesn't crash the entire kernel). More modular, easier to extend, port to new hardware, and debug. Enhanced security due to isolation of services.
- Disadvantages: Slower performance due to increased inter-process communication (IPC) overhead (message passing is slower than direct function calls). More complex to design and implement initially.
- Examples: Mach (used in early macOS), QNX, MINIX.
-
Layered Architecture:
- Description: The OS is broken down into several layers, where each layer provides services to the layer directly above it and requests services from the layer directly below it. The lowest layer interacts with the hardware, and the highest layer interacts with the user.
- Advantages: Modular design, making it easier to develop, debug, and maintain. Changes in one layer typically only affect adjacent layers.
- Disadvantages: Can be less efficient due to multiple layers of communication (a request might have to pass through several layers). Defining the layers and their functionalities can be complex.
- Examples: THE operating system, Multics.
-
Hybrid Kernel Architecture:
- Description: A hybrid kernel attempts to combine the benefits of both monolithic and microkernel architectures. It runs some services (like device drivers and file systems) in kernel space for performance, while others (like networking) might run in user space for modularity and stability.
- Advantages: Offers a balance between performance and modularity/security. Can be optimized for specific needs.
- Disadvantages: Can still be complex to design and manage the interaction between kernel-space and user-space components.
- Examples: Windows NT (and subsequent Windows versions), macOS (modern versions), some Linux distributions.
7.6 GUI vs. TUI/CUI
Exam Question Alert: Differentiating between Graphical User Interface (GUI) and Text/Command User Interface (TUI/CUI) is a very common question.
The user interface (UI) is the means by which a user interacts with a computer system or software application. The primary distinction in operating systems is between graphical interfaces, which are visually driven, and text-based interfaces, which rely on typed commands. Each has its own strengths and weaknesses, making them suitable for different users and tasks.
| Feature | GUI (Graphical User Interface) | TUI/CUI (Text/Command User Interface) |
|---|---|---|
| Interaction Method | Users interact with visual elements like windows, icons, menus, buttons, and scrollbars using a pointing device (mouse, trackpad) and keyboard. | Users interact by typing text commands at a command prompt. The system responds with text output. |
| Ease of Use | Highly user-friendly, intuitive, and easy for beginners to learn and navigate due to visual cues and direct manipulation. | Requires knowledge of specific commands and syntax, making it less intuitive for beginners but very powerful and efficient for experts. |
| Resource Requirements | Requires significant processing power, memory, and graphics capabilities to render visual elements. | Has low resource requirements, making it efficient for systems with limited hardware or for remote administration. |
| Speed & Efficiency | Can be slower for repetitive tasks due to reliance on mouse clicks and visual navigation. | Faster for experienced users performing repetitive tasks or complex operations through scripting and command chaining. |
| Flexibility & Control | Offers good control for general tasks but can be limited for very specific or advanced system configurations. | Provides precise and powerful control over the system, allowing for complex operations and automation through scripts. |
| Examples | Microsoft Windows, Apple macOS, modern Linux desktop environments (GNOME, KDE). | MS-DOS, Linux Bash terminal, Windows Command Prompt, PowerShell. |
7.7 The Booting System
Exam Question Alert: Understanding the booting process, especially warm vs. cold booting, is a frequent exam topic.
Booting is the fundamental process of starting a computer and loading its operating system into memory. It is a sequence of operations that initiates when power is turned on and concludes when the OS is fully loaded and ready for user interaction. This process ensures that all necessary hardware components are initialized and the software environment is prepared for execution.
-
Cold Booting (Hard Boot):
- Description: Starting the computer from a completely powered-off state. This involves applying power to all components, which then undergo a full initialization and self-test sequence.
- Process: All hardware components are reset, and the BIOS/UEFI performs a comprehensive Power-On Self-Test (POST). This ensures that all hardware is functioning correctly before the OS begins to load.
- When Used: Typically performed when first turning on a computer, after a complete shutdown, or when resolving system crashes that prevent a warm boot.
-
Warm Booting (Soft Boot / Restart):
- Description: Restarting the computer when it is already powered on, usually initiated from within the operating system (e.g., using the "Restart" option).
- Process: The OS performs a controlled shutdown, and then the system restarts without completely cutting power to all components. The BIOS/UEFI performs a less extensive POST, skipping some hardware checks, which makes the process faster.
- Advantages: Faster than a cold boot, as it skips some initial hardware checks. Less wear and tear on hardware components compared to a full power cycle.
- When Used: Commonly used after installing software updates, troubleshooting minor software issues, or when the system becomes unresponsive but not completely frozen.
-
Booting Process Steps (General Overview):
- 1. Power On Self Test (POST): When the computer is powered on (cold boot) or restarted (warm boot), the BIOS/UEFI (Basic Input/Output System / Unified Extensible Firmware Interface) firmware performs a series of diagnostic tests to ensure that essential hardware components (CPU, RAM, graphics card, keyboard, etc.) are present and functioning correctly. Any critical errors are usually indicated by beep codes or on-screen messages.
- 2. Bootstrap Loader: After a successful POST, the BIOS/UEFI locates the boot device (e.g., hard drive, SSD, USB drive) as configured in the system settings. It then reads the first sector of the boot device, which contains a small program called the bootstrap loader (or boot loader). This loader's job is to find and load the operating system.
- 3. OS Kernel Loading: The bootstrap loader then loads the core of the operating system, known as the kernel, into the computer's Random Access Memory (RAM). The kernel is the heart of the OS, responsible for managing system resources and providing essential services.
- 4. Initialization: Once the kernel is loaded, it takes over control of the computer. It initializes device drivers for all connected hardware, starts essential system services and background processes, sets up memory management, and finally launches the user interface (GUI or CLI), making the system ready for user interaction.
7.8 Windows and Linux OS: Settings, Properties, and Commands
Understanding how to manage and interact with popular operating systems like Windows and Linux is practical and often tested through command-line questions.
General Settings and Properties:
- Windows OS: Managed through the Control Panel and the Settings App. Users can configure hardware, network, user accounts, system appearance, privacy, and updates.
- Linux OS: Managed through GUI settings menus (like KDE, GNOME) for desktop environments, but also extensively through text-based configuration files and terminal commands for advanced control.
Installation Guides (Conceptual Overview):
Both Windows and Linux typically involve creating bootable media (USB/DVD), booting from it, and following an installer wizard that guides through partitioning, user setup, and software installation.
Common OS Commands (Windows CMD/Linux Terminal):
Exam Question Alert: You might be asked to provide the function and/or syntax of common OS commands.
Command-line interfaces (CLI) provide a powerful way to interact with operating systems directly by typing commands. While GUIs are popular for their ease of use, CLIs offer greater precision, automation capabilities (through scripting), and efficiency for experienced users and system administrators. Below are some common commands for Windows Command Prompt (CMD) and Linux Terminal.
| Command (Windows / Linux) | Description / Function | Example Syntax |
|---|---|---|
| CHKDSK (Windows) | Checks a logical disk for file system errors and can optionally scan for and recover bad sectors. |
CHKDSK C: /F /R (Checks drive C:, fixes errors,
recovers bad sectors)
|
| chkdsk (Linux - equivalent) |
While chkdsk is Windows-specific, Linux uses tools
like fsck (file system check) for similar purposes.
|
sudo fsck /dev/sda1 (Checks the specified partition)
|
| TREE (Windows) / tree (Linux) | Displays a graphical representation of the directory structure (folder and file hierarchy). |
TREE /F (Windows - displays files) tree -L 2 (Linux - displays 2 levels deep)
|
| ATTRIB (Windows) | Displays or changes file attributes (read-only, hidden, system, archive) for files and directories. |
ATTRIB +H "myfile.txt" (Hides myfile.txt)
|
| REN (Windows) / mv (Linux) |
Renames a file or directory. mv in Linux can also
move files.
|
REN oldname.txt newname.txt (Windows) mv oldname.txt newname.txt (Linux)
|
| COPYCON (Windows - Legacy) | A legacy command used to create a text file directly from the command prompt. User types content and presses Ctrl+Z then Enter to save. |
COPYCON newfile.txt
|
| LABEL (Windows) | Creates, changes, or deletes the volume label (name) of a disk drive. |
LABEL C: MyDrive (Sets label of C: to MyDrive)
|
| TYPE (Windows) / cat (Linux) | Displays the contents of a text file directly in the command prompt/terminal. |
TYPE document.txt (Windows) cat document.txt (Linux)
|
| PING (Windows / Linux) | Tests the reachability of a host on an Internet Protocol (IP) network and measures the round-trip time for messages. |
PING google.com
|
| MKDIR (Windows) / mkdir (Linux) | Creates a new directory (folder). |
MKDIR NewFolder (Windows) mkdir new_folder (Linux)
|
| CLS (Windows) / clear (Linux) | Clears the command prompt or terminal screen, removing previous commands and output. |
CLS (Windows) clear (Linux)
|
| CD (Windows) / cd (Linux) | Changes the current working directory. |
CD C:\Users\Admin (Windows) cd /home/user/documents (Linux)
|
| PATH (Windows) | Displays or sets the search path for executable files. When a command is entered, the OS searches these directories for the executable. |
PATH (Displays current path) PATH %PATH%;C:\MyTools (Adds a directory to path)
|
| SCANDISK (Windows - Legacy) | A diagnostic utility for checking and repairing file system errors on disk drives. Replaced by CHKDSK in modern Windows versions. |
SCANDISK C:
|
| MOVE (Windows) / mv (Linux) |
Moves files and renames directories. In Linux, mv
also renames.
|
MOVE file.txt C:\NewFolder (Windows) mv file.txt /home/user/new_folder (Linux)
|
| DIR (Windows) / ls (Linux) | Lists the contents of a directory (files and subdirectories). |
DIR /P (Windows - pauses after each screenful) ls -l (Linux - long listing format)
|
| COPY (Windows) / cp (Linux) | Copies one or more files from one location to another. |
COPY file.txt C:\Backup (Windows) cp file.txt /home/user/backup (Linux)
|
| DEL (Windows) / rm (Linux) | Deletes one or more files. |
DEL oldfile.txt (Windows) rm oldfile.txt (Linux)
|
| RMDIR (Windows) / rmdir (Linux) | Removes an empty directory. |
RMDIR EmptyFolder (Windows) rmdir empty_folder (Linux)
|
| HELP (Windows) / man (Linux) |
Provides help information for commands. man in Linux
provides a manual page.
|
HELP DIR (Windows) man ls (Linux)
|
Course Code: CMP 116
Credit Hours: 3
This unit provides comprehensive knowledge about Operating Systems, their functions, types, and management.
Important Questions
- Explain the roles of OS in the computer system. (7)
- Explain different types of Operating System? Differentiate between Graphical User Interface (GUI) and Text User Interface (TUI). (8)
- What is an operating system? Explain warm booting and cold booting. (8)
- Define operating system. Explain different functions of operating System in details. (7)
- Write short notes on: (Any two)
- System architecture of OS
- Booting in computer
- GUI vs TUI/CUI