0% found this document useful (0 votes)
10 views55 pages

Structure and Design of Operating Systems

Uploaded by

ezekiel nyamu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views55 pages

Structure and Design of Operating Systems

Uploaded by

ezekiel nyamu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 55

STRUCTURE AND

DESIGN OF
OPERATING SYSTEMS
Ass.Lecturer: Ezekiel Ogakhan Nyamu
United African University of Tanzania

[email protected]
•An operating system serves as the environment in which programs
run. Internally, operating systems differ significantly in structure and
organization, as they can be designed in various ways. Developing a
new operating system is a substantial project, requiring that the system's
goals be clearly defined before design work begins. These goals guide
the selection of algorithms and strategies used within the system.
•There are multiple ways to examine an operating system. One
perspective emphasizes the services it offers; another focuses on the
user and programmer interface; and a third considers its
components and how they interact. In this lectuer, we explore these
aspects to provide insights from the perspectives of users,
programmers, and OS designers. We look at the services an OS offers,
the methods used to deliver these services, debugging processes, and the
design methodologies employed.
1. OPERATING SYSTEM SERVICES
The operating system, in various forms, delivers specific services to the
computer system. One group of these services offers functions that are
beneficial to the user.
 User Interface
 Program Execution
 I/O Operations
 File System Manipulation
 Communications
 Error Detection
 Resource Allocation
 Accounting
 Protection and Security
User Interface
Almost all operating systems have a user interface (UI). Two types
of User Interface are Command Based Interface and Graphical User
Interface
Command Based Interface
Requires a user to enter the commands to perform different tasks like
creating, opening, editing or deleting a file, etc. The user has to
remember the names of all such programs or specific commands
which the operating system supports. The primary input device used
by the user for command based interface is the keyboard. Command-
based interface is often less interactive and usually allows a user to
run a single program at a time. Examples of operating systems with
command-based interfaces include MS-DOS and Unix.
Graphical User Interface (GUI)
The interface is a window system with a mouse that serves as a pointing device to direct
I/O, choose from menus, and make selections and a keyboard to enter text. Mobile
systems such as phones and tablets provide a touch-screen interface, enabling users to
slide their fingers across the screen or press buttons on the screen to select choices.
Program Execution:
The OS is in charge of running all types of programs,
whether they are user or system programs. The
operating system makes use of a variety of resources to
ensure that all types of functions perform smoothly.
Input/Output Operations:
The operating system is in charge of handling various
types of inputs, such as those from the keyboard, mouse,
and desktop. Regarding all types of inputs and
outputs, the operating system handles all interfaces in
the most appropriate manner

For instance, the nature of all types of peripheral devices, such as mice or keyboards,
differs, and the operating system is responsible for transferring data between them.
File System Manipulation:
The OS is in charge of deciding where data or files should be stored, such as on
a floppy disk, hard disk, or pen drive. The operating system determines how data
should be stored and handled.

Communications :
There are many circumstances in which one process needs to exchange
information with another process. Such communication may occur between
processes that are executing on the same computer or between processes that
are executing on different computer systems tied together by a network.
Communications may be implemented via shared memory, in which two or more
processes read and write to a shared section of memory, or message passing, in
which packets of information in predefined formats are moved between processes
by the operating system.
Error Detection:
The operating system needs to be detecting and correcting errors
constantly. Errors may occur in the CPU and memory hardware (such as a
memory error or a power failure), in I/O devices (such as a parity error on
disk, a connection failure on a network, or lack of paper in the printer), and in
the user program (such as an arithmetic overflow or an attempt to access an
illegal memory location). For each type of error, the operating system
should take the appropriate action to ensure correct and consistent
computing. Sometimes, it has no choice but to halt the system. At other
times, it might terminate an error-causing process or return an error code to a
process for the process to detect and possibly correct.
Resource Allocation:
The operating system guarantees that all available resources are properly
utilized by determining which resource should be used by whom and for
how long. The operating system makes all of the choices
Accounting:
The operating system keeps track of all the functions
that are active in the computer system at any one time.
The operating system keeps track of all the facts, including
the types of mistakes that happened.
Protection and Security :
The operating system is in charge of making the most
secure use of all the data and resources available
on the machine. Any attempt by an external resource to
obstruct data or information must be foiled by the
operating system.
2. USER AND OPERATING SYSTEM INTERFACE

There are different types of user interfaces each of


which provides a different functionality:
 Command Based Interface
 Graphical User Interface
 Touch Based Interface
 Voice Based Interface
 Gesture Based Interface
Command Interpreters
A command interpreter is a system software that understands and
executes commands that are entered interactively by a human or from
another program. Command interpreter is an important part of any
operating system. It provides an interface between the user and the
computer.Command interpreter is also called Command-Line Interface
Most operating systems, including Linux, UNIX and Windows, treat the
command interpreter as a special program that is running when a
process is initiated or when a user first logs on.

• A command interpreter is often also called a command shell or simply


a shell. A command shell also usually provides a set of programs or
utilities which allows ad users to perform file management functions.
• The shell utility provides a user interface to many system services. For
example, user requests such as listing file names in a directory, running a
program, logging out, may all be handled by the shell. The shell may
invoke other utilities to actually do the work; for example, directory file
listing is sometimes a utility program itself.
• The command interpreter itself contains the code to execute the
command. For example, a command to delete a file may cause the
command interpreter to jump to a section of its code that sets up the
parameters and makes the appropriate system call.
• User may choose among several different shells, including the C shell,
Bourne-Again shell, Korn shell, and others. Third-party shells and
free user-written shells are also available. A very popular shell on most
commercial variants of Unix is the Korn shell.

• Demonstrate MS-DOS and Linux


Graphical User Interface
• GUI provides a graphical interface for the user to interact
with the computer. It is the common user interface that
includes graphical representation like buttons and Marie
icons and communication can be performed by interacting
with these icons rather than the usual text-based or
command-based communication.
• The GUI actually translates user language, which comprises
simple one-line commands, single click and double clicks to
machine language or assembly language. The machine
understands machine language and hence the machine
responds to the task initiated, which is translated to use
language and communicated to the user via GUI.
Touch-Screen Interface
• The first touch screen phone was launched in 1992 by
IBM and was named IBM Simon. iPhone was the latest
invention of the touch screen phone which gets its
popularity in no time.
• Whether it is touch screen microwave, touch screen car
LCD, touch screen monitor, touch screen ATMs and
others. The interface of touch screen devices is made in
such a way that it is easy for people to use them.
Voice Based Interface
• Modern computers have been designed to address the needs
of all types of users including people with special needs and
people who want to interact with computers or smartphones
while doing some other task. For users who cannot use input
devices like the mouse, keyboard, and touchscreens, modern
operating systems provide other means of human-computer
interaction.Users today can use voice-based commands to
make a computer work in the desired way. Some operating
systems which provide voice-based control to users include
iOS (Siri), Android (Google Now or “OK Google”), Microsoft
Windows 10 (Cortana), and so on.
Gesture Based Interface
• Some smartphones based on Android and iOS as well as
laptops let users interact with the devices using
gestures like waving, tilting, eye motion, and
shaking. This technology is evolving faster and it has
promising potential for application in gaming, medicine,
and other areas.
3. SYSTEM CALLS

A system call is a mechanism that provides the interface


between a process and the operating system. It is a
programmatic method in which a computer
program requests a service from the kernel of the
OS. System call offers the services of the operating
system to the user programs via API (Application
Programming Interface). System calls are the only
entry points for the kernel system.
Shell: is the outermost layer of the operating system and serves as the interface between
the user and the kernel. It is essentially a command interpreter that allows users to interact
with the operating system by issuing commands. The shell can be either a command-line
interface (CLI) or a graphical user interface (GUI), depending on the OS design
Core Activities of the Shell
1. Command Interpretation: Reads and interprets user commands, sends them to the kernel,
and displays output.
2. Script Execution: Executes shell scripts to automate tasks using loops, conditions, and
functions.
3. User Interaction: Enables users to navigate, manage files, and configure settings through
CLI or GUI.
4. Process Control: Starts, stops, and manages processes, allowing users to control resource
allocation.
5. File Manipulation: Supports commands for creating, deleting, copying, and managing files
and directories.
6. Environment Customization: Allows users to customize settings, set environment
variables, and define aliases.


Kernel
The kernel is the core, fundamental part of an operating system that directly manages the
hardware and system resources. It is responsible for ensuring that applications and services
can access system resources, such as the CPU, memory, and I/O devices, safely and
efficiently. The kernel operates in a highly privileged mode, often called kernel mode, with
full access to all system resources
Core Activities of the Kernel
1. Process Management: Manages process creation, scheduling, and termination;
handles multitasking and inter-process communication.
2. Memory Management: Allocates memory to processes, manages virtual memory, and
ensures isolation between processes.
3. Device Management: Manages input/output devices through drivers, handles data
transfer, and prioritizes device access.
4. File System Management: Manages file operations (read, write, create, delete) and
controls file access and permissions.
5. Security and Protection: Enforces access controls, user authentication, and process
isolation to ensure security.
6. Error Detection and Handling: Monitors and handles system errors, ensuring stability
and performance.


Step 1) The processes executed in the user mode till the time a system call
interrupts it.
Step 2) After that, the system call is executed in the kernel-mode on a priority basis.
Step 3) Once system call execution is over, control returns to the user mode.,
Step 4) The execution of user processes resumed in Kernel mode

Need of System Call


 Reading and writing from files demand system calls.
 If a file system wants to create or delete files, system calls are required.
 System calls are used for the creation and management of new processes.
 Network connections need system calls for sending and receiving packets.
 Access to hardware devices like scanner, printer, need a system call.
4.Types of System calls

Here are the five types of System Calls in OS:


 Process Control
 File Management
 Device Management
 Information Maintenance
• Communications
Process Control
This system calls perform the task of process creation,
process termination, etc.
Functions:
 End and Abort
 Load and Execute
 Create Process and Terminate Process
 Wait and Signal Event
 Allocate and free memory
File Management
File management system calls handle file
manipulation jobs like creating a file, reading, and
writing, etc.
Functions:
 Create a file
 Delete file
 Open and close file
 Read, write, and reposition
 Get and set file attributes
Device Management
There are many devices connected to a system like the
printer, mouse, keyboard, hard disk, network
interface etc. System calls are needed for requesting a
device, reading from a device, writing to the device,
reposition the location from where the current read or write
can take place and finally releasing the device
Functions:
 Request and release device
 Logically attach/ detach devices
 Get and Set device attributes
Information Maintenance
It handles information and its transfer between the OS and the user
program.
There are system calls to get or set the time or date of a system, get
or set system data, get or set process, file or device attributes.
Functions:
• Get time or date, set time or date
• Get system data, set system data
• Get process, file or device attributes
• Set process, file or device attributes
Communication:
There are system calls for creating a communication connection with a
remote machine and to delete or terminate the connection. There are
system calls for sending and receiving messages over a communication
connectionFunctions:
 Create, delete communications connections
 Send, receive message
 Help OS to transfer status information
Important System Calls Used in OS
•wait(): A process needs to wait for another process to
complete its execution. This occurs when a parent process
creates a child process, and the execution of the parent process
remains suspended until its child process executes. The
suspension of the parent process automatically occurs with a
wait() system call. When the child process ends execution, the
control moves back to the parent process.
•fork():Processes use this system call to create processes that
are a copy of themselves. With the help of this system Call
parent process creates a child process, and the execution of the
parent process will be suspended till the child process executes.
•exec():This system call runs when an executable file in the
context of an already running process that replaces the
older executable file. However, the original process identifier
remains as a new process is not built, but stack, data, head, data,
etc. are replaced by the new process.
•kill():The kill() system call is used by OS to send a termination
signal to a process that urges the process to exit. However, a
kill system call does not necessarily mean killing the process and
can have various meanings.
•exit():The exit() system call is used to terminate program
execution. Specially in the multithreaded environment, this call
defines that the thread execution is complete. The OS reclaims
resources that were used by the process after the use of exit()
system call.
5. SYSTEM PROGRAMS

System programs provide a convenient environment for program development and


execution.

.software components that provide basic functions and services to both users and applications. These
programs act as intermediaries between the user or application software and the hardware by providing
essential functionalities to operate and manage the system effectively. Special software which give us
facility to manage and control the computer’s hardware and resources

It can be divided into:


 File manipulation
 Status information
 File modification
 Programming language support
 Program loading and execution
 Communications
 Application programs
File management.: These programs create, delete, copy, rename,
print, list, and generally access and manipulate files and directories.

Status information:Some programs simply ask the system for the


date, time, amount of available memory or disk space, number of
users, or similar status information. Others are more complex, providing
detailed performance, logging, and debugging information. Typically,
these programs format and print the output to the terminal or other
output devices or files or display it in a window of the GUI. Some
systems also support a registry, which is used to store and retrieve
configuration information.

File modification: .Several text editors may be available to create


and modify the content of files stored on disk or other storage
devices. There may also be special commands to search contents of
files or perform transformations of the text.
Programming-language support: Compilers, assemblers, debuggers, and
interpreters for common programming languages (such as C, C++, Java, and Python)
are often provided with the operating system or available as a separate download.
Program loading and execution: Once a program is assembled or compiled, it
must be loaded into memory to be executed. The system may provide absolute
loaders, relocatable loaders, linkage editors, and overlay loaders. Debugging
systems for either higher-level languages or machine language are needed as well.
Communications:These programs provide the mechanism for creating virtual
connections among processes, users, and computer systems. They allow users to
send messages to one another’s screens, to browse web pages, to send e-mail
messages, to log in remotely, or to transfer files from one machine to another.
Background services:
All general-purpose systems have methods for launching certain system-
programprocesses at boot time. Some of these processes terminate after completing
their tasks, while others continue to run until the system is halted. Constantly
running system-program processes are known as services, subsystems, or daemons.
OPERATING SYTEM DESIGN AND
IMPLEMENTATIOMN
OPERATING SYSTEM STRUCTURE
Operating system can be implemented with the help of various structures. The
structure of the OS depends mainly on how the various common components
of the operating system are interconnected and melded into the kernel.
Depending on this we have following structures of the operating system:
 Monolithic Structure
 Layered Approach
 Microkernels
 Modules
 Hybrid Systems
 macOS and iOS
 Android
SIMPLE STRUCTURE
Such operating systems do not have well defined structure and are small, simple and
limited systems. The interfaces and levels of functionality are not well separated. MS-
DOS is an example of such operating system. In MS-DOS application programs are able to
access the basic I/O routines. These types of operating system cause the entire system to
crash if one of the user programs fails. Diagram of the structure of MS-DOS is shown
below
Monolith Structure
• The central piece of code called kernel is responsible for
all major operations of an operating system. Such
operations includes file management, memory management,
device management and so on. The kernal is the main
component of an operating system and it provides all the
services of an operating system to the application programs
and system programs.
• The kernel has access to the all the resources and it acts as
an interface with application programs and the underlying
hardware. A monolithic kernel structure promotes
timesharing, multiprogramming model and was used in old
banking systems.
•Layered Approach
An OS can be broken into pieces and retain much more control
on system. In this structure the OS is broken into number of
layers (levels). The bottom layer (layer 0) is the hardware and
the topmost layer (layer N) is the user interface. These layers
are so designed that each layer uses the functions of the lower
level layers only. This simplifies the debugging process as if
lower level layers are debugged and an error occurs during
debugging then the error must be on that layer only as the lower
level layers have already been debugged. The main disadvantage
of this structure is that at each layer, the data needs to be
modified and passed on which adds overhead to the system.
Moreover careful planning of the layers is necessary as a layer can
use only lower level layers. UNIX is an example of this structure.
Layered OS
Micro-kernel:
This structure designs the operating system by
removing all non-essential components from the
kernel and implementing them as system and user
programs. This result in a smaller kernel called the micro-
kernel.
Modular structure or approach:

The best approach for an OS. It involves designing of a modular kernel. The kernel
has only set of core components and other services are added as dynamically loadable
modules to the kernel either during run time or boot time. It resembles layered
structure due to the fact that each kernel has defined and protected interfaces but it is
more flexible than the layered structure as a module can call any other module. For
example Solaris OS
Solaris modular approach
Hybrid system

You might also like