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

OSY-PT1

Uploaded by

adityamaurya9471
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)
12 views

OSY-PT1

Uploaded by

adityamaurya9471
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/ 26

OSY-PT1

OSY QUESTION BANK FOR PT1


Q1) Difference between Multiprogramming and
Multitasking
Criteria Multiprogramming Multitasking
Definition Multiple programs in memory Multiple tasks in a single
program
Purpose Maximize CPU use Efficient task management
Execution Programs run one after Tasks run simultaneously
another
System Type Batch-oriented Interactive

Response to Less responsive Immediate response


User
Focus Job throughput Task switching

User Interaction Minimal user interaction Frequent user interaction


Era Older systems Modern systems

Q2) Explain Time-Sharing Operating System


Time-Sharing Operating System:
A time-sharing OS allows multiple users to share system resources simultaneously by
allocating a small time slice to each process. This approach maximizes CPU utilization and
provides an interactive experience for users. Time-sharing systems are characterized by
their responsiveness and efficient use of resources, enabling multiple tasks to be executed
concurrently. This method improves system utilization and user interaction by switching
between tasks quickly.

Advantages and Disadvantages


Advantages Disadvantages
Efficient resource utilization Overhead due to context switching
Interactive and responsive Limited to certain hardware types
Supports multiple users Potential for resource contention
Easy to manage and control Security risks with shared resources
Q3) Define Real-Time Operating System
Real-Time Operating System:
A real-time OS is designed to process data and respond to events within a strict time
constraint, ensuring that critical tasks are performed on time. These systems are used in
environments where timing is crucial, such as embedded systems in automotive or medical
devices. There are two main types: hard real-time systems, which have strict deadlines, and
soft real-time systems, which can tolerate some delays. Applications include flight control
systems and industrial automation.

Types
 Hard Real-Time Systems: Strict deadlines must be met.
 Soft Real-Time Systems: Deadlines are less strict, with some tolerance for delays.

Q4) What is System Call? Explain System Call


Related to Device Management
System Call:
A system call is an interface that allows user applications to request services from the
operating system kernel. System calls provide the mechanism for executing operations that
require higher privileges, such as interacting with hardware or managing processes.

Device Management System Calls


 Open: Opens a device or file.
 Read: Reads data from a device.
 Write: Sends data to a device.
 Close: Closes access to a device.

Q5) Difference between Linux and Unix


Criteria Linux Unix
Source Open-source Originally proprietary
Versions Various distributions Single, consistent version

Flexibility Highly customizable Standardized, less flexible

Usage Widely used in servers and Common in servers and


desktops workstations
Development Community-driven Commercial and academic
use
Hardware Broad hardware support Older hardware compatibility
Criteria Linux Unix
Compatibility
Updates Frequent updates Less frequent updates

User Experience More user-friendly More technical

Q6) List any 4 Services Provided by Operating


System and Explain Any 2
Services:

1. Program Execution
2. I/O Operations
3. File System Manipulation
4. Communication

Program Execution
 Description: Manages the loading, execution, and termination of programs.
 Functions: Process scheduling, program loading, and process control.

I/O Operations
 Description: Manages input and output operations for all devices.
 Functions: Device drivers, data buffering, and data transfer coordination.

Q7) Draw the Diagram of Monolithic Structure


and Explain
Monolithic Structure:
A monolithic OS architecture is characterized by a single large kernel that manages all
system operations. It integrates various services such as process management, memory
management, and device drivers into one large kernel module. This structure contrasts with
modular or layered architectures, where components are more isolated and interact through
well-defined interfaces.

Explanation:

 Single Kernel: All functionalities are contained within one kernel.


 Direct Communication: Components interact directly without intermediaries.
 High Performance: Efficient but can be complex and harder to maintain.
Q8) Enlist Components of Operating System and
Explain Any 2
Components:

1. Process Management
2. Memory Management
3. File System Management
4. I/O System Management
5. Device Drivers

Process Management
 Description: Manages the creation, scheduling, and termination of processes.
 Functions: Process creation, scheduling algorithms, and process control.

Memory Management
 Description: Allocates and manages memory resources for processes.
 Functions: Memory allocation, paging, and segmentation.

Q9) Write Characteristics of Windows XP and


Windows 7
Feature Windows XP Windows 7
Release Year 2001 2009
Feature Windows XP Windows 7
User Interface Classic Start Menu Improved Aero UI
Performance Basic performance Enhanced performance and
enhancements speed
Security Basic security features Advanced security features

Support End of life since 2014 Extended support until 2020

Compatibility Widely compatible with older Better support for new


apps hardware
Networking Basic networking capabilities Improved networking
features
Support for Basic multitasking Enhanced multitasking
Multitasking

Q10) Difference between Real-Time and Time-


Sharing Operating System
Basis Real-Time OS Time-Sharing OS
Timing Constraints Strict timing constraints Time slices for responsiveness
System Type Embedded and General-purpose and
specialized interactive
Task Priority High priority, immediate Equal priority, managed time
Response Time Predictable and minimal Variable and dependent on
load
Application Examples Flight control systems Desktop applications

Flexibility Rigid scheduling Flexible and adaptive


Use Case Critical systems Interactive user systems

Resource Strict, dedicated Shared, dynamic allocation


Management resources

Q11) List Any 4 Functions of Operating System


1. Process Management
2. Memory Management
3. File System Management
4. I/O System Management

Q12) Difference between Internal and External


Fragmentation
Basis Internal Fragmentation External Fragmentation
Definition Unused space within Unused space outside
allocated block allocated blocks
Location Within allocated memory Between allocated memory
blocks blocks
Cause Fixed-size block allocation Variable-sized block allocation
Effect on Wastes space inside Wastes space throughout
Performance allocated area memory
Management Easy to manage (fixed size) Difficult to manage (variable
size)
Space Efficiency Lower efficiency Can be higher efficiency

Handling Compaction may be needed Compaction or


defragmentation needed
Example A block with unused bytes Gaps between blocks in
memory

Q13) Compare Paging and Segmentation Memory


Management Techniques
Basis Paging Segmentation
Memory Division Fixed-size pages Variable-size segments
Address Space Page number and offset Segment number and offset
Fragmentation Internal fragmentation External fragmentation
Management Simpler, fixed-size units More complex, variable-sized
Complexity units

Efficiency Efficient use of memory Can be less efficient

Overhead Page table overhead Segment table overhead


Memory Access Direct access to page Access through segment
tables tables
Example Paging in modern OS Segmentation in early OS

Q14) Compare CLI and GUI Based Operating


Systems
Basis CLI (Command Line GUI (Graphical User Interface)
Interface)
User Text-based commands Graphical elements (windows,
Interaction icons)
Basis CLI (Command Line GUI (Graphical User Interface)
Interface)
Ease of Use Requires knowledge of User-friendly, intuitive
commands
Resource Low resource usage Higher resource usage
Usage
Learning Curve Steeper learning curve Easier to learn and use

Flexibility High flexibility Limited by GUI design


Speed Faster for experts Slower due to graphical
processing
Error Handling Requires precise input Error messages are more
descriptive
Accessibility Accessible via keyboard Accessible via mouse and
keyboard

Q16) Free Space Management Techniques


Bitmap
 Concept: Uses a bit map (a series of bits) to represent free and used space.
 How It Works: Each bit represents a block of memory. A 0 means free, and a 1
means used.
 Advantages: Simple to implement, quick to check if space is free.
 Disadvantages: Requires memory to store the bitmap, less efficient for large files.

Linked List
 Concept: Uses a list of linked blocks to keep track of free memory.
 How It Works: Each free block points to the next free block. The last block points to
null.
 Advantages: Efficient use of space, easy to allocate and deallocate.
 Disadvantages: Slower access compared to bitmap, requires additional memory for
pointers.

Q17) Virtual Memory and Demand Paging


Virtual Memory
 Concept: Uses part of the hard drive to extend RAM, creating a larger memory space.
 How It Works: Allows programs to use more memory than physically available by
swapping data between RAM and disk storage.
 Advantages: Enables running large programs, improves multitasking.
 Disadvantages: Can be slower due to disk access times.

Demand Paging
 Concept: Only loads parts of a program into RAM when needed.
 How It Works: When a program needs a piece of data, it's loaded from disk into RAM.
If RAM is full, some data is swapped out.
 Advantages: Saves RAM space, reduces load times.
 Disadvantages: May cause delays due to disk access.

Q18) Explain Multiprocessor Operating Systems


Explanation
Multiprocessor operating systems use multiple CPUs to perform many tasks at once. Each
CPU can work on different parts of a task or different tasks simultaneously, which helps
complete work faster. For example, in a computer with two or more CPUs, one CPU might
handle running applications while the other manages system updates. This setup allows the
computer to handle complex programs and large amounts of data more efficiently. However,
it can be tricky to manage because the CPUs need to work together smoothly without
conflicting.

Diagram

CPU 1

CPU 2

User Requests Multiprocessor OS Task Execution

CPU 3

CPU 4
Q13 Page Replacement Algorithm(LRU)
Page Order: 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1

What is Page Replacement?


Imagine your computer's memory (RAM) has a limited number of slots (frames) where it can
keep data it needs. When you try to load more data (pages) than it can hold, the computer
has to decide which data to remove to make space for the new data.

What is LRU (Least Recently Used)?


LRU is a way to manage memory. It says that when memory is full and a new page needs to
be loaded, the computer will remove the page that hasn't been used for the longest time.

Process of LRU with Step-by-Step Iterations


1. Initial Setup:
 Frame Size: 3
 Initially, all frames are empty.

Iteration 1: Page 7
 Memory State: [7, -, -]
 Explanation: Load page 7. It's the first page, so no need to replace anything.
 Page Fault: Yes

Empty Frame

Load Page 7

Memory: 7, -, -

Iteration 2: Page 0
 Memory State: [7, 0, -]
 Explanation: Load page 0. There's still space available.
 Page Fault: Yes
Memory: 7, -, -

Load Page 0

Memory: 7, 0, -

Iteration 3: Page 1
 Memory State: [7, 0, 1]
 Explanation: Load page 1. The last available slot is filled.
 Page Fault: Yes

Memory: 7, 0, -

Load Page 1

Memory: 7, 0, 1

Iteration 4: Page 2
 Memory State: [2, 0, 1]
 Explanation: Memory is full. Remove the least recently used page (7) and load page
2.
 Page Fault: Yes

Memory: 7, 0, 1

Replace 7 with 2

Memory: 2, 0, 1

Iteration 5: Page 0
 Memory State: [2, 0, 1]
 Explanation: Page 0 is already in memory, so no change.
 Page Fault: No

Memory: 2, 0, 1

No Change

Memory: 2, 0, 1

Iteration 6: Page 3
 Memory State: [2, 3, 1]
 Explanation: Replace the least recently used page (0) with page 3.
 Page Fault: Yes

Memory: 2, 0, 1

Replace 0 with 3

Memory: 2, 3, 1

Iteration 7: Page 0
 Memory State: [2, 3, 0]
 Explanation: Replace the least recently used page (1) with page 0.
 Page Fault: Yes
Memory: 2, 3, 1

Replace 1 with 0

Memory: 2, 3, 0

Iteration 8: Page 4
 Memory State: [4, 3, 0]
 Explanation: Replace the least recently used page (2) with page 4.
 Page Fault: Yes

Memory: 2, 3, 0

Replace 2 with 4

Memory: 4, 3, 0

Iteration 9: Page 2
 Memory State: [4, 2, 0]
 Explanation: Replace the least recently used page (3) with page 2.
 Page Fault: Yes

Memory: 4, 3, 0

Replace 3 with 2

Memory: 4, 2, 0

Iteration 10: Page 3


 Memory State: [4, 2, 3]
 Explanation: Replace the least recently used page (0) with page 3.
 Page Fault: Yes

Memory: 4, 2, 0

Replace 0 with 3

Memory: 4, 2, 3

Iteration 11: Page 0


 Memory State: [0, 2, 3]
 Explanation: Replace the least recently used page (4) with page 0.
 Page Fault: Yes

Memory: 4, 2, 3

Replace 4 with 0

Memory: 0, 2, 3

Iteration 12: Page 3


 Memory State: [0, 2, 3]
 Explanation: Page 3 is already in memory, so no change.
 Page Fault: No
Memory: 0, 2, 3

No Change

Memory: 0, 2, 3

Iteration 13: Page 2


 Memory State: [0, 2, 3]
 Explanation: Page 2 is already in memory, so no change.
 Page Fault: No

Memory: 0, 2, 3

No Change

Memory: 0, 2, 3

Iteration 14: Page 1


 Memory State: [0, 1, 3]
 Explanation: Replace the least recently used page (2) with page 1.
 Page Fault: Yes

Memory: 0, 2, 3

Replace 2 with 1

Memory: 0, 1, 3

Iteration 15: Page 2


 Memory State: [0, 1, 2]
 Explanation: Replace the least recently used page (3) with page 2.
 Page Fault: Yes

Memory: 0, 1, 3

Replace 3 with 2

Memory: 0, 1, 2

Iteration 16: Page 0


 Memory State: [0, 1, 2]
 Explanation: Page 0 is already in memory, so no change.
 Page Fault: No

Memory: 0, 1, 2

No Change

Memory: 0, 1, 2

Iteration 17: Page 1


 Memory State: [0, 1, 2]
 Explanation: Page 1 is already in memory, so no change.
 Page Fault: No
Memory: 0, 1, 2

No Change

Memory: 0, 1, 2

Iteration 18: Page 7


 Memory State: [7, 1, 2]
 Explanation: Replace the least recently used page (0) with page 7.
 Page Fault: Yes

Memory: 0, 1, 2

Replace 0 with 7

Memory: 7, 1, 2

Iteration 19: Page 0


 Memory State: [7, 0, 2]
 Explanation: Replace the least recently used page (1) with page 0.
 Page Fault: Yes

Memory: 7, 1, 2

Replace 1 with 0

Memory: 7, 0, 2

Iteration 20: Page 1


 Memory State: [7, 0, 1]
 Explanation: Replace the least recently used page (2) with page 1.
 Page Fault: Yes

Memory: 7, 0, 2

Replace 2 with 1

Memory: 7, 0, 1

Total Number of Page Faults


 Total Page Faults: 13

In total, there are 13 page faults during this sequence of operations.

Explanation Recap
 LRU (Least Recently Used) Algorithm: When the memory is full, remove the
page that hasn’t been used for the longest time.
 Frame Size: We used a frame size of 3.
 Page Faults: A page fault occurs when a page needs to be loaded into memory, but
the memory is full, and a page must be replaced.

Q13 Page Replacement Algorithm(OPT)


Let's walk through the Optimal Page Replacement algorithm with the same page order,
frame size of 3, and provide a detailed explanation with Mermaid diagrams.

Q13 Page Replacement Algorithm


Page Order: 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1

What is Page Replacement?


When the computer's memory (RAM) can't hold all the pages (data) needed, the system
must decide which pages to remove and which new pages to load. This process is called
page replacement.
What is Optimal Page Replacement?
The Optimal Page Replacement algorithm replaces the page that will not be used for the
longest period in the future. This method minimizes page faults but requires knowledge of
future page requests, which is not feasible in practice. It serves as a benchmark for
evaluating other algorithms.

Process of Optimal Page Replacement with Step-by-Step


Iterations
1. Initial Setup:
 Frame Size: 3
 Initially, all frames are empty.

Iteration 1: Page 7
 Memory State: [7, -, -]
 Explanation: Load page 7. It's the first page, so no need to replace anything.
 Page Fault: Yes

Empty Frame

Load Page 7

Memory: 7, -, -

Iteration 2: Page 0
 Memory State: [7, 0, -]
 Explanation: Load page 0. There’s still space available.
 Page Fault: Yes
Memory: 7, -, -

Load Page 0

Memory: 7, 0, -

Iteration 3: Page 1
 Memory State: [7, 0, 1]
 Explanation: Load page 1. The last available slot is filled.
 Page Fault: Yes

Memory: 7, 0, -

Load Page 1

Memory: 7, 0, 1

Iteration 4: Page 2
 Memory State: [2, 0, 1]
 Explanation: Memory is full. Replace the page that will not be used for the longest
time (7).
 Page Fault: Yes

Memory: 7, 0, 1

Replace 7 with 2

Memory: 2, 0, 1

Iteration 5: Page 0
 Memory State: [2, 0, 1]
 Explanation: Page 0 is already in memory, so no change.
 Page Fault: No

Memory: 2, 0, 1

No Change

Memory: 2, 0, 1

Iteration 6: Page 3
 Memory State: [2, 3, 1]
 Explanation: Replace the page that will not be used for the longest time (1).
 Page Fault: Yes

Memory: 2, 0, 1

Replace 1 with 3

Memory: 2, 3, 1

Iteration 7: Page 0
 Memory State: [2, 3, 0]
 Explanation: Replace the page that will not be used for the longest time (2).
 Page Fault: Yes
Memory: 2, 3, 1

Replace 2 with 0

Memory: 0, 3, 1

Iteration 8: Page 4
 Memory State: [4, 3, 0]
 Explanation: Replace the page that will not be used for the longest time (1).
 Page Fault: Yes

Memory: 0, 3, 1

Replace 1 with 4

Memory: 4, 3, 0

Iteration 9: Page 2
 Memory State: [4, 2, 0]
 Explanation: Replace the page that will not be used for the longest time (3).
 Page Fault: Yes

Memory: 4, 3, 0

Replace 3 with 2

Memory: 4, 2, 0

Iteration 10: Page 3


 Memory State: [4, 2, 3]
 Explanation: Replace the page that will not be used for the longest time (0).
 Page Fault: Yes

Memory: 4, 2, 0

Replace 0 with 3

Memory: 4, 2, 3

Iteration 11: Page 0


 Memory State: [4, 0, 3]
 Explanation: Replace the page that will not be used for the longest time (4).
 Page Fault: Yes

Memory: 4, 2, 3

Replace 4 with 0

Memory: 0, 2, 3

Iteration 12: Page 3


 Memory State: [0, 2, 3]
 Explanation: Page 3 is already in memory, so no change.
 Page Fault: No
Memory: 0, 2, 3

No Change

Memory: 0, 2, 3

Iteration 13: Page 2


 Memory State: [0, 2, 3]
 Explanation: Page 2 is already in memory, so no change.
 Page Fault: No

Memory: 0, 2, 3

No Change

Memory: 0, 2, 3

Iteration 14: Page 1


 Memory State: [0, 1, 3]
 Explanation: Replace the page that will not be used for the longest time (3).
 Page Fault: Yes

Memory: 0, 2, 3

Replace 2 with 1

Memory: 0, 1, 3

Iteration 15: Page 2


 Memory State: [0, 1, 2]
 Explanation: Replace the page that will not be used for the longest time (3).
 Page Fault: Yes

Memory: 0, 1, 3

Replace 3 with 2

Memory: 0, 1, 2

Iteration 16: Page 0


 Memory State: [0, 1, 2]
 Explanation: Page 0 is already in memory, so no change.
 Page Fault: No

Memory: 0, 1, 2

No Change

Memory: 0, 1, 2

Iteration 17: Page 1


 Memory State: [0, 1, 2]
 Explanation: Page 1 is already in memory, so no change.
 Page Fault: No
Memory: 0, 1, 2

No Change

Memory: 0, 1, 2

Iteration 18: Page 7


 Memory State: [7, 1, 2]
 Explanation: Replace the page that will not be used for the longest time (0).
 Page Fault: Yes

Memory: 0, 1, 2

Replace 0 with 7

Memory: 7, 1, 2

Iteration 19: Page 0


 Memory State: [7, 0, 2]
 Explanation: Replace the page that will not be used for the longest time (1).
 Page Fault: Yes

Memory: 7, 1, 2

Replace 1 with 0

Memory: 7, 0, 2

Iteration 20: Page 1


 Memory State: [7, 0, 1]
 Explanation: Replace the page that will not be used for the longest time (2).
 Page Fault: Yes

Memory: 7, 0, 2

Replace 2 with 1

Memory: 7, 0, 1

Total Number of Page Faults


 Total Page Faults: 13

Explanation Recap
 Optimal Page Replacement Algorithm: Replaces the page that will not be used
for the longest period in the future.
 Frame Size: We used a frame size of 3.
 Page Faults: A page fault occurs when a page needs to be loaded into memory, but
the memory is full, and a page must be replaced.

You might also like