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

01. OS- Introduction

The document provides an overview of operating systems (OS), detailing their definitions, goals, and various types including batch processing, multiprogramming, multitasking, multiuser, time-sharing, personal computers, and multiprocessor systems. It explains the OS's role as an interface between users and hardware, resource management, and the importance of efficient execution of programs. Additionally, it discusses the viewpoints of users and systems regarding OS functionality and resource allocation.

Uploaded by

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

01. OS- Introduction

The document provides an overview of operating systems (OS), detailing their definitions, goals, and various types including batch processing, multiprogramming, multitasking, multiuser, time-sharing, personal computers, and multiprocessor systems. It explains the OS's role as an interface between users and hardware, resource management, and the importance of efficient execution of programs. Additionally, it discusses the viewpoints of users and systems regarding OS functionality and resource allocation.

Uploaded by

Anjali Mhetre
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

** I.

INTRODUCTION **

Syllabus:
1. Introduction and Operating system structures: Definition, Types of Operating system, Real-Time operating
system,
2. System Components: System Services, Systems Calls, System Programs, System structure, Virtual
Machines, System Design and Implementation, System Generations.

1. Introduction/Overview .
1.1. What Is An Operating System
 An operating system (OS) acts as an interface between the user and the computer hardware. The purpose of an
OS is to provide an environment in which a user can execute programs in a convenient and efficient manner.
 Computer = Hardware + Operating System + Application programs + Users
 OS serves as interface between Hardware and ( Application programs & Users ). OS provides services for
Apps & Users
 OS manages resources ( Government model, it doesn't produce anything. )
 Operating system goals:
 Execute user programs and make solving user problems
easier.
 Make the computer system convenient to use.
 Use the computer hardware in an efficient manner.
 Operating System acts as:
1. OS is a resource allocator
o Manages all resources
o Decides between conflicting requests for efficient and
fair resource use
2. OS is a control program
o Controls execution of programs to prevent errors and
improper use of then computer
o Concerned with the operation & control of I/O devices
o Kernel – one program running at all times on the computer.

1.1.2. Computer System Structure:


A computer system can be divided roughly into four components: the hardware, the OS, the application
programs, and the users .
1. Hardware: provides basic computing resources
- Electronic, mechanical, optical devices.
- The central processing unit (CPU), the memory,
and the input/output (I/O) devices-provides the
basic computing resources for the system.
- The hardware must provide appropriate
mechanisms to ensure the correct operation of the
computer system and to prevent user programs
from interfering with the proper operation of the
system.
2. Operating system : Controls and coordinates use of
hardware among various applications and users

F
igure 1: Components of Computer System

Operating system: Unit I- Introduction 1


3. Application programs: define the ways in which the system resources are used to solve the computing
problems of the users
For example: Word processors, compilers, web browsers, database systems, video games
4. Users: People, machines, other computers

 Hardware provides basic computing resources (CPU, memory, I/O devices).


 OS controls and coordinates the use of the hardware among the various application programs for the
various users. Provides orderly and controlled allocation (i.e., sharing, optimization of resource utilization)
and use of the resources by the users (jobs) that compete for them.
 An OS is similar to a government. Like a government, it performs no useful function by itself. It simply
provides an environment within which other programs can do useful work.

1.1.3 Viewpoints of operating system:


Operating system can be explored from these two viewpoints:
1. User viewpoint
2. system viewpoint
User’s viewpoint of operating system:
As per the user’s viewpoint, an OS is designed mostly for ease of use. While designing an OS according to the
user’s viewpoint, an OS should provide
 Better performance
 Ease of use
 Convenience for the user
 Maximum resource utilization
System’s viewpoint of operating system:
From the system point of view, the OS is a program that interacts with hardware. The OS should control various
I/O devices and users program. According to systems viewpoint OS is viewed as :
 Resource allocation, Resource is “Something valuable” e.g. CPU time, memory space (RAM), file-
storage space, I/O devices (disk), and so on.
 Memory manager
 Control program and manages execution of user program
 Conduct operations of computer system efficiently.

1.2. Types of Operating system


1) Simple Batch Processing Systems
 The user prepares a job (which consists of program, data and some control information), submits it to the
computer operator and receives the output after the program is executed. The job is usually punched on cards
and the output is usually printed.
 To speed up processing, jobs with similar needs can be batched together and run as a group. Thus, the operator
sorts the programs with similar requirements into batches, runs each batch and sends the output to the
programmer.
 The operating system is always in memory and its job is to transfer control automatically from one job to the
next.

Figure - Batch OS
Operating system: Unit I- Introduction 2
 For overcoming this problem use the Spooling Technique. Spool is a buffer that holds output for
a device, such as printer, that can not accept interleaved data streams. That is when the job
requests the printer to output a line, that line is copied into a system buffer and is written to the
disk. When the job is completed, the output is printed. Spooling technique can keep both the
CPU and the I/O devices working at much higher rates.
 The problems with Batch Systems are:
 Lack of interaction between the user and job.
 CPU is often idle, because the speeds of the mechanical I/O devices are slower than CPU.As jobs get
executed in batch, turnaround time is more
 Debugging is not easier as it is to be done after completion of jobs by checking memory location.

2) Multiprogramming Operating Systems


 Multiprogramming OS is an ability of an operating system that executes more than one program using a
single processor machine.
 To overcome the problem of underutilization of CPU and main memory, the multi-programming was
introduced. The multi-programming is interleaved execution of multiple jobs by the same computer.
 A single user cannot keep either the CPU or the I/O devices busy at all the times. Multi-programming increases
CPU utilization by organizing jobs so that the CPU always has one to execute.
 The operating system keep set of jobs in job pool, OS picks and begins to execute one of the jobs in main
memory.
 If the job may have to wait for some task, such as an I/O operation to complete then in multiprogramming
system, the OS switches to another job and executes it.
 When that job needs to wait, the CPU is switched to another job and so on.
 Eventually, the first job finishes waiting and gets the CPU back.
 As long as at least one job needs to execute, the CPU is never idle.
 100% processor utilization is achieved with multiprogramming.
 Context switch:Switching of processor from on job to next
 When CPU switches to another process, the system must save the state of the old process
 and load the saved state for the new process
 Context-switch time is overhead; the system does no useful work while switching
 Time dependent on hardware support
 Degree of multiprogramming: The number of programs running simultaneously and actively competing for
resources.
 Higher degree of multiprogramming gives good results in higher resource utilization.

For Example:

Operating system: Unit I- Introduction 3


Advantages
 Maximum CPU utilization.
 Efficient Resource utilization.
 CPU throughput is high and also supports multiple interactive user terminals.

Disadvantages
 CPU scheduling is compulsory because lots of jobs are ready to run on CPU simultaneously.
 Overhead of context switch

Types of the Multiprogramming Operating System


There are mainly two types of multiprogramming operating systems. These are as follows:
1. Multitasking Operating System
2. Multiuser Operating System

Multitasking Operating System


Multitasking term used in a modern computer system. It is a logical extension of a multiprogramming system that
enables the execution of multiple programs simultaneously. In an operating system, multitasking allows a user to
perform more than one computer task simultaneously. Multiple tasks are also known as processes that share
similar processing resources like a CPU. The operating system keeps track of where you are in each of these jobs
and allows you to transition between them without losing data.

Early operating system could execute various programs at the same time, although multitasking was not fully
supported. As a result, a single software could consume the entire CPU of the computer while completing a certain
activity. Basic operating system functions, such as file copying, prevented the user from completing other tasks,
such as opening and closing windows. Fortunately, because modern operating systems have complete multitasking
capability, numerous programs can run concurrently without interfering with one other. In addition, many
operating system processes can run at the same time.

Multiuser Operating System

Definition: A Multi-user operating system is a computer operating system which allows multiple users to access
the single system with one operating system on it. It is generally used on large mainframe computers.
Example: Linux, Unix, Windows 2000, Ubuntu, Mac OS etc.,
In the multi-user operating system, different users connected at
different terminals and we can access, these users through the network
as shown in the diagram.

Features of the Multi-user Operating System


• Multi-tasking- Using multi-user operating system we can
perform multiple tasks at a time, i.e. we can run more than one
program at a time.

Operating system: Unit I- Introduction 4


Example: we can edit a word document while browsing the internet.
• Resource sharing- we can share different peripherals like printers, hard drives or we can share a file or data.
For this, each user is given a small time slice of CPU time.
• Background processing- It means that when commands are not processed firstly, then they are executed in
the background while another programs are interacting with the system in the real time.

Types of Multi-user Operating System


A multi-user operating system is of 3 types which are as follows:
1. Distributed Systems: in this, different computers are managed in such a way so that they can appear as a
single computer. So, a sort of network is formed through which they can communicate with each other.
2. Time-sliced Systems: in this, a short period is assigned to each task, i.e. each user is given a time slice of
the CPU time. As we know these time slices are tiny, so it appears to the users that they all are using
the mainframe computer at the same time.
3. Multiprocessor Systems: in this, the operating system utilises more than one processor.
Example: Linux, Unix, Windows XP

Difference Between Single user and Multi user System

Single user Operating System Multi-user Operating System


It is an operating system in which the user can It is an operating system in which multiple users can
manage one thing at a time effectively. manage multiple resources at a time
Example: Linux, Unix, windows 2000, windows 2003
Example: MS DOS
etc.
Single user Operating System has two types: Single
It is of three types: time-sharing operating system,
user Single task Operating System and Single user
distributed operating system and multiprocessor system.
Multi task Operating System.
It is simple. It is complex.
It provides controlled access for the number of users by
It provides a platform for one user at a time.
maintaining a database of known users.
If another user wants to access the computer
There is no need to wait for accessing the computer
resources, then he/she has to wait until the current
resources.
process completes.
This type of operating system is used for single user. This type of operating system is used for multiple users.
In this, sometimes CPU is utilised to its maximum The operating system stimulates real-time performance
limit. by task switching.
It supports standalone systems. It doesn’t support standalone systems.
It is the operating system which maximum people use It is the operating system which is most of the time used
on their personal computers or laptops. in mainframe computers.
we have to take care of balance between users so that if
In this, there is no need to take care of balance
one problem arises with one user does not affect other
between users.
users also.

Operating system: Unit I- Introduction 5


3) Time Sharing Systems
 Time-Sharing Systems supports Interactive Computing. Time sharing (or multitasking) is a logical
extension of multiprogramming.
 A time-shared operating system allows many users to share the computers simultaneously. The time is
managed properly for multiple users in an interactive manner and at a reasonable cost, the CPU executes
multiple jobs by switching among them, but the switches occur so frequently that the users can interact
with each program while it is running.
 As the system switches rapidly from one user to the next, each user is given the impression that the entire
computer system is dedicated to his use, even though it is being shared among many users.
 Time-sharing operating systems:
- uses CPU scheduling and multiprogramming,
- uses time-slice mechanism,
- allows interactive I/O,
- Allows many users to share the computer simultaneously.
Working:
 All actions and commands are short in size in such type of system.
 Time slice, time slot or quantum: short period of time during which user gets attention of CPU .It is
typically of the order of 10 to 100 milliseconds.
 A time slice is decided and CPU switches from one job to another in circular manner, executing each job
for the time slice only.
 CPU switching occurs so frequently that each user is given impression that the entire system is dedicated
for his use.
 Time-shared OS uses CPU scheduling and multiprogramming to provide small portion of time-shared
system to each user.
 Each user had at least one program in memory. A program loaded into memory, which is referred as a
process.
 When process executes, it executes for small period of time equals to Time Slice, the process can either
complete its operation or CPU can release it as its time slice over.
 The control is given to the next job of next user and so on.
 When all jobs in queue are over, the system again starts from the first process. It starts the process
execution from where it is left.
 Time-sharing OS is more complex than multi-programmed OS.

Advantages –
- It provides the advantage of quick response.
- It reduces CPU idle time.

Disadvantages
- Time sharing has problem of reliability.
- Question of security and integrity of user programs and data can be raised.

Operating system: Unit I- Introduction 6


4) Personnel Computers (Single-Processor Systems)

 These systems are Single-user and dedicated systems. Previously thought as individuals have sole use of
computer, do not need advanced CPU utilization, protection features.
 It may run several different types of OS (Windows, Mac OS X, UNIX, Linux) which offer multitasking and
virtual memory on PC hardware.

Figure: Personal computers

 It has I/O devices like – keyboards, mouse, display screens, printers etc.
 The goal of this O.S. is User convenience and responsiveness so these are neither multi-user nor multitasking
systems.
 PCs contain a microprocessor in the keyboard to convert the keystrokes into codes to be sent to the CPU.
 A disk-controller microprocessor receives a sequence of requests from the main CPU and implements its own
disk queue and scheduling algorithm.
 This arrangement relieves the main CPU of the overhead of disk scheduling.•
 The use of special-purpose microprocessors is common and does not turn a single-processor system into a
multiprocessor.
 They can adopt technology developed for larger operating system, often individuals have sole use of computer
and do not need advanced CPU utilization of protection features
 If there is only one general-purpose CPU, then the system is a single-processor system.

5) Multiprocessor system
 A multiprocessor system is a collection of a number of standard processors put together in an innovative way
to improve the performance / speed of computer hardware.
 The main feature of this architecture is to provide high speed at low cost in comparison to uniprocessor.
 Multiprocessor operating systems aim to support high performance through multiple CPUs.
 Multiprocessor systems have more than one processing unit sharing memory/peripheral devices. They have
greater computing power, and higher reliability.
 Multiprocessor systems are classified into two:
1.Parallel systems (Tightly-coupled )
2.Distributed Systems (Loosely-coupled)

1.6.1 Multiprocessor system (Parallel Systems / Tightly coupled system)


 The desire for increased throughput has led to system designs in which multiple streams of processing
occurs in parallel.
 Multiprocessor systems have two or more processors in close communication.
 It is tightly coupled system in which processors share systems bus, peripheral devices, memory and a
clock; processor’s communication usually takes place through the shared memory.

Operating system: Unit I- Introduction 7


 The multiprocessor systems are of two types:
1. Symmetric multiprocessing (SMP)
 In SMP each processor performs all tasks within operating system and there is no master slave
relationship.
 Each processor runs an identical copy of operating system.
 Many processes can run at once without performance deterioration.
 Most modern operating systems support SMP

2. Asymmetric multiprocessing
 Each processor is assigned a specific task. This scheme have master – slave relationship.
 A master processor controls the system and other processors either look to the master for
instructions or have predefined tasks.
 Master processor schedules and allocate work to slave processors.
 More common in extremely large systems. Virtually all modern OSs-including Windows,
Windows XP, Mac OS x, and Linux-now provide support for SMP
Advantages:
 Increased throughput
By increasing number of processors, we get more work in less time. The speed-up ratio with N
processors is not N, rather it is less than N.
 Economical
Multiprocessor systems can cost less than equivalent multiple single processor systems, because they
can share peripherals, mass storage and power supplies. If several programs operate on same set of
data, it is cheaper to store those data on one disk and to have all the processors share them than to have
many computers with local disks and many copies of data.
 Increased reliability
If functions are distributed properly among several processors , then the failure of one processor will
not halt the system, only slow it down because the remaining systems picks up the load of failure
system.
The ability of providing service proportional to the level of surviving hardware is called as graceful
degradation. Systems designed for graceful degradation are called as fault tolerant systems

1.6.2 Multiprocessor Systems (Distributed Systems – Loosely coupled systems)


 It is a collection of loosely coupled processors interconnected by a communication network. A distributed
system is a collection of physically separate, possibly heterogeneous computer systems that are networked
(LAN or WAN) to provide the users with access to the various resources that the system maintains.
 It is a loosely coupled system in which each processor has its own local memory; they do not share
memory or clock. May be either client-server or peer-to-peer systems.

Figure: Client-Server.
Operating system: Unit I- Introduction 8
 The processors in distributed systems may vary in size and function. They may include small
microprocessors, workstations, minicomputers and large general purpose computer systems.
 Processors communicate with one another through various communications lines, such as high speed buses
or telephone lines.
 In this system, the user can access to the resources maintained by the system and thereby speeding up
computation and data availability and reliability.
 Distributed systems require networking infrastructure and can distribute the computation among several
physical processors.
 Local area networks (LAN) or Wide area networks (WAN) are examples of distributed systems
 They May be either client-server or peer-to-peer systems. Many of today’s systems act as server systems
to satisfy requests generated by client systems. This form of specialized distributed system, called client-
server system, A server running a database that responds to client requests for data is an example of such a
system

Advantages:
 Resources Sharing: If number of machines is connected then user at one site can share files at remote
sites, process information in a database, print files at remote site etc.
 Computation speed up – load sharing: If any computation can be partitioned into sub computations that
can run concurrently, then a distributed system allow us to distribute the sub computation among the
various sites which can run simultaneously thus provide computation speedup.
 Reliability: If one site fails in a distributed system, the remaining sites can continue operating, giving the
system better reliability.
 Communications: Communication among different system is possible by using electronic messaging, or
file transfer or exchange of program or data.

1.3 Real-Time Systems

 A real-time system is defined as a data processing system in which the time interval required to process and
respond to inputs is very small.
 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
 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.
 The primary objective of Real time systems is to provide quick event response times.
 Real time system should process thousands of interrupts per second without missing a single event.
 Real time systems used in application such as controlling scientific experiments, medical imaging systems,
industrial control systems, telephone switching equipment, flight control and some display systems.
 Characteristics of real time system:
- single purpose
- small size
- critical time requirements
 In real time system programmer defined and controlled processes are already stored and a separate process
is there for handling a single external event.
 Whenever an external event occurs, it is signaled by an interrupt which activate the necessary processes.
 Multitasking operation is accomplished by scheduling processes for execution independently of each other
to get an output.
 Memory management is less demanding here as many processes permanently reside in memory in order to
provide quick response time.

Operating system: Unit I- Introduction 9


 Real time systems are of two types:
1. Hard real time systems:
- These systems should guarantee that the critical real time tasks should be completed within their
deadlines.
- Secondary storage limited or absent,
- data stored in short term memory, or read-only memory (ROM)
- Example: Flight controller system, nuclear power plant control systems
2. Soft real time systems :
- They are less restrictive for deadlines, it only require that real time tasks should receive priority
over other tasks and that it will retain that priority until it completes.
- Useful in applications (multimedia, virtual reality) requiring advanced operating-system features.
- Example: Telephone switches, Multimedia transmission and reception control systems
Advantages:
 Real-time systems provide immediate and accurate responses to external events, making them suitable
for critical applications such as air traffic control, medical equipment, and industrial automation.
 They can automate complex tasks that would otherwise be impossible to perform manually, thus
improving productivity and efficiency.
 Real-time systems can reduce human error by automating tasks that require precision, accuracy, and
consistency.
 They can help to reduce costs by minimizing the need for human intervention and reducing the risk of
errors.
 Real-time systems can be customized to meet specific requirements, making them ideal for a wide range
of applications.
Disadvantages:
 Real-time systems can be complex and difficult to design, implement, and test, requiring specialized
skills and expertise.
 They can be expensive to develop, as they require specialized hardware and software components.
 Real-time systems are typically less flexible than other types of computer systems, as they must adhere to
strict timing requirements and cannot be easily modified or adapted to changing circumstances.
 They can be vulnerable to failures and malfunctions, which can have serious consequences in critical
applications.
 Real-time systems require careful planning and management, as they must be continually monitored and
maintained to ensure they operate correctly.

2 System Components: .

2.1. System Components


There are various components of an Operating System to perform well defined tasks. Though most of the
Operating Systems differ in structure but logically they have similar components. Each component must be a well-
defined portion of a system that appropriately describes the functions, inputs, and outputs.
There are following 8-components of an Operating System:
1. Process Management
2. I/O Device Management
3. File Management
4. Network Management
5. Main Memory Management
6. Secondary Storage Management
7. Security Management
8. Command Interpreter System

Operating system: Unit I- Introduction 10


Following section explains all the above components in more detail:

1. Process Management
• A process is program in execution. A process needs certain resources including CPU time, Memory, Files,
and I/O devices to accomplish its task. The process management component manages the multiple
processes running simultaneously on the Operating System.
• The operating system is responsible for the following activities in connection with process management:
o Create, load, execute, suspend, resume, and terminate processes.
o Switch system among multiple processes in main memory.
o Provides communication mechanisms so that processes can communicate with each others
o Provides synchronization mechanisms to control concurrent access to shared data to keep shared data
consistent.
o Allocate/de-allocate resources properly to prevent or avoid deadlock situation.

2. I/O Device Management


• One of the purposes of an operating system is to hide the peculiarities of specific hardware devices from
the user. I/O Device Management provides an abstract level of H/W devices and keep the details from
applications to ensure proper use of devices, to prevent errors, and to provide users with convenient and
efficient programming environment.
• Following are the tasks of I/O Device Management component:
o Hide the details of H/W devices
o Manage main memory for the devices using cache, buffer, and spooling
o Maintain and provide custom drivers for each device.

3. File Management
• File management is one of the most visible services of an operating system. Computers can store
information in several different physical forms; magnetic tape, disk, and drum are the most common forms.
• A files is a sequence of bits, bytes, lines or records whose meaning is defined by its creator and user.
• The operating system implements the abstract concept of the file by managing mass storage device, such as
types and disks. Also files are normally organized into directories to ease their use. These directories may
contain files and other directories and so on.
• The operating system is responsible for the following activities in connection with file management:
o File creation and deletion
o Directory creation and deletion
o The support of primitives for manipulating files and directories
o Mapping files onto secondary storage
o File backup on stable (nonvolatile) storage media

4. Network Management
• Network management is the process of managing and administering a computer network. A computer
network is a collection of various types of computers connected with each other.
• Network management comprises fault analysis, maintaining the quality of service, provisioning of
networks, and performance management.
• Following are the features of network management:
o Network administration
o Network maintenance
o Network operation
o Network provisioning
o Network security

Operating system: Unit I- Introduction 11


5. Main Memory Management
• Memory is a large array of words or bytes, each with its own address. It is a repository of quickly
accessible data shared by the CPU and I/O devices.
• Main memory is a volatile storage device which means it loses its contents in the case of system failure or
as soon as system power goes down.
• The main motivation behind Memory Management is to maximize memory utilization on the computer
system.
• The operating system is responsible for the following activities in connections with memory management:
o Keep track of which parts of memory are currently being used and by whom.
o Decide which processes to load when memory space becomes available.
o Allocate and deallocate memory space as needed.

6. Secondary Storage Management


• Since the main memory is too small to permanently accommodate all data and program, the computer
system must provide secondary storage to backup main memory.
• Most modern computer systems use disks as the principle on-line storage medium, for both programs and
data.
• The operating system is responsible for the following activities in connection with disk management:
o Free space management
o Storage allocation
o Disk scheduling

7. Security Management
• The operating system is primarily responsible for all task and activities happen in the computer system.
The various processes in an operating system must be protected from each other’s activities. For that
purpose, various mechanisms which can be used to ensure that the files, memory segment, cpu and other
resources can be operated on only by those processes that have gained proper authorization from the
operating system.
• Security Management refers to a mechanism for controlling the access of programs, processes, or users to
the resources defined by a computer controls to be imposed, together with some means of enforcement.
• For example, memory addressing hardware ensure that a process can only execute within its own address
space. The timer ensure that no process can gain control of the CPU without relinquishing it. Finally, no
process is allowed to do it’s own I/O, to protect the integrity of the various peripheral devices.

8. Command Interpreter System


• One of the most important component of an operating system is its command interpreter. The command
interpreter is the primary interface between the user and the rest of the system.
• Command Interpreter System executes a user command by calling one or more number of underlying
system programs or system calls.
• Command Interpreter System allows human users to interact with the Operating System and provides
convenient programming environment to the users.
• Many commands are given to the operating system by control statements. A program which reads and
interprets control statements is automatically executed. This program is called the shell and few examples
are Windows DOS command window, Bash of Unix/Linux or C-Shell of Unix/Linux.

Operating system: Unit I- Introduction 12


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

Figure 2.1 - A view of operating system services


Following are a few common services provided by an operating system −
 User Interfaces - Means by which users can issue commands to the system. Depending on the system these
may be a command-line interface ( e.g. sh, csh, ksh, tcsh, etc. ), a GUI interface ( e.g. Windows, X-Windows,
KDE, Gnome, etc. ), or a batch command systems. The latter are generally older systems using punch cards of
job-control language, JCL, but may still be used today for specialty systems designed for a single purpose.
 Program Execution - The OS must be able to load a program into RAM, run the program, and terminate the
program, either normally or abnormally.
 I/O Operations - The OS is responsible for transferring data to and from I/O devices, including keyboards,
terminals, printers, and storage devices.
 File-System Manipulation - In addition to raw data storage, the OS is also responsible for maintaining
directory and subdirectory structures, mapping file names to specific blocks of data storage, and providing
tools for navigating and utilizing the file system.
 Communications - Inter-process communications, IPC, either between processes running on the same
processor, or between processes running on separate processors or separate machines. May be implemented as
either shared memory or message passing, ( or some systems may offer both. )
 Error Detection - Both hardware and software errors must be detected and handled appropriately, with a
minimum of harmful repercussions. Some systems may include complex error avoidance or recovery systems,
including backups, RAID drives, and other redundant systems. Debugging and diagnostic tools aid users and
administrators in tracing down the cause of problems.
 Error Detection and 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.
Other systems aid in the efficient operation of the OS itself:
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.
Accounting - Keeping track of system activity and resource usage, either for billing purposes or for statistical
record keeping that can be used to optimize future performance.
Operating system: Unit I- Introduction 13
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.

2.3. System Calls


• If a process is running a user program in user mode and needs a system service, such as reading a data from
a file, it has to execute a trap instruction to transfer control to the OS.
• System calls provide an interface to the services made available by an OS. These calls are generally
available as routines written in C and C++, although certain low-level tasks may need to be written using
assembly-language instructions.
• System Calls are accessed by programs via a high-level Application Program Interface (API) rather than
direct system call use.
• Three most common APIs are Win32 API for Windows, POSIX API for POSIX-based systems (including
virtually all versions of UNIX, Linux, and Mac OS X), and Java API for the Java virtual machine (JVM)
• Frequently, systems execute thousands of system calls per second.
System Call Implementation:
• The run-time support system (a set of functions built into libraries included with a compiler) for most
programming languages provides a system-call interface that serves as the link to system calls made
available by the OS.
• Typically, a number is associated with each system call, and the system call interface maintains a table
indexed according to these numbers.
• The system call interface then invokes the intended system call in the OS kernel and returns the status of
the system call and any return values.
• The caller need know nothing about how the system call is implemented, he just needs to obey API and
understand what OS will do as a result call
• Most details of OS interface are hidden from programmer by API which are managed by run-time support
library (set of functions built into libraries included with compiler)
• The relationship between an application program interfaces (API), the system-call interface, and the OS is
shown in following Fig. , which illustrates how the OS handles a user application invoking the open()
system call.

Figure: The handling of a user application invoking the open() system call.

Operating system: Unit I- Introduction 14


System Call Parameter Passing:
 Often, more information is required than simply identity of desired system call. Exact type and amount of
information vary according to OS and call
 Three general methods used to pass parameters to the OS
1. Simplest: pass the parameters in registers
2. Parameters stored in a block, or table, in memory, and address of block passed as a parameter in a
register. This approach taken by Linux and Solaris.
3. Parameters placed, or pushed, onto the stack by the program and popped off the stack by the operating
system. Block and stack methods do not limit the number or length of parameters being passed

Figure : Passing of parameters as a table.

Types of System Calls

Examples of Windows and Unix System Calls

Operating system: Unit I- Introduction 15


2.4 System Programs
 System programs provide OS functionality through separate applications, which are not part of the kernel
or command interpreters. They are also known as system utilities or system applications.
 Most systems also ship with useful applications such as calculators and simple editors, ( e.g. Notepad ).
Some debate arises as to the border between system and non-system applications.

 System programs may be divided into these categories:


o File management - programs to create, delete, copy, rename, print, list, and generally manipulate
files and directories.
o Status information - Utilities to check on the date, time, number of users, processes running, data
logging, etc. System registries are used to store and recall configuration information for particular
applications.
o File modification - e.g. text editors and other tools which can change file contents.
o Programming-language support - E.g. Compilers, linkers, debuggers, profilers, assemblers,
library archive management, interpreters for common languages, and support for make.
o Program loading and execution - loaders, dynamic loaders, overlay loaders, etc., as well as
interactive debuggers.
o Communications - Programs for providing connectivity between processes and users, including
mail, web browsers, remote logins, file transfers, and remote command execution.
o Background services - System daemons are commonly started when the system is booted, and run
for as long as the system is running, handling necessary services. Examples include network
daemons, print servers, process schedulers, and system error monitoring services.
 Most operating systems today also come complete with a set of application programs to provide
additional services, such as copying files or checking the time and date.
 Most users' views of the system is determined by their command interpreter and the application programs.
Most never make system calls, even through the API, ( with the exception of simple ( file ) I/O in user-
written programs. )

Operating system: Unit I- Introduction 16


2.5 System structure
What is an operating System Structure?

• An operating system is a design that enables user application programs to communicate with the hardware
of the machine. The operating system should be built with the utmost care because it is such a complicated
structure and should be simple to use and modify.
• We want a clear structure to let us apply an operating system to our particular needs because operating
systems have complex structures.
• It is easier to create an operating system in pieces, much as we break down larger issues into smaller, more
manageable sub problems. Every segment is also a part of the operating system.
• Operating system structure can be thought of as the strategy for connecting and incorporating various
operating system components within the kernel.
• Operating systems are implemented using many types of structures, as given below:
o Simple Structure
o Monolithic Structure
o Layered Approach Structure
o Micro-Kernel Structure
o Modules
o Hybrid Structure

1) SIMPLE STRUCTURE
It is the most straightforward operating system structure, but it lacks definition and is only appropriate for usage
with tiny and restricted systems. Since the interfaces and degrees of functionality in this structure are clearly
defined, programs are able to access I/O routines, which may result in unauthorized access to I/O procedures.
Example: MS-DOS.
 In MS-DOS, the interfaces and levels of functionality are not well separated.
 In MS-DOS application programs are able to access the basic I/O routines. This causes the entire
systems to be crashed when user programs fail.

Example: Traditional UNIX OS


It consists of two separable parts: the kernel and the system programs.
• The kernel is further separated into a series of interfaces and device drivers
• The kernel provides the file system, CPU scheduling, memory management, and other operating-system
functions through system calls.
Advantages of Simple Structure:
o Because there are only a few interfaces and levels, it is simple to develop.
o Because there are fewer layers between the hardware and the applications, it offers superior performance.
Disadvantages of Simple Structure:
o The entire operating system breaks if just one user program malfunctions.
o Since the layers are interconnected, and in communication with one another, there is no abstraction or data
hiding.
o The operating system's operations are accessible to layers, which can result in data tampering and system
failure.
Operating system: Unit I- Introduction 17
2) MONOLITHIC STRUCTURE
• The entire operating system works in the kernel space in the monolithic system. This increases the size of
the kernel as well as the operating system.
• The kernel provides various services such as memory management, file management, process scheduling
etc. using function calls. This makes the execution of the operating system quite fast as the services are
implemented under the same address space.
• The following diagram represents the monolithic structure:

Advantages of Monolithic Structure:


o Because layering is unnecessary and the kernel alone is responsible for managing all operations, it is easy
to design and execute.
o Due to the fact that functions like memory management, file management, process scheduling, etc., are
implemented in the same address area, the monolithic kernel runs rather quickly when compared to other
systems. Utilizing the same address speeds up and reduces the time required for address allocation for new
processes.
Disadvantages of Monolithic Structure:
o The monolithic kernel's services are interconnected in address space and have an impact on one another, so
if any of them malfunctions, the entire system does as well.
o It is not adaptable. Therefore, launching a new service is difficult.

3) LAYERED STRUCTURE
The OS is separated into layers or levels in this kind of arrangement. Layer 0 (the lowest layer) contains the
hardware, and layer 1 (the highest layer) contains the user interface (layer N). These layers are organized
hierarchically, with the top-level layers making use of the capabilities of the lower-level ones.
The functionalities of each layer are separated in this method, and abstraction is also an option. Because layered
structures are hierarchical, debugging is simpler, therefore all lower-level layers are debugged before the upper
layer is examined. As a result, the present layer alone has to be reviewed since all the lower layers have already
been examined.
The image below shows how OS is organized into layers:

Operating system: Unit I- Introduction 18


Advantages of Layered Structure:
o Work duties are separated since each layer has its own functionality, and there is some amount of
abstraction.
o Debugging is simpler because the lower layers are examined first, followed by the top layers.
Disadvantages of Layered Structure:
o Performance is compromised in layered structures due to layering.
o Construction of the layers requires careful design because upper layers only make use of lower layers'
capabilities.

4) MICRO-KERNEL STRUCTURE
• The basic idea behind micro kernels is to remove all non-essential services from the kernel, and
implement them as system applications instead, thereby making the kernel as small and efficient as
possible.
• Most microkernels provide basic process and memory management, and message passing between other
services, and not much more.
• Security and protection can be enhanced, as most services are performed in user mode, not kernel mode.
• System expansion can also be easier, because it only involves adding more system applications, not
rebuilding a new kernel.
• Mach was the first and most widely known microkernel, and now forms a major component of Mac OSX.
• Windows NT was originally microkernel, but suffered from performance problems relative to Windows
95. NT 4.0 improved performance by moving more services into the kernel, and now XP is back to being
more monolithic.
• Another microkernel example is QNX, a real-time OS for embedded systems.

Micro-Kernel Operating System Structure:

Advantages of Micro-Kernel Structure:


o It enables portability of the operating system across platforms.
o Due to the isolation of each Micro-Kernel, it is reliable and secure.
o The reduced size of Micro-Kernels allows for successful testing.
o The remaining operating system remains unaffected and keeps running properly even if a component or
Micro-Kernel fails.
Disadvantages of Micro-Kernel Structure:
o The performance of the system is decreased by increased inter-module communication.
o The construction of a system is complicated.

Operating system: Unit I- Introduction 19


5) MODULAR STRUCTURE OR APPROACH:

• The basic idea behind micro kernels is to remove all non-essential services from the kernel, and
implement them as system applications instead, thereby making the kernel as small and efficient as
possible.
• Most microkernels provide basic process and memory management, and message passing between
other services, and not much more.
• Security and protection can be enhanced, as most services are performed in user mode, not kernel
mode.
• System expansion can also be easier, because it only involves adding more system applications, not
rebuilding a new kernel.
• Mach was the first and most widely known microkernel, and now forms a major component of Mac
OSX.
• Windows NT was originally microkernel, but suffered from performance problems relative to
Windows 95. NT 4.0 improved performance by moving more services into the kernel, and now XP is
back to being more monolithic.
• Another microkernel example is QNX, a real-time OS for embedded systems.
• For example : The Solaris operating system structure is organized around a core kernel with seven
types of loadable kernel modules:

6) HYBRID SYSTEMS:
• The Operating System combines different structures, resulting in hybrid systems that address performance,
security, and usability issues.
• They are monolithic, because having the operating system in a single address space provides very efficient
performance.
• However, they are also modular, so that new functionality can be dynamically added to the kernel.
• Example: Linux and Solaris are monolithic (simple) and also modular, IOS.

Operating system: Unit I- Introduction 20


2.6 VIRTUAL MACHINE:
• Virtual Machine abstracts the hardware of our personal computer such as CPU, disk drives, memory, NIC
(Network Interface Card) etc, into many different execution environments as per our requirements, hence
giving us a feel that each execution environment is a single computer. For example, VirtualBox.
• When we run different processes on an operating system, it creates an illusion that each process is running
on a different processor having its own virtual memory, with the help of CPU scheduling and virtual-
memory techniques. There are additional features of a process that cannot be provided by the hardware
alone like system calls and a file system. The virtual machine approach does not provide these additional
functionalities but it only provides an interface that is same as basic hardware. Each process is provided
with a virtual copy of the underlying computer system.
• We can create a virtual machine for several reasons, all of which are fundamentally related to the ability to
share the same basic hardware yet can also support different execution environments, i.e., different
operating systems simultaneously.
• The main drawback with the virtual-machine approach involves disk systems. Let us suppose that the
physical machine has only three disk drives but wants to support seven virtual machines. Obviously, it
cannot allocate a disk drive to each virtual machine, because virtual-machine software itself will need
substantial disk space to provide virtual memory and spooling. The solution is to provide virtual disks.
• Users are thus given their own virtual machines. After which they can run any of the operating systems or
software packages that are available on the underlying machine. The virtual-machine software is concerned
with multi-programming multiple virtual machines onto a physical machine, but it does not need to
consider any user-support software. This arrangement can provide a useful way to divide the problem of
designing a multi-user interactive system, into two smaller pieces.

(a) Nonvirtual machine (b) virtual machine


Advantages:
• There are no protection problems because each virtual machine is completely isolated from all other virtual
machines.
• Virtual machine can provide an instruction set architecture that differs from real computers.
• Easy maintenance, availability and convenient recovery.
Disadvantages:
• When multiple virtual machines are simultaneously running on a host computer, one virtual machine can
be affected by other running virtual machines, depending on the workload.
• Virtual machines are not as efficient as a real one when accessing the hardware.

Example: The Java Virtual Machine


• Java was designed from the beginning to be platform independent, by running Java only on a Java Virtual
Machine, JVM, of which different implementations have been developed for numerous different
underlying HW platforms.
• Java source code is compiled into Java byte code in .class files. Java byte code is binary instructions that
will run on the JVM.
Operating system: Unit I- Introduction 21
• The JVM implements memory management and garbage collection.
• Java byte code may be interpreted as it runs, or compiled to native system binary code using just-in-time
( JIT ) compilation. Under this scheme, the first time that a piece of Java byte code is encountered, it is
compiled to the appropriate native machine binary code by the Java interpreter. This native binary code is
then cached, so that the next time that piece of code is encountered it can be used directly.
• Some hardware chips have been developed to run Java byte code directly, which is an interesting
application of a real machine being developed to emulate the services of a virtual one.

Figure - The Java virtual machine

2.7 Operating-System Design and Implementation


2.6.1 Design Goals
 Requirements define properties which the finished system must have, and are a necessary
first step in designing any large complex system.
o User requirements are features that users care about and understand, and are written
in commonly understood vernacular. They generally do not include any
implementation details, and are written similar to the product description one might
find on a sales brochure or the outside of a shrink-wrapped box.
o System requirements are written for the developers, and include more details about
implementation specifics, performance requirements, compatibility constraints,
standards compliance, etc. These requirements serve as a "contract" between the
customer and the developers, ( and between developers and subcontractors ), and can
get quite detailed.
 Requirements for operating systems can vary greatly depending on the planned scope and
usage of the system. ( Single user / multi-user, specialized system / general purpose,
high/low security, performance needs, operating environment, etc. )
2.6.2 Mechanisms and Policies
 Policies determine what is to be done. Mechanisms determine how it is to be implemented.
 If properly separated and implemented, policy changes can be easily adjusted without re-
writing the code, just by adjusting parameters or possibly loading new data / configuration
files. For example the relative priority of background versus foreground tasks.
2.6.3 Implementation
 Traditionally OSes were written in assembly language. This provided direct control over
hardware-related issues, but inextricably tied a particular OS to a particular HW platform.
 Recent advances in compiler efficiencies mean that most modern OSes are written in C, or
more recently, C++. Critical sections of code are still written in assembly language, ( or
written in C, compiled to assembly, and then fine-tuned and optimized by hand from there. )
 Operating systems may be developed using emulators of the target hardware, particularly if
the real hardware is unavailable ( e.g. not built yet ), or not a suitable platform for
development, ( e.g. smart phones, game consoles, or other similar devices. )

Operating system: Unit I- Introduction 22


2.8 Operating-System Generation
 OSes may be designed and built for a specific HW configuration at a specific site, but more commonly
they are designed with a number of variable parameters and components, which are then configured for a
particular operating environment.
 Systems sometimes need to be re-configured after the initial installation, to add additional resources,
capabilities, or to tune performance, logging, or security.
 Information that is needed to configure an OS include:
o What CPU(s) are installed on the system, and what optional characteristics does each have?
o How much RAM is installed? (This may be determined automatically, either at install or boot time. )
o What devices are present? The OS needs to determine which device drivers to include, as well as
some device-specific characteristics and parameters.
o What OS options are desired, and what values to set for particular OS parameters. The latter may
include the size of the open file table, the number of buffers to use, process scheduling ( priority )
parameters, disk scheduling algorithms, number of slots in the process table, etc.
 At one extreme the OS source code can be edited, re-compiled, and linked into a new kernel.
 More commonly configuration tables determine which modules to link into the new kernel, and what
values to set for some key important parameters. This approach may require the configuration of
complicated makefiles, which can be done either automatically or through interactive configuration
programs; Then make is used to actually generate the new kernel specified by the new parameters.
 At the other extreme a system configuration may be entirely defined by table data, in which case the
"rebuilding" of the system merely requires editing data tables.
 Once a system has been regenerated, it is usually required to reboot the system to activate the new kernel.
Because there are possibilities for errors, most systems provide some mechanism for booting to older or
alternate kernels.

*** Question Bank ***

2 Marks

1. What is an opearting system?


2. What are operating system services?
3. Describe the operating system operations?
4. Describe the operating system functions?
5. Explain simple batch system?
6. Explain time sharing operating system?
7. List out any four process control system calls?
8. Explain virtual machines?
9. List out any four information management system calls?
10. Describe distributed operating system?

3/4 Marks
1. What are the various objectives and functions of Operating systems?
2. What are the major activities of an operating systems with regard to process management?
3. Differentiate distributed systems from multiprocessor system?
4. Explain OS structure?
5. Explain about multiprogramming and time sharing operating system?
6. Explain computer system architecture?
7. Explain about system calls?
8. What is os user interface?

Operating system: Unit I- Introduction 23


6/8 Marks

1. What is system calls in OS? Explain in detail with its types.


2. Discuss the Simple Operating System Structure. Describe the layered approach
3. What are different types of operating system? Explain them in detail
4. Explain User Operating-System Interface in detail
5. Explain operating system functions and services in detail.
6. Differentiate between tightly coupled systems and loosely coupled systems.
7. Differentiate between symmetric and asymmetric multiprocessor.
8. Define Operating System. List out the various operating system components
9. Explain the various types of system calls with an example for each.
10. Explain the various structure of an operating system.
11. Discuss the essential properties of the following types of systems.
(i) Time sharing systems.
(ii) Multi-processor systems.
(iii) Distributed systems.

Operating system: Unit I- Introduction 24

You might also like