0% found this document useful (0 votes)
13 views20 pages

1 Unit Notes - 21CSC202J Operating System

clean notes

Uploaded by

Suvan Satish
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)
13 views20 pages

1 Unit Notes - 21CSC202J Operating System

clean notes

Uploaded by

Suvan Satish
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/ 20

SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

UNIT-1

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 conveniently and efficiently.
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.
The main goal of the Operating System is to make the computer environment more convenient to use and
the Secondary goal is to use the resources most efficiently.
What is an Operating System?
An operating system is a program on which application programs are executed and acts as a
communication bridge (interface) between the user and the computer hardware. The main task an
operating system carries out is the allocation of resources and services, such as the allocation of memory,
devices, processors, and information. The operating system also includes programs to manage these
resources, such as a traffic controller, a scheduler, a memory management module, I/O programs, and a
file system.
Why are Operating Systems Used?
Operating System is used as a communication channel between the Computer hardware and the user. It
works as an intermediate between System Hardware and End-User. Operating System handles the
following responsibilities:
● It controls all the computer resources.
● It provides valuable services to user programs.
● It coordinates the execution of user programs.
● It provides resources for user programs.
● It provides an interface (virtual machine) to the user.
● It hides the complexity of software.
● It supports multiple execution modes.
● It monitors the execution of user programs to prevent errors.
Functions of an Operating System
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 manages the allocation and deallocation of the memory to
various processes and ensures that the other process does not consume the memory allocated to one
process.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 memory access, 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.

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.
An operating system manages the processors work by allocating carious jobs to it and ensuring that each
process receives enough time from the processor to function properly.
Keeps track of the status of processes. The program which performs this task is known as a traffic
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

controller. Allocates the CPU that is a processor to a process. De-allocates processor when a process is no
more required.

Device Management
An OS manages device communication via its 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 effectively and efficiently. Deallocates devices when they are
no longer required. There are various input and output devices. an OS controls the working of these input-
output devices .It receives the requests from these devices, performs a specific task, and communicates
back to the requesting process.

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, the status of
every file, and more. These facilities are collectively known as the file system. An OS keeps track of
information regarding the creation, deletion, transfer, copy, and storage of files in an organized way. It
also maintains the integrity of the data stored in these files, including the file directory structure, by
protecting against unauthorized access.

User Interface or Command Interpreter


The user interacts with the computer system through the operating system. Hence OS act as an interface
between the user and the computer hardware. This user interface is offered through a set of commands or
a graphical user interface (GUI). Through this interface, the user makes interaction with the applications
and the machine hardware.

Booting the Computer


The process of starting or restarting the computer is known as booting. If the computer is switched off
completely and if turned on then it is called cold booting. Warm booting is a process of using the operating
system to restart the computer.

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. The operating system provides various techniques
which assure the integrity and confidentiality of user data. Following security measures are used to protect
user data:
● Protection against unauthorized access through login.
● Protection against intrusion by keeping firefall active.
● Protecting the system memory against malicious access.
● Displaying messages related to system vulnerabilities.

Control Over System Performance


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’s health. This can help improve performance
by providing important information needed to troubleshoot problems.
Job Accounting
The 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. In a multitasking OS where
multiple programs run simultaneously, the OS determines which applications should run in which order
and how time should be allocated to each application.
Error-Detecting Aids
The operating system constantly monitors the system to detect errors and avoid malfunctioning computer
systems. From time to time, the operating system checks the system for any external threat or malicious
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

software activity. It also checks the hardware for any type of damage. This process displays several alerts
to the user so that the appropriate action can be taken against any damage caused to the system/
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.
Performs Basic Computer Tasks
The management of various peripheral devices such as the mouse, keyboard, and printer is carried out by
the operating system. Today most operating systems are plug-and-play. These operating systems
automatically recognize and configure the devices with no user interference.
Network Management
The OS provides network connectivity and manages communication between computers on a network. It
also manages network security by providing firewalls and other security measures.
Services Provided by an Operating System
The Operating System provides certain services to the users which can be listed in the following manner:
● 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.
● 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 most
appropriately regarding all kinds of Inputs and Outputs.
For example, there is a difference between all types of peripheral devices such as mice or keyboards,
the Operating System is responsible for handling data between them.
● 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.
● 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 of the Computer System from any external source
and probably handling them.
● 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.
● 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.
● 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.
● System Services: The operating system provides various system services, such as printing, time and
date management, and event logging.
All these services are ensured by the Operating System for the convenience of the users to make the
programming task easier. All different kinds of Operating Systems more or less provide the same services.

Characteristics of Operating System


● Virtualization: Operating systems can provide Virtualization capabilities, allowing multiple
operating systems or instances of an operating system to run on a single physical machine. This can
improve resource utilization and provide isolation between different operating systems or
applications.
● Networking: Operating systems provide networking capabilities, allowing the computer system to
connect to other systems and devices over a network. This can include features such as network
protocols, network interfaces, and network security.
● Scheduling: Operating systems provide scheduling algorithms that determine the order in which tasks
are executed on the system. These algorithms prioritize tasks based on their resource requirements
and other factors to optimize system performance.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

● Interprocess Communication: Operating systems provide mechanisms for applications to


communicate with each other, allowing them to share data and coordinate their activities.
● Performance Monitoring: Operating systems provide tools for monitoring system performance,
including CPU usage, memory usage, disk usage, and network activity. This can help identify
performance bottlenecks and optimize system performance.
● Backup and Recovery: Operating systems provide backup and recovery mechanisms to protect data
in the event of system failure or data loss.
● Debugging: Operating systems provide debugging tools that allow developers to identify and fix
software bugs and other issues in the system.

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
Program execution
Operating systems handle many kinds of activities from user programs to system programs like printer
spooler, name servers, file server, etc. Each of these activities is encapsulated as a process.
A process includes the complete execution context (code to execute, data to
manipulate, registers, OS resources in use). 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.
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.
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.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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.
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.
The OS handles routing and connection strategies, and the problems of
contention and security. Following are the major activities of an operating
system with respect to communication −
● 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.
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.
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.
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.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

OPERATING SYSTEM AND USER INTERFACE

As already mentioned, in addition to the hardware, a computer also needs a set of programs—an operating
system—to control the devices. This page will discuss the following:

▪ There are different kinds of operating systems: such as Windows, Linux and Mac OS
▪ There are also different versions of these operating systems, e.g. Windows 10 and 11
▪ Operating systems can be used with different user interfaces (UI): text user interfaces (TUI)
and graphical user interfaces (GUI) as examples
▪ Graphical user interfaces have many similarities in different operating systems: such as the
start menu, desktop etc.
When you can recognize the typical parts of each operating system’s user interface, you will mostly be
able to use both Windows and Linux as well as e.g. Mac OS.

THE ROLE OF OPERATING SYSTEM IN THE COMPUTER

An operating system (OS) is a set of programs which ensures the interoperability of the hardware and
software in your computer. The operating system enables, among other things,

▪ the identification and activation of devices connected to the computer,


▪ the installation and use of programs, and
▪ the handling of files.

What happens when you turn on your computer or smartphone?


– The computer checks the functionality of its components and any devices connected to it, and starts to look
for the OS on a hard drive or other memory media.
– If the OS is found, the computer starts to load it into the RAM (Random Access Memory).
– When the OS has loaded, the computer waits for commands from you.

DIFFERENT OPERATING SYSTEMS

Over the years, several different operating systems have been developed for different purposes. The most
typical operating systems in ordinary computers are Windows, Linux and Mac OS.

WINDOWS
The name of the Windows OS comes from the fact that programs are run in “windows”: each program has
its own window, and you can have several programs open at the same time. Windows is the most popular
OS for home computers, and there are several versions of it. The newest version is Windows 11.

LINUX AND UNIX


Linux is an open-source OS, which means that its program code is freely available to software developers.
This is why thousands of programmers around the world have developed Linux, and it is considered the
most tested OS in the world. Linux has been very much influenced by the commercial Unix OS.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

In addition to servers, Linux is widely used in home computers, since there are a great number of free
programs for it (for text and image processing, spreadsheets, publishing, etc.). Over the years, many
different versions of Linux have become available for distribution, most of which are free for the user
(such as Ubuntu, Fedora and Mint, to name a few).

Linux can be installed on a PC as the only operating system or alongside Windows, so that each time the
machine is started, the user selects either one. Linux may also be used on a virtual computer from the
Windows environment, or vice versa, Windows from Linux.

MAC OS X
Apple’s Mac computers have their own operating system, OS X. Most of the programs that are available
for PCs are also available for Macs running under OS X, but these two types of computers cannot use the
exact same programs: for example, you cannot install the Mac version of the Microsoft Office suite on a
Windows computer. You can install other operating systems on Mac computers, but the OS X is only
available for computers made by Apple. Apple’s lighter portable devices (iPads, iPhones) use a light
version of the same operating system, called iOS.

Mac computers are popular because OS X is considered fast, easy to learn and very stable and Apple’s
devices are considered well-designed—though rather expensive.

ANDROID
Android is an operating system designed for phones and other mobile devices. Android is not available
for desktop computers, but in mobile devices it is extremely popular: more than a half of all mobile devices
in the world run on Android.

USER INTERFACES

A user interface (UI) refers to the part of an operating system, program, or device that allows a user to
enter and receive information. A text-based user interface (see the image to the left) displays text, and
its commands are usually typed on a command line using a keyboard. With a graphical user
interface (see the right-hand image), the functions are carried out by clicking or moving buttons, icons
and menus by means of a pointing device.

Larger image: text UI | graphical UI


The images contain the same information: a directory listing of a computer. You can often carry out the
same tasks regardless of which kind of UI you are using.

TEXT USER INTERFACE (TUI)


Modern graphical user interfaces have evolved from text-based UIs. Some operating systems, such as
Linux, can still be used with a text-based user interface. In this case, the commands are entered as text
(e.g., “cat story.txt”).
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

To display the text-based Command Prompt in Windows, open the Start menu and type cmd. Press Enter on
the keyboard to launch the command prompt in a separate window. With the command prompt, you can type
your commands from the keyboard instead of using the mouse.
GRAPHICAL USER INTERFACE
In most operating systems, the primary user interface is graphical, i.e. instead of typing the commands
you manipulate various graphical objects (such as icons) with a pointing device. The underlying principle
of different graphical user interfaces (GUIs) is largely the same, so by knowing how to use a Windows
UI, you will most likely know how to use Linux or some other GUI.

System Calls in Operating System (OS)


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.
In this article, you will learn about the system calls in the operating system and discuss their types and
many other things.

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 a 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.

Why do you need 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.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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 GetCurrentProcessID() Getpid()


Maintenance 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:
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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.
Operating System Design and Implementation
Computer ScienceMCAOperating System

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.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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 favours 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.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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.

Operating System Structure

An operating system is a construct that allows the user application programs to interact with the system
hardware. Since the operating system is such a complex structure, it should be created with utmost care
so it can be used and modified easily. An easy way to do this is to create the operating system in parts.
Each of these parts should be well defined with clear inputs, outputs and functions.
Simple Structure
There are many operating systems that have a rather simple structure. These started as small systems and
rapidly expanded much further than their scope. A common example of this is MS-DOS. It was designed
simply for a niche amount for people. There was no indication that it would become so popular.
An image to illustrate the structure of MS-DOS is as follows −

It is better that operating systems have a modular structure, unlike MS-DOS. That would lead to greater
control over the computer system and its various applications. The modular structure would also allow
the programmers to hide information as required and implement internal routines as they see fit without
changing the outer specifications.
Layered Structure
One way to achieve modularity in the operating system is the layered approach. In this, the bottom layer
is the hardware and the topmost layer is the user interface.
An image demonstrating the layered approach is as follows −
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

As seen from the image, each upper layer is built on the bottom layer. All the layers hide some structures,
operations etc from their upper layers.
One problem with the layered structure is that each layer needs to be carefully defined. This is necessary
because the upper layers can only use the functionalities of the layers below them.
Operating System Debugging

Debugging is the process of finding the problems in a computer system and


solving them. There are many different ways in which operating systems
perform debugging. Some of these are −
Log Files
The log files record all the events that occur in an operating system. This
is done by writing all the messages into a log file. There are different types
of log files. Some of these are given as follows −
Event Logs
These stores the records of all the events that occur in the execution of a system. This is done so that the
activities of all the events can be understood to diagnose problems.
Transaction Logs
The transaction logs store the changes to the data so that the system can recover from crashes and other
errors. These logs are readable by a human.
Message Logs
These logs store both the public and private messages between the users. They are mostly plain text files,
but in some cases they may be HTML files.
Core Dump Files
The core dump files contain the memory address space of a process that terminates unexpectedly. The
creation of the core dump is triggered in response to program crashes by the kernel. The core dump files
are used by the developers to find the program’s state at the time of its termination so that they can find
out why the termination occurred.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

The automatic creation of the core dump files can be disabled by the users. This may be done to improve
performance, clear disk space or increase security.
Crash Dump Files
In the event of a total system failure, the information about the state of
the operating system is captured in crash dump files. There are three types
of dump that can be captured when a system crashes. These are −
Complete Memory Dump
The whole contents of the physical memory at the time of the system crash are captured in the complete
memory dump. This is the default setting on the Windows Server System.
Kernel Memory Dump
Only the kernel mode read and write pages that are present in the main memory at the time of the system
crash are stored in the kernel memory dump.
Small Memory Dump
This memory dump contains the list of device drivers, stop code, process and thread information, kernel
stack etc.
Trace Listings
The trace listing record information about a program execution using logging. This information is used
by programmers for debugging. System administrators and technical personnel can use the trace listings
to find the common problems with software using software monitoring tools.
Profiling
This is a type of program analysis that measures various parameters in a program such as space and time
complexity, frequency and duration of function calls, usage of specific instructions etc. Profiling is done
by monitoring the source code of the required system program using a code profiler.

Operating System Generations

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 −
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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
plugboards, 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.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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.
Booting in Operating System
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.

Advertisement

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.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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.
SRM Institute of Science and Technology, Ramapuram

21CSC202J – Operating Systems


Department & Semester: Computer Science and Engineering YEAR-2 SEM-3

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