Operating System Services – for user
Operating-system provides many services to the user such as:
User interface to interact with OS - e.g., CLI, GUI, touch screen interface.
Program execution
I/O operations
File-system manipulation
Communications
Error detection
Operating System Services – for system
Resource allocation
Accounting
Protection and Security
User Interface
Command Line Interpreter (CLI) allows direct command entry to OS.
Primary job is to fetch a command from user and execute it.
Windows and Unix CLI are not part of the kernel.
In Unix/Linux they are called shells (e.g., bash shell in Linux).
Sometimes the CLI itself contains the code to execute the command.
Sometimes just names of programs (used by Unix)
Adding new features doesn’t require shell modification!
Shells in Unix and Linux
Multiple shells are available (you can write your own shell
program!) Shells do not have the code to execute the command.
Eg: rm [Link] in terminal -> Invokes Shell -> Shell searches for file rm -> loads rm in
memory -> executes it with [Link] as parameter
Shell has no idea how ‘rm’ command is implemented and the system call used to
process the request
Operating System Structure
General-purpose OS is a very large program
Various ways to structure an OS
Monolithic
Layered
Microkernel
Modular
Simple/non-simple monolithic structure
Simple:
Has little structure
All the functionality of the kernel (process, memory, file, io) is placed into a single, static
binary file that runs in a single address space.
e.g. MS-DOS
Non-Simple
The kernel handles several OS tasks (CPU, memory management, file system)
systems programs
e.g. Original UNIX os
Advantages: Simple, Fast
Disadvantages: Harder to implement and extend
Layered Approach
OS divided into a number of layers (levels)
each layer is built on top of the lower ones
bottom layer (0) is the hardware
highest layer (n) is the user interface
layers are selected such that each layer uses functions (operations) and services of
only lower level layers
Disadvantages: tricky to delineate layers, slow - request needs to propagate all layers
with correct alls and param
Microkernel System Structure
Structures the OP by
removing all the nonessential components from the kernel
implementing them as user or system level programs
Microkernels provide minimal process and memory management
Communication between the modules takes place using message passing
Examples:
Mach
Mac OS x (open sourcE) kernel Darwin partly based on Mach
Windows NT, first release
Advantages: easy to extend, easy to port to new arch, more reliable and secure
Disadvantages: Performance overhead of user space to kernel space communication
Modular Structure using Modules
Kernel has a set separate core components with clearly defined interfaces
Additional services are linked via modules (either at boot time or run time)
Each module is loadable as needed within the kernel
Many modern OS implement loadable kernel modules - so far the best way to do OS
design
Solaris Modular Approach
Hybrid Systems
Most modern OS are actually not one pure model
Hybrid combines the multiple approaches to address performance, security, usability
needs
Linux and Solaris kernels are:
Monolithic for efficient performance
Modular - dynamic loading of functionality
System Calls and System Programs
System calls provide an interface to OS services
Syscalls are routines mostly written in high-level language like C or C++
Lower level tasks are written in Assembly
System calls are accessed by programs via a high level API rather than direct syscall use.
API's can be single or multiple syscalls
System program are programs associated with the OS but not necessarily part of the
kernel
some are simply user interfaces to syscalls; others are considerably more complex
Continuously running system-program processes are known as services, subsystems,
or daemons.