Professional Documents
Culture Documents
Os 2 Marks Qus
Os 2 Marks Qus
Os 2 Marks Qus
Unit-I
2 Marks:
6. Define Process.
New
Running
Ready
Blocked
Waiting
14. List out the 5 basic system calls provided by UNIX for file I/O.
int open
int close
int read
int write
off_t seek
Fairness
Policy Enforcement
CPU Utilization(Response time, Turnaround, Throughput)
5 Marks
1. Explain Operating System Services.
Program Execution
I/O operations
File System Manipulation
Communications
Error Detection
File Management
I/O System Management
Secondary Storage Management
Networking
Protection System.
Program execution
I/O Operation
• I/O operation means read or write operation with any file or any
specific I/O device.
• Operating system provides the access to the required I/O device
when required.
Communication
Error handling
Errors can occur anytime and anywhere. An error may occur in CPU, in
I/O devices or in the memory hardware. Following are the major activities of an
operating system with respect to error handling −
Resource Management
Protection
There is a Process Control Block for each process, enclosing all the
information about the process. It is a data structure, which contains the
following:
CPU utilization
To make out the best use of CPU and not to waste any CPU cycle, CPU
would be working most of the time(Ideally 100% of the time).
Throughput
It is the total number of processes completed per unit time or rather say
total amount of work done in a unit of time.
Turnaround time
Waiting time
The sum of the periods spent waiting in the ready queue amount of time a
process has been waiting in the ready queue to acquire get control on the
CPU.
Load average
Response time
Amount of time it takes from when a request was submitted until the first
response is produced. Remember, it is the time till the first response and
not the completion of process execution (final response).
5. Explain Round Robin Algorithm.
10 Marks
Types of Thread
• User Threads
• Kernel Threads
User threads are above the kernel and without kernel support. These are the
threads that application programmers use in their programs.
Kernel threads are supported within the kernel of the OS itself.
Multithreading Models
The user threads must be mapped to kernel threads, by one of the following
strategies.
• Many-To-One Model
• One-To-One Model
• Many-To-Many Model
Many-To-One Model
• In the many-to-one model, many user-level threads are all mapped onto a
single kernel thread.
• Thread management is handled by the thread library in user space, which
is efficient in nature.
One-To-One Model
• The one-to-one model creates a separate kernel thread to handle each and
every user thread.
• Most implementations of this model place a limit on how many threads
can be created.
• Linux and Windows from 95 to XP implement the one-to-one model for
threads.
Many-To-Many Model
Benefits of Multithreading
1. Responsiveness
2. Resource sharing, hence allowing better utilization of resources.
3. Economy. Creating and managing threads becomes easier.
4. Scalability. One thread runs on one CPU. In Multithreaded processes,
threads can be distributed over a series of processors to scale.
5. Context Switching is smooth
Multithreading Issues
Thread Cancellation.
Cancellation
Signal Handling.
Fork () System Call..
Security Issues because of extensive sharing of resources between
multiple threads.
Shortest-Job-First(SJF)
First(SJF) Scheduling
Priority Scheduling
2. Define Progress.
If no process is executing in its critical section and then exist some
processes that wish to enter their critical section, then the selection of
the processes that will enter the critical section next cannot be
postponed indefinitely.
6. Define Deadlock.
Deadlocks are a set of blocked processes each holding a resources and
waiting to acquire a resource held by another process.
7. Define Deadlock Prevention.
Deadlock prevention algorithms ensure that at least one of the
necessary conditions.
Mutual Exclusion
Hold and Wait
No Pre-emption
Circular Wait
Problem Statement:
A solution to the critical section problem must satisfy the following three
conditions:
Mutual Exclusion
Progress
Bounded Waiting
After a process makes a request for getting into its critical section, there is
a limit for how many other processes can get into their critical section,
before this process's request is granted. So after the limit is reached,
system must grant the process permission to get into its critical section.
3. Explain the Concept of Monitors.
Syntax of Monitor
10 Marks
Following three strategies can be used to remove deadlock after its occurrence.
Pre-emption
We can take a resource from one process and give it to other. This will
resolve the deadlock situation, but sometimes it does cause problems.
Rollback
7. Define Fragmentation.
8. Define Paging.
Advantages:
Multiprogramming is achieved
Exempted from external fragmentation
Disadvantages:
Additional hardware is required.
Based on the size of the page table, it can be placed either in main
memory or in special register.
5 Marks
Compile Time
Load Time
Execution Time
Dynamic loading means loading the library (or any other binary for that
matter) into the memory during load or run-time.
Dynamic loading can be imagined to be similar to plugins , that is an exe
can actually execute before the dynamic loading happens(The dynamic
loading for example can be created using Load Library call in C or C++)
Dynamic linking refers to the linking that is done during load or run-time
and not when the exe is created.
In case of dynamic linking the linker while creating the exe does minimal
work.
For the dynamic linker to work it actually has to load the libraries too.
Hence it's also called linking loader.
5. Explain Fragmentation.
1. Internal Fragmentation
2. External Fragmentation
10 Marks
Swapping:
Demand paging is the type of swapping in which pages of data are not
copied from disk to memory until they are needed.
3. Define Thrashing.
Create
Open
Write/Read
Reposition (Seek)
Delete (unlink)
Truncate
Close
Contiguous allocation
Linked allocation
Indexed allocation
8. List out the techniques used to maintain the free space list.
Bit Vector
Linked List
Grouping
Counting
Single-level directory
Two level directory
Tree Structured directory
Graph directory
5 Marks
Least Recently Used (LRU) algorithm Page which has not been used
for the longest time in main memory is the one which will be selected for
replacement.
Easy to implement, keep a list, replace pages by looking back into time.
2. Describe File allocation methods.
Contiguous allocation
Linked allocation
With the linked allocation approach, disk blocks of a file are ch chained
together with a linked-list.
linked
The directory entry of a file contains a pointer to the first block and a
pointer to the last block
Indexed allocation
Each file has an index block that is an array of disk block addresses.
The i-th
th entry in the index block points to the i-th
i th block of the file.
A file’s directory entry contains a pointer to its index.
Hence, the index block of an indexed allocation plays the same role as
the page table. Index allocation supports both sequential
sequential and direct access
without external fragmentation.
3. Explain file system structure.
Definition
File System Structure Diagram
File control Block
File structure
Logical storage unit
Collection of related information
File system resides on secondary storage (disks)
File system organized into layers
File control block
storage structure with of information about a file
File Structure
Creating a file: First, a space in the file system must be found for the
file. Second, an entry for the new file must be made in the directory.
Writing a file: To write a file, a system call is made specifying both the
name and the file and the information to be written to the file
Reading a file:To read a file; a system call is made that specifies that
specifies the name of the file and where (in memory) the next block of the
file should be put.
Resetting a file: The directory is searched for the appropriate entry, and
the current file position is reset to the beginning of the file.
Deleting a file: To delete a file, the directory is searched for the named
file. Having found the associated directory entry, the space allocated to
the file is released (so it can be reused by other files) and invalidates the
directory entry
10 Marks
• Sequential Access:
• Direct Access
• Indexed access:
Advantages
Disadvantages
2 Marks
Status
Control
Data-in
Data-out
I/O scheduling
Buffering
Caching
Spooling
Device Reservation
Error Handling
3. What is a controller?
7. What is Authentication?
Passwords
Cryptographic or encrypted password
one time password
biometrics
10 Marks
1. Describe the Disk Scheduling Algorithms.
First In First Out (FIFO) Disk Scheduling Algorithm
Shortest Seek Time First (SSTF) Disk Scheduling Algorithm
SCAN
C-SCAN
LOOK
C-LOOK
First Come -First Serve (FCFS): All incoming requests are placed at the
end of the queue.
Whatever number that is next in the queue will be the next number served.
Using this algorithm doesn't provide the best results.
To determine the number of head movements you would simply find the
number of tracks it took to move from one request to the next.
Shortest Seek Time First (SSTF): In this case request is serviced according
to next shortest distance.
Starting at 50, the next shortest distance would be 62 instead of 34 since it
is only 12 tracks away from 62 and 16 tracks away from 34. The process
would continue until all the process is taken care of.
Trust - How can the system be sure that the messages received are really
from the source that they say they are, and can that source be trusted?
Confidentiality - How can one ensure that the messages one is sending
are received only by the intended recipient?
Cryptography can help with both of these problems, through a system of
secrets and keys. In the former case, the key is held by the sender, so that
the recipient knows that only the authentic author could have sent the
message; in the latter, the key is held by the recipient, so that only the
intended recipient can receive the message accurately.
Keys are designed so that they cannot be divined from any public
information, and must be guarded carefully. (Asymmetric encryption
involve both a public and a private key. )
Encryption: The basic idea of encryption is to encode a message so that
only the desired recipient can decode and read it.
Encryption has been around since before the days of Caesar, and is an
entire field of study in itself. Only some of the more significant computer
encryption schemes will be covered here.
The steps in the procedure and some of the key terminology are as
follows: