0% found this document useful (0 votes)
20 views11 pages

Study Material For Exam

note for osy

Uploaded by

addy26194
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views11 pages

Study Material For Exam

note for osy

Uploaded by

addy26194
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Study Material

For 2 marks
Summer-22

Q1.A]. State and describe any two advantages of multiprocessor system. (2 Marks)
Answer:
1. Increased Throughput
2. Reduced Cost.
3. Increased Reliability
4. Economy of Scale
5. Better Resource Utilization
6. Simultaneous Processing
7. Improved Availability
8. Enhanced Performance
9. Scalability
10. Fault Tolerance
1. Increased Throughput:
Multiprocessor systems can handle multiple tasks simultaneously, which significantly
improves the system's overall performance and efficiency.
2. Fault Tolerance:
If one processor fails, the system can continue working with the remaining processors,
ensuring reliability and minimizing downtime.

Q1.b]. State any four types of system calls. (2 Marks)


Answer:
1. Process Control System Calls:
Used to create, execute, and terminate processes (e.g., fork, exec).
2. File Management System Calls:
Handle file operations like opening, reading, writing, and closing files (e.g., open, read,
write).
3. Device Management System Calls:
Manage device operations such as requesting and releasing devices (e.g., ioctl, read).
4. Communication System Calls:
Facilitate interprocess communication through messages or shared memory (e.g., pipe,
shmget).
Q1.c]. Draw a neat labelled diagram for process state. (2 Marks)
Answer:

States Explanation:
1. New: A process is being created.
2. Ready: The process is ready to execute but waiting for the CPU.
3. Running: The process is currently executing on the CPU.
4. Waiting: The process is waiting for some I/O or resource.
5. Terminated: The process has finished execution.
Q1.d]. State the difference between pre-emptive scheduling and non-pre-emptive scheduling. (2
Marks)
Answer:

Preemptive Scheduling Non-Preemptive Scheduling

The CPU can be taken away from a running The CPU is assigned to a process until it completes
process before it completes. or goes into a waiting state.

Suitable for real-time systems to ensure quick Simpler to implement and works well for batch
responses. systems.

Examples: Round Robin, Shortest Remaining Examples: First Come First Serve (FCFS), Shortest
Time First (SRTF). Job First (SJF).

Q1.e]. Define the term fragmentation in terms of memory. (2 Marks)


Answer:
Fragmentation refers to the inefficient use of memory due to unused memory spaces.
 External Fragmentation: Occurs when free memory is divided into small, scattered blocks,
making it difficult to allocate to processes.
 Internal Fragmentation: Happens when allocated memory is slightly larger than the
requested memory, leaving unused space within allocated blocks.
Q1.f]. Give commands to perform the following tasks:
i) To add delay in script
ii) To terminate a process (2 Marks)
Answer:
i) To add delay in script:
Use the sleep command.
For example:
sleep 5
(This adds a delay of 5 seconds.)
ii) To terminate a process:
Use the kill command with the process ID (PID).
For example:
kill 1234
(This terminates the process with PID 1234.)

Q1.g] List any four operations performed on a file


Answer:
1. Create: Making a new file on the computer.
2. Read: Looking at the content of a file.
3. Write: Changing or adding new information to an existing file.
4. Delete: Removing a file from the computer.
Q2.a] Describe working of time-sharing system with neat diagram.
Answer:
A Time-Sharing System is an operating system that allows multiple users to access and share the
computer's resources simultaneously. The system gives each user a small amount of time (called a
"time slice") to work on the system, which makes it seem like each user has their own dedicated
machine, even though the computer is being shared.
Working of Time-Sharing System:
1. The CPU divides its time among multiple tasks or users.
2. Each task gets a small portion of CPU time (called a time slice), and then the CPU switches to
another task.
3. The system continuously cycles through tasks, giving each task or user equal time to execute.
4. This gives the illusion of simultaneous processing, even though the system is only processing
one task at a time.
Diagram:
In the diagram, each user has their task, and the CPU switches between them at a fast pace, allowing
all users to interact with the system almost at the same time.
Time-sharing systems make computers more efficient by allowing multiple users to use the system at
once, with each getting a small, quick slice of CPU time.

Q2.a] List and describe any four services of operating system.


Answer:
An Operating System (OS) provides several important services to manage hardware and
software resources. Here are four key services offered by an OS:
1. Process Management:
o The OS manages processes (programs in execution). It ensures processes are created,
scheduled, and terminated properly. It also handles process synchronization and inter-
process communication.
2. Memory Management:
o The OS controls the system's memory, allocating space for processes and ensuring
that each process gets the memory it needs. It also manages memory sharing and
protects memory used by different processes.
3. File Management:
o The OS handles the creation, deletion, and organization of files. It also manages file
permissions, access, and storage. This service ensures that files are stored efficiently
and securely on disk.
4. Device Management:
o The OS controls and coordinates hardware devices like printers, hard drives, and
keyboards. It provides drivers and manages input/output (I/O) operations, ensuring
devices are used efficiently without conflicts.
These services help the OS run smoothly and enable users and programs to interact with the computer
system efficiently.

Q2.c] Differentiate between shared memory system and message passing system of interprocess
communication.
Answer:

Feature Shared Memory System Message Passing System

Definition In this system, multiple processes Processes communicate by


share a common memory space to sending and receiving messages.
communicate.

Communication Processes access shared memory Processes send and receive


Method locations directly. messages through a
communication channel.

Speed Faster, as it avoids overhead of Slower, due to the overhead of


copying data between processes. message transmission.

Synchronization Requires explicit synchronization Built-in synchronization, as


(e.g., semaphores) to prevent race messages are sent and received in
conditions. an orderly manner.

Memory Usage Memory is shared, so it uses a Each process has its own
common region of memory. memory, so separate message
buffers are used.

Complexity More complex to manage, due to the Easier to implement, as


need for synchronization. communication is based on
sending and receiving messages.

Use Cases Suitable for processes that need Useful in distributed systems or
high-speed data exchange and work when processes are running on
in a tightly-coupled system. different machines.

In summary, shared memory systems are faster and more efficient but require careful synchronization,
while message passing systems are simpler but tend to have higher overhead.

Q2.d] State and describe any two scheduling criteria.


Answer:
Scheduling criteria are used by the operating system to determine how processes are allocated
CPU time. Here are two important scheduling criteria:
1. CPU Utilization: The scheduler aims to keep the CPU busy as possible, ideally at 100%
utilization, but in practice, it ranges from 40% to 90% depending on the system load.
2. Throughput: The number of processes completed per unit time, which may vary greatly
depending on the specific processes.
3. Turnaround Time: The time taken for a process to complete its execution from submission
to completion.
4. Waiting Time: The time spent by a process in the ready queue waiting for the CPU to
become available.
5. Response Time: The time taken to start responding to a request, aiming to minimize it for
interactive users.
6. Fairness: Ensuring each process gets its fair share of CPU time, considering internal and
external priorities.
7. Average Burst Time: The average time a process spends executing its CPU burst.
8. Ratio of CPU to I/O Activity: The balance between CPU-bound and I/O-bound processes.
9. System Resource Use: The utilization of system resources such as memory and I/O devices.

1. CPU Utilization:
o Description: This criterion aims to keep the CPU as busy as possible. The goal is to
maximize the amount of time the CPU is actively processing tasks, minimizing idle
time.
o Importance: High CPU utilization ensures that the system is being used efficiently
and no resources are wasted. This is especially important in systems where
maximizing throughput is crucial.
2. Throughput:
o Description: Throughput refers to the number of processes completed within a given
time period. It is a measure of how many tasks the system can execute per unit of
time.
o Importance: A higher throughput indicates that the system is processing tasks
efficiently. This criterion is important in systems where completing as many tasks as
possible in a short time is desired.
Both criteria help the operating system optimize its performance by balancing CPU usage and task
completion.
Q3.A) Describe use of ps and wait commands with suitable examples. 4marks
Answer:
1. ps Command:
o Use: The ps command is used to display information about currently running
processes in a system. It shows details like process ID (PID), terminal, CPU usage,
and memory usage.
Example:
ps
Output:
yaml
Copy code
PID TTY TIME CMD
1234 pts/0 00:00:01 bash
5678 pts/0 00:00:00 ps
This example shows two processes: the bash shell and the ps command itself.
1. wait Command:
o Use: The wait command makes the shell wait for background processes to finish
before moving to the next command. It ensures the parent process waits until child
processes complete.
Example:
// Start a background process
sleep 10 &
// Wait for the process to finish
wait
echo "Background process completed"
In this example, the wait command pauses the shell until the sleep command (background process)
finishes. After that, the message is printed.
Q3.b) escribe prevention of deadlock occurrence with respect to hold and wait necessary
condition.
Answer:
Hold and Wait Condition:
This condition occurs when a process holds at least one resource and waits for additional resources
that are currently held by other processes.
Prevention of Deadlock with Respect to Hold and Wait:
To prevent deadlock, the operating system ensures that the Hold and Wait condition cannot occur.
This can be achieved by:
1. Requiring Processes to Request All Resources at Once:
o Processes must request all the resources they will need at the start. If all resources are
not available, the process must wait without holding any resource.
o Advantage: Eliminates the scenario where a process holds some resources and waits
for others.
o Disadvantage: May lead to underutilization of resources, as some processes may
reserve resources unnecessarily.
2. Releasing Resources Before Requesting New Ones:
o A process holding resources must release them before making additional resource
requests.
o The process is restarted only after it can acquire all the resources it needs.

o Advantage: Reduces the chance of deadlock as processes do not hold and wait
simultaneously.
o Disadvantage: Overhead in restarting processes and may reduce system efficiency.

Example:
If Process A needs Resource X and Resource Y:
 Without Prevention: Process A may hold Resource X and wait for Resource Y, leading to a
deadlock if Resource Y is held by another process.
 With Prevention: Process A must either request both X and Y simultaneously or release X
before waiting for Y, ensuring no hold-and-wait condition occurs.
By preventing the Hold and Wait condition, deadlock occurrence can be minimized in the system.

Q3.C) With suitable diagram, describe the concept of variable partitioning of memory.

Answer:
Variable Partitioning of Memory:
In variable partitioning, the main memory is divided into sections of variable sizes based on the
memory requirements of processes. Unlike fixed partitioning, the partitions are not pre-determined;
instead, they are created dynamically as processes are loaded.
Working:
1. When a process arrives, the operating system searches for a free memory block large enough
to accommodate it.
2. If such a block is found, the process is loaded into that block, and the remaining space
becomes a smaller free block.
3. Memory is allocated and deallocated dynamically as processes arrive and terminate, creating
free spaces (holes).
Advantages:
 Efficient memory utilization since memory is allocated based on process requirements.
 Can handle processes of varying sizes.
Disadvantages:
 Fragmentation: Over time, free memory becomes scattered into small non-contiguous blocks,
making it difficult to allocate large processes.
Diagram:
Processes size

Q3.D) Describe linked file allocation method with suitable example. Also list its one advantage.
Answer:
Linked File Allocation Method:
In the linked file allocation method, files are stored as a linked list of blocks. Each block contains data
and a pointer to the next block in the sequence. The blocks can be scattered throughout the disk, and
the file’s directory entry stores the starting block number.
Working:
1. A file is broken into several blocks.
2. Each block is linked to the next block using a pointer.
3. The last block of the file contains a special end-of-file (EOF) marker instead of a pointer.
Example:
Consider a file named "File1" that is stored using linked allocation:
 Block 5 contains part of the file data and a pointer to Block 8.
 Block 8 contains more data and a pointer to Block 12.
 Block 12 contains the last part of the data and an EOF marker.
The sequence of blocks for "File1" is: 5 → 8 → 12 (EOF).
Diagram:
+---------+----------+----------+
| Block 5 | Data | Pointer → 8 |
+---------+----------+----------+
| Block 8 | Data | Pointer → 12 |
+---------+----------+----------+
| Block 12| Data | EOF |
+---------+----------+----------+
Advantage:
 Efficient Space Utilization:
Since the blocks do not need to be contiguous, this method eliminates external fragmentation
and allows better utilization of disk space.
Limitation:
 Accessing data can be slower because the system must follow the pointers to retrieve all parts
of the file.

Q4.A) Differentiate between command line-based operating system and GUI-based


operating system.

Answer:

Feature Command Line-Based OS GUI-Based OS


User Text-based interface where Graphical interface with windows,
Interface commands are typed. icons, and menus.
Ease of Use Difficult for beginners; requires Easy to use; suitable for all users,
knowledge of commands. including beginners.
Speed Faster as it uses fewer system Slower due to higher resource usage
resources. for graphical elements.
Examples DOS, Linux (Command Line Windows, macOS, Ubuntu (GUI
Mode). Mode).
Flexibility More flexible for advanced users Less flexible but more intuitive for
and automation. general tasks.
Error Errors are displayed as text Errors are displayed as graphical
Handling messages. messages with options to fix them.

Q4.B) Describe various activities performed by the following operating system components.
i) Main Memory Management:
Answer:
Main memory management is a crucial function of the operating system that manages the primary
memory (RAM). The key activities performed by the main memory management component include:
1. Memory Allocation:
The operating system allocates memory to processes when they need it and ensures that each
process gets the memory it requires without exceeding the available capacity.
2. Tracking Memory Usage:
The OS keeps track of all memory locations in use and available memory to avoid
fragmentation and ensure efficient use of space.
3. Memory Deallocation:
When processes finish, the OS releases the allocated memory back to the system so it can be
reused by other processes.
4. Address Mapping:
The OS maps the logical addresses (used by processes) to physical addresses (actual locations
in RAM), often using techniques like paging or segmentation.
5. Protection:
The OS protects processes from accessing each other's memory to prevent unauthorized
access and corruption of data.

ii) File Management:


Answer:
File management is responsible for handling the organization, storage, retrieval, and manipulation of
files. The key activities performed by the file management component include:
1. File Creation and Deletion:
The OS allows the creation of new files and the deletion of old ones. It manages the metadata
of files such as name, size, and location.
2. File Storage and Organization:
The OS organizes files in a directory structure (like folders) to make it easier for users and
programs to access them.
3. File Access Control:
The OS manages access to files by defining permissions (read, write, execute) for users and
processes to ensure security.
4. File Reading and Writing:
The OS provides methods for reading from and writing to files, ensuring that data is correctly
stored or retrieved.
5. File Protection:
The OS ensures that files are protected from unauthorized access and corruption. It uses
techniques like file permissions and encryption.
6. File System Management:
The OS manages the file system, including organizing and maintaining the structure of files
and directories on storage devices like hard drives.

You might also like