0% found this document useful (0 votes)
16 views

Operating Systems Part - 1/5

operating systems
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Operating Systems Part - 1/5

operating systems
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

UNIT I

Operating Systems Overview: Operating system functions, Operating system structure,


Operating systems operations, Computing environments, Open-Source Operating Systems.
System Structures: Operating System Services, User and Operating-System Interface,
systems calls, Types of System Calls, system programs, operating system structure, operating
system debugging, System Boot.

Introduction:
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.
Some popular Operating Systems include Linux Operating System, Windows
Operating System, VMS, OS/400, AIX, z/OS, etc.

Definition
An operating system is a program that acts as an interface between the user and the
computer hardware and controls the execution of all kinds of programs.

Operating Systems Functions:


Following are some of important functions of an operating System.

 Memory Management
 Processor Management
 Device Management
 File Management
 Security
 Control over system performance
 Job accounting
 Error detecting aids
 Coordination between other software and users

1. Memory Management
Memory management refers to management of Primary Memory or Main Memory.
Main memory is a large array of words or bytes where each word or byte has its own
address.
Main memory provides a fast storage that can be accessed directly by the CPU. For a
program to be executed, it must in the main memory. An Operating System does the
following activities for memory management −
 Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part
are not in use.
 In multiprogramming, the OS decides which process will get memory when and how
much.
 Allocates the memory when a process requests it to do so.
 De-allocates the memory when a process no longer needs it or has been terminated.

2. Processor Management
In multiprogramming environment, the OS decides which process gets the processor when
and for how much time. This function is called process scheduling. An Operating System
does the following activities for processor management −
 Keeps tracks of processor and status of process. The program responsible for this task
is known as traffic controller.
 Allocates the processor (CPU) to a process.
 De-allocates processor when a process is no longer required.

3. Device Management
An Operating System manages device communication via their respective drivers. It does
the following activities for device management −
 Keeps tracks of all devices. Program responsible for this task is known as the I/O
controller.
 Decides which process gets the device when and for how much time.
 Allocates the device in the efficient way.
 De-allocates devices.

4. File Management
A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions.
An Operating System does the following activities for file management −
 Keeps track of information, location, uses, status etc. The collective facilities are
often known as file system.
 Decides who gets the resources.
 Allocates the resources.
 De-allocates the resources.

Other Important Activities


Following are some of the important activities that an Operating System performs −
 Security − By means of password and similar other techniques, it prevents
unauthorized access to programs and data.
 Control over system performance − Recording delays between request for a service
and response from the system.
 Job accounting − Keeping track of time and resources used by various jobs and
users.
 Error detecting aids − Production of dumps, traces, error messages, and other
debugging and error detecting aids.
 Coordination between other softwares and users − Coordination and assignment
of compilers, interpreters, assemblers and other software to the various users of the
computer systems.

Operating Systems w.r.t. Computer Generations:


Operating systems are there from the very first computer generation and they keep
evolving with time. In this chapter, we will discuss some of the important types of operating
systems which are most commonly used.
1. Batch operating system
The users of a batch operating system do not interact with the computer directly. Each user
prepares his job on an off-line device like punch cards and submits it to the computer
operator. To speed up processing, jobs with similar needs are batched together and run as a
group. The programmers leave their programs with the operator and the operator then sorts
the programs with similar requirements into batches.
The problems with Batch Systems are as follows −
 Lack of interaction between the user and the job.
 CPU is often idle, because the speed of the mechanical I/O devices is slower than the
CPU.
 Difficult to provide the desired priority.

2. Time-sharing operating systems


Time-sharing is a technique which enables many people, located at various terminals, to
use a particular computer system at the same time. Time-sharing or multitasking is a logical
extension of multiprogramming. Processor's time which is shared among multiple users
simultaneously is termed as time-sharing.
The main difference between Multiprogrammed Batch Systems and Time-Sharing
Systems is that in case of Multiprogrammed batch systems, the objective is to maximize
processor use, whereas in Time-Sharing Systems, the objective is to minimize response
time.
Multiple jobs are executed by the CPU by switching between them, but the switches
occur so frequently. Thus, the user can receive an immediate response. For example, in a
transaction processing, the processor executes each user program in a short burst or quantum
of computation. That is, if n users are present, then each user can get a time quantum. When
the user submits the command, the response time is in few seconds at most.
Advantages of Timesharing operating systems are as follows −

 Provides the advantage of quick response.


 Avoids duplication of software.
 Reduces CPU idle time.
Disadvantages of Time-sharing operating systems are as follows −

 Problem of reliability.
 Question of security and integrity of user programs and data.
 Problem of data communication.

3. Distributed operating System


Distributed systems use multiple central processors to serve multiple real-time
applications and multiple users. Data processing jobs are distributed among the processors
accordingly.
The processors communicate with one another through various communication lines
(such as high-speed buses or telephone lines). These are referred as loosely coupled
systems or distributed systems. Processors in a distributed system may vary in size and
function. These processors are referred as sites, nodes, computers, and so on.
The advantages of distributed systems are as follows −
 With resource sharing facility, a user at one site may be able to use the resources available at
another.
 Speedup the exchange of data with one another via electronic mail.
 If one site fails in a distributed system, the remaining sites can potentially continue operating.
 Better service to the customers.
 Reduction of the load on the host computer.
 Reduction of delays in data processing.

4. Network operating System


A Network Operating System runs on a server and provides the server the capability to
manage data, users, groups, security, applications, and other networking functions. The
primary purpose of the network operating system is to allow shared file and printer access
among multiple computers in a network, typically a local area network (LAN), a private
network or to other networks.
Examples of network operating systems include Microsoft Windows Server 2003,
Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.
The advantages of network operating systems are as follows −
 Centralized servers are highly stable.
 Security is server managed.
 Upgrades to new technologies and hardware can be easily integrated into the system.
 Remote access to servers is possible from different locations and types of systems.

The disadvantages of network operating systems are as follows −


 High cost of buying and running a server.
 Dependency on a central location for most operations.
 Regular maintenance and updates are required.

5. Real Time operating System


A real-time system is defined as a data processing system in which the time interval
required to process and respond to inputs is so small that it controls the environment. The
time taken by the system to respond to an input and display of required updated information
is termed as the response time. So in this method, the response time is very less as
compared to online processing.
Real-time systems are used when there are rigid time requirements on the operation of a
processor or the flow of data and real-time systems can be used as a control device in a
dedicated application. A real-time operating system must have well-defined, fixed time
constraints, otherwise the system will fail. For example, Scientific experiments, medical
imaging systems, industrial control systems, weapon systems, robots, air traffic control
systems, etc.
There are two types of real-time operating systems.

a) Hard real-time systems


Hard real-time systems guarantee that critical tasks complete on time. In hard real-time systems,
secondary storage is limited or missing and the data is stored in ROM. In these systems, virtual
memory is almost never found.
b) Soft real-time systems
Soft real-time systems are less restrictive. A critical real-time task gets priority over
other tasks and retains the priority until it completes. Soft real-time systems have limited
utility than hard real-time systems. For example, multimedia, virtual reality, Advanced
Scientific Projects like undersea exploration and planetary rovers, etc.

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

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.

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

2. Layered Structure of Operating System

The operating system can be implemented with the help of various structures. The
structure of the OS depends mainly on how the various common components of the operating
system are interconnected and melded into the kernel. Depending on this, we have to follow
the structures of the operating system.

The layered structure approach breaks up the operating system into different layers and
retains much more control on the system. The bottom layer (layer 0) is the hardware, and the
topmost layer (layer N) is the user interface. These layers are so designed that each layer uses
the functions of the lower-level layers only. It simplifies the debugging process as if lower-
level layers are debugged, and an error occurs during debugging. The error must be on that
layer only as the lower-level layers have already been debugged.

o This allows implementers to change the inner workings and increases modularity.
o As long as the external interface of the routines doesn't change, developers have more
freedom to change the inner workings of the routines.
o The main advantage is the simplicity of construction and debugging. The main
difficulty is defining the various layers.

The main disadvantage of this structure is that the data needs to be modified and passed
on at each layer, which adds overhead to the system. Moreover, careful planning of the layers
is necessary as a layer can use only lower-level layers. UNIX is an example of this structure.
There are six layers in the layered operating system.
A diagram demonstrating these layers is as follows:

1. Hardware: This layer interacts with the system hardware and coordinates with all the peripheral
devices used, such as a printer, mouse, keyboard, scanner, etc. These types of hardware devices are
managed in the hardware layer.
The hardware layer is the lowest and most authoritative layer in the layered operating
system architecture. It is attached directly to the core of the system.
2. CPU Scheduling: This layer deals with scheduling the processes for the CPU. Many scheduling
queues are used to handle processes. When the processes enter the system, they are put into the job
queue.
The processes that are ready to execute in the main memory are kept in the ready queue.
This layer is responsible for managing how many processes will be allocated to the CPU and how many
will stay out of the CPU.
3. Memory Management: Memory management deals with memory and moving processes from disk
to primary memory for execution and back again. This is handled by the third layer of the operating
system. All memory management is associated with this layer. There are various types of memories in
the computer like RAM, ROM.
If you consider RAM, then it is concerned with swapping in and swapping out of memory. When
our computer runs, some processes move to the main memory (RAM) for execution, and when
programs, such as calculator, exit, it is removed from the main memory.
4. Process Management: This layer is responsible for managing the processes, i.e., assigning the
processor to a process and deciding how many processes will stay in the waiting schedule. The priority
of the processes is also managed in this layer. The different algorithms used for process scheduling are
FCFS (first come, first served), SJF (shortest job first), priority scheduling, round-robin scheduling, etc.
5. I/O Buffer: I/O devices are very important in computer systems. They provide users with
the means of interacting with the system. This layer handles the buffers for the I/O devices and makes
sure that they work correctly.
Suppose you are typing from the keyboard. There is a keyboard buffer attached with the
keyboard, which stores data for a temporary time. Similarly, all input/output devices have some buffer
attached to them. This is because the input/output devices have slow processing or storing speed. The
computer uses buffers to maintain the good timing speed of the processor and input/output devices.
6. User Programs: This is the highest layer in the layered operating system. This layer deals
with the many user programs and applications that run in an operating system, such as word processors,
games, browsers, etc. You can also call this an application layer because it is concerned with
application programs.
Advantages of Layered Structure
There are several advantages of the layered structure of operating system design, such as:
1. Modularity: This design promotes modularity as each layer performs only the tasks it is scheduled to
perform.
2. Easy debugging: As the layers are discrete so it is very easy to debug. Suppose an error occurs in the
CPU scheduling layer. The developer can only search that particular layer to debug, unlike the
Monolithic system where all the services are present.
3. Easy update: A modification made in a particular layer will not affect the other layers.
4. No direct access to hardware: The hardware layer is the innermost layer present in the design. So a
user can use the services of hardware but cannot directly modify or access it, unlike the Simple system
in which the user had direct access to the hardware.
5. Abstraction: Every layer is concerned with its functions. So the functions and implementations of the
other layers are abstract to it.

Disadvantages of Layered Structure


Though this system has several advantages over the Monolithic and Simple design, there are also
some disadvantages, such as:
1. Complex and careful implementation: As a layer can access the services of the layers below it, so the
arrangement of the layers must be done carefully. For example, the backing storage layer uses the
services of the memory management layer. So it must be kept below the memory management layer.
Thus with great modularity comes complex implementation.
2. Slower in execution: If a layer wants to interact with another layer, it requests to travel through all the
layers present between the two interacting layers. Thus it increases response time, unlike the
Monolithic system, which is faster than this. Thus an increase in the number of layers may lead to a
very inefficient design.
3. Functionality: It is not always possible to divide the functionalities. Many times, they are interrelated
and can't be separated.
4. Communication: No communication between non-adjacent layers.

Operations of an Operating Systems:


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.
The major operations of the operating system are process management, memory
management, device management and file management. These are given in detail as follows:
Process Management
The operating system is responsible for managing the processes i.e assigning the
processor to a process at a time. This is known as process scheduling. The different
algorithms used for process scheduling are FCFS (first come first served), SJF (shortest job
first), priority scheduling, round robin scheduling etc.
There are many scheduling queues that are used to handle processes in process
management. When the processes enter the system, they are put into the job queue. The
processes that are ready to execute in the main memory are kept in the ready queue. The
processes that are waiting for the I/O device are kept in the device queue.

Memory Management
Memory management plays an important part in operating system. It deals with memory and
the moving of processes from disk to primary memory for execution and back again.
The activities performed by the operating system for memory management are −

 The operating system assigns memory to the processes as required. This can be done
using best fit, first fit and worst fit algorithms.
 All the memory is tracked by the operating system i.e. it nodes what memory parts are
in use by the processes and which are empty.
 The operating system deallocated memory from processes as required. This may
happen when a process has been terminated or if it no longer needs the memory.
Device Management
There are many I/O devices handled by the operating system such as mouse, keyboard, disk
drive etc. There are different device drivers that can be connected to the operating system to
handle a specific device. The device controller is an interface between the device and the
device driver. The user applications can access all the I/O devices using the device drivers,
which are device specific codes.

File Management
Files are used to provide a uniform view of data storage by the operating system. All the files
are mapped onto physical devices that are usually non volatile so data is safe in the case of
system failure.
The files can be accessed by the system in two ways i.e. sequential access and direct access −

 Sequential Access
The information in a file is processed in order using sequential access. The files
records are accessed on after another. Most of the file systems such as editors,
compilers etc. use sequential access.

 Direct Access
In direct access or relative access, the files can be accessed in random for read and
write operations. The direct access model is based on the disk model of a file, since it
allows random accesses.
Computing environments;
Computing is nothing but process of completing a task by using this computer
technology and it may involve computer hardware and/or software. But computing uses
some form of computer system to manage, process, and communicate information. After
getting some idea about computing now lets understand about computing environments.

ComputingEnvironments:
When a problem is solved by the computer, during that computer uses many
devices, arranged in different ways and which work together to solve problems. This
constitutes a computing environment where various number of computer devices arranged
in different ways to solve different types of problems in different ways. In different
computing environments computer devices are arranged in different ways and they
exchange information in between them to process and solve problem. One computing
environment consists of many computers other computational devices, software and
networks that to support processing and sharing information and solving task.
Based on the organization of different computer devices and communication processes
there exists multiple types of computing environments. Now lets know about different
types of computing environments.

Types of Computing Environments :


The are the various types of computing environments. They are :

1. Personal Computing Environment :


In personal computing environment there is a stand-alone machine. Complete program
resides on computer and executed there. Different stand-alone machines that constitute
a personal computing environment are laptops, mobiles, printers, computer systems,
scanners etc. That we use at our homes and offices.
2. Time-Sharing Computing Environment :
In Time Sharing Computing Environment multiple users share system simultaneously.
Different users (different processes) are allotted different time slice and processor
switches rapidly among users according to it. For example, student listening to music
while coding something in an IDE. Windows 95 and later versions, Unix, IOS, Linux
operating systems are the examples of this time sharing computing environment.
3. Client Server Computing Environment :
In client server computing environment two machines are involved i.e., client
machine and server machine, sometime same machine also serve as client and
server. In this computing environment client requests resource/service and server
provides that respective resource/service. A server can provide service to multiple
clients at a time and here mainly communication happens through computer
network.
4. Distributed Computing Environment :
In a distributed computing environment multiple nodes are connected together using
network but physically they are separated. A single task is performed by different
functional units of different nodes of distributed unit. Here different programs of an
application run simultaneously on different nodes, and communication happens in
between different nodes of this system over network to solve task.
5. Grid Computing Environment :
In grid computing environment, multiple computers from different locations works
on single problem. In this system set of computer nodes running in cluster jointly
perform a given task by applying resources of multiple computers/nodes. It is
network of computing environment where several scattered resources provide
running environment for single task.
6. Cloud Computing Environment :
In cloud computing environment on demand availability of computer system
resources like processing and storage are availed. Here computing is not done in
individual technology or computer rather it is computed in cloud of computers
where all required resources are provided by cloud vendor.
7. Cluster Computing Environment :
In cluster computing environment cluster performs task where cluster is a set of
loosely or tightly connected computers that work together. It is viewed as single
system and performs task parallelly that’s why also it is similar to parallel
computing environment. Cluster aware applications are especially used in cluster
computing environment.

Open-Source Operating Systems.

Open Source operating systems are released under a license where the copyright
holder allows others to study, change as well as distribute the software to other people. This
can be done for any reason. The different open source operating system available in the
market are −

Cosmos
This is an open source operating system written mostly in programming language C#. Its full
form is C# Open Source Managed Operating System.

FreeDOS
This was a free operating system developed for systems compatible with IBM PC computers.
FreeDOS provides a complete environment to run legacy software and other embedded
systems.

Genode
Genode is free as well as open source. It contains a microkernel layer and different user
components. It is one of the few open source operating systems not derived from a licenced
operating system such as Unix.
Ghost OS
This is a free, open source operating system developed for personal computers. It started as a
research project and developed to contain various advanced features like graphical user
interface, C library etc.

ITS
The incompatible time-sharing system was developed by the MIT Artificial Intelligence
Library. It is principally a time sharing system. There is a remote login facility which allowed
guest users to informally try out the operating system and its features using ARPAnet.

OSv
This was an operating system released in 2013. It was mainly focused on cloud computing
and was built to run on top of a virtual machine as a guest. This is the reason it doesn't
include drivers for bare hardware.

Phantom OS
This is an operating system that is based on the concepts on persistent virtual memory and is
code oriented. It was mostly developed by Russian developers. Phantom OS is not based on
concepts of famous operating systems such as Unix.

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

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

User and Operating-System Interface


User Interface
A User interface (UI) facilitates communication between an application and its user
by acting as an intermediary between them. Each application including the operating system
is provided with a specific UI for effective communication. The two basic function of a user
interface of an application is to take the inputs from the user and to provide the output to the
users. However, the types of inputs taken by the UI and the types of output provided by the
UI may vary from one application to another.

A user interface of any operating system can be classified into one of the following types:

1. Graphical user interface (GUI)


2. Command line user interface (CLI)

1) Graphical user interface (GUI)


The graphical user interface is a type of GUI that enables the users to interact with the
operating system by means of point-and-click operations. GUI contains several icons
representing pictorial representation of the variables such as a file, directory, and device. The
graphical icon provided in the UI can be manipulated by the users using a suitable pointing
device such as a mouse, trackball, touch screen and light pen. The other input devices like
keyboard can also be used to manipulate these graphical icons. GUIs are considered to be
very user- friendly interface because each object is represented with a corresponding icon.
Unlike the other UIs the users need not provide text command for executing tasks.

Some advantages of GUI based operating system

 The GUI interface is easy to understand and even the new users can operate on them on their
own.
 The GUI interface visually acknowledges and confirms each type of activities performed by
the users. For example when the user deletes a file in the Windows operating system, then the
operating system asks for the confirmation before deleting it.
 The GUI interface enables the users to perform a number of tasks at the same time. This
features of the operating system are also known as multitasking.

2) Command line Interface (CLI)


ommand line interface is a type of UI that enables the users to interact with the
operating system by issuing some specific commands. In order to perform a task in this
interface, the user needs to type a command at the command line. When the user enters the
key, the command line interpreter received a command. The software program that is
responsible for receiving and processing the commands issued by the user. After processing
the command are called command line interpreter, the command line interpreter displays the
command prompt again along with the output of the previous command issued by the user.
The disadvantages of the CLI is that the user needs to remember a lot to interact with the
operating system. Therefore these types of interface are not considered very friendly from the
users perspective.

Example: In order to perform a task, we need to type a command at the command prompt
denoted by C:\> to copy a text file, say al.text, from the C drive of our computer system. To
the D drive, we need to type the copy command at the command prompt.

SYSTEM CALL:
System Call: 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.

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.

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.

Types of System Calls


There are commonly five types of system calls. These are as follows:
Process Control
These system calls deal with processes such as process creation, process termination etc.
File Management
These system calls are responsible for file manipulation such as creating a file, reading a file,
writing into a file etc.
Device Management
These system calls are responsible for device manipulation such as reading from device
buffers, writing into device buffers etc.
Information Maintenance
These system calls handle information and its transfer between the operating system and the
user program.
Communication
These system calls are useful for interprocess communication. They also deal with creating
and deleting a communication connection.
Details of some of those system calls are as follows −

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.

wait()
In some systems, a process may wait for another process to complete its execution.
This happens when a parent process creates a child process and the execution of the parent
process is suspended until the child process executes.

exec()
This system call runs an executable file in the context of an already running process.
It replaces the previous executable file.

fork()
Processes use the fork() system call to create processes that are a copy of themselves.
This is one of the major methods of process creation in operating systems. When a parent
process creates a child process and the execution of the parent process is suspended until the
child process executes.

exit()
The exit() system call is used by a program to terminate its execution. In a
multithreaded environment, this means that the thread execution is complete.
kill()
The kill() system call is used by the operating system to send a termination signal to a
process that urges the process to exit.

System Programs
System programs provide an environment where programs can be developed and
executed. In the simplest sense, system programs also provide a bridge between the user
interface and system calls. In reality, they are much more complex. For example, a compiler
is a complex system program.

System Programs Purpose


The system program serves as a part of the operating system. It traditionally lies
between the user interface and the system calls. The user view of the system is actually
defined by system programs and not system calls because that is what they interact with and
system programs are closer to the user interface.
An image that describes system programs in the operating system hierarchy is as
follows −

Types of System Programs


System programs can be divided into seven parts. These are given as follows:
Status Information
The status information system programs provide required data on the current or past
status of the system. This may include the system date, system time, available memory in
system, disk space, logged in users etc.
Communications
These system programs are needed for system communications such as web browsers.
Web browsers allow systems to communicate and access information from the network as
required.
File Manipulation
These system programs are used to manipulate system files. This can be done using
various commands like create, delete, copy, rename, print etc. These commands can create
files, delete files, copy the contents of one file into another, rename files, print them etc.
Program Loading and Execution
The system programs that deal with program loading and execution make sure that
programs can be loaded into memory and executed correctly. Loaders and Linkers are a
prime example of this type of system programs.
File Modification
System programs that are used for file modification basically change the data in the
file or modify it in some other way. Text editors are a big example of file modification
system programs.
Application Programs
Application programs can perform a wide range of services as per the needs of the
users. These include programs for database systems, word processors, plotting tools,
spreadsheets, games, scientific applications etc.
Programming Language Support
These system programs provide additional support features for different programming
languages. Some examples of these are compilers, debuggers etc. These compile a program
and make sure it is error free respectively.

Debugging in Operating Systems:


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

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

You might also like