Professional Documents
Culture Documents
22516-operating-system-sample-paper-merged
22516-operating-system-sample-paper-merged
Instructions:
(1) All questions are compulsory.
(2) Illustrate your answers with neat sketches wherever necessary.
(3) Figures to the right indicate full marks.
(4) Assume suitable data if necessary.
(5) Preferably, write the answers in sequential order.
1
c) Compare between short term and long term scheduler.(any four points)
d) Compare FCFS and SJF Scheduling algorithm with any four points.
e) Describe contiguous memory allocation done by Operating System with he help of
suitable example.
P1 0 7
P2 1 4
P3 2 9
P4 3 6
P5 4 8
b) Compare between bitmap and linked list free space management techniques.(any six
points)
c) Construct and explain directory structure of a file system in terms of single level, two
level and tree structure.
2
Scheme - I
Instructions:
(1) All questions are compulsory.
(2) Illustrate your answers with neat sketches wherever necessary.
(3) Figures to the right indicate full marks.
(4) Assume suitable data if necessary.
(5) Preferably, write the answers in sequential order.
3
Scheme - I
Instructions:
(1) All questions are compulsory.
(2) Illustrate your answers with neat sketches wherever necessary.
(3) Figures to the right indicate full marks.
(4) Assume suitable data if necessary.
(5) Preferably, write the answers in sequential order.
4
Sample question paper
Q Questions/ Answer Ma
u rk
e. s
a) Differentiate between Batch Operating System and Time shared Operating
System.
(any two points)
Sr. Batch Operating System Time shared Operating
No System
1 There is an operator which takes Each task is given some time to
similar jobs having same execute, so that all the tasks
requirement and group them into work smoothly
batches.
2 It is very difficult to guess or know Each task gets an equal
the time required by any job to opportunity
complete
b) State any four services of Operating System.
Here is a list of common services offered by an almost all operating systems:
• User Interface
• Program Execution
• File system manipulation
• Input / Output Operations
• Communication
• Resource Allocation
• Error Detection
• Accounting
• Security and protection
ii) Segmentation
ps
• User Mode:
The system is in user mode when the operating system is running a user
application such as handling a text editor. The transition from user mode to
kernel mode occurs when the application requests the help of operating
system or an interrupt or a system call occurs.
The mode bit is set to 1 in the user mode. It is changed from 1 to 0 when
switching from user mode to kernel mode.
• Kernel Mode
The system starts in kernel mode when it boots and after the operating
system is loaded, it executes applications in user mode. There are some
privileged instructions that can only be executed in kernel mode. These are
interrupt instructions, input output management etc. If the privileged
instructions are executed in user mode, it is illegal and a trap is generated.
The mode bit is set to 0 in the kernel mode. It is changed from 0 to 1 when
switching from kernel mode to user mode.
• All the processes that use the shared memory model need to make sure
that they are not writing to the same memory location.
• Shared memory model may create problems such as synchronization
and memory protection that need to be addressed.
Q. 12
3 M
a) Define PCB. List information contained in PCB and explain any two 4
M
Each process is represented as a process control block (PCB) in the operating
system. It contains
Information associated with specific process.
In general, a PCB may contain information regarding:
1. Process Number: Each process is identified by its process number, called
process identification
number (PID).
2. Priority: Each process is assigned a certain level of priority that
corresponds to the relative importance of the event that it services.
3. Process State: This information is about the current state of the process. I.e.
whether process is in
new, ready, running, waiting or terminated state.
4. Program Counter: This contains the address of the next instruction to be
executed for this process.
5. CPU Registers: CPU registers vary in number and type, depending upon the
computer architectures. These include index registers, stack pointers and
general purpose registers etc. When an interrupt occurred, information about
the current status of the old process is saved in registers along with the
program counters. This information is necessary to allow the process to be
continued correctly after the completion of an interrupted process.
6. CPU Scheduling Information: This information includes a process priority,
pointers to scheduling queues and any other scheduling parameters.
7. Memory Management Information: This information may include such
information as the value of base and limit registers, the page table or the
segment table depending upon the memory system used by operating system.
8. Accounting: This includes actual CPU time used in executing a process in
order to charge individual user for processor time.
9. I/O Status: It includes outstanding I/O request, allocated devices
information, pending operation and so on.
10. File Management: It includes information about all open files, access rights
etc.
b) Define deadlock and state the necessary conditions for deadlock..
A Deadlock is a situation where each of the computer process waits for a
resource which is being assigned to some another process. In this situation,
none of the process gets executed since the resource it needs, is held by some
other process which is also waiting for some other resource to be released.
Let us assume that there are three processes P1, P2 and P3. There are three
different resources R1, R2 and R3. R1 is assigned to P1, R2 is assigned to P2
and R3 is assigned to P3.
After some time, P1 demands for R1 which is being used by P2. P1 halts its
execution since it can't complete without R2. P2 also demands for R3 which is
being used by P3. P2 also stops its execution because it can't continue without
R3. P3 also demands for R1 which is being used by P1 therefore P3 also stops
its execution.
In this scenario, a cycle is being formed among the three processes. None of the
process is progressing and they are all waiting. The computer becomes
unresponsive since all the processes got blocked.
Swapping
Swapping is a concept in which we do swapping of a process from main
memory to secondary storage and vice-versa. The swapping of processes from
one memory to another is explained clearly in the diagram given below. It
clearly explains that how this swap in and swap out thing works. This is done
so that the memory which we get free through swapping can be used by other
processes.
Swapping affects the performance of the system, but it is helpful or beneficial
for the system when we want to run multiple processes in parallel. Due to this
reason, memory compaction technique is another name given to swapping.
linked Allocation:
In this method, each file occupies disk blocks scattered anywhere on the disk.
It is a linked list of allocated blocks.
When space has to be allocated to the file, any free block can be used from
the disk and system makes an entry in directory.
Directory entry for allocated file contains file name, a pointer to the first
allocated block and last allocated block of the file.
The file pointer is initialized to nil value to indicate empty file.
A write to a file, causes search of free block.
After getting free block data is written to the file and that block is linked to
the end of the file.
To read the file, read blocks by following the pointers from block to block
starting with block address specified in the directory entry.
For example, a file of five blocks starting with block 9 and continue with
block 16,then block 1,then block 10 an finally block 25.each allocated block
contains a pointer to the next block.
Indexed Allocation:
In this method, each file has its own index block.
This index block is an array of disk block addresses.
When a file is created, an index block and other disk blocks according to the
file size are allocated to that file.
Pointer to each allocated block is stored in the index block of that file.
Directory entry contains file name and address of index block.
When any block is allocated to the file, its address is updated in the index
block.
Any free disk block can be allocated to the file. Each ith entry in the index
block points to the ith block of the file. To find and read the ith block, we use
the pointer in the ith index block entry.
Q.
4
a) Compare between Windows and LINUX Operating System.(any four points)
Description LInux Windows
Linux can be freely
distributed,
downloaded freely,
distributed through
$119 - $199.99, $69 for
magazines, Books
Cost students, $99 to upgrade to
etc. There are priced
pro
versions for Linux
also, but they are
normally cheaper
than Windows.
Linux is developed
by Open Source
development i.e.
Development through sharing and
Developed and distributed
and collaboration of
by Microsoft.
Distribution code and features
through forums etc
and it is distributed
by various vendors.
Linux kernel is
developed by the
Manufacturer community. Linus Microsoft
Torvalds oversees
things.
Everyone. From
home users to
User developers and Everyone
computer
enthusiasts alike.
Linux can be
installed on a wide
variety of computer
hardware, ranging
from mobile phones, On PC's desktops, laptops,
Usage
tablet computers servers and some phones.
and video game
consoles, to
mainframes and
supercomputers.
Ext2, Ext3, Ext4, Jfs,
File system
ReiserFS, Xfs, Btrfs, FAT, FAT32, NTFS, exFAT
support
FAT, FAT32, NTFS
Windows uses a command
shell and each version of
BASH (Bourne Again
Windows has a single
SHell) is the Linux
command interpreter with
Text mode default shell. It can
dos-like commands,
interface support multiple
recently there is the
command
addition of the optional
interpreters.
PowerShell that uses more
Unix-like commands.
PowerPC: versions 1.0 - NT
4.0; DEC Alpha: versions 1.0
- NT 4.0; MIPS R4000:
Supported versions 1.0 - NT 4.0; IA-32:
All
platforms versions 1.0 - 8; IA-64:
version XP; x86-64:
versions XP - 8; ARM:
version RT;
b) Write any four system calls related to device management.
A process may need several resources for its execution. So system calls used
for asking permission from the kernel to use those resources are included in
this type.
c) Compare between short term and long term scheduler.(any four points)
BASIS FOR LONG-TERM SHORT-TERM
COMPARISON SCHEDULER SCHEDULER
d) Compare FCFS and SJF Scheduling algorithm with any four points.
• FCFS algorithm doesn't include any complex logic, it just puts the
process requests in a queue and executes it one by one.
• Hence, FCFS is pretty simple and easy to implement.
• Eventually, every process will get a chance to run, so starvation doesn't
occur.
• According to the definition, short processes are executed first and then
followed by longer processes.
• The throughput is increased because more processes can be executed in
less amount of time.
Task scheduler
Schedulers
Schedulers are special system software which handle process scheduling in
various ways. Their main task is to select the jobs to be submitted into the
system and to decide which process to run. Schedulers are of three types −
• Long-Term Scheduler
• Short-Term Scheduler
• Medium-Term Scheduler
User Management
To kill, or terminate a process first find out the process identifier number or
PID of the process to be killed, then pass the PID number to the kill command.
b. Ps 07121975
the ps command shows the running processes by the user running it within a
terminal window. To invoke ps simply type the following:
c. Sleep 05
waiting for 5 seconds
1 3 4 5 1 2 5 1 2 3 4 5 1 6 7 8 7 8 9 7 8 9 5 4 4 5 4 2
2
1 1 1 5 5 5 5 5 5 3 3 3 1 1 1 8 8 8 8 8 8 8 8 4 4 4 4 4
2 2 2
3 3 3 1 1 1 1 1 1 4 4 4 6 6 6 6 6 9 9 9 9 9 9 9 9 9 2
4 4 4 2 2 2 2 2 2 5 5 5 7 7 7 7 7 7 7 7 5 5 5 5 5 5
F F F F F F F F F F F F F F F F F
LRU
1 3 4 5 1 2 5 1 2 3 4 5 1 6 7 8 7 8 9 7 8 8 5 4 4 5 4 2
2
1 1 1 5 5 5 5 5 5 3 3 3 1 1 1 8 8 8 9 9 8 8 8 4 4 4 4 2
2 2 2
33 3 1 1 1 1 1 1 4 4 4 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
4 4 4 2 2 2 2 2 2 5 5 5 7 7 7 7 7 7 7 7 5 5 5 5 5 5
F F F F F F F F F F F F F F F F F F
No. of page fault:- 18
P1 P2 P3 P4 P5
0 7 11 20 26 34
This technique is used to implement the free space management. When the
free space is implemented as the bitmap or bit vector then each block of the
disk is represented by a bit. When the block is free its bit is set to 1 and when
the block is allocated the bit is set to 0. The main advantage of the bitmap is it
is relatively simple and efficient in finding the first free block and also the
consecutive free block in the disk. Many computers provide the bit
manipulation instruction which is used by the users.
For Example: Apple Macintosh operating system uses the bitmap method to
allocate the disk space.
Advantages:
Disadvantages:
For example: Consider a disk where blocks 2, 3, 4, 5, 8, 9, 10, 11, 12, 13, 17, 18,
25,26, and 27 are free and the rest of the blocks are allocated. The free-space
bitmap would be: 001111001111110001100000011100000
2. Linked list
This is another technique for free space management. In this linked list of all
the free block is maintained. In this, there is a head pointer which points the
first free block of the list which is kept in a special location on the disk. This
block contains the pointer to the next block and the next block contain the
pointer of another next and this process is repeated. By using this disk it is not
easy to search the free list. This technique is not sufficient to traverse the list
because we have to read each disk block that requires I/O time. So traversing
in the free list is not a frequent action.
Advantages:
Disadvantages:
• Searching the free space list will be very time consuming; each block
will have to be read from the disk, which is read very slowly as
compared to the main memory.
• Not Efficient for faster access.
In our earlier example, we see that keep block 2 is the first free block which
points to another block which contains the pointer of the 3 blocks and 3 blocks
contain the pointer to the 4 blocks and this contains the pointer to the 5 block
then 5 block contains the pointer to the next block and this process is repeated
at the last.
c) Construct and explain directory structure of a file system in terms of single
level, two level and tree structure
A directory is a container that is used to contain folders and file. It organizes
files and folders into a hierarchical manner.
There are several logical structures of a directory, these are given below.
1. Single-level directory –
Single level directory is simplest directory structure.In it all files are
contained in same directory which make it easy to support and
understand.
A single level directory has a significant limitation, however, when the
number of files increases or when the system has more than one user.
Since all the files are in the same directory, they must have the unique
name . if two users call their dataset test, then the unique name rule
violated.
Advantages:
• Since it is a single directory, so its implementation is very easy.
• If files are smaller in size, searching will faster.
• The operations like file creation, searching, deletion, updating are
very easy in such a directory structure.
Disadvantages:
• There may chance of name collision because two files can not have
the same name.
• Searching will become time taking if directory will large.
• In this can not group the same type of files together.
2. Two-level directory –
As we have seen, a single level directory often leads to confusion of files
names among different users. the solution to this problem is to create a
separate directory for each user.
In the two-level directory structure, each user has there own user files
directory (UFD). The UFDs has similar structures, but each lists only the
files of a single user. system’s master file directory (MFD) is searches
whenever a new user id=s logged in. The MFD is indexed by username or
account number, and each entry points to the UFD for that user.
Advantages:
• We can give full path like /User-name/directory-name/.
• Different users can have same directory as well as file name.
• Searching of files become more easy due to path name and user-
grouping.
Disadvantages:
• A user is not allowed to share files with other users.
• Still it not very scalable, two files of the same type cannot be
grouped together in the same user.
3. Tree-structured directory –
Once we have seen a two-level directory as a tree of height 2, the natural
generalization is to extend the directory structure to a tree of arbitrary
height.
This generalization allows the user to create there own subdirectories
and to organize on their files accordingly.
A tree structure is the most common directory structure. The tree has a
root directory, and every file in the system have a unique path.
Advantages:
• Very generalize, since full path name can be given.
• Very scalable, the probability of name collision is less.
• Searching becomes very easy, we can use both absolute path as well
as relative.
Disadvantages:
• Every file does not fit into the hierarchical model, files may be saved
into multiple directories.
• We can not share files.
• It is inefficient, because accessing a file may go under multiple
directories.
4. Acyclic graph directory –
An acyclic graph is a graph with no cycle and allows to share
subdirectories and files. The same file or subdirectories may be in two
different directories. It is a natural generalization of the tree-structured
directory.
It is used in the situation like when two programmers are working on a
joint project and they need to access files. The associated files are stored
in a subdirectory, separated them from other projects and files of other
programmers since they are working on a joint project so they want to
the subdirectories into there own directories. The common
subdirectories should be shared. So here we use Acyclic directories.
It is the point to note that shared file is not the same as copy file if any
programmer makes some changes in the subdirectory it will reflect in
both subdirectories.
Advantages:
• We can share files.
• Searching is easy due to different-different paths.
Disadvantages:
• We share the files via linking, in case of deleting it may create the
problem,
• If the link is soft link then after deleting the file we left with a
dangling pointer.
• In case of hard link, to delete a file we have to delete all the
reference associated with it.
Advantages:
• It allows cycles.
• It is more flexible than other directories structure.
Disadvantages:
• It is more costly than others.
• It needs garbage collection.