Definition

Operating System (OS) Services are the facilities and functions provided by the operating system to users and application programs. These services help users execute programs, manage hardware resources, and ensure efficient, secure, and reliable operation of the computer system.


Objectives of OS Services

  • Provide a convenient environment for users.
  • Manage computer hardware resources efficiently.
  • Execute application programs.
  • Ensure security and protection.
  • Improve system performance and reliability.

Major Operating System Services

1. User Interface (UI)

The User Interface allows users to interact with the operating system.

Types

  • Command Line Interface (CLI): Users enter text commands.
  • Graphical User Interface (GUI): Users interact through windows, icons, menus, and a mouse.

Examples:

  • CLI: Linux Terminal, Windows Command Prompt
  • GUI: Windows Desktop, macOS Finder

2. Program Execution

The OS loads a program into memory, executes it, and terminates it after completion.

Functions

  • Load a program into memory
  • Allocate required resources
  • Execute the program
  • Free resources after execution

Example: Running Microsoft Word or a web browser.


3. Input/Output (I/O) Operations

The operating system manages communication between programs and input/output devices.

Devices Managed

  • Keyboard
  • Mouse
  • Printer
  • Monitor
  • Hard Disk
  • USB Devices

Example: Printing a document or reading data from a USB drive.


4. File System Management

The OS organizes and manages files and directories stored on storage devices.

Functions

  • Create files
  • Open files
  • Read and write files
  • Rename files
  • Delete files
  • Create and manage folders

Example: Saving a document in the “Documents” folder.


5. Communication (Inter-Process Communication)

The OS enables communication between different processes running on the same computer or across a network.

Methods

  • Shared Memory
  • Message Passing
  • Pipes
  • Sockets

Example: A web browser communicating with a web server.


6. Error Detection

The OS detects hardware and software errors and takes corrective action.

Types of Errors

  • Memory errors
  • Disk failures
  • CPU errors
  • Input/Output errors

Example: Displaying an error message when a disk is full.


7. Resource Allocation

The OS allocates system resources among multiple users and programs.

Resources

  • CPU
  • Memory (RAM)
  • Disk Space
  • Input/Output Devices

Example: Sharing CPU time between multiple running applications.


8. Accounting

The OS keeps track of resource usage for monitoring and billing purposes.

Information Recorded

  • CPU usage
  • Memory usage
  • Disk usage
  • User activity

Example: Monitoring resource usage in Task Manager.


9. Protection and Security

The OS protects data and system resources from unauthorized access.

Security Features

  • User authentication (login)
  • Password protection
  • File permissions
  • Access control
  • Data encryption

Example: Only authorized users can access protected files.


Diagram of OS Services

                  Users
                     |
                     โ–ผ
          +----------------------+
          |   Operating System   |
          +----------------------+
          | User Interface       |
          | Program Execution    |
          | I/O Operations       |
          | File Management      |
          | Communication        |
          | Error Detection      |
          | Resource Allocation  |
          | Accounting           |
          | Protection & Security|
          +----------------------+
                     |
                     โ–ผ
              Computer Hardware

Advantages of OS Services

  • Simplifies interaction with the computer.
  • Efficiently manages hardware resources.
  • Supports multitasking and multi-user environments.
  • Improves system performance.
  • Provides data security and protection.
  • Detects and handles system errors.
  • Enables communication between processes.

Applications of OS Services

  • Running application software
  • Managing files and storage
  • Internet browsing
  • Database management
  • Networking
  • Multimedia applications
  • Cloud computing

System Calls, System Programs, and OS Structure

1. System Calls

Definition

A System Call is a mechanism through which a user program requests a service from the Operating System (OS) kernel. It acts as an interface between user applications and the operating system.

Since application programs cannot directly access hardware resources, they use system calls to request services such as file handling, process creation, memory allocation, and communication.

System Call Flow

+--------------------+
|   User Program     |
+--------------------+
          |
          | System Call
          โ–ผ
+--------------------+
| Operating System   |
|      Kernel        |
+--------------------+
          |
          โ–ผ
+--------------------+
|      Hardware      |
+--------------------+

Types of System Calls

1. Process Control System Calls

Definition

Process control system calls are used to create, execute, suspend, and terminate processes.

Functions

  • Create a new process
  • Execute a process
  • Terminate a process
  • Wait for process completion
  • Allocate and free memory

Common System Calls (UNIX/Linux)

  • fork() โ€“ Creates a new process.
  • exec() โ€“ Replaces the current process with a new program.
  • wait() โ€“ Waits for a child process to finish.
  • exit() โ€“ Terminates a process.

Example

When you open a web browser, the operating system creates a new process using process control system calls.


2. File Management System Calls

Definition

File management system calls are used to perform operations on files and directories.

Functions

  • Create a file
  • Open a file
  • Read data from a file
  • Write data to a file
  • Close a file
  • Delete or rename a file

Common System Calls

  • open()
  • read()
  • write()
  • close()
  • unlink()

Example

Saving a document in a text editor involves opening the file, writing data, and closing it.


3. Device Management System Calls

Definition

These system calls manage communication between software and hardware devices.

Functions

  • Request a device
  • Release a device
  • Read from a device
  • Write to a device
  • Get or set device attributes

Devices Managed

  • Printer
  • Keyboard
  • Mouse
  • Disk Drive
  • Scanner

Example

Printing a document requires the operating system to communicate with the printer using device management system calls.


4. Information Maintenance System Calls

Definition

Information maintenance system calls retrieve or update information about the system.

Functions

  • Get current date and time
  • Get process information
  • Get system information
  • Set system parameters

Common System Calls

  • getpid()
  • time()
  • uname()

Example

Displaying the current system date and time.


5. Inter-Process Communication (IPC)

Definition

Inter-Process Communication (IPC) allows two or more processes to exchange data and synchronize their activities.

IPC Methods

  • Shared Memory
  • Message Passing
  • Pipes
  • Message Queues
  • Sockets
  • Signals

Example

A web browser communicates with a web server using sockets.

Advantages

  • Data sharing
  • Faster communication
  • Process synchronization
  • Resource sharing

6. Protection System Calls

Definition

Protection system calls ensure the security of the operating system and its resources.

Functions

  • User authentication
  • Access control
  • File permissions
  • Memory protection
  • Process protection

Example

A user must enter the correct username and password before accessing the system.


Summary of System Calls

TypePurposeExamples
Process ControlManage processesfork(), exec(), wait(), exit()
File ManagementManage filesopen(), read(), write(), close()
Device ManagementControl hardware devicesRead/write device, request/release device
Information MaintenanceRetrieve or update system informationgetpid(), time(), uname()
Inter-Process CommunicationCommunication between processesPipes, Shared Memory, Sockets
ProtectionSecurity and access controlAuthentication, file permissions

2. System Programs

Definition

System Programs are utility programs provided by the operating system that create a convenient environment for users and programmers. They are not part of the kernel but use operating system services.

Types of System Programs

1. File Management Programs

  • Copy files
  • Move files
  • Rename files
  • Delete files
  • List directory contents

Example: File Explorer (Windows), cp, mv, rm commands in Linux.


2. Status Information Programs

Display system information such as:

  • Date and time
  • Memory usage
  • Disk usage
  • CPU usage

Example: Task Manager (Windows), top command (Linux).


3. File Modification Programs

Used to edit files.

Examples:

  • Notepad
  • Text editors
  • Word processors

4. Programming Language Support

Provides tools for software development.

Examples:

  • Compiler
  • Assembler
  • Interpreter
  • Debugger

5. Program Loading and Execution

Loads executable programs into memory and starts their execution.


6. Communication Programs

Used for communication over networks.

Examples:

  • Email applications
  • Web browsers
  • FTP clients
  • Chat applications

3. Operating System Structure

The structure of an operating system defines how its components are organized and interact with each other.


A. Simple Structure

Definition

The entire operating system is implemented as one large program where all components interact directly.

Diagram

Applications
      |
Operating System
      |
Hardware

Advantages

  • Simple design
  • Fast execution

Disadvantages

  • Difficult to maintain
  • Difficult to debug
  • Poor security

Example: MS-DOS


B. Layered Structure

Definition

The operating system is divided into several layers. Each layer provides services to the layer above it and uses services from the layer below.

Diagram

+----------------------+
| User Applications    |
+----------------------+
| User Interface       |
+----------------------+
| File Management      |
+----------------------+
| Memory Management    |
+----------------------+
| Process Management   |
+----------------------+
| Hardware             |
+----------------------+

Advantages

  • Easy to develop and maintain
  • Better security
  • Easy debugging

Disadvantages

  • Slight performance overhead

Example: THE Operating System


C. Microkernel Structure

Definition

A Microkernel keeps only essential functions inside the kernel, while other services run in user space.

Kernel Functions

  • CPU Scheduling
  • Memory Management
  • Inter-Process Communication (IPC)

User Space Services

  • File System
  • Device Drivers
  • Network Services

Diagram

Applications
      |
User Space Services
      |
Microkernel
      |
Hardware

Advantages

  • High reliability
  • Better security
  • Easy to extend

Disadvantages

  • Communication overhead may reduce performance

Examples: MINIX, QNX


D. Modular Structure

Definition

The kernel is divided into independent modules that can be loaded or removed dynamically.

Diagram

           Kernel
      /      |       \
 File Module Memory Module Network Module
              |
           Hardware

Advantages

  • High performance
  • Flexible and extensible
  • Easy maintenance

Disadvantages

  • More complex than a simple structure

Examples: Linux, Solaris


Comparison of OS Structures

StructureAdvantagesDisadvantagesExample
SimpleFast, simple designDifficult to maintain and secureMS-DOS
LayeredModular, secure, easy to debugPerformance overheadTHE OS
MicrokernelReliable, secure, extensibleCommunication overheadMINIX, QNX
ModularFlexible, efficient, maintainableMore complex designLinux, Solaris

Related Posts