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

unit1 os

The document is a question bank for Operating System Concepts for the IV Semester BCA, covering various topics such as definitions of operating systems, processes, interrupts, and types of systems. It includes questions on batch processing, multiprogramming, multiprocessor systems, and system calls, along with their functions and advantages. Additionally, it discusses file operations, directory operations, and attributes of files, providing a comprehensive overview of operating system principles and functionalities.

Uploaded by

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

unit1 os

The document is a question bank for Operating System Concepts for the IV Semester BCA, covering various topics such as definitions of operating systems, processes, interrupts, and types of systems. It includes questions on batch processing, multiprogramming, multiprocessor systems, and system calls, along with their functions and advantages. Additionally, it discusses file operations, directory operations, and attributes of files, providing a comprehensive overview of operating system principles and functionalities.

Uploaded by

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

National Education Policy – 2020 [NEP-2020]

QUESTION BANK OF Operating System Concepts


IV SEMESTER BCA
UNIT-I
2 Marks Questions
1. Define an Operating System?
An operating system is a program that manages the computer hardware. It also
provides a basis for application programs and acts as an intermediary between a user
of a computer and the computer hardware. So operating system is a control program.
Components of a computer system are its hardware, software,data and user.

2. What is a process?
A process is a program in execution. It is a unit of work within the system.
Program is a passive entity like the contents of a file stored on disk; process is
an active entity.
Process needs resources to accomplish its task
1. CPU, memory, I/O, files
2. Initialization data

3. What is an interrupt? List its types.


An interrupt is a hardware-generated signal that changes the flow within the system. A
trap is a software-generated interrupt.

Mr K Praveen Kumar, SMC SHIRVA Page 1


An interrupt can be used to signal the completion of I/O so that the CPU doesn't have to
spend cycles polling the device. A trap can be used to catch arithmetic errors or to call
system routines. The types of interrupts are hardware and software interrupts

4. What are maskable and nonmaskable interrupts?


One is the nonmaskable interrupt, which is reserved for events such as
unrecoverable memory errors.
The second interrupt line is maskable: it can be turned off by the CPU before
the execution of critical instruction sequences that must not be interrupted. The
maskable interrupt is used by device controllers to request service.

5. What are the draw backs of Batch processing System?


In this execution environment the CPU is often idle because of the speed of the
mechanized I/O device are slower than electronic device.
 The computer operator must be trained and provided ample knowledge for
handling the batch processing operating system
 It takes more time for debugging
 The users do not have direct interaction with the system
 It has a high turnaround time
 If a job enters an infinite loop, other jobs might have to wait for an
unknown period of time
 Failure of one job impacts the execution of other jobs

6. What is Time sharing system and Multiprogramming System?


Time sharing, or multitasking, is a logical extension of multiprogramming.
Multiple jobs are executed by the CPU switching between them, but the
switches occur so frequently that the users may interact with each program
while it is running.
Multiprogramming System
One of the most important aspects of operating systems is the ability to run
multiple programs, as a single program cannot, in general, keep either the CPU
or the I/O devices busy at all times. Furthermore, users typically want to run
more than one program at a time as well. Multiprogramming increases CPU
utilization, as well as keeping users satisfied, by organizing programs so that
the CPU always has one to execute. In a multiprogrammed system, a program in
execution is termed a process.
Mr K Praveen Kumar, SMC SHIRVA Page 2
7. Define distributed system and Clustered System?
A distributed system is a collection of physically separate, possibly
heterogeneous computer systems that are networked to provide users with
access to the various resources that the system maintains. Access to a shared
resource increases computation speed, functionality, data availability, and
reliability

8. Give the advantages of multiprocessor system?


Multiprocessing operating system or the parallel system supports the use of
more than one processor in close communication.
The advantages of the multiprocessing system are:
 Increased Throughput − By increasing the number of processors, more
work can be completed in a unit time.
 Cost Saving − Parallel system shares the memory, buses, peripherals etc.
Multiprocessor system thus saves money as compared to multiple single
systems. Also, if a number of programs are to operate on the same data, it
is cheaper to store that data on one single disk and shared by all processors
instead of using many copies of the same data.
 Increased Reliability − In this system, as the workload is distributed
among several processors which results in increased reliability. If one
processor fails then its failure may slightly slow down the speed of the
system but system will work smoothly.

9. List any two functions of Process Management Component of the OS.


 Creating and deleting both user and system processes
 Suspending and resuming processes
 Providing mechanisms for process synchronization
 Providing mechanisms for process communication
 Providing mechanisms for deadlock handling

10. List any two functions of Memory Management Component of the OS.
 Keeping track of which parts of memory are currently being used and by
whom

Mr K Praveen Kumar, SMC SHIRVA Page 3


 Deciding which processes (or parts thereof) and data to move into and out of
memory
 Allocating and deallocating memory space as needed

11. List any two functions of Mass-Storage Management Component of the OS.
 Mounting and unmounting
 Free-space management
 Storage allocation
 Disk scheduling
 Partitioning
 Protection

12. List any two functions of Cache Management Component of the OS.
Faster storage (cache) checked first to determine if information is there
 If it is, information used directly from the cache (fast)
 If not, data copied to cache and used there

13. Give any four attributes of File.


 Name – only information kept in human-readable form.
 Identifier- This unique tag, usually a number, identifies the file within the file
system; it is the non-human-readable name for the file.
 Type – needed for systems that support different types.
 Location – pointer to file location on device.
 Size – The current size of the file (in bytes, words, or blocks), and possibly
the maximum allowed size are included in this attribute.
 Protection – controls who can do reading, writing, executing.
 Time, date, and user identification – This information may be kept for creation, last
modification, and last use. These data can be useful for protection, security, and
usage monitoring.

14. Give any four File Operations


 Creating a file:
 Writing a file:
 Reading a file:

Mr K Praveen Kumar, SMC SHIRVA Page 4


 Repositioning within a file:
 Deleting a file:
 Truncating a file

15. Give any four File types.

16. Give any four Directory Operations.


 Search for a file:
 Create a file:
 Delete a file:
 List a Directory:
 Rename a file:
 Traverse the file system

17. List any four information associated with an open file.


 Source program
 Object programs,
 Executable programs
 Numeric data,
 Text data
Mr K Praveen Kumar, SMC SHIRVA Page 5
 Graphics images
 Sound recording and so on.

18. What is single-level directory?
Single level directory: The simplest directory structure is the single-level
directory. All files are contained in the same directory, which is easy to support and
understand.

19. List various Free space Management.


There are four free space management methods available in OS.
These are - Bit vector, linked list, grouping, and counting.

20. List various Allocation Methods.


There are following methods which can be used for allocation.
1. Contiguous Allocation.
2. Linked Allocation
3. Indexed Allocation

21. What is system calls? Mention its Categories.


A system call is a way for a user program to interface with the operating
system. The program requests several services, and the OS responds by
invoking a series of system calls to satisfy the request. A system call can be
written in assembly language or a high-level language like C or Pascal.
System calls can be grouped roughly into six major categories:
 process control,
 file management,
 device management,
 information maintenance,
 communications, and
 protection.

22. What is Multiprocessor system?


Computer systems that carry more than one general purpose processors are
known as multiprocessor (or) parallel (or) tightly coupled systems. These

Mr K Praveen Kumar, SMC SHIRVA Page 6


processors share computer bus, memory, clocks and various hardware
components. These type of systems are used because of following advantages.
(a) Increased reliability
(b) Increased throughput
(c) Economy of scale.
(d) Increased Reliability

23. Define Symmetric multiprocessing?


 The multiprocessing system, in which multiple processors work together on
the same task, is known as Symmetric Multiprocessing System.
 In this system, each processor can perform all types of tasks.
 All processors are treated equally and no master-slave relationship exists
between the processors.
 For example, different processors in the system can communicate with each
other.

24. What is Clustered system?


 Clustered system is another form of multiprocessor system.
 This system also contains multiple processors but it differs from
multiprocessor system.
 The clustered system consists of two or more individual systems that are
coupled together.
 In clustered system, individual systems (or clustered computers) share the
same storage and are linked together, via Local Area Network(LAN).
 A layer of cluster software runs on the cluster nodes.
 Each node can monitor one or more of the other nodes over the LAN.
 If the monitored machine fails due to some technical fault (or due to other
reason), the monitoring machine can take ownership of its storage.
 The monitoring machine can also restart the applications that were running on
the failed machine.
25. What is shell? Give the different types of shell.
 Most operating systems, including Linux, UNIX, and Windows, treat the
command interpreter as a special program that is running when a process is
initiated or when a user first logs on (on interactive systems).

Mr K Praveen Kumar, SMC SHIRVA Page 7


 On systems with multiple command interpreters to choose from, the
interpreters are known as shells. For example, on UNIX and Linux systems, a
user may choose among several different shells, including the Cshell,Bourne-
Again shell, Korn shell, and others.

26. What is API?


API is the acronym for application programming interface — a software
intermediary that allows two applications to talk to each other. APIs are an
accessible way to extract and share data within and across organizations.
27. What are system utilities? Give any 2 categories.
 System services, also known as system utilities, provide a convenient
environment for program development and execution.
 Some of them are simply user interfaces to system calls.
 Others are considerably more complex.
 They can be divided into these categories:
1. File management
2. Status information
3. File modification
4. Programming-language support
5. Program loading and execution
6. Communications
7. Background services

Mr K Praveen Kumar, SMC SHIRVA Page 8


Three or More Marks questions.
1. Explain Computer-System Organization with diagram.
Computer - system operation: One or more CPUs, device controllers connect
through common bus providing access to shared memory. Each device
controller is in-charge of a specific type of device. To ensure orderly access to
the shared memory, a memory controller is provided whose function is to
synchronize access to the memory. The CPU and other devices execute
concurrently competing for memory cycles. Concurrent execution of CPUs
and devices competing for memory cycles

 When system is switched on, ‘Bootstrap’ program is executed. It is the initial


program to run in the system. This program is stored in read-only memory
(ROM) or in electrically erasable programmable read-only memory
(EEPROM).
 It initializes the CPU registers, memory, device controllers and other initial
setups. The program also locates and loads, the OS kernel to the memory.
Then the OS starts with the first process to be executed (ie. ‘init’ process) and
then wait for the interrupt from the user.
Switch on ‘Bootstrap’ program
• Initializes the registers, memory and I/O devices
• Locates & loads kernel into memory
• Starts with ‘init’ process
• Waits for interrupt from user.

2. Explain Batch Processing System.


Batch Processing System: It is designed to maximize resources utilization to
assure that all available CPU type, memory and I/O devices are used
efficiently. In the network environment user stores resources as
Mr K Praveen Kumar, SMC SHIRVA Page 9
networking and about the nature of the job and submitted to the
computer. The job was usually in the form of punched cards and
sometime later the output appeared. The output consists of result of final
memory and register consists for debugging. Its major task was to
transfer control automatically from one job to the next. The operating
system was resident in memory.
To speed up processing job, operators batched together jobs with similar
needs and ran them through the computer as a group. In such batch system
the computer operator would sort programs into batches with similar
requirements and, as the computer, became available, would run each batch.
The output from each job would be sent back to the appropriate programmer.

Disadvantages:
In this execution environment the CPU is often idle because of the speed of the
mechanized I/O device are slower than electronic device

3. Write a note on multi-programmed systems.


 The operating system keeps several jobs in memory simultaneously. These
setup services like computer and print servers. Their system is designed to
compromise between use-ability and resource ability as in resource allocation.
 A computer system has many resource hardware and software that may be
registered to solve in problems CPU, memory space, file storage case, I/O
devices and so on. The OS acts as the manager of these resources.
 The operating system is a control program to prevent errors and improves use
of the computer. Operating system is one program that is running at all time on
the computer usually called kernel, as provides user with direct interface that
may be command line interface or GUI where the operating systems are therefore
fairly sophisticated.
 All the jobs that enter the system are kept in the job pool. This pool consists of
all processes residing on disk awaiting allocation of main memory. If several
Mr K Praveen Kumar, SMC SHIRVA Page 10
jobs are ready to be brought into memory, and if there is not enough room for all
of them, then the system must choose among them.

(Memory layout for Multiprogramming System)


Making this discussion is job scheduling. When the operating system selects
a job into memory for execution. If several jobs are ready to run at the same
time, then the system must choose among them. Making this decision is CPU
scheduling.

4. Explain Multiprocessor System with diagram.


Multiprocessor Systems: Computer systems that carry more than one general
purpose processors are known as multiprocessor (or) parallel (or) tightly coupled
systems. These processors share computer bus, memory, clocks and various
hardware components. These type of systems are used because of following
advantages.
(a) Increased reliability
(b) Increased throughput
(c) Economy of scale.
(a) Increased Reliability: When multiple processors are used and tasks are
thoroughly distributed among them, then even if a processor fails, the overall
system will not be halted. This is because the tasks of the failed process can be
shared among different active processors. This distribution slows down the
performance of the system but prevent it from failing.
(b) Increased Throughput: With the of multiple processors and distribution of
system functions among them, so that more work can be done in less time. This
Mr K Praveen Kumar, SMC SHIRVA Page 11
is similar to multiple programmers working on a single project which results in
completing the task quickly.
However, some overhead will be involved when more than one processors are
working on a single task. This also results in decreasing the expected gain from
additional processors due to sharing of resources.
(c) Economy of Scale: Overall cost of multiprocessors systems is less when
compared with the single processor systems. This is because a single peripheral
such as disk drive, power supply etc are shared among these processors instead
of maintaining multiple computers with their own disks and power suppliers.
In this types of systems, fault tolerance mechanism is used with which faults
present in the system are detected, diagnosed and corrected.
There are two types of multiprocessor systems. They are,
(i) Asymmetric multiprocessor systems
(ii) Symmetric multiprocessor systems.
(i) Asymmetric Multiprocessor Systems: An asymmetric multiprocessor
system is a typical master slave system in which one processor acts as a master
processor and all the others as slaves. Every slave processor performs its specific
tasks which are either assigned by the master processor (or) that are predefined.
The master processor is responsible for controlling the system and assigning
tasks to other processors.
(ii)Symmetric Multiprocessor Systems: In a Symmetric Multiprocessor System
(SMP) all the processors act as peers and hence there exist no master (or) slave
processors. Every processor involves in performing tasks associated with the
operating system. Apart from sharing physical memory, every processor in a
symmetric multiprocessors system carry its own cache memory and a set of
registers.

Mr K Praveen Kumar, SMC SHIRVA Page 12


A major example of symmetric multiprocessor systems is solaris system which is
developed by Sun Microsystems as a commercial version of UNIX. It can
support the connectivity of several dozens of processors running identical
operating system i.e., solaris.
One of the major advantages of SMP is that it can run multiple processes (equal
to the number of processors) simultaneously without any performance
degradation. In order to ensure that the data is sent to the appropriate processor
the Input-Output (I/O) must be controlled carefully. In addition to this, the
inefficiencies like overloading of one processor while others are idle can be
avoided by sharing certain data structures.

5. Write a note on following.


i. Real Time System.
ii. Time Sharing System
Real Time Systems: Embedded system almost always runs real time operating
system.
A real-time system is used when there are rigid time requirements on the
operation of a processor or the flow of data, and thus is often used as a control
device in a dedicated application. Systems that control scientific experiments,
medical –imaging systems, industrial control systems, and some display systems
are real-time systems.
Processing must be done within the defined constraints, or the system will fail.
A real-time system is considered to function correctly only if-it returns the
correct result within any time constraints.
A real-time are of two types:
(i) Hard real-time systems: A hard real-time system guarantees that critical
tasks complete on time. This goal requires that all delays in the system be
bounded, from the retrieval of stored data to the time that it takes the
operating system to finish any request made of it. Such time constraints
dictate the facilities that are available in hard real-time systems.
(ii) Soft real-time systems: A less restrictive type of real-time system is a soft
real-time system, where a critical real-time task gets priority over other tasks,
and retains that priority until it completes. As in hard real-time systems, kernel
delays need to be bounded: A real-time task cannot be kept waiting
indefinitely for the kernel to run it. Soft real time is an achievable goal that is

Mr K Praveen Kumar, SMC SHIRVA Page 13


amenable to mixing with other types of systems. Soft real-time systems,
however, have more limited utility than do hard real-time systems.
Time Sharing System
 In Time sharing (or multitasking) systems, a single 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. The user feels that all
the programs are being executed at the same time.
 Time sharing requires an interactive (or hands-on) computer system, which
provides direct communication between the user and the system. The user
gives instructions to the operating system or to a program directly, using a
input device such as a keyboard or a mouse, and waits for immediate results
on an output device. Accordingly, the response time should be short—
typically less than one second.
 A time-shared operating system allows many users to share the computer
simultaneously. 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 only, even though it is being shared among many users.
 A multiprocessor system is a computer system having two or more CPUs
within a single computer system, each sharing main memory and peripherals.
Multiple programs are executed by multiple processors parallel.

6. Explain any three Operating System Resource Management.


iii. File system Management?
iv. Process Management
v. Memory Management
vi. Mass-Storage Management
vii. Cache Management
viii. I/O System Management

Mr K Praveen Kumar, SMC SHIRVA Page 14


Process Management
A process is a program in execution. It is a unit of work within the system.
Program is a passive entity like the contents of a file stored on disk; process
is an active entity.
Process needs resources to accomplish its task
o CPU, memory, I/O, files
o Initialization data
Process termination requires reclaim of any reusable resources
Single-threaded process has one program counter specifying location of next
instruction to execute
o Process executes instructions sequentially, one at a time, until
completion
Multi-threaded process has one program counter per thread
Typically system has many processes, some user, some operating system
running concurrently on one or more CPUs
o Concurrency by multiplexing the CPUs among the processes / threads
Process Management Activities
The operating system is responsible for the following activities in connection
with process management:
Creating and deleting both user and system processes
Suspending and resuming processes
Providing mechanisms for process synchronization
Providing mechanisms for process communication
Providing mechanisms for deadlock handling
Memory Management
To execute a program all (or part) of the instructions must be in memory
All (or part) of the data that is needed by the program must be in memory
Memory management determines what is in memory and when
o Optimizing CPU utilization and computer response to users
Memory management activities
o Keeping track of which parts of memory are currently being used and by
whom
o Deciding which processes (or parts thereof) and data to move into and
out of memory
o Allocating and deallocating memory space as needed

Mr K Praveen Kumar, SMC SHIRVA Page 15


File-system Management
OS provides uniform, logical view of information storage
o Abstracts physical properties to logical storage unit - file
o A file is a collection of related information defined by its creator.
Commonly, files represent programs (both source and object forms) and
data. Data files may be numeric, alphabetic, alphanumeric, or binary.
o Files may be freeform (for example, text files), or they may be formatted
rigidly (for example,fixed fields such as an mp3 music file).
o Clearly, the concept of a file is an extremely general one
o Each medium is controlled by device (i.e., disk drive, tape drive)
 Varying properties include access speed, capacity, data-transfer
rate, access method (sequential or random)
File-System management
o Files usually organized into directories
o Access control on most systems to determine who can access what
o OS activities include
 Creating and deleting files and directories
 Primitives to manipulate files and directories
 Mapping files onto secondary storage
 Backup files onto stable (non-volatile) storage media
Mass-Storage Management
The computer system must provide secondary storage to back up main
memory. Most modern computer systems use HDDs and NVM devices as the
principal on-line storage media for both programs and data
Usually disks used to store data that does not fit in main memory or data that
must be kept for a “long” period of time
Proper management is of central importance
Entire speed of computer operation hinges on disk subsystem and its
algorithms
OS activities
o Mounting and unmounting
o Free-space management
o Storage allocation
o Disk scheduling
o Partitioning
o Protection
Mr K Praveen Kumar, SMC SHIRVA Page 16
Caching
Important principle, performed at many levels in a computer (in hardware,
operating system, software)
Information in use copied from slower to faster storage temporarily
Faster storage (cache) checked first to determine if information is there
o If it is, information used directly from the cache (fast)
o If not, data copied to cache and used there
Cache smaller than storage being cached
o Cache management important design problem
o Cache size and replacement policy
Migration of data “A” from Disk to Register
Multitasking environments must be careful to use most recent value, no matter

where it is
stored in the storage hierarchy
Multiprocessor environment must provide cache coherency in hardware such
that all CPUs have the most recent value in their cache
Distributed environment situation even more complex
o Several copies of a datum can exist
I/O Subsystem
One purpose of OS is to hide peculiarities of hardware devices from the user
I/O subsystem responsible for
o Memory management of I/O including buffering (storing data
temporarily while it is being transferred), caching (storing parts of data
in faster storage for performance), spooling (the overlapping of output of
one job with input of other jobs)
o General device-driver interface
o Drivers for specific hardware devices
Protection and Security
Protection – any mechanism for controlling access of processes or users to
resources defined by the OS
Security – defense of the system against internal and external attacks
o Huge range, including denial-of-service, worms, viruses, identity theft,
theft of service

Mr K Praveen Kumar, SMC SHIRVA Page 17


Systems generally first distinguish among users, to determine who can do
what
o User identities (user IDs, security IDs) include name and associated
number, one per user
o User ID then associated with all files, processes of that user to determine
access control
o Group identifier (group ID) allows set of users to be defined and
controls managed, then also associated with each process, file
o Privilege escalation allows user to change to effective ID with more
rights

7. Explain Monolithic structure with a neat diagram.


Monolithic Structure
 The simplest structure for organizing an operating system is no structure at all.
 That is, place all of the functionality of the kernel into a single, static binary
file that runs in a single address space.
 This approach—known as a monolithic structure—is a common technique
for designing operating systems.
 An example of such limited structuring is the original UNIX operating system,
which consists of two separable parts: the kernel and the system programs.
 The kernel is further separated into a series of interfaces and device drivers,
which have been added and expanded over the years as UNIX has evolved.
 Everything below the system-call interface
and above the physical hardware is the
kernel.
 The kernel provides the file system, CPU
scheduling, memory management, and other
operating system functions through system
calls.
 Taken in sum, that is an enormous amount
of functionality to be combined into one
single address space
 The Linux operating system is based on
UNIX and is structured similarly, as shown
in Figure 2.13.
 Applications typically use the glibc standard
Mr K Praveen Kumar, SMC SHIRVA Page 18
C library when communicating with the system call interface to the kernel.
 Monolithic kernels do have a distinct performance advantage, however: there
is very little overhead in the system-call interface, and communication within
the kernel is fast

8. Explain Types of System Call.


System calls are categorized into following five groups based on their functionality.
They are as follow,
1. Process Control System Calls
A process refers to a program under execution. Any operation in the computer
system is executed in the form of a process. The system calls in this group are
used to create processes, load, execute and terminate them. Also end or abort
processes if runtime error occurs. The following are few process control
system calls,
 Create process, terminate process
 Wait for event, wait for time, signal
 Load process, execute process
 Allocate memory and free memory
 Get attributes and set attributes
 Abort, end.
2. File Management System Calls
This category contains system calls to create, manage, read and write files.
Some of the system calls in this group are,
 Create and Delete
Before the file is used for read or write we must be able to create the file. This
system call usually takes the name of the file as parameter. The ‘delete’
system removes the file from the memory.
 Open file, close file
 Read file, write file
 Get file attributes and set file attributes.
3. System Information Management System Calls
This category contain system calls used to manage system information like
system date, time, number of current users, operating system version, amount
of free memory available etc. Some of these calls are,
 Get system information and set system information.

Mr K Praveen Kumar, SMC SHIRVA Page 19


 Get current date/time and set current date/time.
 Get device attributes and set device attributes.
 Get process attributes and set process attributes.
4. Device Management System Calls
A computer system comprises several devices like main memory, disk drives
etc. These are called resources of the system and are under control by
operating system. A process that needs resources should uses system calls to
access these resources from the operating system. Few device management
system calls are,
 Request device from operating system and release device.
 Read from device, write to device
 Get and set device attributes
 Attach device logically and detach device logically.
5. Communications System Calls
These system calls enables process to exchange information.
Communication can be performed in two ways,
(i) Message Passing
In this method, messages are exchanged between processes either
through a mailbox or directly between processes. But before sending a
message needs to be created.
(ii) Shared Memory
The communicating processes uses a memory area called shared
memory. Process that wants to send a message, writes into shared
memory and process that wants to receive a message reads from the
share memory. Shared memory is created using “shared memory creates”
and “shared memory attach” system calls.
Some of the communication system calls are,
 Create communication connection and delete communication connection.
 Shared memory creates and shared memory attach.
 Send message, receive message.
 Send status information.

9. Explain Layered Approach operating system structure with a neat diagram.


 The monolithic approach is often known as a tightly coupled system because
changes to one part of the system can have wide-ranging effects on other
parts.
Mr K Praveen Kumar, SMC SHIRVA Page 20
 Alternatively, we could design a loosely coupled system.
 Such a system is divided into separate, smaller components that have specific
and limited functionality.
 All these components together comprise the kernel.
 The advantage of this modular approach is that changes in one component
affect only that component, and no others, allowing system implementers
more freedom in creating and
changing the inner workings of
the system.
 A system can be made modular
in many ways.
 One method is the layered
approach, in which the
operating system is broken into
a number of layers (levels).
 The bottom layer (layer 0) is
the hardware; the highest
(layerN) is the user interface.
 This layering structure is
depicted in Figure 2.14.

 An operating-system layer is an implementation of an abstract object made up


of data and the operations that can manipulate those data.
 A typical operating-system layer—say, layer M—consists of data structures
and a set of functions that can be invoked by higher-level layers.
 Layer M, in turn, can invoke operations on lower-level layers.
 The main advantage of the layered approach is simplicity of construction and
debugging. The layers are selected so that each uses functions (operations and
services of only lower-level layers
 This approach simplifies debugging and system verification.
 Once the first layer is debugged, its correct functioning can be assumed while
the second layer is debugged, and so on.
 If an error is found during the debugging of a particular layer, the error must
be on that layer, because the layers below it are already debugged.
 Each layer is implemented only with operations provided by lower-level
layers.
Mr K Praveen Kumar, SMC SHIRVA Page 21
 A layer does not need to know how these operations are implemented;
 it needs to know only what these operations do.
 Hence, each layer hides the existence of certain data structures, operations,
and hardware from higher level layers.
 Layered systems have been successfully used in computer networks (such as
TCP/IP) and web applications

10. Write a note on Android Operating System.


 The Android operating system was
designed by the Open Handset Alliance
(led primarily by Google) and was
developed for Android smartphones and
tablet computers.
 Whereas iO is designed to run on Apple
mobile devices and is close sourced,
Android runs on a variety of mobile
platforms and is open sourced, partly
explaining its rapid rise in popularity.
 The structure of Android appears in
Figure 2.18
 Android is similar to Ios in that it is a
layered stack of software that provides a
rich set of frameworks supporting
graphics, audio, and hardware features.
 These features, in turn, provide a platform for developing mobile
applications that run on a multitude of Android-enabled devices.
 Software designers for Android devices develop applications in the Java
language, but they do not generally use the standard Java API.
 Google has designed a separate Android API for Java development.
 Java applications are compiled into a form that can execute on the Android
Run Time ART, a virtual machine designed for Android and optimized for
mobile devices with limited memory and CPU processing capabilities.

 Java programs are first compiled to a Java byte code .class file and then
translated into an executable .dex file.

Mr K Praveen Kumar, SMC SHIRVA Page 22


 Whereas many Java virtual machines perform just-in-time (JIT)
compilation to improve application efficiency, ART performs a head-of-
time(AOT) compilation.
 Here, .dex files are compiled into native machine code when they are
installed on a device, from which they can execute on the ART.
 AOT compilation allows more efficient application execution as well as
reduced power consumption, features that are crucial for mobile systems
 Android developers can also write Java programs that use the Java native
interface—or JNI—which allows developers to bypass the virtual machine
and instead write Java programs that can access specific hardware features.
 Programs written using JNI are generally not portable from one hardware
device to another.
 The set of native libraries available for Android applications includes
frameworks for developing web browsers (webkit), database support
(SQLite), and network support, such as secure sockets (SSLs).
 Because Android can run on an almost unlimited number of hardware
devices, Google has chosen to abstract the physical hardware through the
hardware abstraction layer, or HAL.
 By abstracting all hardware, such as the camera ,GPS chip, and other
sensors, the HAL provides applications with a consistent view independent
of specific hardware
 The standard C library used by Linux systems is the GNUC library (glibc).
 Google instead developed the Bionic standard C library for Android. Not
only does Bionic have a smaller memory footprint than glibc, but it also
has been designed for the slower CPUs that characterize mobile devices
 At the bottom of Android’s software stack is the Linux kernel.
 Google has modified the Linux kernel used in Android in a variety of areas
to support the special needs of mobile systems, such as power management.
 It has also made changes in memory management and allocation and has
added a new form of IPC known as Binder

11. Explain any 5 operating system Services.


Operating-system services are provided for the convenience of the programmer,
to make the programming task easier.

Mr K Praveen Kumar, SMC SHIRVA Page 23


 Program execution: The system must be able to load a program into memory
and to run it. The program must be able to end its execution, either normally
or abnormally (indicating error).
 I/O operations: A running program may require I/O. This I/O may involve a
file or an I/O device. For specific devices, special functions may be desired
(such as rewind a tape drive, or blank the screen on a CRT). For efficiency
and protection, users usually cannot control I/O devices directly. Therefore,
.the operating system must provide some means to do I/O.
 File-system manipulation: The file system is of particular interest. It should
be obvious that programs need to read and write files. They also" need to
create and delete files by name.
 Communications: There are many circumstances in which one process needs
to exchange information with another process. There are two major ways in
which such communication can occur. The first takes place between processes
executing on the same computer; the second takes place between processes
executing on different computer systems that are tied together by a computer
network. Communications may be implemented via shared memory, or by the
technique of message passing, in which packets of information are moved
between processes by the operating system.
 Error detection: The operating system constantly needs to be aware of
possible errors. Errors may occur in the CPU and memory hardware (such as a
memory error or a power failure), in I/O devices (such as a parity error on
tape, a connection failure on a network, or lack of paper in jne printer), or in
the user program (such as an arithmetic overflow, an attempt to access an
illegal memory location, or a too great use of CPU time). For each type of
error, the operating system should take the appropriate action to ensure correct
and consistent computing.

12. Explain any 5 File operations.


A file is an abstract data type. To define a file properly, we need to consider the
operations that can be performed on files. The operating system provides system
calls to create, write, read, reposition, delete, and truncate files.
o Creating a file: Two steps are necessary to create a file. First, space in the file
system must be found for the file. We shall discuss how to allocate space for

Mr K Praveen Kumar, SMC SHIRVA Page 24


the file. An array for the new file must be made in the directory. The directory
entry records the name of the file and the location in the file system.
o Writing a file: To write a file, we make a system call specifying both the
name of the file and the information to be written to the file. Given the name
of the file, the system searches the directory to find the location of the file.
The system must keep a write pointer to the location in the file where the next
bwrite is to take place. The pointer must be updated whenever the write
occurs.
o Reading a file: To read from a file, we use a system call that specifies the
name of the file and where (in memory) the next block of the file should be
put. Again, the directory is searched for the associated directory entry, and the
system needs to keep a read pointer to the location in the file where the next
read is to take place. Once the read has taken place, the read pointer is
updated.
o Repositioning within a file: The directory is searched for the appropriate
entry, and the current-file-position is set to a given value. Repositioning
within a file does not need to involve any actual I/O. This file operation is also
known as a file seek.
o Deleting a file: To delete a file, we search the directory for the named file.
Having found the associated directory entry, we release all file space (so that
it can be reused by other files) and erase the directory entry.
o Truncating a file: There are occasions when the user wants the attributes of a
file to remain the same, but wants to erase the contents of the file. Rather than
forcing the user to delete the file and then recreate it, this function allows all
attributes to remain unchanged (except for file length) but for the file to be
reset to length zero and its file space released.

13. Explain various File Attributes.


A file is named, for the convenience of its human users, and is referred to by
its name. A name is usually a string of characters, such as examp1e.c. Some
systems differentiate between upper- and lowercase characters in names,
whereas other systems consider the two cases to be equivalent.
A file has certain other attributes, which vary from one operating system to
another, but typically consist of these:
Name – only information kept in human-readable form.

Mr K Praveen Kumar, SMC SHIRVA Page 25


Identifier- This unique tag, usually a number, identifies the file within the file
system; it is the non-human-readable name for the file.
Type – needed for systems that support different types.
Location – pointer to file location on device.
Size – The current size of the file (in bytes, words, or blocks), and
possibly the maximum allowed size are included in this attribute.
Protection – controls who can do reading, writing, executing.
Time, date, and user identification – This information may be kept for
creation, last modification, and last use. These data can be useful for
protection, security, and usage monitoring
Information about files are kept in the directory structure, which is maintained
on the disk

14. Explain any two directory structures.


ix. Tree-Structured Directories
x. Two-Level Directory
xi. Single-Level Directory
xii. Acyclic-Graph Directories
i. Single level directory: The simplest directory structure is the single-level
directory. All files are contained in the same directory, which is easy to
support and understand.
A single-level directory has significant limitations, however, when the number
of files increases or when there is more than one user. Since all files are in the
same directory, they must have unique names. If we have two users who call
their data file test, then the unique-name rule is violated.

In one programming class, 23 students called the program for their second
assignment prog2; another 11 called it assign2.) Although file names are
generally selected to reflect the content of the file, they are often limited in
length. The MS-DOS operating system allows only 11-character file names;
UNIX allows 255 characters.
Mr K Praveen Kumar, SMC SHIRVA Page 26
Even with a single user, as the number of files increases, it becomes difficult to
remember the names of all the files, so as to create only files with unique names.
It is not uncommon for a user to have hundreds of files on one computer system
and an equal number of additional files on another system.
ii. Tree structured directory: Tree structured directory generalization allows
users to create their own sub- directories and to organize their files accordingly.
The tree has a root directory. Every file in the system has a unique path name. A
path name is the path from the root, through all the subdirectories, to a specified
file.
In normal use, each user has a current directory. The current directory should
contain most of the files that are of current interest to the user. When reference is
made to a file, the current directory is searched. If a file is needed that is not in
the current directory, then the user must either specify a path name or change the
current directory to be the directory holding that file. To change the current
directory to a different directory, a system call is provided that takes a directory
name as a parameter and uses it to redefine the current directory. The initial
current directory of a user is designated when the user job starts or the user logs
in. The path names can be of two types:
1. Absolute path name 2. Relative path name
1. An absolute path name begins at the root and follows a path down to the
specified file, giving the directory names on the path.
2. A relative path name defines a path from the current directory.

Mr K Praveen Kumar, SMC SHIRVA Page 27


Two level Directory Structure: A single-level directory often leads to
confusion of file names between different users. The standard solution is to
create a separate directory for each user.

In the two-level directory structure, each user has own user file directory (UFD).
Each UFD has a similar structure, but lists only the files of a single user. When a
user job starts or a user logs in, the system's master file directory (MFD) is
searched. The MFD is indexed by user name or account number, and each entry
points to the UFO for that user (Figure).
 Although the two-level directory structure solves the name-collision problem,
it still has disadvantages.
 This structure effectively isolates one user from another.
 This isolation is an advantage when the users are completely independent, but
is a disadvantage when the users want to cooperate on some task and to access
one another's files.
 Some systems simply do not allow local user files to be accessed by other
users.

Acyclic-Graph Directories:
The common subdirectory should be shared. A shared directory or
file will exist in the file system in two or more places at once. A tree
structure prohibits the sharing of files or directories.
An acyclic graph is a graph with no cycles. It allows directories to
share subdirectories and files.
The same file or subdirectory may be in two different directories.
The acyclic graph is a natural generalization of the tree-structured
directory scheme.
Mr K Praveen Kumar, SMC SHIRVA Page 28
Two methods to implement shared-files (or subdirectories):
1. Create a new directory-entry called a link. A link is a pointer to
another file (or subdirectory).
2. Duplicate all information about shared-files in both sharing directories.

Two problems:
1. A file may have multiple absolute path-names.
2. Deletion may leave dangling-pointers to the non-existent file.

Solution to deletion problem:


1. Use back-pointers: Preserve the file until all references to it are deleted.
2. With symbolic links, remove only the link, not the file. If the file
itself is deleted, the link can be removed.

15. Explain various Access methods in Files.


ACCESS METHODS
 Files store information. When it is used, this information must be
accessed and read into computer memory. The information in the
file can be accessed in several ways.

 Some of the common methods are:


1. Sequential methods

Mr K Praveen Kumar, SMC SHIRVA Page 29


 The simplest access method is sequential methods.
Information in the file is processed in order, one record after the
other.
 Reads and writes make up the bulk of the operations on a file.
 A read operation (next-reads) reads the next portion of
the file and automatically advances a file pointer, which
tracks the I/O location

 The write operation (write next) appends to the end of the file and
advances to the end of the newly written material.
 A file can be reset to the beginning and on some systems, a
program may be able to skip forward or backward n records for
some integer n-perhaps only for n =1.

1. Direct Access
 A file is made up of fixed length logical records that allow programs
to read and write records rapidly in no particular order.
 The direct-access method is based on a disk model of a file, since
disks allow random access to any file block. For direct access, the
file is viewed as a numbered sequence of blocks or records.
 Example: if we may read block 14, then read block 53, and then
write block 7. There are no restrictions on the order of reading or
writing for a direct-access file.

 Direct-access files are of great use for immediate access to large


amounts of information such as Databases, where searching
becomes easy and fast.
Mr K Praveen Kumar, SMC SHIRVA Page 30
 For the direct-access method, the file operations must be modified to
include the block number as a parameter. Thus, we have read n,
where n is the block number, rather than read next, and ·write n
rather than write next.
Figure: Simulation of sequential access on a direct-access file.
 An alternative approach is to retain read next and write next, as with
sequential access, and to add an operation position file to n, where n
is the block number. Then, to affect a read n, we would position to n
and then read next.
2. Other Access Methods:
 Other access methods can be built on top of a direct-access method.
These methods generally involve the construction of an index for the
file.
 The Index, is like an index in the back of a book contains pointers
to the various blocks. To find a record in the file, we first search the
index and then use the pointer to access the file directly and to find
the desired record.

Figure: Example of index and relative files

16. Explain any two Allocation Method.


a. Contiguous allocation.
b. Linked allocation
c. Indexed Aallocation.
Contiguous allocation:
Requires that each file occupy a set of contiguous blocks on the disk

Mr K Praveen Kumar, SMC SHIRVA Page 31


Accessing a file is easy – only need the starting location (block #) and
length (number of blocks)
Contiguous allocation of a file is defined by the disk address and length
(in block units) of the first block. If the file is n blocks long and starts at
location b, then it occupies blocks b, b + 1, b + 2, ... ,b + n - 1. The
directory entry for each file indicates the address of the starting block
and the length of the area allocated for this file.
Accessing a file that has been allocated contiguously is easy. For
sequential access, the file system remembers the disk address of the last
block referenced and when necessary, reads the next block. For direct
access to block i of a file that starts at block b, we can immediately
access block b + i. Thus, both sequential and direct access can be
supported by contiguous allocation.

Disadvantages:
1. Finding space for a new file is difficult. The system chosen to
manage free space determines how this task is accomplished. Any
management system can be used, but some are slower than others.
Satisfying a request of size n from a list of free holes is a problem. First
fit and best fit are the most common strategies used to select a free
hole from the set of available holes.
2. The above algorithms suffer from the problem of external
fragmentation.
 As files are allocated and deleted, the free disk space is broken
into pieces.

Mr K Praveen Kumar, SMC SHIRVA Page 32


 External fragmentation exists whenever free space is broken into
chunks.
 It becomes a problem when the largest contiguous chunk is
insufficient for a request; storage is fragmented into a number
of holes, none of which is large enough to store the data.
 Depending on the total amount of disk storage and the average
file size, external fragmentation may be a minor or a major
problem.
Linked Allocation:
 Solves the problems of contiguous allocation
 Each file is a linked list of disk blocks: blocks may be scattered
anywhere on the disk
 The directory contains a pointer to the first and last blocks of a file
 Creating a new file requires only creation of a new entry in the
directory
 Writing to a file causes the free-space management system to find a
free block
 This new block is written to and is linked to the end of the file
 Reading from a file requires only reading blocks by following the
pointers from block to block.
Advantages
 There is no external
fragmentation
 Any free blocks on the free list
can be used to satisfy a request
for disk space
 The size of a file need not be
declared when the file is
created
 A file can continue to grow as
long as free blocks are
available
 It is never necessary to compact disk space for the sake of
linked allocation (however, file access efficiency may require it)

Mr K Praveen Kumar, SMC SHIRVA Page 33


Indexed Allocation
 Linked allocation solves the
external-fragmentation and size-
declaration problem s of
contiguous allocation.
 However, in the absence of a
FAT, linked allocation cannot
support efficient direct access,
since the pointers to the blocks
are scattered with the blocks
themselves all over the disk and
need to be retrieved in order.
 Indexed allocation solves the
problem of linked allocation by
bringing all the pointers together
into one location: the index block.
 Each file has its own index block, which is an array of disk-block addresses.
 The ith entry in the index block points to the f th block of the file. The directory
contains the address of the index block.
 To read the fth block, we use the pointer in the fth index block entry to find and
read the desired block.
 Indexed allocation supports direct access, without suffering from external
fragmentation, because any free block on the disk may satisfy a request for more
space.

17. Explain any two Free-space Management.


a. Bit Vector
b. Linked Lis
c. Grouping
d. Counting
Free Space Management:
The space created after deleting the files can be reused. Another important aspect
of disk management is keeping track of free space in memory. The list which
keeps track of free space in memory is called the free-space list. To create a file,
search the free-space list for the required amount of space and allocate that space
Mr K Praveen Kumar, SMC SHIRVA Page 34
to the new file. This space is then removed from the free- space list. When a file is
deleted, its disk space is added to the free-space list. The free-space list, is
implemented in different ways as explained below.
a) Bit Vector
 Fast algorithms exist for quickly finding contiguous blocks of a given size
 One simple approach is to use a bit vector, in which each bit represents a
disk block, set to 1 if free or 0 if allocated.
For example, consider a disk where blocks 2,3,4,5,8,9, 10,11, 12, 13, 17and 18
are free, and the rest of the blocks are allocated. The free-space bit map would
be 0011110011111100011
 Easy to implement and also very efficient in finding the first
free block or ‘n’consecutive free blocks on the disk.
 The down side is that a 40GB disk requires over 5MB just to store the
bitmap.
b) Linked List
a. A linked list can also be used to keep track of all free blocks.
b. Traversing the list and/or finding a contiguous block of a given size are not
easy, but fortunately are not frequently needed operations. Generally the
system just adds and removes single blocks from the beginning of the list.
c. The FAT table keeps track of the free list as just one more linked list on the
table.
c) Grouping
a. A variation on linked list free lists. It stores the addresses of n free blocks in
the first free block. The first n-1 blocks are actually free. The last block
contains the addresses of another n free blocks, and so on.
b. The address of a large number of free blocks can be found quickly.
d) Counting
a. When there are multiple contiguous blocks of free space then the system can
keep track of the starting address of the group and the number of contiguous
free blocks.
b. Rather than keeping al list of n free disk addresses, we can keep the address
of first free block and the number of free contiguous blocks that follow the
first block.
c. Thus the overall space is shortened. It is similar to the extent method of
allocating blocks.
Mr K Praveen Kumar, SMC SHIRVA Page 35

You might also like