0% found this document useful (0 votes)
9 views26 pages

Operating Systems Notes-Unit 1

An Operating System (OS) is essential software that serves as an interface between computer hardware and users, enabling the execution of applications and managing system resources. Key functions of an OS include memory management, process scheduling, device management, and file management, ensuring efficient and secure operation of the computer system. The document also discusses various types of computer architectures, including single-processor and multiprocessor systems, and highlights the importance of multiprogramming and time-sharing in enhancing CPU utilization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views26 pages

Operating Systems Notes-Unit 1

An Operating System (OS) is essential software that serves as an interface between computer hardware and users, enabling the execution of applications and managing system resources. Key functions of an OS include memory management, process scheduling, device management, and file management, ensuring efficient and secure operation of the computer system. The document also discusses various types of computer architectures, including single-processor and multiprocessor systems, and highlights the importance of multiprogramming and time-sharing in enhancing CPU utilization.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

Unit I

Chapter – I

Introduction - Operating System


An Operating System (OS) is a software that acts as an interface between computer hardware
components and the user. Every computer system must have at least one operating system to run other programs.
Applications like Browsers, MS Office, Notepad Games, etc., need some environment to run and perform
its tasks.
The OS helps you to communicate with the computer without knowing how to speak the computer’s
language. It is not possible for the user to use any computer or mobile device without having an operating
system.

An operating system (OS) is system software that manages computer hardware, software resources, and
provides common services for computer programs.

What an Operating Systems do

An operating system is the most important software that runs on a computer. It manages the
computer's memory and processes, as well as all of its software and hardware.
It also allows you to communicate with the computer without knowing how to speak the computer's
language. Without an operating system, a computer is useless.
An Operating System (OS) is an interface between a computer user and computer hardware. An operating
system is a software which performs all the basic tasks like file management, memory management, process
management, handling input and output, and controlling peripheral devices such as disk drives and printers.
The operating system (OS) manages all of the software and hardware on the computer. It performs basic
tasks such as file, memory and process management, handling input and output, and controlling peripheral
devices such as disk drives and printers.
Most of the time, there are several different computer programs running at the same time, and they all
need to access your computer’s central processing unit (CPU), memory and storage. The operating system
coordinates all of this to make sure each program gets what it needs.
An Operating System acts as a communication bridge (interface) between the user and computer
hardware. The purpose of an operating system is to provide a platform on which a user can execute programs
in a convenient and efficient manner.
An operating system is a piece of software that manages the allocation of computer hardware. The
coordination of the hardware must be appropriate to ensure the correct working of the computer system and
to prevent user programs from interfering with the proper working of the system.
Example: Just like a boss gives orders to his employee, in a similar way we request or pass our orders
to the Operating System. The main goal of the Operating System is to thus make the computer environment
more convenient to use and the secondary goal is to use the resources in the most efficient manner.

Important functions of an operating System:


1. Security

The operating system uses password protection to protect user data and similar other techniques. it
also prevents unauthorized access to programs and user data.

2. Control over system performance

Monitors overall system health to help improve performance. records the response time between
service requests and system response to having a complete view of the system health. This can help
improve performance by providing important information needed to troubleshoot problems.

3. Job accounting

Operating system Keeps track of time and resources used by various tasks and users, this information
can be used to track resource usage for a particular user or group of users.

4. Error detecting aids

The operating system constantly monitors the system to detect errors and avoid the malfunctioning of
a computer system.
5. Coordination between other software and users

Operating systems also coordinate and assign interpreters, compilers, assemblers, and other software
to the various users of the computer systems.

6. Memory Management

The operating system manages the Primary Memory or Main Memory. Main memory is made up of a
large array of bytes or words where each byte or word is assigned a certain address.
Main memory is fast storage and it can be accessed directly by the CPU. For a program to be
executed, it should be first loaded in the main memory.
An Operating System performs the following activities for memory management:
It keeps track of primary memory, i.e., which bytes of memory are used by which user program. The
memory addresses that have already been allocated and the memory addresses of the memory that has not
yet been used.
In multiprogramming, the OS decides the order in which processes are granted access to memory and
for how long. It allocates the memory to a process when the process requests it and deallocates the
memory when the process has terminated or is performing an I/O operation.

7. Processor Management

In a multi-programming environment, the OS decides the order in which processes have access to the
processor, and how much processing time each process has. This function of OS is called process
scheduling.

An Operating System performs the following activities for processor management. Keeps track of the
status of processes.
The program which performs this task is known as a traffic controller. Allocates the CPU that is a
processor to a process. De-allocates processor when a process is no more required.

8. Device Management

An OS manages device communication via their respective drivers. It performs the following
activities for device management.
Keeps track of all devices connected to the system. Designates a program responsible for every device
known as the Input/Output controller.
Decides which process gets access to a certain device and for how long. Allocates devices in an
effective and efficient way. Deallocates devices when they are no longer required.

9. File Management

A file system is organized into directories for efficient or easy navigation and usage. These directories
may contain other directories and other files.

An Operating System carries out the following file management activities. It keeps track of where
information is stored, user access settings and status of every file, and more… These facilities are
collectively known as the file system.

Moreover, Operating System also provides certain services to the computer system in one form or the
other.
The Operating System provides certain services to the users which can be listed in the follo wing manner:
1. Program Execution:

The Operating System is responsible for the execution of all types of programs whether it be user
programs or system programs.
The Operating System utilizes various resources available for the efficient running of all types of
functionalities.

2. Handling Input/Output Operations:

The Operating System is responsible for handling all sorts of inputs, i.e, from the keyboard, mouse,
desktop, etc.

The Operating System does all interfacing in the most appropriate manner regarding all kinds of
Inputs and Outputs.

For example, there is a difference in the nature of all types of peripheral devices such as mice or
keyboards, the Operating System is responsible for handling data between them.

3. Manipulation of File System:

The Operating System is responsible for making decisions regarding the storage of all types of data or
files, i.e, floppy disk/hard disk/pen drive, etc. The Operating System decides how the data should be
manipulated and stored.

4. Error Detection and Handling:

The Operating System is responsible for the detection of any type of error or bugs that can occur
while any task.

The well-secured OS sometimes also acts as a countermeasure for preventing any sort of breach to the
Computer System from any external source and probably handling them.

5. Resource Allocation:

The Operating System ensures the proper use of all the resources available by deciding which
resource to be used by whom for how much time. All the decisions are taken by the Operating System.

6. Accounting:

The Operating System tracks an account of all the functionalities taking place in the computer system
at a time. All the details such as the types of errors that occurred are recorded by the Operating System.

7. Information and Resource Protection:

The Operating System is responsible for using all the information and resources available on the
machine in the most protected way.

The Operating System must foil an attempt from any external resource to hamper any sort of data or
information.
Computer System Organization

The computer system is a combination of many parts such as peripheral devices, secondary memory,
CPU etc. This can be explained more clearly using a diagram.

The salient points about the above figure displaying Computer System Organisation is.,

 The I/O devices and the CPU both execute concurrently. Some of the processes are scheduled for the
CPU and at the same time, some are undergoing input/output operations.
 There are multiple device controllers, each in charge of a particular device such as keyboard, mouse,
printer etc.
 There is buffer available for each of the devices. The input and output data can be stored in these buffers.
 The data is moved from memory to the respective device buffers by the CPU for I/O operations and then
this data is moved back from the buffers to memory.
 The device controllers use an interrupt to inform the CPU that I/O operation is completed.
Interrupt Handling
An interrupt is a necessary part of Computer System Organisation as it is triggered by hardware and
software parts when they need immediate attention.
An interrupt can be generated by a device or a program to inform the operating system to halt its current
activities and focus on something else. The types of interrupts are better explained using the following diagram −
Hardware and software interrupts are two types of interrupts. Hardware interrupts are triggered by
hardware peripherals while software interrupts are triggered by software function calls.
Hardware interrupts are of further two types. Maskable interrupts can be ignored or disabled by the CPU
while this is not possible for non maskable interrupts.

Layers of Organization

Modern computer systems have a layered organization, which each layer either using the services of, or
being physically built from, entities on the level directly below it.

The Computer System Layer

The computer systems we build today feature programmable processing units which interact with a
number of devices, each controlled by an I/O controller, and using memory.
Clearly, this picture is an over simplification. Each CPU can have one or more cores. There may be
additional kinds of processors, including GPUs and TPUs. Memory itself is layered (cache memory, main
memory, secondary memory).

Machines themselves are networked, giving the appearance of one large machine made up of smaller
ones. Devices are roughly classified into input devices, output devices and storage devices. Examples include:

Software Layers

Software can be roughly divided into systems software and applications software. The dividing line is
fuzzy, but the basic concepts are:

Applications Software Systems Software

Written for people Written for computers

Deals with human-centered abstractions like Deals with computer-centered concepts like
customers, products, orders, employees, registers and memory locations
players, users

Solves problems of interest to humans, Controls and manages computer systems


usually in application areas like health care,
game playing, finance, etc.
Concerned with anything high-level Concerned with data transfer, reading from
and writing to files, compiling, linking, loading,
starting and stopping programs, and even
fiddling with the individual bits of a small word
of memory

Is almost always device or platform Deals with writing device drivers and operating
independent; programs concentrate on systems, or at least directly using them;
general-purpose algorithms programmers exploit this low-level knowledge

Is often done in languages like JavaScript, Is often done in assembly language, C, C++,
Perl, Python, Ruby, Lisp, Elm, Java, and C# and Rust where programmers have
that feature automatic garbage collection and to manage memory themselves
free the programmer from low-level worries

Is done in languages that generally have big Generally feature extremely small run-time
fat runtime systems images, because they often have to run in
resource constrained environments

If done properly, can be very efficient: good If done properly, can be very efficient: you can
garbage collection schemes allow much more take advantage of the hardware
efficient memory utilization than the usual
memory micro-management common in C
programs

There are different levels of programming languages: High-level languages, Assembly Languages,
Machine Languages.

A Machine language is what a processor runs. It’s pure binary.

A Assembly language has instructions that map one-to-one to machine language instructions. A high-
level language uses far more abstract concepts to describe computations.

Often, people write in a high-level language, which a compiler translates to assembly language, which an
assembler translates into machine language:
Computer System Architecture

A computer system may be organized in a number of different ways, which we can categorize roughly
according to the number of general-purpose processors used.

Single-Processor Systems

Most systems vise a single processor. a single-processor system, there is one main CPU capable of
executing a general-purpose instruction set, including instructions from user processes.

Almost all systems have other special-purpose processors as well. They may come in the form of device-
specific processors, such as disk, keyboard, and graphics controllers; or, on mainframes, they may come in
the form of more general-purpose processors, such as I/O processors that move data rapidly among the
components of the system.

All of these special-purpose processors run a limited instruction set and do not run user processes.
Sometimes they are managed by the operating system, in that the operating system sends them information about
their next task and monitors their status.

Multiprocessor Systems

Multiprocessor systems (also known as parallel systems or tightly coupled systems) are growing in
importance.

Such systems have two or more processors in close communication, sharing the computer bus and
sometimes the clock, memory, and peripheral devices.

Multiprocessor systems have three main advantages:

1. Increased throughput.
By increasing the number of processors, we expect to get more work done in less time. The speed-up
ratio with N processors is not N, however; rather, it is less than N. When multiple processors cooperate on a task,
a certain amount of overhead is incurred in keeping all the parts working correctly.

This overhead, plus contention for shared resources, lowers the expected gain from additional processors.
Similarly, N programmers working closely together do not produce N times the amount of work a single
programmer would produce.

2. Economy of scale.
Multiprocessor systems can cost less than equivalent multiple single-processor systems, because they can
share peripherals, mass storage, and power supplies.

If several programs operate on the same set of data, it is cheaper to store those data on one disk and to
have all the processors share them than to have many computers with local disks and many copies of the data.
3. Increased reliability.
If functions can be distributed properly among several processors, then the failure of one processor will
not halt the system, only slow it down. If we have ten processors and one fails, then each of the remaining nine
processors can pick up a share of the work of the failed processor.
Thus, the entire system runs only 10 percent slower, rather than failing altogether.

Graceful degradation
It is the ability to continue providing service proportional to the level of surviving hardware.

Fault tolerant - Some systems go beyond graceful degradation.

The multiple-processor systems in use today are of two types.

1.Asymmetric multiprocessing, which each processor is assigned a specific task.

2.Symmetric multiprocessing (SMP), The most common systems use in which each processor performs all
tasks within the operating system.

Clustered Systems

Clustered system is an another type of multiple-CPU system. Clustered systems differ from
multiprocessor systems, however, in that they are composed of two or more individual systems coupled together.

The definition of the term clustered is not concrete; many commercial packages wrestle with what a
clustered system is and why one form is better than another.

The generally accepted definition is that clustered computers share storage and are closely linked via
a local-area network (LAN) or a faster interconnect such as InfiniBand.

Clustering is usually used to provide high-availability service; that is, service will continue even if one
or more systems in the cluster fail. Clustering can be structured asymmetrically or symmetrically. Cluster
technology is changing rapidly.

Some cluster products support dozens of systems in a cluster, as well as clustered nodes that are
separated by miles. Many of these improvements are made possible by storage-area networks (SANs).
Operating-System Structure

An operating system provides the environment within which programs are executed. One of the most
important aspects of operating systems is the ability to multiprogram. A single user cannot, in general, keep
either the CPU or the I/O devices busy at all times.

Multiprogramming increases CPU utilization by organizing jobs (code and data) so that the CPU
always has one to execute. The operating system keeps several jobs in memory simultaneously (Figure 1.7).

Time sharing (or multitasking) is a logical extension of multiprogramming. In time-sharing systems,


the CPU executes multiple jobs by switching among them, but the switches occur so frequently that the users can
interact with each program while it is running.

Time sharing requires an interactive (or hands-on) computer system, which provides direct
communication between the user and the system.

A time-shared operating system allows many users to share the computer simultaneously. A time-shared
operating system uses CPU scheduling and multiprogramming to provide each user with a small portion of a
time-shared computer.

Operating-System Operations
Interrupt driven is modern operating systems.

Trap (or an exception) is a software-generated interrupt caused either by an error (for example, division
by zero or invalid memory access) or by a specific request from a user program that an operating-system service
be performed.
The interrupt-driven nature of an operating system defines that system's general structure. For each type
of interrupt, separate segments of code in the operating system determine what action should be taken.
An interrupt service routine is provided that is responsible for dealing with the interrupt.
Since the operating system and the users share the hardware and software resources of the computer
system, we need to make sure that an error in a user program could cause problems only for the one program that
was running.

Dual-Mode Operation

Two separate modes of operation: user mode and kernel mode (also called supervisor mode, system
mode, or privileged mode). A bit, called the mode bit, is added to the hardware of the computer to indicate the
current mode: kernel (0) or user (1).

The dual mode of operation provides us with the means for protecting the operating system from errant
users—and errant users from one another.
We accomplish this protection by designating some of the machine instructions that may cause harm
as privileged instructions. The hardware allows privileged instructions to be executed only in kernel mode.

If an attempt is made to execute a privileged instruction in user mode, the hardware does not execute the
instruction but rather treats it as illegal and traps it to the operating system.

Timer

A timer can be set to interrupt the computer after a specified period. The period may be fixed (for
example, 1/60 second) or variable (for example, from 1 millisecond to 1 second).

Variable timer is generally implemented by a fixed-rate clock and a counter.

The operating system sets the counter. Every time the clock ticks, the counter is decremented. We can
use the timer to prevent a user program from running too long. A simple technique is to initialize a counter with
the amount of time that a program is allowed to run.

Chapter – II - System Structures

Operating System Services


An Operating System provides services to both the users and to the programs.

 It provides programs an environment to execute.


 It provides users the services to execute the programs in a convenient manner.
Following are a few common services provided by an operating system −
 Program execution
 I/O operations
 File System manipulation
 Communication
 Error Detection
 Resource Allocation
 Protection
 Control Input/output devices
 Program creation
 Accounting

1. Program execution

Operating systems handle many kinds of activities from user programs to system programs like printer,
name servers, file server, etc. Each of these activities is encapsulated as a process.
Following are the major activities of an operating system with respect to program management −

 Loads a program into memory.


 Executes the program.
 Handles program's execution.
 Provides a mechanism for process synchronization.
 Provides a mechanism for process communication.
 Provides a mechanism for deadlock handling.
2. I/O Operation

An I/O subsystem comprises of I/O devices and their corresponding driver software. Drivers hide the
peculiarities of specific hardware devices from the users.
An Operating System manages the communication between user and device drivers.

 I/O operation means read or write operation with any file or any specific I/O device.
 Operating system provides the access to the required I/O device when required.

3. File system manipulation

A file represents a collection of related information. Computers can store files on the disk (secondary
storage), for long-term storage purpose.
Examples of storage media include magnetic tape, magnetic disk and optical disk drives like CD, DVD.
Each of these media has its own properties like speed, capacity, data transfer rate and data access methods.
A file system is normally organized into directories for easy navigation and usage. These directories may
contain files and other directions. Following are the major activities of an operating system with respect to file
management −

 Program needs to read a file or write a file.


 The operating system gives the permission to the program for operation on file.
 Permission varies from read-only, read-write, denied and so on.
 Operating System provides an interface to the user to create/delete files.
 Operating System provides an interface to the user to create/delete directories.
 Operating System provides an interface to create the backup of file system.

4. Communication

In case of distributed systems which are a collection of processors that do not share memory, peripheral
devices, or a clock, the operating system manages communications between all the processes. Multiple
processes communicate with one another through communication lines in the network.
Two processes often require data to be transferred between them

 Both the processes can be on one computer or on different computers, but are connected through a
computer network.
 Communication may be implemented by two methods, either by Shared Memory or by Message Passing.

5. Error handling

Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices or in the memory
hardware. Following are the major activities of an operating system with respect to error handling −

 The OS constantly checks for possible errors.


 The OS takes an appropriate action to ensure correct and consistent computing.

6. Resource Management
In case of multi-user or multi-tasking environment, resources such as main memory, CPU cycles
and files storage are to be allocated to each user or job. Following are the major activities of an operating
system with respect to resource management −
 The OS manages all kinds of resources using schedulers.
 CPU scheduling algorithms are used for better utilization of CPU.

7. Protection

Considering a computer system having multiple users and concurrent execution of multiple processes,
the various processes must be protected from each other's activities.
Protection refers to a mechanism or a way to control the access of programs, processes, or users to the
resources defined by a computer system. Following are the major activities of an operating system with respect
to protection −

 The OS ensures that all access to system resources is controlled.


 The OS ensures that external I/O devices are protected from invalid access attempts.
 The OS provides authentication features for each user by means of passwords.

System Calls

A system call is a way for a user program to interface with the operating system. The program requests
several services, and the OS responds by invoking a series of system calls to satisfy the request.

A system call can be written in assembly language or a high-level language like C or Pascal. System calls
are predefined functions that the operating system may directly invoke if a high-level language is used.

What is a System Call?

A system call is a method for a computer program to request a service from the kernel of the operating
system on which it is running. A system call is a method of interacting with the operating system via programs.

A system call is a request from computer software to an operating system's kernel. The Application
Program Interface (API) connects the operating system's functions to user programs.

It acts as a link between the operating system and a process, allowing user-level programs to request
operating system services. The kernel system can only be accessed using system calls. System calls are required
for any programs that use resources.

How are system calls made?

When computer software needs to access the operating system's kernel, it makes a system call. The
system call uses an API to expose the operating system's services to user programs. It is the only method to
access the kernel system.

All programs or processes that require resources for execution must use system calls, as they serve as an
interface between the operating system and user programs.

Below are some examples of how a system call varies from a user function.

1. A system call function may create and use kernel processes to execute the asynchronous processing.
2. A system call has greater authority than a standard subroutine. A system call with kernel-mode privilege
executes in the kernel protection domain.
3. System calls are not permitted to use shared libraries or any symbols that are not present in the kernel
protection domain.
4. The code and data for system calls are stored in global kernel memory.

Need of System Calls in Operating System?

There are various situations where you must require system calls in the operating system. Following of
the situations are as follows:

1. It is must require when a file system wants to create or delete a file.


2. Network connections require the system calls to sending and receiving data packets.
3. If you want to read or write a file, you need to system calls.
4. If you want to access hardware devices, including a printer, scanner, you need a system call.
5. System calls are used to create and manage new processes.

How System Calls Work

The Applications run in an area of memory known as user space. A system call connects to the operating
system's kernel, which executes in kernel space.

When an application creates a system call, it must first obtain permission from the kernel. It achieves this
using an interrupt request, which pauses the current process and transfers control to the kernel.

If the request is permitted, the kernel performs the requested action, like creating or deleting a file. As
input, the application receives the kernel's output.

The application resumes the procedure after the input is received. When the operation is finished, the
kernel returns the results to the application and then moves data from kernel space to user space in memory.

A simple system call may take few nanoseconds to provide the result, like retrieving the system date and
time. A more complicated system call, such as connecting to a network device, may take a few seconds.

Most operating systems launch a distinct kernel thread for each system call to avoid bottlenecks. Modern
operating systems are multi-threaded, which means they can handle various system calls at the same time.

Types of System Calls

There are commonly five types of system calls. These are as follows:

1. Process Control
2. File Management
3. Device Management
4. Information Maintenance
5. Communication
Now, you will learn about all the different types of system calls one-by-one.

Process Control

Process control is the system call that is used to direct the processes. Some process control examples
include creating, load, abort, end, execute, process, terminate the process, etc.

File Management

File management is a system call that is used to handle the files. Some file management examples include
creating files, delete files, open, close, read, write, etc.

Device Management

Device management is a system call that is used to deal with devices. Some examples of device
management include read, device, write, get device attributes, release device, etc.

Information Maintenance

Information maintenance is a system call that is used to maintain information. There are some examples
of information maintenance, including getting system data, set time or date, get time or date, set system data, etc.

Communication

Communication is a system call that is used for communication. There are some examples of
communication, including create, delete communication connections, send, receive messages, etc.

Examples of Windows and Unix system calls

There are various examples of Windows and Unix system calls. These are as listed below in the table:

Process Windows Unix

Process Control CreateProcess() Fork()


ExitProcess() Exit()
WaitForSingleObject() Wait()
File Manipulation CreateFile() Open()
ReadFile() Read()
WriteFile() Write()
CloseHandle() Close()

Device Management SetConsoleMode() Ioctl()


ReadConsole() Read()
WriteConsole() Write()

Information Maintenance GetCurrentProcessID() Getpid()


SetTimer() Alarm()
Sleep() Sleep()

Communication CreatePipe() Pipe()


CreateFileMapping() Shmget()
MapViewOfFile() Mmap()

Protection SetFileSecurity() Chmod()


InitializeSecurityDescriptor() Umask()
SetSecurityDescriptorgroup() Chown()

Here, you will learn about some methods briefly:

open()

The open() system call allows you to access a file on a file system. It allocates resources to the file and
provides a handle that the process may refer to. Many processes can open a file at once or by a single process
only. It's all based on the file system and structure.

read()

It is used to obtain data from a file on the file system. It accepts three arguments in general:

o A file descriptor.
o A buffer to store read data.
o The number of bytes to read from the file.

The file descriptor of the file to be read could be used to identify it and open it using open() before
reading.
wait()

In some systems, a process may have to wait for another process to complete its execution before
proceeding. When a parent process makes a child process, the parent process execution is suspended until the
child process is finished. The wait() system call is used to suspend the parent process. Once the child process has
completed its execution, control is returned to the parent process.

write()

It is used to write data from a user buffer to a device like a file. This system call is one way for a program
to generate data. It takes three arguments in general:

o A file descriptor.
o A pointer to the buffer in which data is saved.
o The number of bytes to be written from the buffer.

fork()

Processes generate clones of themselves using the fork() system call. It is one of the most common ways
to create processes in operating systems. When a parent process spawns a child process, execution of the parent
process is interrupted until the child process completes. Once the child process has completed its execution,
control is returned to the parent process.

close()

It is used to end file system access. When this system call is invoked, it signifies that the program no
longer requires the file, and the buffers are flushed, the file information is altered, and the file resources are de-
allocated as a result.

exec()

When an executable file replaces an earlier executable file in an already executing process, this system
function is invoked. As a new process is not built, the old process identification stays, but the new process
replaces data, stack, data, head, etc.

exit()

The exit() is a system call that is used to end program execution. This call indicates that the thread
execution is complete, which is especially useful in multi-threaded environments. The operating system reclaims
resources spent by the process following the use of the exit() system function.

System Programs

System Program can be defined as the act of building Systems Software using System Programming
Languages. According to Computer Hierarchy, one which comes at last is Hardware.

Then it is Operating System, System Programs, and finally Application Programs. Program
Development and Execution can be done conveniently in System Programs.

Some of the System Programs are simply user interfaces, others are complex. It traditionally lies
between the user interface and system calls.
So here, the user can only view up-to-the System Programs he can’t see System Calls. System
Programs can be divided into these categories:
1. File Management

A file is a collection of specific information stored in the memory of a computer system. File
management is defined as the process of manipulating files in the computer system, its management includes
the process of creating, modifying and deleting files.
 It helps to create new files in the computer system and placing them at specific locations.
 It helps in easily and quickly locating these files in the computer system.
 It makes the process of sharing files among different users very easy and user-friendly.
 It helps to store files in separate folders known as directories.
 These directories help users to search files quickly or to manage files according to their types of uses.
 It helps users to modify the data of files or to modify the name of files in directories.

1. Status Information

Information like date, time amount of available memory, or disk space is asked by some users. Others
providing detailed performance, logging, and debugging information which is more complex.

All this information is formatted and displayed on output devices or printed. Terminal or other output
devices or files or a window of GUI is used for showing the output of programs.

2. File Modification

For modifying the contents of files we use this. For Files stored on disks or other storage devices, we
used different types of editors. For searching contents of files or perform transformations of files we use
special commands.

3. Programming-Language support

For common programming languages, we use Compilers, Assemblers, Debuggers, and interpreters
which are already provided to users. It provides all support to users. We can run any programming
language. All languages of importance are already provided.

4. Program Loading and Execution

When the program is ready after Assembling and compilation, it must be loaded into memory for
execution.
A loader is part of an operating system that is responsible for loading programs and libraries. It is one
of the essential stages for starting a program. Loaders, relocatable loaders, linkage editors, and Overlay
loaders are provided by the system.

5. Communications

Virtual connections among processes, users, and computer systems are provided by programs. Users
can send messages to another user on their screen, User can send e-mail, browsing on web pages, remote
login, the transformation of files from one user to another.

Some examples of system program in O.S. are –


 Windows 10
 Mac OS X
 Ubuntu
 Linux
 Unix
 Android
 Anti-virus
 Disk formatting
 Computer language translators

Operating System Design and Implementation

An operating system is a construct that allows the user application programs to interact with the system
hardware. Operating system by itself does not provide any function but it provides an atmosphere in which
different applications and programs can do useful work.
There are many problems that can occur while designing and implementing an operating system. These
are covered in operating system design and implementation.

Operating System Design Goals


It is quite complicated to define all the goals and specifications of the operating system while designing
it. The design changes depending on the type of the operating system i.e if it is batch system, time shared system,
single user system, multi user system, distributed system etc.
There are basically two types of goals while designing an operating system. These are −
User Goals

The operating system should be convenient, easy to use, reliable, safe and fast according to the users.
However, these specifications are not very useful as there is no set method to achieve these goals.
System Goals

The operating system should be easy to design, implement and maintain. These are specifications
required by those who create, maintain and operate the operating system. But there is not specific method to
achieve these goals as well.
Operating System Mechanisms and Policies
There is no specific way to design an operating system as it is a highly creative task. However, there are
general software principles that are applicable to all operating systems.
A subtle difference between mechanism and policy is that mechanism shows how to do something and
policy shows what to do. Policies may change over time and this would lead to changes in mechanism. So, it is
better to have a general mechanism that would require few changes even when a policy change occurs.
For example - If the mechanism and policy are independent, then few changes are required in mechanism
if policy changes. If a policy favors I/O intensive processes over CPU intensive processes, then a policy change
to preference of CPU intensive processes will not change the mechanism.
Operating System Implementation
The operating system needs to be implemented after it is designed. Earlier they were written in assembly
language but now higher level languages are used. The first system not written in assembly language was the
Master Control Program (MCP) for Burroughs Computers.
Advantages of Higher Level Language

There are multiple advantages to implementing an operating system using a higher level language such
as: the code is written more fast, it is compact and also easier to debug and understand. Also, the operating
system can be easily moved from one hardware to another if it is written in a high level language.
Disadvantages of Higher Level Language

Using high level language for implementing an operating system leads to a loss in speed and increase in
storage requirements. However in modern systems only a small amount of code is needed for high performance,
such as the CPU scheduler and memory manager. Also, the bottleneck routines in the system can be replaced by
assembly language equivalents if required.

Operation System Generation


Operating Systems have evolved over the years. So, their evolution through the years can be mapped
using generations of operating systems. There are four generations of operating systems. These can be described
as follows –
The First Generation ( 1945 - 1955 ): Vacuum Tubes and Plugboards
Digital computers were not constructed until the second world war. Calculating engines with mechanical
relays were built at that time.
However, the mechanical relays were very slow and were later replaced with vacuum tubes. These
machines were enormous but were still very slow.
These early computers were designed, built and maintained by a single group of people. Programming
languages were unknown and there were no operating systems so all the programming was done in machine
language. All the problems were simple numerical calculations.
By the 1950’s punch cards were introduced and this improved the computer system. Instead of using plug
boards, programs were written on cards and read into the system.

The Second Generation ( 1955 - 1965 ): Transistors and Batch Systems


Transistors led to the development of the computer systems that could be manufactured and sold to
paying customers. These machines were known as mainframes and were locked in air-conditioned computer
rooms with staff to operate them.
The Batch System was introduced to reduce the wasted time in the computer. A tray full of jobs was
collected in the input room and read into the magnetic tape. After that, the tape was rewound and mounted on a
tape drive.
Then the batch operating system was loaded in which read the first job from the tape and ran it. The
output was written on the second tape. After the whole batch was done, the input and output tapes were removed
and the output tape was printed.

The Third Generation ( 1965 - 1980 ): Integrated Circuits and Multiprogramming


Until the 1960’s, there were two types of computer systems i.e the scientific and the commercial
computers. These were combined by IBM in the System/360.
This used integrated circuits and provided a major price and performance advantage over the second
generation systems. The third generation operating systems also introduced multiprogramming.
This meant that the processor was not idle while a job was completing its I/O operation. Another job was
scheduled on the processor so that its time would not be wasted.
The Fourth Generation ( 1980 - Present ): Personal Computers
Personal Computers were easy to create with the development of large-scale integrated circuits. These
were chips containing thousands of transistors on a square centimeter of silicon.
Because of these, microcomputers were much cheaper than minicomputers and that made it possible for a
single individual to own one of them. The advent of personal computers also led to the growth of networks.
This created network operating systems and distributed operating systems. The users were aware of a
network while using a network operating system and could log in to remote machines and copy files from one
machine to another.

System Boot

Booting is the process of starting a computer. It can be initiated by hardware such as a button press or by
a software command. After it is switched on, a CPU has no software in its main memory, so some processes
must load software into memory before execution.
This may be done by hardware or firmware in the CPU or by a separate processor in the computer
system. Restarting a computer also is called rebooting, which can be "hard", e.g., after electrical power to
the CPU is switched from off to on, or "soft", where the power is not cut.
On some systems, a soft boot may optionally clear RAM to zero. Hard and soft booting can be initiated
by hardware such as a button press or a software command. Booting is complete when the operative runtime
system, typically the operating system and some applications, is attained.
The process of returning a computer from a state of sleep does not involve booting; however, restoring it
from a state of hibernation does. Minimally, some embedded systems do not require a noticeable boot sequence
to begin functioning and, when turned on, may run operational programs that are stored in ROM.
All computer systems are state machines and a reboot may be the only method to return to a designated
zero-state from an unintended, locked state. In addition to loading an operating system or stand-alone utility, the
boot process can also load a storage dump program for diagnosing problems in an operating system.

Sequencing of Booting
Booting is a start-up sequence that starts the operating system of a computer when it is turned on. A boot
sequence is the initial set of operations that the computer performs when it is switched on. Every computer has a
boot sequence.
1. Boot Loader

Computers powered by the central processing unit can only execute code found in the system's memory.
Modern operating systems and application program code and data are stored on nonvolatile memories.

When a computer is first powered on, it must initially rely only on the code and data stored in nonvolatile
portions of the system's memory.

The operating system is not really loaded at boot time, and the computer's hardware cannot perform many
complex systems actions.

The program that starts the chain reaction that ends with the entire operating system being loaded is the
boot loader or bootstrap loader. The boot loader's only job is to load other software for the operating system to
start.

2. Boot Devices

The boot device is the device from which the operating system is loaded. A modern PC BIOS (Basic
Input/Output System) supports booting from various devices.

These include the local hard disk drive, optical drive, floppy drive, a network interface card, and a USB
device. The BIOS will allow the user to configure a boot order. If the boot order is set to:

o CD Drive
o Hard Disk Drive
o Network

The BIOS will try to boot from the CD drive first, and if that fails, then it will try to boot from the hard disk
drive , and if that fails, then it will try to boot from the network, and if that fails, then it won't boot at all.

3. Boot Sequence

There is a standard boot sequence that all personal computers use. First, the CPU runs an instruction in
memory for the BIOS. That instruction contains a jump instruction that transfers to the BIOS start-up program.

This program runs a power-on self-test (POST) to check that devices the computer will rely on are
functioning properly. Then, the BIOS goes through the configured boot sequence until it finds a bootable device.

Once BIOS has found a bootable device, BIOS loads the bootsector and transfers execution to the boot
sector. If the boot device is a hard drive, it will be a master boot record (MBR).

The MBR code checks the partition table for an active partition. If one is found, the MBR code loads that
partition's boot sector and executes it. The boot sector is often operating system specific, and however, in most
operating systems, its main function is to load and execute the operating system kernel, which continues start-up.

Suppose there is no active partition, or the active partition's boot sector is invalid. In that case, the MBR
may load a secondary boot loader which will select a partition and load its boot sector, which usually loads the
corresponding operating system kernel.
Types of Booting

There are two types of booting in an operating system.

1. Cold Booting: When the computer starts for the first time or is in a shut-down state and switch on the
power button to start the system, this type of process to start the computer is called cold booting. During
cold booting, the system will read all the instructions from the ROM (BIOS) and the Operating System
will be automatically get loaded into the system. This booting takes more time than Hot or Warm
Booting.

2. Warm Booting: Warm or Hot Booting process is when computer systems come to no response or hang
state, and then the system is allowed to restart during on condition. It is also referred to as rebooting.
There are many reasons for this state, and the only solution is to reboot the computer. Rebooting may be
required when we install new software or hardware.

The system requires a reboot to set software or hardware configuration changes, or sometimes systems
may behave abnormally or may not respond properly. In such a case, the system has to be a force restart.
Most commonly Ctrl+Alt+Del button is used to reboot the system. Else, in some systems, the external
reset button may be available to reboot the system.

Booting Process in Operating System


When our computer is switched on, it can be started by hardware such as a button press, or
by software command, a computer's central processing unit (CPU) has no software in its main memory, there is
some process which must load software into main memory before it can be executed. Below are the six steps to
describe the boot process in the operating system, such as:

Step 1: Once the computer system is turned on, BIOS (Basic Input /Output System) performs a series of
activities or functionality tests on programs stored in ROM, called on POST (Power-on Self Test) that checks to
see whether peripherals in the system are in perfect order or not.

Step 2: After the BIOS is done with pre-boot activities or functionality test, it read bootable sequence
from CMOS (Common Metal Oxide Semiconductor) and looks for master boot record in the first physical sector
of the bootable disk as per boot device sequence specified in CMOS. For example, if the boot device sequence
is:
o Floppy Disk
o Hard Disk
o CDROM
Step 3: After this, the master boot record will search first in a floppy disk drive. If not found, then the
hard disk drive will search for the master boot record. But if the master boot record is not even present on the
hard disk, then the CDROM drive will search. If the system cannot read the master boot record from any of these
sources, ROM displays "No Boot device found" and halted the system.

On finding the master boot record from a particular bootable disk drive, the operating system loader, also
called Bootstrap loader, is loaded from the boot sector of that bootable drive· into memory. A bootstrap loader is
a special program that is present in the boot sector of a bootable drive.

Step 4: The bootstrap loader first loads the IO.SYS file. After this, MSDOS.SYS file is loaded, which is
the core file of the DOS operating system.

Step 5: After this, MSDOS.SYS file searches to find Command Interpreter in CONFIG.SYS file, and
when it finds, it loads into memory. If no Command Interpreter is specified in the CONFIG.SYS file,
the COMMAND.COM file is loaded as the default Command Interpreter of the DOS operating system.

Step 6: The last file is to be loaded and executed is the AUTOEXEC.BAT file that contains a sequence
of DOS commands. After this, the prompt is displayed. We can see the drive letter of bootable drive displayed
on the computer system, which indicates that the operating system has been successfully on the system from that
drive.

What is Dual Booting

When two operating systems are installed on the computer system, then it is called dual booting. Multiple
operating systems can be installed on such a system. But to know which operating system is to boot, a boot
loader that understands multiple file systems and multiple operating systems can occupy the boot space.

Once loaded, it can boot one of the operating systems available on the disk. The disk can have
multiple partitions, each containing a different type of operating system. When a computer system turns on, a
boot manager program displays a menu, allowing the user to choose the operating system to use.

You might also like