Professional Documents
Culture Documents
Osy Sample Questions Paper Solved
Osy Sample Questions Paper Solved
Q Questions/ Answer M
u ar
e. ks
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
User Interface
Program Execution
File system manipulation
Input / Output Operations
Communication
Resource Allocation
Error Detection
Accounting
Security and protection
ii) Segmentation
Q.
2
)
a Explain dual modes of operations of an Operating system.
)
There are two modes of operation in the operating system to make sure it
works correctly. These are user mode and kernel mode.
A diagram that illustrates the transition from user mode to kernel mode and
back again is as follows:
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.
Multiple processes can read and write data to the message queue without
being connected to each other. Messages are stored on the queue until their
recipient retrieves them. Message queues are quite useful for interprocess
communication and are used by most operating systems.
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)
)
c) Compare between short term and long term scheduler.(any four points)
BASIS FOR LONG-TERM SHORT-TERM
COMPARISON SCHEDULER SCHEDULER
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
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 invokeps 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
3 3 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
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.