0% found this document useful (0 votes)
96 views57 pages

MCA OS UNIT-1 Notes

The document outlines the syllabus for an Operating Systems course, covering topics such as the objectives and functions of operating systems, their evolution, architecture, and various types including batch systems, multiprogramming, and real-time operating systems. It details the roles of operating systems as resource allocators and control programs, and describes key functions like memory management, process management, and device control. Additionally, it introduces the architecture of operating systems, emphasizing the kernel's role and the communication between system components.

Uploaded by

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

MCA OS UNIT-1 Notes

The document outlines the syllabus for an Operating Systems course, covering topics such as the objectives and functions of operating systems, their evolution, architecture, and various types including batch systems, multiprogramming, and real-time operating systems. It details the roles of operating systems as resource allocators and control programs, and describes key functions like memory management, process management, and device control. Additionally, it introduces the architecture of operating systems, emphasizing the kernel's role and the communication between system components.

Uploaded by

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

OPERATING SYSTEM[Type the document title]

UNIT-1-SYLLABUS

SLO-1 Operating System Objectives and functions- Gaining the role of Operating systems
S-1
SLO-2 The evolution of operating system

Understanding the evolution of Operating systems from early batch processing systems to modern complex
SLO-1
systems
S-2
SLO-2 Architecture of OS

SLO-1 Understanding the architecture


S-3
SLO-2 Operating system operations-

SLO-1
S-4 to S-
Lab 1 : Understanding the booting process of Linux
5

Real time understanding of operations


S - 6 SLO-1

SLO-1 Operating system services


S-7
SLO-2 Learning of services

SLO-1 System calls


S-8
SLO-2 Examples

SLO-1
S-9 to S-
Lab 2:understand the behavior of the OS and get the CPU type and model
10

SLO-1 Types
S-11
SLO-2 Understanding of different types

SLO-1 System programs


S-12
SLO-2 Learn with examples

SLO-1 System Design and implementation


S13
SLO-2 Implementation with design process

S-14

to SLO-1 Lab 3: Understanding the Linux file system

S-15

PCA20C102J OPERATING SYSTEM UNIT-1 Page 1 of 57


OPERATING SYSTEM[Type the document title]

INTRODUCTION :

Operating System -Objectives and functions- Gaining the role of Operating systems-
The evolution of operating system from early batch processing systems to modern
complex systems- Architecture of OS- Understanding the architecture- Operating
system operations- Real time understanding of operations- Operating system services-
Learning of services- System calls- Examples- Types-Understanding of different
types- System programs- Learn with examples- System Design and implementation-
Implementation with design process.

************** **************

Introduction

What is an Operating System?


❖ Operating System is system software that controls and manages the resources and acts
as an intermediary between a user of a computer and the computer hardware.

Operating system Objectives:

• The primary goal is to make the computer system convenient to use.


• The secondary goal is to use the computer hardware in an efficient manner.

Roles of Operating System- We can also view an Operating System as a


❖ Resource allocator –
There are four major resources that are controlled by Operating System.
• Memory (Core)
• Processors (I/O Channels, CPU)
• Devices (Tapes, drum, disks)
• Information (File, Library routines, other segments)

PCA20C102J OPERATING SYSTEM UNIT-1 Page 2 of 57


OPERATING SYSTEM[Type the document title]

File Allocation, Allocation of Memory, I/O Controlling, Maintaining the File system,
Library segments ,etc.,

❖ Control program – controls the execution of user programs and prvent errors,
improper use of computer operations of I/O devices.
Operating system Objectives:
❖ Efficiently execute user programs and make solving user problems easier.
❖ Make the computer system convenient to use.
❖ Use the computer hardware in an efficient manner.

Computer System Components


1. Hardware – provides basic computing resources (CPU, memory, I/O devices).
2. Operating system – controls and coordinates the use of the hardware among the
various application programs for the various users.
3. Applications programs – define the ways in which the system resources are used to
solve the computing problems of the users (compilers, database systems, video games,
business programs).
4. Users (people, machines, other computers).

Abstract View of System Components

Functions of Operating System


Operating system performs the following functions as,

1. Booting
Booting is a process of starting the computer operating system starts the computer to work.
It checks the computer and makes it ready to work.
PCA20C102J OPERATING SYSTEM UNIT-1 Page 3 of 57
OPERATING SYSTEM[Type the document title]

2. Memory Management
It is also an important function of operating system. The memory cannot be managed
without operating system. Different programs and data execute in memory at one time.

3. Loading and Execution


A program is loaded in the memory before it can be executed. Operating system provides
the facility to load programs in memory easily and then execute it.

4. Data Security
Data is an important part of computer system. The operating system protects the data
stored on the computer from illegal use, modification or deletion.

5. Disk Management
Operating system manages the disk space. It manages the stored files and folders in a
proper way.

6. Process Management
CPU can perform one task at one time. If there are many tasks, operating system decides
which task should get the CPU.

7. Device Controlling
Operating system also controls all devices attached to computer. The hardware devices are
controlled with the help of small software called device drivers.

8. Printing Controlling
Operating system also controls printing function. It a user issues two print commands at a
time, it does not mix data of these files and prints them separately.

9. Providing Interface
It is used in order that user interface acts with a computer mutually. User interface controls
how you input data and instruction and how information is displayed on screen.

The Evolution of operating system:

PCA20C102J OPERATING SYSTEM UNIT-1 Page 4 of 57


OPERATING SYSTEM[Type the document title]

Let us consider how the OS have developed over the last 40 years.By tracing that
evaluation we can identify the common elements of OS.

The developing of OS may depend upon the hardware design and its implementation.

Types of Operating Systems


Following are some of the most widely used types of Operating system.

1. Simple Batch System


2. Multiprogramming Batch System
3. Multiprocessor System
4. Desktop System
5. Distributed Operating System
6. Clustered System
7. Real time Operating System
8. Handheld System

Simple Batch Systems

• In this type of system, there is no direct interaction between user and the
computer.
• The user has to submit a job (written on cards or tape) to a computer operator.
• Then computer operator places a batch of several jobs on an input device.
• Jobs are batched together by type of languages and requirement.
• Then a special program, the monitor, manages the execution of each program in
the batch.
• The monitor is always in the main memory and available for execution.

Advantages of Simple Batch Systems

PCA20C102J OPERATING SYSTEM UNIT-1 Page 5 of 57


OPERATING SYSTEM[Type the document title]

1. No interaction between user and computer.


2. No mechanism to prioritise the processes.

Multiprogramming Batch Systems

• In this the operating system picks up and begins to execute one of the jobs from
memory.
• Once this job needs an I/O operation operating system switches to another job
(CPU and OS always busy).
• Jobs in the memory are always less than the number of jobs on disk(Job Pool).
• If several jobs are ready to run at the same time, then the system chooses which
one to run through the process of CPU Scheduling.
• In Non-multi programmed system, there are moments when CPU sits idle and
does not do any work.
• In Multiprogramming system, CPU will never be idle and keeps on processing.

Time Sharing Systems are very similar to Multiprogramming batch systems. In fact
time sharing systems are an extension of multiprogramming systems.
In Time sharing systems the prime focus is on minimizing the response time, while
in multiprogramming the prime focus is to maximize the CPU usage.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 6 of 57


OPERATING SYSTEM[Type the document title]

Multiprocessor Systems
A Multiprocessor system consists of several processors that share a common physical
memory. Multiprocessor system provides higher computing power and speed. In
multiprocessor system all processors operate under single operating system.
Multiplicity of the processors and how they do act together are transparent to the
others.

Advantages of Multiprocessor Systems

1. Enhanced performance
2. Execution of several tasks by different processors concurrently, increases the
system's throughput without speeding up the execution of a single task.
3. If possible, system divides task into many subtasks and then these subtasks can
be executed in parallel in different processors. Thereby speeding up the execution
of single tasks.

Desktop Systems
Earlier, CPUs and PCs lacked the features needed to protect an operating system from
user programs. PC operating systems therefore were
PCA20C102J OPERATING SYSTEM UNIT-1 Page 7 of 57
OPERATING SYSTEM[Type the document title]

neither multiuser nor multitasking. However, the goals of these operating systems
have changed with time; instead of maximizing CPU and peripheral utilization, the
systems opt for maximizing user convenience and responsiveness. These systems are
called Desktop Systems and include PCs running Microsoft Windows and the Apple
Macintosh. Operating systems for these computers have benefited in several ways
from the development of operating systems for mainframes.
Microcomputers were immediately able to adopt some of the technology developed
for larger operating systems. On the other hand, the hardware costs for
microcomputers are sufficiently low that individuals have sole use of the computer,
and CPU utilization is no longer a prime concern. Thus, some of the design decisions
made in operating systems for mainframes may not be appropriate for smaller systems.

Distributed Operating System


The motivation behind developing distributed operating systems is the availability of
powerful and inexpensive microprocessors and advances in communication
technology.
These advancements in technology have made it possible to design and develop
distributed systems comprising of many computers that are inter connected by
communication networks. The main benefit of distributed systems is its low
price/performance ratio.

Advantages Distributed Operating System

1. As there are multiple systems involved, user at one site can utilize the resources
of systems at other sites for resource-intensive tasks.
2. Fast processing.
3. Less load on the Host Machine.

Types of Distributed Operating Systems


Following are the two types of distributed operating systems used:

1. Client-Server Systems
2. Peer-to-Peer Systems

PCA20C102J OPERATING SYSTEM UNIT-1 Page 8 of 57


OPERATING SYSTEM[Type the document title]

Client-Server Systems
Centralized systems today act as server systems to satisfy requests generated
by client systems. The general structure of a client-server system is depicted in the
figure below:

Server Systems can be broadly categorized as: Compute Servers and File Servers.

• Compute Server systems, provide an interface to which clients can send


requests to perform an action, in response to which they execute the action and
send back results to the client.
• File Server systems, provide a file-system interface where clients can create,
update, read, and delete files.

Peer-to-Peer Systems
The growth of computer networks - especially the Internet and World Wide Web
(WWW) – has had a profound influence on the recent development of operating
systems. When PCs were introduced in the 1970s, they were designed
for personal use and were generally considered standalone computers. With the
beginning of widespread public use of the Internet in the 1990s for electronic mail and
FTP, many PCs became connected to computer networks.
In contrast to the Tightly Coupled systems, the computer networks used in these
applications consist of a collection of processors that do not share memory or a clock.
PCA20C102J OPERATING SYSTEM UNIT-1 Page 9 of 57
OPERATING SYSTEM[Type the document title]

Instead, each processor has its own local memory. The processors communicate with
one another through various communication lines, such as high-speed buses or
telephone lines. These systems are usually referred to as loosely coupled systems ( or
distributed systems). The general structure of a client-server system is depicted in the
figure below:

Clustered Systems

• Like parallel systems, clustered systems gather together multiple CPUs to


accomplish computational work.
• Clustered systems differ from parallel systems, however, in that they are
composed of two or more individual systems coupled together.
• The definition of the term clustered is not concrete; the general accepted
definition is that clustered computers share storage and are closely linked via LAN
networking.
• Clustering is usually performed to provide high availability.
• A layer of cluster software runs on the cluster nodes. Each node can monitor
one or more of the others. If the monitored machine fails, the monitoring machine
can take ownership of its storage, and restart the application(s) that were running
on the failed machine. The failed machine can remain down, but the users and
clients of the application would only see a brief interruption of service.
• Asymmetric Clustering - In this, one machine is in hot standby mode while the
other is running the applications. The hot standby host (machine) does nothing but

PCA20C102J OPERATING SYSTEM UNIT-1 Page 10 of 57


OPERATING SYSTEM[Type the document title]

monitor the active server. If that server fails, the hot standby host becomes the
active server.
• Symmetric Clustering - In this, two or more hosts are running applications,
and they are monitoring each other. This mode is obviously more efficient, as it
uses all of the available hardware.
• Parallel Clustering - Parallel clusters allow multiple hosts to access the same
data on the shared storage. Because most operating systems lack support for this
simultaneous data access by multiple hosts, parallel clusters are usually
accomplished by special versions of software and special releases of applications.

Clustered technology is rapidly changing. Clustered system's usage and it's features
should expand greatly as Storage Area Networks(SANs). SANs allow easy
attachment of multiple hosts to multiple storage units. Current clusters are usually
limited to two or four hosts due to the complexity of connecting the hosts to shared
storage.

Real Time Operating System


It is defined as an operating system known to give maximum time for each of the
critical operations that it performs, like OS calls and interrupt handling.
The Real-Time Operating system which guarantees the maximum time for critical
operations and complete them on time are referred to as Hard Real-Time Operating
Systems.
While the real-time operating systems that can only guarantee a maximum of the time,
i.e. the critical task will get priority over other tasks, but no assurity of completeing it
in a defined time. These systems are referred to as Soft Real-Time Operating
Systems.

Handheld Systems
Handheld systems include Personal Digital Assistants(PDAs), such as Palm-
Pilots or Cellular Telephones with connectivity to a network such as the Internet. They
are usually of limited size due to which most handheld devices have a small amount of
memory, include slow processors, and feature small display screens.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 11 of 57


OPERATING SYSTEM[Type the document title]

• Many handheld devices have between 512 KB and 8 MB of memory. As a


result, the operating system and applications must manage memory efficiently.
This includes returning all allocated memory back to the memory manager once the
memory is no longer being used.
• Currently, many handheld devices do not use virtual memory techniques, thus
forcing program developers to work within the confines of limited physical
memory.
• Processors for most handheld devices often run at a fraction of the speed of a
processor in a PC. Faster processors require more power. To include a faster
processor in a handheld device would require a larger battery that would have to
be replaced more frequently.
• The last issue confronting program designers for handheld devices is the small
display screens typically available. One approach for displaying the content in web
pages is web clipping, where only a small subset of a web page is delivered and
displayed on the handheld device.

Some handheld devices may use wireless technology such as Blue Tooth, allowing
remote access to e-mail and web browsing. Cellular telephones with connectivity to
the Internet fall into this category. Their use continues to expand as network
connections become more available and other options such as cameras and MP3
players, expand their utility.

Architecture of OS

PCA20C102J OPERATING SYSTEM UNIT-1 Page 12 of 57


OPERATING SYSTEM[Type the document title]

The core software components of an operating system are collectively


known as the kernel. The kernel has unrestricted access to all of the
resources on the system. In early monolithic systems, each component of
the operating system was contained within the kernel, could communicate
directly with any other component.

A monolithic OS architecture

In this kind of architecture, each layer communicates only with the layers
immediately above and below it, and lower-level layers provide services to
higher-level ones using an interface that hides their implementation.

The modularity of layered operating systems allows the implementation of


each layer to be modified without requiring any modification to adjacent
layers. Many of today’s operating systems, including Microsoft Windows
and Linux, implement some level of layering.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 13 of 57


OPERATING SYSTEM[Type the document title]

A layered OS architecture

A microkernel architecture includes only a very small number of services


within the kernel in an attempt to keep it small and scalable. It include low-
level memory management, inter-process communication and basic
process synchronisation to enable processes to cooperate.

A Microkernel architecture

Operating system operations-


PCA20C102J OPERATING SYSTEM UNIT-1 Page 14 of 57
OPERATING SYSTEM[Type the document title]

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.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 15 of 57


OPERATING SYSTEM[Type the document title]

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.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 16 of 57


OPERATING SYSTEM[Type the document title]

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.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 17 of 57


OPERATING SYSTEM[Type the document title]

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 −

PCA20C102J OPERATING SYSTEM UNIT-1 Page 18 of 57


OPERATING SYSTEM[Type the document title]

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


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

System Calls
• System calls provide an interface to the services made available by an operating system.
These calls are generally available as routines written in C and C++, although certain low-
level tasks (for example, tasks where hardware must be accessed directly), may need to be
written using assembly-language instructions.

System Call Implementation


• Typically, a number associated with each system call
• System-call interface maintains a table indexed according to these Numbers
• The system call interface invokes intended system call in OS kernel and returns
status of the system call and any return values
• The caller need know nothing about how the system call is implemented
• Just needs to obey API and understand what OS will do as a result call
• Most details of OS interface hidden from programmer by API
• Managed by run-time support library (set of functions built into libraries included
with compiler)

The API then makes the appropriate system calls through the system call interface, using a table
lookup to access specific numbered system calls, as shown in Figure :

PCA20C102J OPERATING SYSTEM UNIT-1 Page 19 of 57


OPERATING SYSTEM[Type the document title]

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

• Parameters are generally passed to system calls via registers, or less commonly, by values
pushed onto the stack. Large blocks of data are generally accessed indirectly, through a
memory address passed in a register or on the stack, as shown in Figure 2.7:

PCA20C102J OPERATING SYSTEM UNIT-1 Page 20 of 57


OPERATING SYSTEM[Type the document title]

Figure - Passing of parameters as a table

Types of System Calls

Six major categories, as outlined in Figure 2.8 and the following six subsections:

PCA20C102J OPERATING SYSTEM UNIT-1 Page 21 of 57


OPERATING SYSTEM[Type the document title]

PCA20C102J OPERATING SYSTEM UNIT-1 Page 22 of 57


OPERATING SYSTEM[Type the document title]

( Sixth type, protection, not shown here but described below. )

• Standard library calls may also generate system calls, as shown here:

Process Control


Process control system calls include end, abort, load, execute, create process,
terminate process, get/set process attributes, wait for time or event, signal event, and
allocate and free memory.
PCA20C102J OPERATING SYSTEM UNIT-1 Page 23 of 57
OPERATING SYSTEM[Type the document title]

• Processes must be created, launched, monitored, paused, resumed,and eventually


stopped.
• When one process pauses or stops, then another must be launched or resumed
• When processes stop abnormally it may be necessary to provide core dumps and/or
other diagnostic or recovery tools.
• Compare DOS ( a single-tasking system ) with UNIX ( a multi-tasking system ).
o When a process is launched in DOS, the command interpreter first unloads as
much of itself as it can to free up memory, then loads the process and transfers
control to it. The interpreter does not resume until the process has completed,
as shown in Figure 2.9:

Figure - MS-DOS execution. (a) At system startup. (b) Running a program.

o Because UNIX is a multi-tasking system, the command interpreter remains


completely resident when executing a process, as shown in Figure 2.11 below.
▪ The user can switch back to the command interpreter at any time, and
can place the running process in the background even if it was not
originally launched as a background process.
▪ In order to do this, the command interpreter first executes a "fork"
system call, which creates a second process which is an exact duplicate
( clone ) of the original command interpreter. The original process is
known as the parent, and the cloned process is known as the child, with
its own unique process ID and parent ID.
▪ The child process then executes an "exec" system call, which replaces
its code with that of the desired process.
▪ The parent ( command interpreter ) normally waits for the child to
complete before issuing a new command prompt, but in some cases it
can also issue a new prompt right away, without waiting for the child

PCA20C102J OPERATING SYSTEM UNIT-1 Page 24 of 57


OPERATING SYSTEM[Type the document title]

process to complete. ( The child is then said to be running "in the


background", or "as a background process". )

File Management

• File management system calls include create file, delete file, open, close, read, write,
reposition, get file attributes, and set file attributes.
• These operations may also be supported for directories as well as ordinary files.
• ( The actual directory structure may be implemented using ordinary files on the file
system, or through other means. Further details will be covered in chapters 11 and 12.
)

Device Management

• Device management system calls include request device, release device, read, write,
reposition, get/set device attributes, and logically attach or detach devices.
• Devices may be physical ( e.g. disk drives ), or virtual / abstract ( e.g. files, partitions,
and RAM disks ).
• Some systems represent devices as special files in the file system, so that accessing
the "file" calls upon the appropriate device drivers in the OS. See for example the /dev
directory on any UNIX system.

Information Maintenance

•Information maintenance system calls include calls to get/set the time, date, system
data, and process, file, or device attributes.
• Systems may also provide the ability to dump memory at any time, single step
programs pausing execution after each instruction, and tracing the operation of
programs, all of which can help to debug programs.
PCA20C102J OPERATING SYSTEM UNIT-1 Page 25 of 57
OPERATING SYSTEM[Type the document title]

Communication

• Communication system calls create/delete communication connection, send/receive


messages, transfer status information, and attach/detach remote devices.
• The message passing model must support calls to:
o Identify a remote process and/or host with which to communicate.
o Establish a connection between the two processes.
o Open and close the connection as needed.
o Transmit messages along the connection.
o Wait for incoming messages, in either a blocking or non-blocking state.
o Delete the connection when no longer needed.
• The shared memory model must support calls to:
o Create and access memory that is shared amongst processes ( and threads. )
o Provide locking mechanisms restricting simultaneous access.
o Free up shared memory and/or dynamically allocate it as needed.
• Message passing is simpler and easier, ( particularly for inter-computer
communications ), and is generally appropriate for small amounts of data.
• Shared memory is faster, and is generally the better approach where large amounts of
data are to be shared, ( particularly when most processes are reading the data rather
than writing it, or at least when only one or a small number of processes need to
change any given data item. )

Protection

• Protection provides mechanisms for controlling which users / processes have access to
which system resources.
• System calls allow the access mechanisms to be adjusted as needed, and for non-
priveleged users to be granted elevated access permissions under carefully controlled
temporary circumstances.
• Once only of concern on multi-user systems, protection is now important on all
systems, in the age of ubiquitous network connectivity.

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.
PCA20C102J OPERATING SYSTEM UNIT-1 Page 26 of 57
OPERATING SYSTEM[Type the document title]

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

• 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 Design and Implementation

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

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.

Implementation

PCA20C102J OPERATING SYSTEM UNIT-1 Page 27 of 57


OPERATING SYSTEM[Type the document title]

• Traditionally OS 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 OS 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 Structure

For efficient performance and implementation an OS should be partitioned into separate subsystems,
each with carefully defined tasks, inputs, outputs, and performance characteristics. These subsystems
can then be arranged in various architectural configurations:

Simple Structure

When DOS was originally written its developers had no idea how big and important it would
eventually become. It was written by a few programmers in a relatively short amount of time,
without the benefit of modern software engineering techniques, and then gradually grew over time to
exceed its original expectations. It does not break the system into subsystems, and has no distinction
between user and kernel modes, allowing all programs direct access to the underlying hardware. (
Note that user versus kernel mode was not supported by the 8088 chip set anyway, so that really
wasn't an option back then. )

Figure - MS-DOS layer structure

PCA20C102J OPERATING SYSTEM UNIT-1 Page 28 of 57


OPERATING SYSTEM[Type the document title]

The original UNIX OS used a simple layered approach, but almost all the OS was in one big layer,
not really breaking the OS down into layered subsystems:

Figure - Traditional UNIX system structure

Layered Approach

• Another approach is to break the OS into a number of smaller layers, each of which
rests on the layer below it, and relies solely on the services provided by the next lower
layer.
• This approach allows each layer to be developed and debugged independently, with
the assumption that all lower layers have already been debugged and are trusted to
deliver proper services.
• The problem is deciding what order in which to place the layers, as no layer can call
upon the services of any higher layer, and so many chicken-and-egg situations may
arise.
• Layered approaches can also be less efficient, as a request for service from a higher
layer has to filter through all lower layers before it reaches the HW, possibly with
significant processing at each step.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 29 of 57


OPERATING SYSTEM[Type the document title]

Figure - A layered operating system

Microkernels

• 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 micro kernels 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.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 30 of 57


OPERATING SYSTEM[Type the document title]

Figure - Architecture of a typical microkernel

Modules

• Modern OS development is object-oriented, with a relatively small core kernel and a


set of modules which can be linked in dynamically. See for example the Solaris
structure, as shown in Figure 2.13 below.
• Modules are similar to layers in that each subsystem has clearly defined tasks and
interfaces, but any module is free to contact any other module, eliminating the
problems of going through multiple intermediary layers, as well as the chicken-and-
egg problems.
• The kernel is relatively small in this architecture, similar to microkernels, but the
kernel does not have to implement message passing since modules are free to contact
each other directly.

Figure - Solaris loadable modules

Hybrid Systems
PCA20C102J OPERATING SYSTEM UNIT-1 Page 31 of 57
OPERATING SYSTEM[Type the document title]

• Most OS today do not strictly adhere to one architecture, but are hybrids of several.

Mac OS X

• The Max OSX architecture relies on the Mach microkernel for basic system
management services, and the BSD kernel for additional services. Application
services and dynamically loadable modules ( kernel extensions ) provide the
rest of the OS functionality:

Figure - The Mac OS X structure

iOS

• The iOS operating system was developed by Apple for iPhones and iPads. It
runs with less memory and computing power needs than Max OS X, and
supports touch creen interface and graphics for small screens:

Figure - Architecture of Apple's iOS.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 32 of 57


OPERATING SYSTEM[Type the document title]

Android

• The Android OS was developed for Android smartphones and tablets by the
Open Handset Alliance, primarily Google.
• Android is an open-source OS, as opposed to iOS, which has lead to its
popularity.
• Android includes versions of Linux and a Java virtual machine both optimized
for small platforms.
• Android apps are developed using a special Java-for-Android development
environment.

• Debugging here includes both error discovery and elimination and performance tuning.

Failure Analysis

• Debuggers allow processes to be executed stepwise, and provide for the examination
of variables and expressions as the execution progresses.
• Profilers can document program execution, to produce statistics on how much time
was spent on different sections or even lines of code.
• If an ordinary process crashes, a memory dump of the state of that process's memory
at the time of the crash can be saved to a disk file for later analysis.
o The program must be specially compiled to include debugging information,
which may slow down its performance.
• These approaches don't really work well for OS code, for several reasons:

PCA20C102J OPERATING SYSTEM UNIT-1 Page 33 of 57


OPERATING SYSTEM[Type the document title]

o The performance hit caused by adding the debugging ( tracing ) code would be
unacceptable. ( Particularly if one tried to "single-step" the OS while people
were trying to use it to get work done! )
o Many parts of the OS run in kernel mode, and make direct access to the
hardware.
o If an error occurred during one of the kernel's file-access or direct disk-access
routines, for example, then it would not be practical to try to write a crash
dump into an ordinary file on the file system.
▪ Instead the kernel crash dump might be saved to a special unallocated
portion of the disk reserved for that purpose.

Performance Tuning

• Performance tuning ( debottlenecking ) requires monitoring system performance.


• One approach is for the system to record important events into log files, which can
then be analyzed by other tools. These traces can also be used to evaluate how a
proposed new system would perform under the same workload.
• Another approach is to provide utilities that will report system status upon demand,
such as the unix "top" command. ( w, uptime, ps, etc. )
• System utilities may provide monitoring support.

***********************************************************

PART-A QUESTIOS & ANSWERS (5 MARKS)

1. What are the System Components? Draw & Explain them.

Computer System Components


1. Hardware – provides basic computing resources (CPU, memory, I/O devices).
2. Operating system – controls and coordinates the use of the hardware among the
various application programs for the various users.
3. Applications programs – define the ways in which the system resources are used to
solve the computing problems of the users (compilers, database systems, video games,
business programs).
4. Users (people, machines, other computers).

Abstract View of System Components

PCA20C102J OPERATING SYSTEM UNIT-1 Page 34 of 57


OPERATING SYSTEM[Type the document title]

2. Explain the various Functions of Operating System

1. Booting
Booting is a process of starting the computer operating system starts the computer to work.
It checks the computer and makes it ready to work.

2. Memory Management
It is also an important function of operating system. The memory cannot be managed
without operating system. Different programs and data execute in memory at one time.

3. Loading and Execution


A program is loaded in the memory before it can be executed. Operating system provides
the facility to load programs in memory easily and then execute it.

4. Data Security
Data is an important part of computer system. The operating system protects the data
stored on the computer from illegal use, modification or deletion.

5. Disk Management
Operating system manages the disk space. It manages the stored files and folders in a
proper way.

6. Process Management
CPU can perform one task at one time. If there are many tasks, operating system decides
which task should get the CPU.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 35 of 57


OPERATING SYSTEM[Type the document title]

7. Device Controlling
Operating system also controls all devices attached to computer. The hardware devices are
controlled with the help of small software called device drivers.

8. Printing Controlling
Operating system also controls printing function. It a user issues two print commands at a
time, it does not mix data of these files and prints them separately.

9. Providing Interface
It is used in order that user interface acts with a computer mutually. User interface controls
how you input data and instruction and how information is displayed on screen.

3. Write a short note on Clustered Systems.

• Clustering is usually performed to provide high availability.


• A layer of cluster software runs on the cluster nodes. Each node can monitor
one or more of the others. If the monitored machine fails, the monitoring machine
can take ownership of its storage, and restart the application(s) that were running
on the failed machine. The failed machine can remain down, but the users and
clients of the application would only see a brief interruption of service.
• Asymmetric Clustering - In this, one machine is in hot standby mode while the
other is running the applications. The hot standby host (machine) does nothing but
monitor the active server. If that server fails, the hot standby host becomes the
active server.
• Symmetric Clustering - In this, two or more hosts are running applications,
and they are monitoring each other. This mode is obviously more efficient, as it
uses all of the available hardware.
• Parallel Clustering - Parallel clusters allow multiple hosts to access the same
data on the shared storage. Because most operating systems lack support for this
simultaneous data access by multiple hosts, parallel clusters are usually
accomplished by special versions of software and special releases of applications.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 36 of 57


OPERATING SYSTEM[Type the document title]

4. What are the Services of Operating System? Explain.


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.

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.

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.
Communication
the operating system manages communications between all the processes. Multiple processes
communicate with one another through communication lines in the network.

Error handling
Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices or in the
memory hardware.

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.

Protection
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.
PCA20C102J OPERATING SYSTEM UNIT-1 Page 37 of 57
OPERATING SYSTEM[Type the document title]

5.Write the various types of System Calls?

Six major categories as,

PCA20C102J OPERATING SYSTEM UNIT-1 Page 38 of 57


OPERATING SYSTEM[Type the document title]

PCA20C102J OPERATING SYSTEM UNIT-1 Page 39 of 57


OPERATING SYSTEM[Type the document title]

6. Draw a neat Diagram of Operating System a layered Structure &Explain it.

Layered Approach

• OS into a number of smaller layers, each of which rests on the layer below it, and
relies solely on the services provided by the next lower layer.
• This approach allows each layer to be developed and debugged independently, with
the assumption that all lower layers have already been debugged and are trusted to
deliver proper services.
• The problem is deciding what order in which to place the layers, as no layer can call
upon the services of any higher layer, and so many chicken-and-egg situations may
arise.
• Layered approaches can also be less efficient, as a request for service from a higher
layer has to filter through all lower layers before it reaches the HW, possibly with
significant processing at each step.

Figure - A layered operating system

7. What are the two types of distributed operating systems ?explain them

The two types of distributed operating systems used:


PCA20C102J OPERATING SYSTEM UNIT-1 Page 40 of 57
OPERATING SYSTEM[Type the document title]

A)Client-Server Systems

B)Peer-to-Peer Systems

Client-Server Systems
Centralized systems today act as server systems to satisfy requests generated
by client systems. The general structure of a client-server system is depicted in the
figure below:

Server Systems can be broadly categorized as: Compute Servers and File Servers.

• Compute Server systems, provide an interface to which clients can send


requests to perform an action, in response to which they execute the action and
send back results to the client.
• File Server systems, provide a file-system interface where clients can create,
update, read, and delete files.

Peer-to-Peer Systems
Tightly Coupled systems, the computer networks used in these applications consist of
a collection of processors that do not share memory or a clock. Instead, each processor
has its own local memory. The processors communicate with one another through
various communication lines, such as high-speed buses or telephone lines. These

PCA20C102J OPERATING SYSTEM UNIT-1 Page 41 of 57


OPERATING SYSTEM[Type the document title]

systems are usually referred to as loosely coupled systems ( or distributed systems).


The general structure of a client-server system is depicted in the figure below:

8 . What is Multiprocessor Systems? Write its Advantages?

Multiprocessor Systems
A Multiprocessor system consists of several processors that share a common physical
memory. Multiprocessor system provides higher computing power and speed. In
multiprocessor system all processors operate under single operating system.
Multiplicity of the processors and how they do act together are transparent to the
others.

Advantages of Multiprocessor Systems

1. Enhanced performance
2. Execution of several tasks by different processors concurrently, increases the
system's throughput without speeding up the execution of a single task.
3. If possible, system divides task into many subtasks and then these subtasks can
be executed in parallel in different processors. Thereby speeding up the execution
of single tasks.

9. Differentiate terms Multiprogramming and Multiprocessing Systems.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 42 of 57


OPERATING SYSTEM[Type the document title]

Multiprogramming: operating system picks up and begins to execute one of the


jobs from memory.

• Once this job needs an I/O operation operating system switches to another job
(CPU and OS always busy).
• Jobs in the memory are always less than the number of jobs on disk(Job Pool).

If several jobs are ready to run at the same time, then the system chooses which one
to run through the process of CPU Scheduling.

Multiprocessing:

A Multiprocessor system consists of several processors that share a common physical


memory. Multiprocessor system provides higher computing power and speed. In
multiprocessor system all processors operate under single operating system.
Multiplicity of the processors and how they do act together are transparent to the
others.

10. Write a short note on Real Time Operating System.


It is defined as an operating system known to give maximum time for each of the
critical operations that it performs, like OS calls and interrupt handling.
The Real-Time Operating system which guarantees the maximum time for critical
operations and complete them on time are referred to as Hard Real-Time Operating
Systems.
While the real-time operating systems that can only guarantee a maximum of the time,
i.e. the critical task will get priority over other tasks, but no assurity of completeing it
in a defined time. These systems are referred to as Soft Real-Time Operating
Systems.

11.What is meant by Time Sharing Systems ?Write its advantages.


Time Sharing Systems are very similar to Multiprogramming batch systems. In fact
time sharing systems are an extension of multiprogramming systems.
In Time sharing systems the prime focus is on minimizing the response time, while
in multiprogramming the prime focus is to maximize the CPU usage.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 43 of 57


OPERATING SYSTEM[Type the document title]

12.What are the various Roles of Operating System? Explain.

Roles of Operating System:


Resource allocator –
There are four major resources that are controlled by Operating System.
• Memory (Core)
• Processors (I/O Channels, CPU)
• Devices (Tapes, drum, disks)
• Information (File, Library routines, other segments)

File Allocation, Allocation of Memory, I/O Controlling, Maintaining the File system,
Library segments ,etc.,

Control program – controls the execution of user programs and prvent errors,
improper use of computer operations of I/O devices.

PART-B QUESTIOS & ANSWERS (15 MARKS)

1.Explain abut the Evolution of operating system briefly.

The developing of OS may depend upon the hardware design and its implementation.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 44 of 57


OPERATING SYSTEM[Type the document title]

Types of Operating Systems


Following are some of the most widely used types of Operating system.

1. Simple Batch System


2. Multiprogramming Batch System
3. Multiprocessor System
4. Desktop System
5. Distributed Operating System
6. Clustered System
7. Real time Operating System
8. Handheld System

Simple Batch Systems

• In this type of system, there is no direct interaction between user and the
computer.
• The user has to submit a job (written on cards or tape) to a computer operator.
• Then computer operator places a batch of several jobs on an input device.
• Jobs are batched together by type of languages and requirement.
• Then a special program, the monitor, manages the execution of each program in
the batch.
• The monitor is always in the main memory and available for execution.

Multiprogramming Batch Systems

• In this the operating system picks up and begins to execute one of the jobs from
memory.
• Once this job needs an I/O operation operating system switches to another job
(CPU and OS always busy).
PCA20C102J OPERATING SYSTEM UNIT-1 Page 45 of 57
OPERATING SYSTEM[Type the document title]

• Jobs in the memory are always less than the number of jobs on disk(Job Pool).
• If several jobs are ready to run at the same time, then the system chooses which
one to run through the process of CPU Scheduling.
• In Non-multi programmed system, there are moments when CPU sits idle and
does not do any work.
• Time Sharing Systems are very similar to Multiprogramming batch systems. In
fact time sharing systems are an extension of multiprogramming systems.
• In Time sharing systems the prime focus is on minimizing the response time,
while in multiprogramming the prime focus is to maximize the CPU usage.

Multiprocessor Systems
A Multiprocessor system consists of several processors that share a common
physical memory. Multiprocessor system provides higher computing power and
speed. In multiprocessor system all processors operate under single operating
system. Multiplicity of the processors and how they do act together are transparent
to the others.

Desktop Systems

Earlier, CPUs and PCs lacked the features needed to protect an operating system
from user programs. PC operating systems therefore were
neither multiuser nor multitasking. However, the goals of these operating systems

PCA20C102J OPERATING SYSTEM UNIT-1 Page 46 of 57


OPERATING SYSTEM[Type the document title]

have changed with time; instead of maximizing CPU and peripheral utilization, the
systems opt for maximizing user convenience and responsiveness. These systems
are called Desktop Systems .

Distributed Operating System


The motivation behind developing distributed operating systems is the availability of
powerful and inexpensive microprocessors and advances in communication
technology.

Types of Distributed Operating Systems


Following are the two types of distributed operating systems used:

1. Client-Server Systems

2. Peer-to-Peer Systems

Client-Server Systems

Centralized systems today act as server systems to satisfy requests generated


by client systems.

Peer-to-Peer Systems

The growth of computer networks - especially the Internet and World Wide Web
(WWW) – has had a profound influence on the recent development of operating
systems

Clustered Systems

• Clustering is usually performed to provide high availability.


• A layer of cluster software runs on the cluster nodes. Each node can monitor
one or more of the others. If the monitored machine fails, the monitoring machine
can take ownership of its storage, and restart the application(s) that were running

PCA20C102J OPERATING SYSTEM UNIT-1 Page 47 of 57


OPERATING SYSTEM[Type the document title]

on the failed machine. The failed machine can remain down, but the users and
clients of the application would only see a brief interruption of service.
• Asymmetric Clustering - In this, one machine is in hot standby mode while the
other is running the applications. The hot standby host (machine) does nothing but
monitor the active server. If that server fails, the hot standby host becomes the
active server.
• Symmetric Clustering - In this, two or more hosts are running applications,
and they are monitoring each other. This mode is obviously more efficient, as it
uses all of the available hardware.

Parallel Clustering - Parallel clusters allow multiple hosts to access the same data
on the shared storage. Because most operating systems lack support for this
simultaneous data access by multiple hosts, parallel clusters are usually
accomplished by special versions of software and special releases of applications.

Real Time Operating System


It is defined as an operating system known to give maximum time for each of the
critical operations that it performs, like OS calls and interrupt handling.
The Real-Time Operating system which guarantees the maximum time for critical
operations and complete them on time are referred to as Hard Real-Time Operating
Systems.
While the real-time operating systems that can only guarantee a maximum of the time,
i.e. the critical task will get priority over other tasks, but no assurity of completeing it
in a defined time. These systems are referred to as Soft Real-Time Operating
Systems.

Handheld Systems
Handheld systems include Personal Digital Assistants(PDAs), such as Palm-
Pilots or Cellular Telephones with connectivity to a network such as the Internet. They
are usually of limited size due to which most handheld devices have a small amount of
memory, include slow processors, and feature small display screens.
2. Explain the Architecture of OS.

Architecture of OS
PCA20C102J OPERATING SYSTEM UNIT-1 Page 48 of 57
OPERATING SYSTEM[Type the document title]

The core software components of an operating system are collectively


known as the kernel. The kernel has unrestricted access to all of the
resources on the system. In early monolithic systems, each component of
the operating system was contained within the kernel, could communicate
directly with any other component.

A monolithic OS architecture

In this kind of architecture, each layer communicates only with the layers
immediately above and below it, and lower-level layers provide services to
higher-level ones using an interface that hides their implementation.

Many of today’s operating systems, including Microsoft Windows and Linux,


implement some level of layering.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 49 of 57


OPERATING SYSTEM[Type the document title]

A layered OS architecture

A microkernel architecture includes only a very small number of services


within the kernel in an attempt to keep it small and scalable. It include low-
level memory management, inter-process communication and basic
process synchronisation to enable processes to cooperate.

A Microkernel architecture

3. Explain about the Operating system operations-

Operating system operations-


PCA20C102J OPERATING SYSTEM UNIT-1 Page 50 of 57
OPERATING SYSTEM[Type the document title]

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.

PCA20C102J OPERATING SYSTEM UNIT-1 Page 51 of 57


OPERATING SYSTEM[Type the document title]

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.
PCA20C102J OPERATING SYSTEM UNIT-1 Page 52 of 57
OPERATING SYSTEM[Type the document title]

4. Explain about the Operating system services.

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.
PCA20C102J OPERATING SYSTEM UNIT-1 Page 53 of 57
OPERATING SYSTEM[Type the document title]

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 −

PCA20C102J OPERATING SYSTEM UNIT-1 Page 54 of 57


OPERATING SYSTEM[Type the document title]

5. What is meant by System Calls? How it is implemented?


System Calls
• System calls provide an interface to the services made available by an operating system.
These calls are generally available as routines written in C and C++, although certain low-
level tasks (for example, tasks where hardware must be accessed directly), may need to be
written using assembly-language instructions.

System Call Implementation


• Typically, a number associated with each system call
• System-call interface maintains a table indexed according to these Numbers
• The system call interface invokes intended system call in OS kernel and returns
status of the system call and any return values
• The caller need know nothing about how the system call is implemented
• Just needs to obey API and understand what OS will do as a result call
• Most details of OS interface hidden from programmer by API
• Managed by run-time support library (set of functions built into libraries included
with compiler)

The API then makes the appropriate system calls through the system call interface, using a table
lookup to access specific numbered system calls, as shown in Figure 2.6:

PCA20C102J OPERATING SYSTEM UNIT-1 Page 55 of 57


OPERATING SYSTEM[Type the document title]

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

• Parameters are generally passed to system calls via registers, or less commonly, by values
pushed onto the stack.

Large blocks of data are generally accessed indirectly, through a memory address passed in a
register or on the stack, as shown in Figure :

PCA20C102J OPERATING SYSTEM UNIT-1 Page 56 of 57


OPERATING SYSTEM[Type the document title]

Figure - Passing of parameters as a table

PCA20C102J OPERATING SYSTEM UNIT-1 Page 57 of 57

You might also like