0% found this document useful (0 votes)
14 views14 pages

Operating System Structures

The document outlines key concepts related to operating systems, including services provided by the OS, user interfaces, system calls, and various design strategies. It discusses the booting process, performance monitoring tools, and the use of kernel modules in Linux. Additionally, it covers OS design goals, implementation, and debugging techniques, emphasizing the importance of flexibility and efficiency in modern operating systems.

Uploaded by

Irfan Ul Haq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views14 pages

Operating System Structures

The document outlines key concepts related to operating systems, including services provided by the OS, user interfaces, system calls, and various design strategies. It discusses the booting process, performance monitoring tools, and the use of kernel modules in Linux. Additionally, it covers OS design goals, implementation, and debugging techniques, emphasizing the importance of flexibility and efficiency in modern operating systems.

Uploaded by

Irfan Ul Haq
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Chapter Objectives

 Identify OS services.
 Explain system calls for OS services.
 Compare different OS design strategies (monolithic, layered, microkernel, etc.).
 Explain the booting process.
 Discuss performance monitoring tools and kernel modules in Linux.

1. Operating System Services

 An OS offers various services to users, programs, and other system programs. These
services make it easier for users to interact with the computer and for programs to
execute tasks efficiently.

1.1 User Services

 User Interface (UI):


o The UI can be a CLI, GUI, or touch screen interface.
o Example: Windows uses a GUI where users interact using a mouse and keyboard,
while Linux can use a CLI like Bash.
o Figure: A diagram showing the different types of interfaces (CLI, GUI, Touch
Screen).
 Program Execution:
o OS loads and runs programs and manages their termination.
o Example: Double-clicking a program icon in Windows launches the application,
and the OS manages its execution.
 I/O Operations:
o OS manages communication with input and output devices, ensuring that devices
like keyboards, printers, or screens work properly.
o Example: When printing a document, the OS manages the connection between
the application and the printer.
 File System Manipulation:
o OS provides services to create, delete, read, write, and manage files.
o Example: The File Explorer in Windows allows users to manage files visually,
while system calls like open () and read () in Linux provide similar
functionality.
 Communication:
o Processes often need to exchange data; this can happen locally or over a network.
o Example: Two applications using sockets to send and receive messages over a
network.
 Error Detection:
o OS monitors the system for errors in hardware, I/O devices, and software.
o Example: If a printer runs out of paper, the OS sends an alert.
1.2 System Services

 These services ensure the efficient operation of the computer itself, beyond user-oriented
tasks.
 Resource Allocation:
o OS allocates CPU time, memory, and other resources to processes efficiently.
o Example: When multiple programs run, the OS schedules their access to the CPU
using algorithms like Round Robin.
 Accounting:
o Keeps track of resource usage by each process for monitoring and billing
purposes.
o Example: Tracking CPU usage statistics for each application.
 Protection and Security:
o Ensures processes do not interfere with each other and protects against
unauthorized access.
o Example: User authentication through passwords or biometrics to gain system
access.
 Figure 2.1: Depicts a view of various OS services and their relationships (e.g., UI,
program execution, I/O operations, etc.).

2. User and Operating-System Interface

 OS interfaces allow users to interact with the system. There are several types:

2.1 Command Interpreters (CLI)

 Users type commands to execute tasks directly.


 Example: The bash shell on Linux where users enter commands like ls to list files.
 Figure 2.2: Shows the Bash shell in macOS.

2.2 Graphical User Interface (GUI)

 Provides a visual way to interact using icons and windows.


 Example: Windows and macOS both use GUIs, where users click on icons to open
programs or manage files.

 Figure 2.4: Shows the macOS GUI interface.

2.3 Touch-Screen Interface


 Common on mobile systems; users interact by tapping or swiping.
 Example: iPhone or Android systems where users tap icons or slide screens.

 Figure 2.3: Illustrates the iPhone touch screen interface.

2.4 Choice of Interface

 Users choose based on preference or system requirements. CLI is preferred by system


administrators, while GUI is favored by general users.

3. System Calls

 These provide an interface between a running program and the OS. They allow programs
to request services like file operations and process control.

3.1 Example of System Calls

 A system call sequence to copy data from one file to another involves multiple steps (e.g.,
open file, read file, write file, close file).
 Figure 2.5: Illustrates the sequence of system calls for copying a file in a simplified
manner.

3.2 Application Programming Interface (API)

 APIs like Windows API, POSIX API, or Java API allow programs to use system calls
without directly managing them, making programming easier.
 Figure 2.6: Shows the interaction between a user application, API, and system call
interface.

3.3 Types of System Calls

 Categories include:
o Process Control: Create, terminate, or manage processes.
o File Management: Create, delete, open, and close files.
o Device Management: Request, release, read, and write devices.
o Information Maintenance: System data, time/date settings.
o Communications: Manage communication between processes.
o Protection: Set file permissions and control access.
 Figure 2.8: Lists and explains the different types of system calls provided by the OS.

4. Operating System Structure

 OS design strategies differ based on efficiency and functionality.

4.1 Monolithic Systems

 The entire OS is integrated as a single large system (e.g., early MS-DOS).

4.2 Layered Approach

 Divides the OS into layers, each responsible for specific functions (e.g., UNIX).
4.3 Microkernel Systems

 Only essential services run in the kernel, with others running separately (e.g., Minix).

4.4 Modules

 Combines multiple design strategies; Linux uses loadable modules for flexibility.

5. Booting the Operating System

 Describes how the OS initializes hardware and loads the kernel.


 Example: BIOS/UEFI loading the bootloader (e.g., GRUB) which then loads the OS
kernel.

6. System Performance Monitoring

 Tools and techniques for monitoring CPU, memory, and I/O usage are discussed.
 Example: The top command in Linux shows real-time performance statistics.

7. Kernel Modules in Linux

 Modules add or remove capabilities without restarting the system.


 Example: Adding support for a new network driver using kernel modules.

8. Linkers and Loaders

 Linker: Combines object files into a single executable.


 Loader: Loads the executable into memory for execution.
 Figure 2.11: Illustrates the process from source code compilation to program execution.

9. Application Portability Across Operating Systems

 Applications can be designed to run across multiple OS platforms using APIs,


interpreters, or virtual machines (e.g., Java Virtual Machine).
 Discusses challenges like different system calls and binary formats.

1. Introduction to Operating-System Concepts

Operating systems (OS) are the software that manage hardware resources and provide services
for computer programs. They are vital for the functioning of computers, ranging from desktops
and servers to mobile devices and embedded systems.
2. Operating-System Design and Implementation

2.1. Design Goals

OS design begins by defining goals and specifications. Goals vary based on:

 System Type: Desktop, mobile, distributed, or real-time systems.


 User Requirements: Reliability, speed, and ease of use.
 Developer Requirements: Flexibility, efficiency, and maintainability.

Example: Requirements for a mobile OS (like iOS) focus on power efficiency, while desktop
systems (like Windows) prioritize multi-access capabilities.

2.2. Mechanisms and Policies

 Mechanisms: Define how tasks are executed (e.g., setting a timer for process control).
 Policies: Define what tasks should be executed (e.g., determining how long a process
should run).

Separating these ensures flexibility; mechanisms can adapt to different policies without major
system changes.

Example: Linux allows changes in scheduling policies without altering the underlying
mechanisms.

2.3. Implementation

Most modern OSs are written in higher-level languages (like C/C++), making them easier to
understand and portable across different hardware.

Example: Android uses C for its kernel and Java for its application frameworks to balance
performance and flexibility.

3. Operating-System Structure

3.1. Monolithic Structure

 All functionality is combined in a single, large binary file. This structure is efficient but
harder to maintain.
Figure: (Figure 2.12) The traditional UNIX system shows how components like file
systems, memory management, and CPU scheduling are tightly integrated in the kernel.

Example: Linux, while monolithic, supports dynamic modules to enhance flexibility.

3.2. Layered Approach

 Divides the OS into layers, each responsible for specific functions (e.g., memory
management, device control). This approach simplifies debugging and system updates.
Figure: (Figure 2.14) A layered OS where hardware is the bottom layer, and the user
interface is the top.

Example: Network protocols like TCP/IP also use a layered model for communication.

3.3. Microkernels

 A microkernel architecture keeps the core minimal, moving many services (like file
systems) to user space. This improves modularity and security but may reduce
performance due to message-passing overhead.
Figure: (Figure 2.15) Shows how services interact with the microkernel through message
passing.

Example: macOS uses the Mach microkernel, offering modularity but optimizing
communication for better performance.

3.4. Modules

 Modern OSs use loadable kernel modules (LKMs), allowing features to be dynamically
added or removed, enhancing flexibility while maintaining performance.

Example: Linux supports USB drivers as modules, loading them when a device is connected.

3.5. Hybrid Systems

 Most contemporary OSs use hybrid models, combining monolithic, microkernel, and
modular features for performance and adaptability.

Example: Windows combines monolithic and modular designs to optimize performance while
supporting subsystem flexibility (e.g., Windows Subsystem for Linux).

4. Building and Booting an Operating System

4.1. Operating-System Generation

Creating an OS involves configuring, compiling, and installing it on specific hardware. Steps


include:
 Writing source code.
 Configuring the system.
 Compiling and installing the OS.

Example: When building a Linux system, use make menuconfig to configure the kernel and
make to compile it.

4.2. System Boot

The boot process loads the OS into memory and starts it. BIOS or UEFI firmware initiates the
boot, loading the bootloader (e.g., GRUB) which then loads the kernel.

Example: Linux uses GRUB to manage boot parameters like selecting the kernel and configuring
the root file system.

5. Operating-System Debugging

Debugging is critical for maintaining and optimizing OS performance.

5.1. Failure Analysis

When an OS or process fails, the system captures a log or core dump for analysis.

Example: If Linux crashes, it writes a core dump that can be analyzed using debugging tools.

5.2. Performance Monitoring and Tuning

 Tools monitor performance by tracking system activity, such as CPU and memory usage.
Examples:
o ps for process monitoring.
o vmstat for memory statistics.
Figure: (Figure 2.19) Windows Task Manager displaying system information.

Example: Use the top command in Linux to view real-time process statistics.

5.3. Tracing

Tracing tools track specific events:

 strace traces system calls.


 gdb allows debugging at the source code level.

Example: strace can help identify system calls made by a process, aiding in debugging
application behavior.

6. BCC (BPF Compiler Collection)

BCC is a toolkit for advanced kernel tracing and debugging, offering low-overhead analysis tools
for Linux. It uses extended BPF (eBPF) to insert probes and monitor system behavior
dynamically.

Example: Using ./[Link] with BCC monitors disk I/O latency, helping system
administrators identify bottlenecks.

You might also like