0% found this document useful (0 votes)
25 views67 pages

Os-Sol Bank

Uploaded by

gr218396
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)
25 views67 pages

Os-Sol Bank

Uploaded by

gr218396
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/ 67

SOLUTION BANK

BCA303T Operating System


BCA305T: OPERATING SYSTEMS
Total Teaching Hours : 65 No of hours/Week:05
Unit – I
Introduction: Batch Systems, Concepts of Multiprogramming and Time Sharing, Parallel,
Distributed and real time Systems, Operating System Structures, Components & Services,
System calls, System programs, Virtual machines. Process Management: Process Concept,
Process Scheduling, Co – Operating process, Threads, Inter process communication, CPU
Scheduling Criteria, Scheduling algorithm, Multiple Processor Scheduling, Real time
Scheduling, Algorithm evolution. [ 13 Hours ]
Unit – II
Process Synchronization and deadlocks: The Critical Section Problem, Synchronization
hardware, Semaphores, Classical problems of synchronization, Critical regions, monitors,
Dead locks – system model, Characterization, Dead lock prevention, avoidance and
detection, Recovery from dead lock, Combined approach to deadlock handling. [ 13 Hours ]
Unit - III
Memory Management: Logical and Physical address space, Swapping, Contiguous allocation,
Paging, Segmentation, Segmentation with paging in Mastics and Intel 386, Virtual memory-
Demand paging and it’s performance, Page replacement algorithms, Allocation of frames,
thrashing, page size and other considerations. Demand Segmentation. [ 13 Hours ]
Unit - IV
File management (Systems, Secondary Storage Structure): File Concepts, Access methods,
Directory Structure, Protection and consistency, File system structure, Allocation methods,
Free space management, Directory Implementation, Efficiency and Performance, Recovery.
Disk Management (Structure, Disk Scheduling Methods): Disk Structure & Scheduling
methods, Disk management, Swap – Space management. [ 13 Hours ]
Unit – V
Protection and Security: Goals of protection, Domain Protection, Access matrix, Security
Problem, Authentication, One time password, program threats, System threads. Case Study of
Windows and Linux Operating System [ 13 Hours ]
Text Books: 1. Abraham Silberschatz and Peter Baer Galvin, “Operating System Concepts”,
7th Edition, Pearson Education, 2002.
Reference Books: 1. H.M.Deitel, “Operating Systems”, Pearson Learning Solutions, 3rd
Edition, 2003.
2. William Stallings, “Operating Systems”, 6th Edition, Pearson Education, 2010.
3. Stuart, “Operating systems: Principles, Design and Implementation”, 1st Edition 2008,
Cengage Learning India
BLUE PRINT
SECTION A [2 MARKS]
UNIT-I
[NOV/DEC 2015]
1. WHAT IS AN OPERATING SYSTEM? MENTION ANY TWO FUNCTIONS OF AN
OPERATING SYSTEM. [ REPEATED IN NOV/DEC 2016]

2. LIST DIFFERENCES BETWEEN BATCH PROCESSING AND


MULTI-PROGRAMMING OS.
3. DEFINE THE TERMS SCHEDULER AND DISPATCHER.
4. WHAT IS INTER-PROCESS COMMUNICATION?

[NOV/DEC 2016]
5. DEFINE TIME SHARING SYSTEM.

[NOV/DEC 2017]
6. WHAT ARE THE MAIN FUNCTIONS OF OPERATING SYSTEM?
7. DIFFERENTIATE PROCESS AND PROGRAM.

[NOV/DEC 2018]
8. MENTION THE DIFFERENT OPERATING SYSTEM COMPONENTS.
9. WHAT IS CONCURRENT EXECUTION?
10. WHAT IS THE DIFFERENCE BETWEEN MULTI-TASKING AND MULTI-USER
SYSTEM?

[ TMAQ - Important Tutor Mark Assignment Questions ]


11.WHAT IS BUFFERING?
12.WHAT IS SPOOLING?
13.WHAT ARE THE FUNCTIONS OF DISTRIBUTED OPERATING SYSTEM?
14.WHAT IS THE PURPOSE OF A SYSTEM CALL?
UNIT-II

[NOV/DEC 2015]
15. EXPLAIN TEST() AND SET () SYNCHRONISATION HARDWARE.
16. MENTION THE METHODS USED TO HANDLE DEADLOCKS.

[NOV/DEC 2016]
17. WHAT IS AGING?
18. WHAT IS MONITOR?
19. DEFINE DEADLOCK WITH AN EXAMPLE.
20. DEFINE COMPACTION. [REPEATED IN NOV/DEC 2017]

[NOV/DEC 2017]
21. WHAT IS CONVOY EFFECT?
22. WHAT IS MUTUAL EXCLUSION?
23. WHAT ARE THE NECESSARY CONDITIONS FOR DEADLOCK?[REPEATED IN
2018]

[NOV/DEC 2018]
24. WHAT IS SEMAPHORE?

[ TMAQ - Important Tutor Mark Assignment Questions ]


25.WHAT IS RACE CONDITION?
26.WHAT ARE THE STATES OF RESOURCE?
27.GIVE THE CHARACTERISTICS OF A DEADLOCK SITUATION.
28.WHAT IS SAFE STATE?
UNIT-III

[NOV/DEC 2015]
29. WHAT IS DYNAMIC LOADING?
30. EXPLAIN OVERLAYS.[REPEATED IN 2018]
[NOV/DEC 2016]
31. DEFINE VIRTUAL MEMORY.[REPEATED IN NOV/DEC 2017]
32. DEFINE LOGICAL AND PHYSICAL ADDRESS.
[NOV/DEC 2017]
33. WHAT IS DEMAND PAGING?
[NOV/DEC 2018]
34. WHAT IS FRAGMENTATION?

[ TMAQ - Important Tutor Mark Assignment Questions ]


35.WHAT DO YOU MEAN BY SWAPPING?
36.DEFINE PAGING IN MEMORY
37.WHAT IS PAGE BREAK? EXPLAIN
38.EXPLAIN THE TERMS SWAP IN AND SWAP OUT.

UNIT-IV
[NOV/DEC 2015]
39. DEFINE THRASHING.
40. LIST DIFFERENT TYPES OF FILES.
41. WHAT IS DISK FORMATTING?[REPEATED IN NOV/DEC 2018]

[NOV/DEC 2016]
42. MENTION ANY FOUR ATTRIBUTES OF FILE.
43. WHAT IS A BIT VECTOR?
44. DEFINE SEEK TIME.[REPEATED IN NOV/DEC2018]

[NOV/DEC 2017]
45. MENTION ANY FOUR FILE OPERATIONS.[REPEATED IN NOV/DEC2018]
[NOV/DEC 2018]
46. WHAT IS THE DIFFERENCE BETWEEN ABSOLUTE PATH AND RELATIVE
PATH NAME?
47. EXPLAIN CONTIGUOUS MEMORY MANAGEMENT TECHNIQUES.

[ TMAQ - Important Tutor Mark Assignment Questions ]


48.WHAT IS A FILE?
49. WHAT ARE THE VARIOUS FILE ACCESS METHODS.
50. LIST THE FUNCTIONS OF FILE MANAGEMENT SYSTEM.
51. DEFINE TRACK.

UNIT-V
[NOV/DEC 2015]
52.DEFINE ENCRYPTION
[NOV/DEC 2016]
53.WHAT IS WORM?
[NOV/DEC 2017]
54.WRITE ANY TWO ANTIVIRUS SOFTWARE.
[NOV/DEC 2018]
55.WHAT IS AN ACCESS MATRIX?

[ TMAQ - Important Tutor Mark Assignment Questions ]


56.WHAT IS PROTECTION?
57.WHAT IS VIRUS?
58.WHAT IS RICH TEXT FORMAT?
59.WHAT IS ZOMBIE?
SECTION B(5 MARKS)
UNIT I

[NOV/DEC 2015]
1. EXPLAIN SPOOLING WITH A DIAGRAM.
[NOV/DEC 2016]
2. EXPLAIN MULTIPROGRAMMING SYSTEM. MENTION ITS ADVANTAGES.

[NOV/DEC 2017]
3.EXPLAIN TIME SHARING SYSTEM.
4. WHAT IS SYSTEM CALL? EXPLAIN THE TYPES OF SYSTEM CALLS.
5. EXPLAIN DIFFERENT PROCESS STATES WITH A NEAT DIAGRAM.[REPEATED
IN NOV/DEC 2016 & 2018]
[NOV/DEC 2018]
6. What is an operating system? Give four functions of OS.
7. What is multiprogramming? Difference between multiprogramming,
multiprocessing and distributed processing.

UNIT II
[NOV/DEC 2015]

8. Explain Process control Block (PCB).


9. Explain dining philosopher problem using semaphore
10. Explain resource allocation graph.[REPEATED IN NOV/DEC 2016
&2018]

[NOV/DEC 2016]
11. Explain the critical section problem and requirements of a critical section
problem.[REPEATED IN NOV/DEC 2018]

[NOV/DEC 2017]
12. WHAT IS SEMAPHORE? EXPLAIN DIFFERENT TYPES OF SEMAPHORE.
13. EXPLAIN BANKER’S ALGORITHM.

UNIT III
[NOV/DEC 2015]
14. WRITE A NOTE ON FRAGMENTATION .
[NOV/DEC 2016]
15. EXPLAIN THE TERMS FIRST-FIT, BEST-FIT AND WORST-FIT .[REPEATED IN
NOV/DEC 2017 & 2018]
UNIT IV
[NOV/DEC 2015]
16. EXPLAIN LRU PAGE REPLACEMENT ALGORITHM[REPEATED IN NOV/DEC
2017]
17. EXPLAIN VARIOUS FILE ACCESSING METHOD[REPEATED IN NOV/DEC 2016]

[NOV/DEC 2016]
18. Describe the frame allocation algorithm.

UNIT V
[NOV/DEC 2015]
19. WHAT IS VIRUS? EXPLAIN DIFFERENT TYPES OF VIRUS.[REPEATED IN
NOV/DEC 2017 & NOV/DEC 2018]

[NOV/DEC 2016]
20. List any three goals of protection.

[NOV/DEC 2018]

21. Describe the UNIX system process scheduling algorithm.

SECTION C
UNIT I
[NOV/DEC 2015]
1. Explain time sharing and real time operating system.
2. Explain various services offered by an operating system.

[NOV/DEC 2016]
3. EXPLAIN DIFFERENT TYPES OF SCHEDULERS[REPEATED IN NOV/DEC 2017]

[NOV/DEC 2018]
4. Define, compare and contrast each of the following terms:
a. Batch processing
b. Time sharing
c. Real time processing
UNIT II

[NOV/DEC 2015]
5. EXPLAIN DIFFERENT PROCESS STATES WITH A NEAT DIAGRAM.
6. Consider the following processes with their CPU burst time in milliseconds.
PROCESS CPU BURST
P1 10
P2 1
P3 2
P4 10
P5 5

The processes arrive in the order P1,P2, P3,P4,P5. Draw the Gantt chart illustrating the
execution of these processes using FCFS.
Calculate
1. Average waiting time
2. Average turnaround time
7. WHAT IS SEMAPHORE? EXPLAIN DIFFERENT TYPES OF SEMAPHORE.
8. Explain different methods of deadlock prevention[REPEATED IN NOV/DEC 2016 &
2017]
[NOV/DEC 2016]
9. Explain FCFS and round robin scheduling with example[REAPEATED IN NOV/DEC
2017]
10. EXPLAIN BANKER’S ALGORITHM.
[NOV/DEC 2017]

11.Explain dining philosopher problem using semaphore


[NOV/DEC 2018]
12.WHEN DO YOU RUN DEADLOCK DETECTION ALGORITHM? EXPLAIN WITH
AN EXAMPLE.
UNIT III
[NOV/DEC 2015]

13. Explain paging scheme.

14. What is demand paging? Explain


[NOV/DEC 2016]

15. Differentiate between paging and segmentation .


[NOV/DEC 2017]

16. Write a note on segmentation .


17. WRITE A NOTE ON FRAGMENTATION[REPEATED IN NOV/DEC 2018]

UNIT IV

[NOV/DEC 2015]
18. Explain various method used to allocate space to files[REPEATED IN
NOV/DEC 2017]
19. Explain any two disk scheduling algorithm[REPEATED IN NOV/DEC
2016 & 2017]

[NOV/DEC 2016]
20. Explain any two page replacement algorithm with an example.
21. EXPLAIN VARIOUS FILE ACCESSING METHOD[REPEATED IN
NOV/DEC 2017]
22. Explain single level and two level directory.
[NOV/DEC 2018]
23. Explain any three disk scheduling algorithms with example
UNIT V

[NOV/DEC 2016]
24. WHAT IS VIRUS? EXPLAIN DIFFERENT TYPES OF VIRUES
[NOV/DEC 2017]
25. EXPLAIN USER AUTHENTICATION IN DETAIL[REPEATED IN NOV/DEC
2018]
SECTION D
UNIT I

[NOV/DEC 2017]
1. WRITE A SHORT NOTE ON OPERATING SYSTEM COMPONENTS.
UNIT II

[NOV/DEC 2015]
2. WRITE A SHORT NOTE ON:
PRE-EMPTIVE AND NON-PREEMPTIVE SCHEDULING

[NOV/DEC 2016]
3.WRITE A SHORT NOTE ON:
i. PCB [REPEATED IN NOV/DEC 2018]
ii. SEMAPHORE
iii. DINING-PHILOSOPHER PROBLEM [REPEATED IN NOV/DEC 2018]

[NOV/DEC 2017]
4. WRITE A SHORT NOTE ON MULTI-LEVEL QUEUE SCHEDULING
UNIT III

[NOV/DEC 2016]
5. WRITE A SHORT NOTE ON OVERLAYS [REPEATED IN NOV/DEC 2017]
UNIT IV

[NOV/DEC 2015]
6. WRITE A SHORT NOTE ON SWAP SPACE MANAGEMENT

[NOV/DEC 2017]
7. WRITE A SHORT NOTE ON OPTIMAL PAGE REPLACEMENT TECHNIQUE
UNIT V

[NOV/DEC 2015]
8. WRITE A SHORT NOTE ON ANY FIVE OBJECTS OF WINDOWS EXECUTIVE
9. WRITE A SHORT NOTE ON SECURITY MECHANISM USED IN LINUX

[NOV/DEC 2018]

10. EXPLAIN THE LAYERED STRUCTURE OF WINDOWS OPERATING SYSTEM.


SECTION A [2 MARKS]

1. WHAT IS AN OPERATING SYSTEM? MENTION ANY TWO FUNCTIONS OF AN


OPERATING SYSTEM.
Ans: An operating system is system software that provides an interface between the hardware
and the user. The operating system is responsible for management and co-ordinating of
processes and allocation and sharing of hardware resources.
FUNCTIONS:
i. Program execution
ii. Error detection

2. LIST DIFFERENCES BETWEEN BATCH PROCESSING AND MULTI-


PROGRAMMING OS.
Ans:
BATCH PROCESSING MULTI PROGRAMMING
i. Grouping of several processing jobs to be i. Ability of an OS to execute multiple
executed one after another by a computer programs at the same time on a single
without any user interaction processor
ii. It is slower ii. It is faster
iii. CPU might stay without performing a task iii. CPU always perform a task
iv. Helps to minimize human interactions and iv. Provides maximum CPU utilization
cost

3. DEFINE THE TERMS SCHEDULER AND DISPATCHER.


Ans: Scheduler : A process migrates among various scheduling queue throughout its lifetime.
The operating system must select for scheduling purposes, processes from these queue in
some manner. The selection process is carried out from appropriate scheduler.
Dispatcher: It is the module that gives control to the CPU to the process selected by the short
term scheduler. Another component involved in CPU scheduling function is a dispatcher.
4. WHAT IS INTER-PROCESS COMMUNICATION?
Ans: Co-operating process require an inter process communication(IPC) mechanism that will
allow them to exchange data & information .There are two fundamental models of inter
process communication.
i. Shared memory model
ii. Message passing model
5. DEFINE TIME SHARING SYSTEM
Ans: Time sharing is a logical extension of multiprogramming. A time shared operating
system allows many users to share the computer simultaneously. The system switches rapidly
from one user to the next and hence the user is given an impression that the entire computer
system is dedicated to his use, though it is being shared among many users.
6. WHAT ARE THE MAIN FUNCTIONS OF OPERATING SYSTEM?
Ans: i. Program execution
ii. I/O operation
iii. File-system manipulation
iv. Error detection
v. Communication

7. DIFFERENTIATE PROCESS AND PROGRAM.


PROCESS PROGRAM
i. It is a instance of a computer the i. Program collection of instruction that perform
programming that is being executed. specific task when executed by a computer.
ii. Have longer life time ii. Have shorter lifetime
iii. Require resource such as memory, iii. Hard disk stores the program & this program
I/O device & CPU. do not require resource

8.MENTION THE DIFFERENT OPERATING SYSTEM COMPONENTS.


Ans: i. Process Management
ii. Main memory Management
iii. File Management
iv. Input-output system management
v. Secondary storage management
vi. Networking
vii. Protection System
viii. Command Interpreter system
9. WHAT IS CONCURRENT EXECUTION?
Ans: Concurrent execution of database transactions in a multi user system means that any
number of users can use the same database at the same time. Concurrency control is needed
to avoid inconsistencies in the database.
10.WHAT IS THE DIFFERENCE BETWEEN MULTI-TASKING AND MULTI-USER
SYSTEM?
Ans:
MULTI-TASKING MULTI-USER
i. It provides many services to the user as well as i. It allows simultaneous access to
the program it runs computer through multiple terminals.
ii. In a multitasking environment the multiple jobs ii. Several users can access the same
of a single user are processed simultaneously program from different terminate

11.WHAT IS BUFFERING?
Ans: Buffering is a method of overlapping input/output and processing a job.
12.WHAT IS SPOOLING?
Ans: Spooling allows overlapping of input/output of one job with the computation of other
jobs thereby increasing the performance of CPU.
13.WHAT ARE THE FUNCTIONS OF DISTRIBUTED OPERATING SYSTEM?
Ans: i. Resource sharing
ii. Computation speedup
iii. Reliability
iv. Communication

14.WHAT IS THE PURPOSE OF A SYSTEM CALL?


Ans: System call acts as an interface between a process and an operating system. They are
available as assembly level instructions manuals.
15. EXPLAIN TEST() AND SET () SYNCHRONISATION HARDWARE.
Ans: It is an instruction used to both test and write to a memory location as a part of a single
atomic (i.e non interruptible operation.
This means it is used for setting a value but first some test (such as, the value is equal to
another given value). If the test fails, the value is not-set. The entire test and set () is carried
out automatically (without interruption).
16. MENTION THE METHODS USED TO HANDLE DEADLOCKS
Ans: There are three ways of handling deadlocks:

1. Deadlock prevention or avoidance


2. Deadlock detection and recovery
3. Ignore the problem all together

17. WHAT IS AGING?


Ans: A solution to the problem of indefinite blocking of low-priority process is aging. Aging
is a technique of gradually increasing the priority of process that wait in the system for a long
time.
18. WHAT IS MONITOR?
Ans: Another high level synchronization construct is the monitor type. A type, or abstract
data type, encapsulates private data with public methods to operate on that data. A monitor
type presents a set of programmer-defined operations that provide mutual exclusion within
the monitor.
19. DEFINE DEADLOCK WITH AN EXAMPLE.
Ans: Deadlock is a situation in which each process in a set of processes is waiting for an
event that only another process in the set can cause. Since all the processes are waiting, the
system enters a deadlock condition.
For eg: P1 and P2 are two processes and R1 and R2 are two resources. P1 request the
resource R1 which is been held by the process P2. P2 request the resource R2 held by the
process P1, then both are waiting for the resource held by the other and there is no work
progress for process P1 and P2. It is a deadlock.
20. DEFINE COMPACTION. [REPEATED IN NOV/DEC 2017]
Ans: Compaction is a technique of combining all the free spaces together into a large block
by pushing all process downwards as far as possible.
21. WHAT IS CONVOY EFFECT?
Ans: In FCFS scheduling, since the time taken for executing the big process is very high the
smaller process has to wait for a long time to get the attention of the CPU. All small process
has to wait for the one big process to get off the CPU. This is known as Convoy Effect.
22. WHAT IS MUTUAL EXCLUSION?
Ans: When process P1 is executing in its critical section, no other processes can be
executing in their critical sections. Only one process should execute in its critical section at a
time.
23. WHAT ARE THE NECESSARY CONDITIONS FOR DEADLOCK?[REPEATED IN
2018]
Ans: i. Mutual Exclusion
ii. Hold and Wait
iii. No Pre-emption
iv. Circular Wait
24. WHAT IS SEMAPHORE?

Ans: A semaphore S is an integer variable with non-negative values, which can be accessed
only through two standard atomic operations: wait () and signal ().
25.WHAT IS RACE CONDITION?
Ans: When several processes access and manipulate the same data concurrently and the final
outcome of the execution depends on the particular order in which the access takes place, is
called race condition.
26.WHAT ARE THE STATES OF RESOURCE?
Ans: i. Request
ii. Use
iii. Release
27.GIVE THE CHARACTERISTICS OF A DEADLOCK SITUATION.
Ans: i. Necessary condition
ii. Resource-allocation graph
28.WHAT IS SAFE STATE?
Ans: A state is safe if the system can allocate resources to each process in some order and
still avoid a deadlock.

29. WHAT IS DYNAMIC LOADING?

Ans: In dynamic loading, a program or routine is not loaded until it is called. All routines are
stored on the disk in a relocatable load format.

30. EXPLAIN OVERLAYS.


Ans: Overlays are used to enable a process to be larger than the amount of memory allocated
to it. The main objective of this scheme is to keep only those instructions and data in
memory, which are required at that time. Other instructions are loaded into memory,
whenever they are required and they occupy the space of the previous instructions which are
no longer required.

31. Define virtual memory.


Ans: Virtual memory is a memory management technique that allows the execution of
processes, which may not be completely in memory. The advantage of this scheme is that
user programs can be larger than the physical memory.
32. DEFINE LOGICAL AND PHYSICAL ADDRESS.
Ans:
Logical Address is generated by CPU while a program is running. The logical address is
virtual address as it does not exist physically, therefore, it is also known as Virtual Address.
This address is used as a reference to access the physical memory location by CPU.
Physical Address identifies a physical location of required data in a memory. The user never
directly deals with the physical address but can access by its corresponding logical address.
The user program generates the logical address and thinks that the program is running in this
logical address but the program needs physical memory for its execution.

33. WHAT IS DEMAND PAGING?


Ans: A demand paging system is quite similar to a paging system with swapping where
processes reside in secondary memory and pages are loaded only on demand, not in advance.
When a context switch occurs, the operating system does not copy any of the old program’s
pages out to the disk or any of the new program’s pages into the main memory Instead, it just
begins executing the new program after loading the first page and fetches that program’s
pages as they are referenced.

34. WHAT IS FRAGMENTATION?


Ans: Fragmentation occurs in a dynamic memory allocation system when many of the free
blocks are too small to satisfy any request. The different types of fragmentation are:
i. External fragmentation
ii. Internal fragmentation

35.WHAT DO YOU MEAN BY SWAPPING?


Ans: The technique of removing the process temporarily out of main memory to secondary
memory and then bringing it back to main memory is called swapping.

36.DEFINE PAGING IN MEMORY.


Ans: Paging is a memory management scheme which permits the physical address of a
process to be non-contiguous.
37.WHAT IS PAGE BREAK? EXPLAIN.
Ans: If the size of the program is less than the total size of pages allocated to it, the last
allocated page is partially used. The remaining bytes of the last page is wasted. This type of
memory wastage inside a page is called page fragmentation or page break.
38.EXPLAIN THE TERMS SWAP IN AND SWAP OUT.
Ans: Swap in refers to the data loaded into the main memory from the secondary memory
Swap out refers to the data moved / unloaded from the main memory to the secondary
memory

39. DEFINE THRASHING.

Ans: Suppose the number of frames allocated is not sufficient to hold the pages, the process
will quickly page fault. Next it must replace some page. Since all the pages of the process are
active, it must replace a page which is in current use. As a result, it quickly faults again, and
again and again. Thus the process continues to fault, replacing pages, for which it faults and
brings it back immediately.

This process of high paging activity is called Thrashing.

40. LIST DIFFERENT TYPES OF FILES.


Ans: A text file consists of lines or pages, which are sequences of characters.
An object file contains a sequence of bytes forming blocks used by the linker.
A source file consists of subroutines and functions which contain declaration followed by
executable statements.
41. WHAT IS DISK FORMATTING?
Ans: An unformatted blank magnetic disk is just a disk made of magnetic recording material.
To store data on disk, it must be divided into tracks and sectors. This process is known as
disk formatting or low level formatting or physical formatting.

42. MENTION ANY FOUR ATTRIBUTES OF FILE.


Ans: i. NAME
ii. IDENTIFIER
iii. TYPE
iv. LOCATION
v. SIZE
43. WHAT IS A BIT VECTOR?
Ans: The list of free disk space is implemented as a bit map or bit vector. Every block is
represented by 1 bit. When the block is free, the bit is 0, and when the block is allocated, the
bit is 1 or vice versa.
44. DEFINE SEEK TIME?
Ans: It is the time required for the disk arm to move the heads to the cylinder containing the
desired track.
45. MENTION ANY FOUR FILE OPERATIONS.
Ans: i. Creating a file
ii. Writing a file
iii. Reading a file
iv. Deleting a file

46. WHAT IS THE DIFFERNCE BETWEEN ABSOLUTE PATH AND RELATIVE PATH
NAME?
Ans: Absolute path, also referred to as file path or full path, refers to a specific location in the
file system, irrespective of the current working directory. It is the location of a file or
directory in a computer which contain the root directory and the complete directory list that is
required to locate the file or directory.
A relative path, on the contrary, refers to the location of a directory using current directory as
a reference, which avoids the need to specify the full absolute path. Thus, a relative path is
also called as a non-absolute path.
47. EXPLAIN CONTIGUOUS MEMORY MANAGEMENT TECHNIQUES.
Ans: Contiguous memory allocation is one of the oldest memory allocation schemes. When a
process needs to execute, memory is requested by the process. The size of the process is
compared with the amount of contiguous main memory available to execute the process. If
sufficient contiguous memory is found, the process is allocated memory to start its execution.
The contiguous memory allocation scheme can be implemented in operating systems with the
help of two registers, known as the base and limit registers.
48.WHAT IS A FILE?
Ans: File provides a mechanism for online storage and access to both data and programs for
the operating system and all the users of the computer system.
49.WHAT ARE THE VARIOUS FILE ACCESS METHODS.
Ans: i. Sequential access
ii. Direct access
iii. Sequential direct access
50. LIST THE FUNCTIONS OF FILE MANAGEMENT SYSTEM.
Ans: i. To provide storage of data
ii. Keeping track of all files in a system.
51.DEFINE TRACK.
Ans: Each disk surface is divided into concentric circles called tracks.
52. DEFINE ENCRYPTION.
Ans: Encryption is the conversion of plain text or data into unintelligible form by means of a
reversible mathematical computation.

53. WHAT IS WORM?


Ans: A worm is a process that uses reproduction mechanism to ravage the computer
performance. Worm uses some sort of network vehicles such as E-mail etc.
54. WRITE ANY TWO ANTIVIRUS SOFTWARES.
Ans: i. AVAST
ii. AVG ANTIVIRUS
55. WHAT IS AN ACCESS MATRIX?
Ans: Access matrix is an abstract security model of protection in compute systems, which
keeps track of which object belongs to which domain. The rows of the access matrix
represent domains and the column s represent the object. Each entry in the matrix consists of
a set of access rights.
56.WHAT IS PROTECTION?
Ans: Protection refers to a mechanism for controlling the access of programs, processes or
users to the resources defined by a computer system.
57.WHAT IS VIRUS?
Ans: Viruses are self-replicated and are designed to infect other programs.
58. WHAT IS RICH TEXT FORMAT?
Ans: To prevent attack from macro viruses, exchange word documents in a file format called
rich text format.
59.WHAT IS ZOMBIE?
Ans: A zombie is a program that secretly takes over another internet-attached computer and
then uses that computer to launch attacks.
SECTION B(5 MARKS)

1. EXPLAIN SPOOLING WITH A DIAGRAM.


Ans: Spooling is a process in which data is temporarily held to be used and executed by a
device, program or the system.
Data is sent and stored in memory or other volatile storage until the process or computer
requests it for execution

Advantages:
i. It overlaps I/O jobs with the computation of other jobs
ii. It can be used to process data at remote sites
iii. It increases the performance of the system.

2. Explain multiprogramming system. Mention its advantages

Ans: The multiprogramming operating system can execute several jobs concurrently by
switching the attention of the CPU back and forth among them.

The primary reason multiprogramming operating system was developed and the reason they
are popular, is that they enable the CPU to be utilized more efficiently.

Advantages of multiprogramming operating system:

It increases CPU utilization


It decreases total read time needed to execute a job
Management of several jobs at a time
Increased throughput
It has shorter response time
3. EXPLAIN TIME SHARING SYSTEM.
Ans: TIME SHARING OPERATING SYSTEM
Time sharing is a technique which enables many people, located at various terminals to use a
particular computer resources at the same time. Processor’s time which is shared among
multiple users simultaneously is termed as time sharing.
Its objective is to minimize response time.
Advantages:
 Reduces CPU idle time
 Provides the advantage of quick response
Disadvantage:
 Problem of reliability

4. WHAT IS SYSTEM CALL? EXPLAIN THE TYPES OF SYSTEM CALLS.


Ans:
Operating system provide the service requested by the user by system calls which act as an
interface between the process and the operating system .System calls are generally available
as assembly language instructions listed in user manual.
Types of system calls are:
Process management:
 the system calls for process management
 end, abort a process
 load, execute a process
 create, terminate a process

File management:
 Create file, delete a file
 Open, close a file
 Read, write, reposition on file
 Get a file attributes, set file attributes

Device management:
 Request device, release device
 Read, write, reposition
 Get the device attributes, set device attributes
 Logically attach, detach devices
Information maintenance:
 Get time/date, set time/date
 Get system data, set system data
 Set process, file or device attributes
 Get process, file or device attributes

Communication Management
 Create, delete connection
 Send receive message
 Attach, detach remote devices
 Transfer status information
5. EXPLAIN DIFFERENT PROCESS STATES WITH A NEAT DIAGRAM.
Ans:
 New state: first the process is being created and it is loaded from secondary
storage device to main memory.
 Running state: instructions are being executed.
 Waiting state: the process is waiting for some event to occur such as an i/o
completion
 Ready state: the process is waiting to be allocated to a processor. The process
generally Comes to this state immediately after it is created.
 Terminated: A process terminates when it is finishes execution.

6. What is an operating system? Give four functions of OS.

Ans: An operating system is system software that manages the computer hardware. It acts as an
interface between a user and the hardware of a computer.

Functions of OS:
 User interface: All operating systems provide either command line interface or
graphical user interface (GUI)
 Program execution: The operating system must be able to load a program into
memory or run the program
 I/O operation: A running program may require I/O from a file or I/O device. The OS
provides an interface to perform I/O operations.
 Error detection: OS needs to be constantly aware of errors like power failure, memory
error etc.
 Accounting: It keeps track of resources used by different users.

7. What is multiprogramming? Difference between multiprogramming, multiprocessing and


distributed processing.

Ans: Multiprogramming is the rapid switching of CPU between multiple processes in memory. It
organizes job in such way that CPU always have atleast one job to execute. As there is only
one processor, different programs cannot be executed simultaneously.

Multiprocessing Multiprogramming Distributed


. It refers to processing . It keeps several programs in . A distributed operating
of multiple processes at main memory at the same time system connects multiple
same time by multiple and execute them concurrently independent computers via
CPU’s utilizing single CPU network to perform tasks
similar to a single computer.
. It utilizes multiple . It uses single CPU and context . Processors have their own
CPU’s and permits switching takes place local memory and they don’t
parallel processing share memory or clock

8. Explain Process control Block (PCB).


Ans: Information associated with each process is called as process control block.
It is also called as TASK CONTROL BLOCK.
Process state
Process number
Program counter
Registers
Memory limits
List of open files
………..

Process state: The state may be new, ready, running, waiting and so on.
Program Counter: It holds the address of the next instruction to be executed for that process.
CPU Registers: The registers vary in number and type, depending on the computer
architecture. They include accumulators, index registers.
CPU Scheduling information: This information includes a process priority and other
scheduling parameters.
Accounting Information: This information may include the amount of CPU and real time used.
I/O status information: This information includes the list of I/O device allocated to the
process and so on.

9. Explain dining philosopher problem using semaphore


In dining philosopher problem a philosopher has to pick up only one chopstick at a time.
When a hungry philosopher has both chopsticks at the same time, he eats without releasing
his chopsticks when he has finished eating he puts down both the chopsticks and start
thinking again.
But when all the philosophers try to pick up the chopsticks at the same time starvation might
occur independently of deadlock as no philosopher is unable to acquire both the forks.
Solution to the dinning –philosopher problem using semaphores
One simple solution is to represent each chopstick by a semaphore.
Each philosopher picks up, first the fork on the left and then the fork on the right by
executing a wait() operation on that semaphore
After eating the philosopher releases his chopsticks executing a signal() operation on the
appropriate semaphores.
Thus the shared data are:
Semaphore chopstick[s]
Where all the elements of chopstick are initialized to 1
The structure of the philosopher I is as follows:
Do{
Wait(chopstick[i]);
Wait(chopstick[(i+1)%s]);
Eat();
Signal(chopstick[i]);
Signal(chopstick[(i+1)%s)]
Think();
}while(TRUE);

10. Explain resource allocation graph.


Ans: i. Deadlocks can be described more precisely in terms of directed graph is called a
system resource allocation graph.
ii. This graph consist of set of vertices V and a set of edges E.
iii. The set of vertices V is partitioned into two types
iv. P={P1,P2………..Pn} the set of all active processes in the system and
R={R1,R2……..Rn} the set consisting of all resource types of the system.
v. The directed edge from process Pi to resource type Rj denoted by PiRj signifies that
process Pi as requested and instance of resource type Rj and is currently waiting for that
resource.
This edge is called a request edge.
vi. A directed edge from resource type Rj to process Pi denoted by RjPi signifies that an
instance of resource type Rj has been allocated to process Pi and it is called an assignment
edge.
If there is a cycle in the Resource Allocation Graph and each resource in the cycle provides
only one instance, then the processes will be in deadlock. For example, if process P1 holds
resource R1, process P2 holds resource R2 and process P1 is waiting for R2 and process P2 is
waiting for R1, then process P1 and process P2 will be in deadlock.

11. Explain the critical section problem and requirements of a critical section problem.

Ans: Each process has a section of code, called a critical section in which the process may be
changing common variables, updating a table, writing a file and so on. The important feature
of the system is that when one process is executing its critical section, no other process is to
be allowed to execute in its critical section. Thus the execution of critical sections by process
is mutually exclusive in time.

Requirements of critical section problem:

 Mutual exclusion : If process Pi is executing in its critical section, then no other


processes can be executing in their critical sections one process should execute in its
critical section at a time.
 Progress: If no process is executing its critical section and some processes wish to
enter their critical section, then only those processes that are not executing in their
remainder section can participate in the decision on which will enter its critical
section next, and this selection cannot be postponed indefinitely.
 Bounded waiting: There exists a bound, or limit on number of times that other
processes are allowed to enter their critical section after a process has made a request
to enter its critical section and before that request is granted. So after the limit is
reached, system must grant process the permission to enter into its critical section.
12. WHAT IS SEMAPHORE? EXPLAIN DIFFERENT TYPES OF SEMAPHORE.
Ans:
A semaphore is a process synchronization tool that represents data structures used by the
operating system kernel to synchronize processes. In the other word semaphore is an integer
variable with non -negative values which can be accessed only through two standard atomic
operations: wait() and signal().
wait(S):the wait() operation was originally termed P . It decrements the semaphore value.
Signal(S):the signal() operation increments the value of its semaphore S.
Types of semaphore
There are 2 types
 Binary semaphore
 Counting semaphore
Binary semaphore: binary semaphore is a semaphore which can be take only values of 0 and
1. It is also known as mutex locks, since they provide mutual exclusion.
Do{
Wait(mutex);
//Critical section;
Signal(mutex);
//Remainder section;
}
While (TRUE);
Counting semaphore: counting semaphore is a semaphore whose value can range over an
unrestricted domain. It can be used to control access to a given resource containing a finite
number of instances.
13.EXPLAIN BANKER’S ALGORITHM.
The resource-allocation graph algorithm can be applied only to a system with single instance
of each resource type. Banker’s algorithm is a resource allocation and deadlock avoidance
algorithm developed by Edsger Dijkastra that is applicable to resource-allocation systems
with multiple instances of each resource type. It is modelled after the lending politics
employed in a banking system. The bank ensures that it allocates the available
cash(resources) to the customers in such a way that it satisfies the needs of all its customers.
When a process enters the system, it must declare the maximum number of instances of each
resource type that it may need. The system then determines whether the allocation of these
resources will leave the system in a safe state. If it will, the resources are allocated, otherwise
the process must wait until some other process releases enough resources.
1. data structures for banker’s algorithm :for implementing banker’s algorithm, several data
structures are required.
2 .safety algorithm: the safety algorithm checks to see whether the system is in a safe state or
not.
3 .resource-request algorithm: this algorithm determines whether the requests can be granted
or not.

14. WRITE A NOTE ON FRAGMENTATION .


Fragmentation occurs in a dynamic memory allocation system when many of the free blocks
are too small to satisfy any request .The different type of fragmentation are:
1.External fragmentation
2.Internal fragmentation
1.EXTERNAL FRAGMENTATION:
*In the case of multi-partitioned allocation as the process are loaded and removed from the
memory ,the free space gets divided into little pieces ,in some situation even though there is
enough total memory space to allocate for the process ,the available space is not contigious
i.e , the storage space is fragmented into a number of small holes .
* In extreme cases there may be a block of free memory between every two processes. If all
the small holes could be combined into one big free block, it would accommodate several
more processes. Therefore wastage of memory between partitions, due to scattering of free
space into a number of discontiguous areas, is known as External Fragmentation.
* Depending on the total size of memory and average size of a program, external
fragmentation may either be a minor or major problem.
* The selection of first-fit or best-fit algorithm can affect the amount of fragmentation. For
example statistical analysis of first fit algorithm shows that for N blocks of allocated
memory, another 0.5N will be lost to fragmentation.

15. EXPLAIN THE TERMS FIRST-FIT, BEST-FIT AND WORST-FIT .


Ans:
The fixed-size partition methods leads to dynamic storage allocation problem, which deals
with how to allocate an available block of memory to a waiting process. There are many
solutions to this problem.
First-fit: allocate the first hole that is big enough to hold the process. Searching can start
either at the beginning of the set of holes or where the previous first-fit search ended.
Searching is stopped as soon as a free block of memory large enough is found.
Best-fit: allocate the smallest hole that is being enough. Entire list must be searched, unless
the list is ordered by size. Produces the smallest leftover hole.
Worst-fit: allocate the largest hole; must also search entire list. Produces the largest leftover
hole.
16. EXPLAIN LRU PAGE REPLACEMENT ALGORITHM .
Ans: If the optimal algorithm is not feasible, an approximation of the optimal algorithm is
possible. The key distinction between the FIFO algorithm uses the time when a page was
brought into memory, whereas the optimal algorithm uses the time when a page is to be used.
This algorithm associates with each page the time of that page’s late use. lRU chooses the
page that has not been used for the longest period of time.
Example:
 In the example, the first 3 faults are the same as those for optimal replacement.
 Next reference to page 2 replaces 7 as it is least recently used.
 Next reference to page 0 does not need replacement
 Next reference to page 3 replaces 1 which is least recently used from(2,0,1)
 When the reference to page4 occurs, LRU sees that of the three frames in memory,
page 2 was used least recently. Thus LRU replaces page 2 not knowing that page 2 is
about to be used.
 When it faults for page 2, it replaces page 3 as it is recently used.
 It results in 12 page faults.

17. EXPLAIN VARIOUS FILE ACCESSING METHOD


File stores information that must be accessed and real into the computer memory. The
information stored in the file can be accessed in different types .They are :
1.sequential access
2.Direct access
3.Index access

1.SEQUENTIAL FILE ACCESS:


The simplest access method is the sequential access. Information in the file processes order
one record after other.
*A real option read next reads the next record of the file is the processes file pointer tracks
the I/O location.
* the writer option-write next-appends the record to end of the file and advances to the file
operation to the end of the newly written record.
*sequential file can only be reset to the beginning of the file.
*sequential files are typically used in batch processing and payroll applications.
For eg consider a file consisting of 100 records , assume that the current position of the next
write head is as 45 record, suppose we want to read the 75 record then all the records from
th th

45,46,47……,73,74,75 must be accessed sequentially.


DIRECT METHOD
Direct access method is also called as relative access .it is based on a disk model of a file,
because disk allows random access to any file block .
In this model the file is viewed as a number sequential of blocks or records .
Direct access method does not impose any restriction in order of reading and writing records,
records are read and written randomly. For example we may read block 14,these read block
53 and write block 7.
The block number provided by the user to the operating system is a relative block number is
an index relative to the beginning of the file .
The first relative block of the file is numbered as 0,the next is 1 and as soon.
INDEX METHOD
In this method, data is organized into records that are stored in data files.
Then an index is constructed for the file. The index contains pointers to the various records.
The index makes it possible to retrieve records quickly without having to search an entire
data set.
To find a record in the file, we first search the index, and then use the pointers to find the
desired record.
With large files, the file may become too large to be kept in memory.
One solution is to create an index for the index file. The primary index file would contain
pointers to secondary index files, which would then point to the actual data items.

18. Describe the frame allocation algorithm.

Ans: There are two techniques for allocation of frames to user process.

They are:

i. Equal allocation: The easiest way to split m frames among n processes is to give everyone
an equal share, m/n frames. This scheme is called equal allocation.
For example: If there are 93 frames and five processes, each process will get around 18
frames. The leftover three frames can be used as a free-frame buffer pool.

ii. Proportional allocation: An alternative method is to recognize the fact that different
processes will need differing amounts of memory. For example, consider a system with a
1KB frame size. If a small process of 10KB and an interactive database of 127KB are the
only 2 processes running in a system with 62frames, it does not make much sense to give
each process 31 frames. The smaller process does not need more than 10 frames, so the other
21 frames are wasted.

To solve this problem, proportional allocation can be used, in which we allocate available
memory to each process according to its size.

Let the size of the virtual memory for process p be s and define
i i

S=∑si

Then, if the total number of available frames is m, we allocate ai frames to process p , where
i

ai is approximately,
ai=si/S*m
a must be adjusted to an integer that is greater than the minimum number of frames required
i

by the instruction set, with a sum not exceeding m.

19. WHAT IS VIRUS? EXPLAIN DIFFERENT TYPES OF VIRUES .


Ans:
A virus is a program that can infect other programs by modifying them. The modification
includes a copy of the virus program, which then goes on to infect other programs.
A virus is a fragment of code embedded in a legitimate program. It carries the code for
making perfect copies of itself. Once a virus reaches the host computer, a program called
virus dropper inserts the virus onto the system. The virus dropper is usually a Trojan horse
used to install the virus may do any one of a number of things.
Types of virus are:
*File virus(parasitic virus):
A parasitic virus attaches itself to executable files and replicates, when the infected program
is executed, by finding other executable files to infect.
*Boot virus:
A boot sector virus infects a master boot record or boot record and spreads when a system is
booted from disk containing the virus.
*Macro virus:
Most of the virus programs are written in low-level language such as C or assembly language,
this virus gets triggered when a program which uses a macro is run.
*Source code virus:
A source code virus generally searches for source code and modifies it to include the virus
and spread the virus.
*Polymorphic virus:
The polymorphic virus changes with every infection or installation to avoid detection by an
antivirus software.
*stealth virus:
It avoids the detection by modifying parts of the system that could be used to detect it.
*encrypted virus:
An encrypted virus includes decryption code along with the encrypted virus to avoid
detection.
*tunnelling virus:
The tunnelling virus avoids detection by installing itself in the interrupt-handler chain.
*Multipartite virus:
This virus multiple parts of a system such as the boot sector, memory and files and is difficult
to detect and cure.

20. List any three goals of protection.

Ans: We need to provide protection for several reasons. The most common goals are as
follows:
 To prevent mischievous, intentional violation of access restriction by a user.
 To ensure that each program component active in the system uses resources only in
the ways consistent with stated policies.
 To improve reliability by detecting errors at the interfaces between component
subsystems. Early detection of errors can prevent contamination of a healthy
subsystem by a malfunctioning subsystem.
 To provide a mechanism to enforce the policies governing the usage of resources.
 To guard resources created and supported by an application programmer against
misuse.
21. UNIX system process scheduling algorithm
Ans: Linux has two separate process- scheduling algorithms.
One is time-sharing algorithm for fair, pre-emptive scheduling among multiple
processes
The second algorithm is designed for real-time tasks, where priorities of tasks are more
important than fairness.

The LINUX scheduler is a pre-emptive, priority based algorithm with two separate
priority ranges:
A real-time ranges from 0 to 99 and a nice value ranging from 100 to 140.
These ranges map into a global priority scheme whereby numerically lower values
indicate higher priorities. The peculiarity of LINUX is it assigns higher priority tasks
longer time quantum and vice versa.
The relationship between priorities and time-slice length is shown in fig.

SECTION C
1. Explain time sharing and real time operating system.
Ans:
TIME SHARING OPERATING SYSTEM

Time sharing is a technique which enables many people, located at various terminals to use a
particular computer resources at the same time. Processor’s time which is shared among
multiple users simultaneously is termed as time sharing.
Its objective is to minimize response time.
Advantages:
 Reduces CPU idle time
 Provides the advantage of quick response
Disadvantage:
 Problem of reliability

REAL TIME OPERATING SYSTEM:


Real-time processing is the execution of data in a short time period. It is a data processing
that occurs as the user enters in the data or command.
Advantage:
 Real time processing provides immediate responses to the user queries.
Disadvantage:
 Real time processing is very complex as well as expensive processing.

2. Explain various services offered by an operating system.


Ans: Services of an operating system are:
 User interface: All operating systems provide either command line interface or
graphical user interface (GUI)
 Program execution: The operating system must be able to load a program into
memory or run the program
 I/O operation: A running program may require I/O from a file or I/O device. The OS
provides an interface to perform I/O operations.
 Error detection: OS needs to be constantly aware of errors like power failure, memory
error etc.
 Accounting: It keeps track of resources used by different users.
 Resource management: When there are multiple users or multiple jobs running at the
same time, OS must allocate resources to requested processors based on priority.
 Protection and security: Protection involves in ensuring that all access to the system
are controlled. Security ensures that, unauthorized access is restricted.

3. EXPLAIN DIFFERENT TYPES OF SCHEDULERS


A process migrates among the various scheduling queues throughout its lifetime. The OS
must select for scheduling purposes, processes from these queues in some manner. The
selection process from the queues in some manner. The selection process is carried out by an
scheduler.
There are 3 types of scheduler:
*Long term scheduler- it is also called a job scheduler. A long term determine which
programs are admitted to the system for processing. It selects the process from the queue and
loads them into memory for execution.
*Short term scheduler-it is also called as CPU scheduler. Its main objective is to increase
system performance. It is the change of ready state to running state of the process. CPU
scheduler selects a process among the process that are ready to execute and allocates CPU to
one of them.
*Medium term scheduler: medium term is a part of swapping. It removes the process from
the memory. The medium-term scheduler is in-charge of handling swapped-out process. The
suspended process is moved to the secondary storage. This is called swapping.

4. Define, compare and contrast each of the following terms:

a. Batch processing

b. Time sharing

c. Real time processing

Ans: Batch processing

Batch processing is a technique in which an OS collects the programs and data together in a
batch before processing starts. The OS keeps a number of jobs in memory and executes them
without any manual information. Jobs are processed in the order of submission i.e First come
first served.

Advantage:

i. Increased performance as a new job get started as soon as the previous job is finished.

Disadvantage:

i. Due to lack of protection, one batch job can affect pending jobs.

Time sharing
Time sharing is a technique which enables many people, located at various terminals to use a
particular computer resources at the same time. Processor’s time which is shared among
multiple users simultaneously is termed as time-sharing. Its objective is to minimize response
time.

Advantage:

i. Reduces CPU idle time

ii. Provides the advantage of quick response

Disadvantage:

i. Problem of reliability

Real-time processing

Real-time processing is the execution of data in a short time period. It is a data processing
that occurs as the user enters in the data or a command .

Advantage:

i. Real time processing provides immediate responses to user queries.

Disadvantage:

i. Real-time processing is very complex as well as expensive processing.

5.EXPLAIN DIFFERENT PROCESS STATES WITH A NEAT DIAGRAM.


Ans:
 New state: first the process is being created and it is loaded from secondary
storage device to main memory.
 Running state: instructions are being executed.
 Waiting state: the process is waiting for some event to occur such as an i/o
completion
 Ready state: the process is waiting to be allocated to a processor. The process
generally Comes to this state immediately after it is created.
 Terminated: A process terminates when it is finishes execution.
6. Consider the following processes with their CPU burst time in milliseconds.
PROCESS CPU BURST
P1 10
P2 1
P3 2
P4 10
P5 5

The processes arrive in the order P1,P2, P3,P4,P5. Draw the Gantt chart illustrating the execution
of these processes using FCFS.
Calculate
1. Average waiting time
2. Average turnaround time
Ans: Gantt Chart
P1 P2 P3 P4 P5
0 10 11 13 23 28

Average waiting time:


Waiting time for
P1=0
P2=10
P3=11
P4=13
P5=23
= 0+10+11+13+23/5
=11.4 m/s
Average turnaround time
The turnaround time for
P1=10
P2=11
P3=13
P4=23
P5=28
= 10+11+13+23+28/5
=17m/s
7. WHAT IS SEMAPHORE? EXPLAIN DIFFERENT TYPES OF SEMAPHORE.
Ans:
A semaphore is a process synchronization tool that represents data structures used by the
operating system kernel to synchronize processes. In the other word semaphore is an integer
variable with non -negative values which can be accessed only through two standard atomic
operations: wait() and signal().
wait(S):the wait() operation was originally termed P . It decrements the semaphore value.
Signal(S):the signal() operation increments the value of its semaphore S.
Types of semaphore
There are 2 types
 Binary semaphore
 Counting semaphore
Binary semaphore: binary semaphore is a semaphore which can be take only values of 0 and
1. It is also known as mutex locks, since they provide mutual exclusion.
Do{
Wait(mutex);
//Critical section;
Signal(mutex);
//Remainder section;
}
While (TRUE);
Counting semaphore: counting semaphore is a semaphore whose value can range over an
unrestricted domain. It can be used to control access to a given resource containing a finite
number of instances.
8. Explain different methods of deadlock prevention.
Ans: mutual exclusion:
 To eliminate mutual exclusion, allow everybody to use the resource
immediately.
 The mutual exclusion condition must hold for non-sharable resources. For
example several processes cannot concurrently share a pointer.
 In general, dead locks cannot be prevented by denying mutual exclusion
condition because some resources are intrinsically non-sharable.
Hold and wait:
 To prevent hold and wait, ensure that when a process requests resources, it
does not hold any other resources.
 One protocol that can be used requires each process to request and be
allocated all its resources before it begins execution.
 An alternative protocol allows a process to request resources only when the
process has none. A process may request some resources and use them, but
before it requests any additional resources, it must release all the resources
that it is currently allocated to it.
9. Explain FCFS and round robin scheduling with example.
Ans: First –come, first-serve scheduling:
 FCFS scheduling algorithm is the simplest CPU scheduling algorithm. The
process that requests the CPU first is allocated the CPU first.
 The implementation of FCFCS policy is easily managed with a FIFO queue.
When a process enters the ready queue, its PCB is linked onto tail of the
queue. When the CPU is free, it is allocated to the process at the head of the
queue. The running process is then removed from the queue.
 Processes are dispatched according to their arrival time on the ready queue.
Requests are scheduled in the order in which they arrive in the system.
 The FCFS algorithm is non-premptive.
 Once the CPU has been allocated to a process, that process keeps the CPU
until it releases the CPU, either by termination or by requesting I/O.
Example:

Process Burst
time
8888 P1 8
4 P2 4
1 P3 1

P1 P2 P3

0 8 12 13
Round Robin scheduling
 The RR scheduling algorithm is designed especially for timesharing systems. It is
similar to FCFS scheduling but pre-emption is added.
 Each and every process gets a small unit of CPU time called a time quantum or time
slice, which is usually 10-100 ms.
 The ready queue is treated as a circular queue. The CPU scheduler goes around the
ready queue allocating CPU to each process for a time interval of up to 1 time
quantum. After the time elapses, the process is automatically pre-empted by the
operating system and added at the tail of the ready queue.

Example;
process Burst time

P1 25

P2 3
P3 3

 P1 gets first 5 ms and then pre-empted.


 P2 next gets the CPU runs for 3 ms and quits before time.
 P3 next , is given the CPU and runs to completion.
 One each process has received 1 time-slice, the CPU is returned to process p1 for
addition time-slice. Thus robin-robin schedule is as shown

P1 P2 P3 P1 P1 P1 P1
0 5 8 11 16 21 26 31

10. EXPLAIN BANKER’S ALGORITHM.


Ans: The resource-allocation graph algorithm can be applied only to a system with single
instance of each resource type. Banker’s algorithm is a resource allocation and deadlock
avoidance algorithm developed by Edsger Dijkastra that is applicable to resource-allocation
systems with multiple instances of each resource type. It is modelled after the lending politics
employed in a banking system. The bank ensures that it allocates the available
cash(resources) to the customers in such a way that it satisfies the needs of all its customers.
When a process enters the system, it must declare the maximum number of instances of each
resource type that it may need. The system then determines whether the allocation of these
resources will leave the system in a safe state. If it will, the resources are allocated, otherwise
the process must wait until some other process releases enough resources.
1. data structures for banker’s algorithm :for implementing banker’s algorithm, several data
structures are required.
2 .safety algorithm: the safety algorithm checks to see whether the system is in a safe state or
not.
3 .resource-request algorithm: this algorithm determines whether the requests can be granted
or not

11. Explain dining philosopher problem using semaphore


In dining philosopher problem a philosopher has to pick up only one chopstick at a time.
When a hungry philosopher has both chopsticks at the same time, he eats without releasing
his chopsticks when he has finished eating he puts down both the chopsticks and start
thinking again.
 But when all the philosophers try to pick up the chopsticks at the same time
starvation might occur independently of deadlock as no philosopher is unable
to acquire both the forks.
 Solution to the dinning –philosopher problem using semaphores
 One simple solution is to represent each chopstick by a semaphore.
 Each philosopher picks up, first the fork on the left and then the fork on the
right by executing a wait() operation on that semaphore
 After eating the philosopher releases his chopsticks executing a signal()
operation on the appropriate semaphores.
 Thus the shared data are:
 Semaphore chopstick[s]
 Where all the elements of chopstick are initialized to 1
The structure of the philosopher I is as follows:
Do{
Wait(chopstick[i]);
Wait(chopstick[(i+1)%s]);
Eat();
Signal(chopstick[i]);
Signal(chopstick[(i+1)%s)]
Think();
}while(TRUE);

12.WHEN DO YOU RUN DEADLOCK DETECTION ALGORITHM? EXPLAIN WITH


AN EXAMPLE.
Ans: Deadlock Detection
1. If resources have single instance:
In this case for Deadlock detection we can run an algorithm to check for cycle in
the Resource Allocation Graph. Presence of cycle in the graph is the sufficient
condition for deadlock.

In the above diagram, resource 1 and resource 2 have single instances. There
is a cycle R1 → P1 → R2 → P2. So, Deadlock is Confirmed.
2. If there are multiple instances of resources:
Detection of the cycle is necessary but not sufficient condition for deadlock
detection, in this case, the system may or may not be in deadlock varies
according to different situations.
Deadlock Recovery
A traditional operating system such as Windows doesn’t deal with deadlock recovery
as it is time and space consuming process. Real-time operating systems use
Deadlock recovery.
Recovery method
1. Killing the process: killing all the process involved in the deadlock. Killing
process one by one. After killing each process check for deadlock again keep
repeating the process till system recover from deadlock.
2. Resource Pre-emption: Resources are pre-empted from the processes
involved in the deadlock, preempted resources are allocated to other processes
so that there is a possibility of recovering the system from deadlock. In this
case, the system goes into starvation.

13. Explain paging scheme.


Ans:
Paging is a memory management scheme which permits the physical address of the process
to be non-contiguous.
The logical memory is broken into blocks of the same size called pages. When a program is
executed its pages are loaded into any frames from the disk.

Advantages of paging scheme:


 Avoids external fragmentation and hence results in better memory utilization.
 Supports virtual memory
 Eliminates compaction overheads
 Very useful in time sharing systems.
Disadvantages of paging scheme:
 Suffers from page breaks resulting in internal fragmentation.
 Difficult to maintain page tables when the number of pages increases.
 Hardware cost is high
 It increases context switch time which slows down the CPU.

14. What is demand paging? Explain


Ans: DEMAND PAGING
 Demand paging is where pages are loaded only when they are needed.
 It is commonly used technique in virtual memory systems.
 With demand paged virtual memory, pages are only loaded when they are demanded
during program execution and hence the pages that are never accessed are never
loaded into physical memory.
 A demand-paging system is similar to a paging system with swapping where
processes reside in secondary memory.
 When a process has to be executed, it is swapped into memory.
 Rather than swapping the entire process into memory, a lazy swapper is used which
swaps a page into memory only when it is needed.

15. Differentiate between paging and segmentation .

Ans:
PAGING SEGMENTATION
i. Main memory is divided into fixed size i. Main memory is divided into variable sized
partitions called pages. partitions called segments.
ii. Pages are mapped directly to frames. ii. Segments with base address and limit are
mapped to main memory.
iii. Does not support user’s view of iii. Supports user’s view of memory
memory
iv. Does not support growing and iv. Supports dynamic growing and shrinking of
shrinking of pages segments
v. Suffers from internal fragmentation v. Suffers from external fragmentation

16. Write a note on segmentation .


Program is a collection of segments. A segmentation is a logical unit such as main program
,procedure, object ,local variable, global variable, common block, stack, symbol table or
arrays.
Segmentation is a memory management scheme that support user view of memory. Each
segments a different length. Elements is a segment are identified by their offset from the
beginning of the segment. For eg. the first statement in the main program,6 instruction in the
th

function ,etc.
Segments are formed at the time of program translation by grouping logically related entities
per segment .Formation of segments depend on the compiler. When a program is complied
,the complier automatically creates segment of the input program. A logical address space is a
collection of segments.
Each segment has a name and length. The components of a single segment reside in one
contigious . Different segments of the same process may occupy non contigious area of
physical memory.
To address specify both the segment name and offset within the segment .The user therefore
specifies each address by two quantities: a segment name and an offset.
17. WRITE A NOTE ON FRAGMENTATION .
Fragmentation occurs in a dynamic memory allocation system when many of the free blocks
are too small to satisfy any request .The different type of fragmentation are:
1.External fragmentation
2.Internal fragmentation
1.EXTERNAL FRAGMENTATION:
*In the case of multi-partitioned allocation as the process are loaded and removed from the
memory ,the free space gets divided into little pieces ,in some situation even though there is
enough total memory space to allocate for the process ,the available space is not contigious
i.e , the storage space is fragmented into a number of small holes .
* In extreme cases there may be a block of free memory between every two processes. If all
the small holes could be combined into one big free block, it would accommodate several
more processes. Therefore wastage of memory between partitions, due to scattering of free
space into a number of discontiguous areas, is known as External Fragmentation.
* Depending on the total size of memory and average size of a program, external
fragmentation may either be a minor or major problem.
* The selection of first-fit or best-fit algorithm can affect the amount of fragmentation. For
example statistical analysis of first fit algorithm shows that for N blocks of allocated
memory, another 0.5N will be lost to fragmentation.
18. Explain various method used to allocate space to files.
Ans: There are three methods of file allocation:
i. Contiguous allocation
ii. Linked allocation
iii. Indexed allocation

i. Contiguous Allocation:
a. Contiguous allocation requires that each file occupy a set of contiguous blocks on the disk.
The word contiguous means continuous
b. The seek time is minimal over here. Consequently, access time of a file and the I/O
performance is greatly improved.
c. To access a file, there we only need to know the starting location and length of the file
which are stored in the directory as shown in the figure.

Advantage:
ii. Contiguous allocation is easy to implement.
Disadvantage:
i. Each block of a file contains a pointer to the next block after it in the list.
ii . Linked Allocation:
With the linked allocation approach, disk blocks of a file are chained together with a linked-
list. The directory entry of a file contains a pointer to the first block and a pointer to the last
block.
To create a file, we create a new directory entry and the pointers are initialized to nil. When a
write occurs, a new disk block is allocated and chained to the end of the list.
a. This method solves the problems associated with contiguous allocation.
b. Here the blocks of a single file can be scattered anywhere on the disk. The reason because
the entire file is implemented as a Linked List.
c. Here every file is an element of Linked List (similar to concept of Linked List in Data
Structures).
d. The directory maintained by the OS contains a pointer to the first and the last blocks of a
file.
e. Each block of a file contains a pointer to the next block after it in the list.
Advantages include no external fragmentation, size of file need not be declared at start, a file
can grow as long as free blocks are available on disk.
Disadvantages: It works perfectly for Sequential access only, space needs to be allocated in
block for pointers.
iii .Indexed Allocation

 Provides solutions to problems of contiguous and linked allocation.


 A index block is created having all pointers to files.
 Each file has its own index block which stores the addresses of disk space occupied
by the file.
 Directory contains the addresses of index blocks of files.

19. Explain any two disk scheduling algorithm.

Ans:

FIRST COME FIRST SERVE (FCFS) SCHEDULING


 The simplest form of disk scheduling algorithm is first-come first-served algorithm
(FCFS)
 FCFS algorithm processes requests in the same order as they arrive into the system.
 In this method, operating system creates a queue which contains the sequence order in
which the request are to be executed
 The job which had requested first will executed first by the CPU and the jobs that are
entered later will be executed according their entering order.
 Even though the algorithm is intrinsically fair, it does not provide the fastest service.
The main drawback of FCFS algorithm is that it involves a lot of head movements,
thereby decreasing the disk throughput.
 This algorithm is used in the small systems where I/O efficiency is not very
important.
 Illustration shows total head movement of 640 cylinders

SHORTEST SEEK TIME FIRST(SSTF)

 SSTF is essentially a form of shortest-job first (SJF) scheduling.


 SSTF selects the request with the minimum seek time from current head position.
That is, all the requests close to the current head position is serviced first before
moving the head away to service other requests.
 SSTF chooses the requests from the disk queue closest to the current head position
irrespective of their order of arrival.
20. Explain any two page replacement algorithm with an example.

Ans: Optimal page replacement

This page replacement technique has the least page fault rate. The concept behind this
algorithm is that “replace the page that will not be used for a longest period of time”. Using
this page replacement algorithm guarantees the lowest possible page fault rate for a fixed
number of frames.

Example:

Consider the reference string:

7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1

7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7 7 7 2 2 2 2 2 2 2 2 2 2 2 2 2 2 7 7 7
0 0 0 0 0 0 4 4 4 0 0 0 0 0 0 0 0 0 0
1 1 1 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1

 The first three references cause faults that fill three empty frames.
 Reference to page 2 replaces page 7 because 7 will not be used until reference 18,
whereas page 0 will be used at 5, and page 1 at 14.
 Next reference to 0 does not fault.
 The reference to page 3 replaces page 1 as page 1 will be the last of three pages in
memory to be referenced again.
 This algorithm results in 9 page faults.
 Page fault can be calculated as:

Page fault rate = number of faults / number of bits in reference string


= 9/20*100 = 45%

LRU page replacement

 This algorithm associates with each page the time of that page’s last use. LRU
chooses the page that has not been used for the longest period of time. This stratergy
is similar to the optimal page replacement, except that LRU looks backward in time
whereas, OPT looks forward in time.

Example:
7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
7 7 7 2 2 2 2 4 4 4 0 0 0 1 1 1 1 1 1 1
0 0 0 0 0 0 0 0 3 3 3 3 3 3 0 0 0 0 0
1 1 3 3 3 3 2 2 2 2 2 2 2 2 2 7 7 7

 In the example, the first 3 faults(7,0,1) are the same as those for optimal replacement.
 Next reference to page 2 replaces 7 as it is least recently used
 Next reference to page 0 does not need replacement
 Next reference to page 3 replaces 1 which is least recently used from(2,0,1)
 When the reference to page 4 occurs, LRU sees that of the three frames in memory,
page 2 was used least recently. Thus LRU replaces page 2 not knowing that page 2 is
about to be used.
 When it faults for page 2, it replaces page 3 as it is recently used.
 It results in 12 page faults
Page fault rate = no of faults / no of bits in reference

= 12 / 20*100 = 60%

21. EXPLAIN VARIOUS FILE ACCESSING METHOD


File stores information that must be accessed and real into the computer memory. The
information stored in the file can be accessed in different types .They are :
1.sequential access
2.Direct access
3.Index access

SEQUENTIAL FILE ACCESS:


The simplest access method is the sequential access. Information in the file processes order
one record after other.
*A real option read next reads the next record of the file is the processes file pointer tracks
the I/O location.
* the writer option-write next-appends the record to end of the file and advances to the file
operation to the end of the newly written record.
*sequential file can only be reset to the beginning of the file.
*sequential files are typically used in batch processing and payroll applications.
For eg consider a file consisting of 100 records , assume that the current position of the next
write head is as 45 record, suppose we want to read the 75 record then all the records from
th th

45,46,47……,73,74,75 must be accessed sequentially.


DIRECT METHOD:
Direct access method is also called as relative access .it is based on a disk model of a file,
because disk allows random access to any file block .
In this model the file is viewed as a number sequential of blocks or records.
Direct access method does not impose any restriction in order of reading and writing records,
records are read and written randomly. For example we may read block 14,these read block
53 and write block 7.
The block number provided by the user to the operating system is a relative block number is
an index relative to the beginning of the file .
The first relative block of the file is numbered as 0,the next is 1 and as soon.
INDEX METHOD:
In this method, data is organized into records that are stored in data files.
Then an index is constructed for the file. The index contains pointers to the various records.
The index makes it possible to retrieve records quickly without having to search an entire
data set.
To find a record in the file, we first search the index, and then use the pointers to find the
desired record.
With large files, the file may become too large to be kept in memory.
One solution is to create an index for the index file. The primary index file would contain
pointers to secondary index files, which would then point to the actual data items.

22. Explain single level and two level directory.

Ans:

Single level directory

 The simplest directory structure where all files are stored in a single.
 In this all files are stored in the same directory.
 A single-level directory has significant limitations when the number of files increases
or when the system has more than one user.
 The files in the same directory must have unique names.
 Even a single user on a single-level directory finds it difficult to remember the file
names as the number of files increases.

Two-level directory

 Since a single level directory leads to confusion of file names among different users, a
better solution is to use a separate directory for each user.
 In this directory structure, each user will have his/her own directory(or use or file
directory UFD) whenever the user wants to access his files. First the root directory I
or the master file directory MFD is searched for the UFD of that user. Next the file to
be opened is searched only in her own UFD. Thus, different users can have same file
names, as long as all these file names are unique within that directory.

23. Explain any three disk scheduling algorithms with example


To performance of a computer system depends on how fast a disk I/O request is serviced. For
each I/O request, the read/write head is moved over the destination track. After that the disk
is rotated to perform the desired sector under the head and finally the I/O operation is
performed.
After one request is completed the operating system uses any one of the following disk
scheduling algorithms to decide which request has to be serviced next.
The different scheduling algorithms are:
1.FIRST COME FIRST SERVE SCHEDULING
2.SHORTEST SEEK TIME FIRST SCHEDULING
3.SCAN SCHEDULING
4.CIRCULAR SCAN SCHEDULING
5.LOOK SCHEDULING
6.CIRCULAR LOOK SCHEDULING

FIRST COME FIRST SERVE


 The simplest form of disk scheduling algorithm is first served algorithm
 FCFS algorithm process request in the same order as they arrived into the system.
 In this method operating system creates first by the CPU and the job that are entered
later will be executed according their entering order.
 The job which had request first will be executed first by the CPU and the jobs that are
entered later will be executed according their entering order.
 Even though the algorithm is intrinsically fair, it does not provide the fastest service.
The main drawback of FCFS algorithm is that it involves a lot of head movements,
thereby decreasing the disk throughput.
 This algorithm is used in the small system where 1/0 efficiency is not very important

SHORTEST SEEK TIME FIRST (SSTF) SCHEDULING


*SSTF is essentially a form of shortest-job first (SJF) scheduling .
* SSTF selects the request with the minimum seek time from the current head position. The
is, all the requests close to the current head position is serviced first before moving the head
away to service other requests .
* SSTF chooses the requests from the disk queue closest to the current head position
irrespective of their order of arrival.
Scan scheduling:
In the scan algorithm, the disk arm starts at one end of the disk, and moves towards the other
end, serving requests as it reaches each cylinder until it gets to the other end of the disk.
At the other end, the direction of head movement is reversed and servicing continues. The head
continuously scans back and forth across the disk.
The SCAN algorithm is also called the elevator algorithm, since the disk arm just like the
elevator in a building, first services all the requests going up and then reversing to service the
requests in the other direction.

24. WHAT IS VIRUS? EXPLAIN DIFFERENT TYPES OF VIRUES .


Ans:
A virus is a program that can infect other programs by modifying them. The modification
includes a copy of the virus program, which then goes on to infect other programs.
A virus is a fragment of code embedded in a legitimate program. It carries the code for
making perfect copies of itself. Once a virus reaches the host computer, a program called
virus dropper inserts the virus onto the system. The virus dropper is usually a Trojan horse
used to install the virus may do any one of a number of things.
Types of virus are:
*File virus(parasitic virus):
A parasitic virus attaches itself to executable files and replicates, when the infected program
is executed, by finding other executable files to infect.
*Boot virus:
A boot sector virus infects a master boot record or boot record and spreads when a system is
booted from disk containing the virus.
*Macro virus:
Most of the virus programs are written in low-level language such as C or assembly language,
this virus gets triggered when a program which uses a macro is run.
*Source code virus:
A source code virus generally searches for source code and modifies it to include the virus and
spread the virus.
*Polymorphic virus:
The polymorphic virus changes with every infection or installation to avoid detection by an
antivirus software.
*stealth virus:
It avoids the detection by modifying parts of the system that could be used to detect it.
*encrypted virus:
An encrypted virus includes decryption code along with the encrypted virus to avoid detection.
*tunnelling virus:
The tunnelling virus avoids detection by installing itself in the interrupt-handler chain.
*Multipartite virus:
This virus multiple parts of a system such as the boot sector, memory and files and is
difficult to detect and cure.

25. EXPLAIN USER AUTHENTICATION IN DETAIL


ANS: If a system cannot authenticate a user, then authenticating a message sent from that
user is pointless. A major security problem for operating system is user authentication. The
protection system depends on the ability to identify the programs and processes currently
executing, which in turn depends on the ability to identify each user of the system. Generally,
user authentication is based on one or more of three things:
 User’s possession of something like a key or a card
 User’s knowledge of something like a user identifier and password and or
 An attribute for the user like fingerprint, retina pattern or signature.

SECTION D
1. WRITE A SHORT NOTE ON OPERATING SYSTEM COMPONENTS.
Ans:
Process management: A process needs certain resources like CPU time, memory, files and
I/O devices. These resources are either given to the process when it is created or allocated
while it is running.
Main memory management: main memory is a large array of words or bytes. Each byte has
its own address. The CPU fetches instruction fetch cycle, then reads and writes data from
main memory during data fetch cycle.
File management: this is visible component of an operating system. A file is a collection of
related information defined by its creator. Files may be of free form or formatted.
Input-output system management: one of the purposes of an operating system is to hide the
peculiarities of specific hardware devices from the user.
Secondary storage management: the main memory is too small to accommodate all data and
programs, and its data are lost when power is lost, the computer system must provide
secondary storage to backup main memory.
Networking: A distributed system is a collection of processors that do not share memory,
peripheral devices or a clock. Each processor has its own memory and clock.
Protection system: if a computer system has multiple users and allows the concurrent
execution of multiple processes then the various processes must be protected from each
other’s activities.
Command interpreter system: command interpreter is the interface between the user and the
operating system. Many commands are given to the operating system by control statement.

2. WRITE A SHORT NOTE ON:


PRE-EMPTIVE AND NON-PREEMPTIVE SCHEDULING.

Ans: PRE-EMPTIVE

 The CPU can be taken away from a running process.


 Shorter jobs need not wait as longer jobs can be pre-empted for execution of shorter
jobs.
 Overheads are high due to storage of non-running programs in the main memory.
 Suitable for real time and interactive timesharing systems.
 Rescheduling is necessary.

NON PRE-EMPTIVE
 Once the CPU is given to a process, it cannot be taken away from that process
 Shorter jobs must wait for completion of longer jobs.
 Overheads are low
 Suitable for batch processing
 Scheduling is done once
 If an interrupt occurs, the process is terminated
 Jobs is completed according to the allocated time

3.WRITE A SHORT NOTE ON:


i. PCB [REPEATED IN NOV/DEC 2018]
Ans: Information associated with each process is called as process control block.
It is also called as TASK CONTROL BLOCK.
Process state
Process number
Program counter
Registers
Memory limits
List of open files
………..

Process state: The state may be new, ready, running, waiting and so on.
Program Counter: It holds the address of the next instruction to be executed for that process.
CPU Registers: The registers vary in number and type, depending on the computer architecture. They
include accumulators, index registers.
CPU Scheduling information: This information includes a process priority and other scheduling
parameters.
Accounting Information: This information may include the amount of CPU and real time used.
I/O status information: This information includes the list of I/O device allocated to the process and so
on.
ii. SEMAPHORE
Ans: A semaphore is a process synchronization tool that represents data structures used by
the operating system kernel to synchronize processes. In the other word semaphore is an
integer variable with non -negative values which can be accessed only through two standard
atomic operations: wait() and signal().
wait(S):the wait() operation was originally termed P . It decrements the semaphore value.
Signal(S):the signal() operation increments the value of its semaphore S.
Types of semaphore
There are 2 types
 Binary semaphore
 Counting semaphore
Binary semaphore: binary semaphore is a semaphore which can be take only values of 0 and
1. It is also known as mutex locks, since they provide mutual exclusion.
Do{
Wait(mutex);
//Critical section;
Signal(mutex);
//Remainder section;
}
While (TRUE);
Counting semaphore: counting semaphore is a semaphore whose value can range over an
unrestricted domain. It can be used to control access to a given resource containing a finite
number of instances.

iii. DINING-PHILOSOPHER PROBLEM [REPEATED IN NOV/DEC 2018]


 Ans: In dining philosopher problem a philosopher has to pick up only one
chopstick at a time. When a hungry philosopher has both chopsticks at the
same time, he eats without releasing his chopsticks when he has finished
eating he puts down both the chopsticks and start thinking again.
 But when all the philosophers try to pick up the chopsticks at the same time
starvation might occur independently of deadlock as no philosopher is unable
to acquire both the forks.
 Solution to the dinning –philosopher problem using semaphores
 One simple solution is to represent each chopstick by a semaphore.
 Each philosopher picks up, first the fork on the left and then the fork on the
right by executing a wait() operation on that semaphore
 After eating the philosopher releases his chopsticks executing a signal()
operation on the appropriate semaphores.
 Thus the shared data are:
 Semaphore chopstick[s]
 Where all the elements of chopstick are initialized to 1
The structure of the philosopher I is as follows:
Do{
Wait(chopstick[i]);
Wait(chopstick[(i+1)%s]);
Eat();
Signal(chopstick[i]);
Signal(chopstick[(i+1)%s)]
Think();
}while(TRUE);

4. WRITE A SHORT NOTE ON MULTI-LEVEL QUEUE SCHEDULING.


Ans: a.

A multilevel queue scheduling algorithm partitions the ready queues might be used for
foreground and background processes. The foreground queue may be scheduled by RR
algorithm and background queue may be scheduled by an FCFS algorithm.
Each queue has its own scheduling algorithm. For example, separate queues might be used
for foreground and background processes. The foreground queue may be scheduled by RR
algorithm and background queue may be scheduled an FCFS algorithm.
There must also be scheduling among the queues-
*One method is to assign time-slice to each, with which it can schedule the various
processes in its queue.
*another method is to execute the high priority queues first and then process the lower priority
queues.

5. WRITE A SHORT NOTE ON OVERLAYS [REPEATED IN NOV/DEC 2017]


Ans: Overlays means replacement of a block of stored instructions or data with another.
overlaying is a programming method that allows programs to be larger than the central
processing unit’s main memory.
An embedded system would normally use overlays because of the limitation of physical
memory, which is internal memory for a system-on-chip and the lack of virtual memory
facilities.
Advantages:
*require small amount of memory for working
*does not need any special support from the operating system.
*can be completely implemented by the user using simple file structures
Disadvantages:
i. Used in microcomputers and other systems which have limited physical memory and lack
hardware support for advanced techniques
ii. programming is quite complex

6. WRITE A SHORT NOTE ON SWAP SPACE MANAGEMENT

Ans: Swap space management

Swapping is the process of moving out processes temporarily out of the main memory when
it reaches critically low point in to main memory to the swap space (on to the disk). This is
done to free main memory. Modern computers combine swapping with virtual memory
techniques and swap pages, thereby merging the two concepts of swapping and paging.

Swap space management is a low level task of the OS. The main goal for the design and
implementation of swap space is to provide the best throughput for the virtual memory
system. However, swapping decreases system performance since disk access is much slower
than memory access.

Swap space use:

Swap space is used in various ways by different OS , depending on the memory management
algorithms in use, for instance

i. Some system that implements swapping may use swap space to hold an entire process
image, including the code and data
ii. Paging systems simply store pages that have been pushed out of the memory

7. WRITE A SHORT NOTE ON OPTIMAL PAGE REPLACEMENT TECHNIQUE


Ans: This page replacement technique has the least page fault rate. The concept behind this
algorithm is that replace that will not be used for the longest period of time. Using this page
replacement algorithm guarantees the lowest possible page fault rate for a fixed number of
frames.

 The first three references cause faults that fill three empty frames
 Reference to page2 replaces page 7 because 7 will not be used until reference
18, whereas page 0 will be used at 5, and page 1 at 14.
 Next reference to page 0 does not fault.
 The reference to page 3 replaces page1 as page 1 will be the last of the three
pages in memory to be referenced again.
 This algorithm results in 9 page faults.
 Page fault rate can be calculated as :
Page fault rate=number of faults/number of bits in reference string

8. WRITE A SHORT NOTE ON ANY FIVE OBJECTS OF WINDOWS EXECUTIVE


Ans: Object Manager:
Objects are entities that are generic set of interfaces manipulated by user mode programs used
to manage kernel-mode entities. Objects are instances of object types. The object type
defined data fields and implementation of virtual functions used for all objects.
Virtual memory manager:
It is that executive component that manages the virtual address space, physical memory
allocation and paging.
The VM manager in Windows uses a page-based management scheme with a pages size of
4KB on IA32-compatible(Intel Architecture) processor and 8KB on an IA64-compatible
processor.
Process Manager:
Process manager provides services for creating, deleting and using threads and processes,
threads and jobs.
The process manager is not involved in scheduling of processes.
I/O Manager:
The I/O manager is responsible for file systems, device drivers and network devices. It keeps
track of which device drivers, filter drivers, and file systems are loaded. It manages
the buffers for I/O requests.
Cache Manager:
In earlier OS, caching was done by the file system. Windows provide a centralized caching
facility. The caching manager works with the VM manager to provide cache services to all
components controlled by the I/O manager.

9. WRITE A SHORT NOTE ON SECURITY MECHANISM USED IN LINUX.


Ans: Security mechanism in LINUX:
The security concerns are divided into two groups:
i. Authentication
In this user can access the system only after providing that he has entry rights.
Authentication in LINUX is performed through the use of a publicly readable
password file. When a user logs in, the login program asks for a login name and a
password. It hashes the password and then looks in the password file, to see if the
hashes matches the one there. If the password is correct, the login program looks
in to see the name of the user’s preferred shell. The login program then uses setuid
and setgid to give itself the user’s UID and GID and opens the keyboard for
standard input, the screen for standard output, and the screen for standard error.
ii. Access control:
Access control is performed through the use of unique numeric identifiers. A user
identifier identifies a single user or a single set of access rights.
A group identifier identifies rights belonging to more than one user.
Linux performs access control by assigning objects a protection mask that
specifies which access modes- read, write or execute – are to be granted to
processes with the owner, group or universe access.

10. EXPLAIN THE LAYERED STRUCTURE OF WINDOWS OPERATING SYSTEM.


Ans:
WINDOWS ARCHITECTURE
The architecture is a layered system of modules as shown in the fig.
The main layers are the HAL, the kernel and the executive which run in protected mode.
A collection of subsystems and services run in the user mode.
The user subsystems are of two types:
i. Environmental subsystems emulate different operating systems.
ii. Protection subsystems provide security facilities.

The main advantage of this architecture is that interactions between modules are kept simple.

You might also like