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

Q1

abdddsd

Uploaded by

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

Q1

abdddsd

Uploaded by

Saad Nadaf
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Q1.

A. Batch operating system :


1) The batch operating system has minimum to no user interaction.
2) The batch operating system prioritises efficient completion of large processes.
3) The batch operating system has longer response time In comparison to time sharing
operating system.
4) The batch operating system maximises resource utilization by executing large jobs during
idle times.

Time sharing operating system :


1) The time sharing operating system has high level of user interaction.
2) The time sharing operating system prioritizes interactive computing where multiple
users can use the system simultaneously.
3) The time sharing operating system has lower response time In comparison to batch
operating system.
4) The time sharing operating system shares system resources among multiple users in
a fair manner, ensuring no one user can monopolize it.

B. Four services of operating system are :


1. Memory management
2. process management
3.File system management
4.I/O system management

C. 1.Process: Process is an instance of a program that is being executed. It includes the program
code and it’s current activity.
2.Program : A program is a set of instruction written In a programming language that
specifies a task to be performed by the instruction.

D. Two features of preemptive scheduling are as follows :

E. Page Fault :
Page fault occurs when a program tries to access a portion of memory that is not currently
mapped to the physical memory by the operating system.
Segmentation:
Segmentation is a memory management technique where memory is divided into multiple
segments based on the logical division of the program.

F. Syntax of ps command : ps- display process for the current shell


(Find better answer for the question)
G. Any four file attributes are : i) name ii)size iii)Type iv)Permission

Q2.
A. Dual modes of operation of an operating system are kernal mode and user mode.
i) User mode :
In user mode, applications run with limited storage. They can not directly access
hardware or critical memory area.
Certain meachine instructions are not allowed to execute in user mode.
Process in user mode are isolated from each other to prevent one process from
interfaring with other one.
ii) Kernal mode :
In kernal mode, the operating system has unrestricted access to all hardware and
memory.
The os can execute any machine instruction, including those that interact with
hardware.
All critical and sensitive operations, such as managing memory, process and
hardware, occur in kernal mode.
B. The essential activities done by operating system for protection and sharing are as
follows :
i) Protection:
a) Access control : The OS enforces rules such as who can access what
resources in what manner. It uses mechanism like user account, password
and permission.
b) Authentication : The OS identifies it’s user before granting access. It’s done
using password, account, and biometrics.
c) Authorization: Once authorized the OS insures process can only perform
actions they are authorized to do so.
d) Resource Isolation : The OS isolates processes and their resources from each
other to prevent unauthorized access or interference.
ii) Sharing:
a) File System Management : The OS manages files and directories, allowing
multiple users and processes to share data efficiently and securely.
b) Process Management : OS schedules and manages processes , allowing
multiple processes to run silmultaneously ensuring they do not interfere
with one another.
c) Memory Management: The OS allocates and manages memory
processes ,allowing multiple processes to share memory while ensuring they
do not connect each others data.
d) The OS manages hardware devices and allows multiple users and processes
to share these devices.
C. Interprocess Communication : Interprocess communication refers to a technique that
allows processes to synchronize and communicate with each other. IPC is essential in
multi tasking and multi user operating system where multiple processes may need to
share and collaborate data.
Advantages of Interprocess Communication
i) Data Sharing : Allows processes to exchange data effectively.
ii) Resource Sharing : Enables processors to share files, memory and devices,
optimizing resource use.
iii) Synchronization : Coordinates process activities to ensure orderly and consistent
execution.
iv) Concurrancy : Facilitates simultaneous execution of processes, improving
performance on multi-core system.
v) Fault Isolation : Keeps error in one process from affecting other, enhancing
system reliability.
vi) Distributed Computing: Enables process to communicate across computers.
Essential for scalable applications.

D. Scheduling Criteria : Scheduling criteria are used to evaluate and compare different
scheduling algorithms in operating system.
i) CPU Utilization: Measures the percentage of time the CPU is working. Higher
utilization means the CPU is effectively used.
ii) Throughput : The number of processes that complete their execution per time
unit. Higher is better.
iii) Turnaround time: The total time taken for a process to complete from
submission to finish. Lower is better.
iv) Waiting Time : The total time a process spends in ready queue waiting for CPU
allocation.
v) Response Time: The time from process submission until first response is
produced. Lower response is crucial for interactive systems.
vi) Fairness : Ensures that all processes get an equitable share of CPU time,
preventing starvation of any process.

Q3.
A. PCB : Process Control Box is a data structure used by OS to store all the
information about a process. The information contained in PCB typically
includes :
i) Process ID : Unique identifier for the process.
ii) Process State : Current state of the process.
iii) Program Counter : Address of the next instruction to execute.
iv) CPU Registers : Contents of all process specific registers.
v) Memory Management Information : Information about memory
allocation for the process.
vi) Accounting Information: CPU usage, execution time etc.
B. Deadlock : Deadlock is a condition In which a set of processors becomes
stuck because each process is waiting for resource that is held by another
process in the set, and none of the processes can proceed.

For a deadlock to occur, four conditions must be met :


I) Mutual Exclusio : At least one resource must be held In a non
sharable mode. Only one process can use the resource at any given
time.
II) Hold and Wait: A process holding at least one resource is waiting to
acquire another resource currently held by another process.
III) No preemption : Resources can not be forcibly taken from process
holding them, they must be released voluntarily by holding process.
IV) Circular Wait: A set of processes (p1, p2, ..pn) such that p1 is waiting
for resource to be available from p2 and so on. This way they are
stuck in a endless loop.
C. Compaction : Compaction is a memory management technique used to
reduce fragmentation and make more memory available for allocation.
Fragmentation occurs when memory is broken into small, non-contagious
blocks, making it difficult to allocate large contagious blocks of memory.
Compaction is used to eliminate fragmentation by moving memory content
around, thereby creating larger contagious blocks of free memory.
 Advantages :
i) Increases the availability of large contagious memory blocks.
ii) Can improve performance by reducing the overhead associated
with managing the fragmented memory.
 Disadvantages :
i) Can be time consuming and resource-intensive, as it involves
moving data in memory.
ii) May temporarily decrease system performance during
compaction process.

Swapping : Swapping is a memory management technique that


involves moving process between main memory (RAM) and
secondary storage(Hard disk) to ensure that the operating
system can run more processes than there is physical memory
available. Its purpose is to maximize the use of available memory
by temporarily moving inactive or less frequently used processes
to secondary storage.
 Advantages :
i) Allows the system to run more processes simultaneously than
there is physical memory to support.
ii) Can improve the responsiveness of the system by ensuring that
active processes have the necessary memory resources.
 Disadvantages :
i) Swapping can introduce significant overhead due to the time
taken to read from and start to secondary storage, leading to
potential performance degradation.
ii) Frequent swapping can severely impact system performance.

D. Different file allocation methods are as follows :


File allocation methods determine how files are stored and managed on disk.
There are several file allocation methods commonly used by operating
system.
i) Contiguous allocation
ii) Linked allocation
iii) Indexed allocation
iv) Multi -level indexed allocation
v) Hashed allocation
I) Contiguous allocation :
Contiguous allocation involves storing a file in sequence of
contiguous blocks on the disk This means that all blocks of a
file are placed next to each other.
 Advantages :
1) Simple and Efficient : Accessing files is very fast because blocks are
contagious. This makes sequential access especially efficient.
2) Easy to calculate address : Knowing the starting blocks and the size
of the file allows easy calculation of the address of all blocks.
 Disadvantages :
1) Fragmentation: Over time, as file are created and deleted, free space
can become fragmented, making it difficult to find large contagious
blocks.
2) Difficulty in File Growth :
If a file needs to grow and it’s adjacent blocks are already allocated.
It may require relocating the file to a new contagious blocks, which
can be time consuming.
II) Linked Allocation :
Linked Allocation involves storing a file as a linked list of a
disk blocks, which do not need to be contiguous. The
directory entry for a file contains a pointer to the first and
sometimes to the last block.
 Advantages:
1) No External Fragmentation : Since blocks do not need to be
contagious, there is no external fragmentation, and any free block
can be used to store part of the file.
2) Easy file Growth : Adding new block to file is straightforward as any
free block can be used.
 Disadvantages :
1) Sequential Access Slower :
Accessing the blocks sequentially due to need to follow pointers
from one block to the next.
2) Reliability : If a pointer is lost or corrupted, a part of the file can
become inaccessible.
3) Space Overhead : Each block must store pointer to the next
block, which can use additional space.

Q4.

A. The difference between Windows operating system and linux operating system is as follows :
B. System calls related to device management are as follows :
i) ‘Open()’ :
This sytem call is used to open a file or a device for reading, writing or both. It
returns a file descriptor that can be used for subsequent operation on the device.
ii) ‘close()’ :
This system call is used to close a

You might also like