0% found this document useful (0 votes)
19 views27 pages

Operating System Winter 2019

operating system model answer paper for the diploma 3rd year students of 5th semster

Uploaded by

Mayur Gaikwad
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)
19 views27 pages

Operating System Winter 2019

operating system model answer paper for the diploma 3rd year students of 5th semster

Uploaded by

Mayur Gaikwad
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/ 27

OPERATING SYSTEM WINTER 2019

2 MARKS
1) Define real time operating system. List its any four applications of it. ?
Ans:
1. An RTOS is a system that runs tasks on time.
2. It makes sure tasks finish within a fixed time.
3. It handles many tasks at once with little delay.
4. It is used in devices that need quick and exact responses.
Types of real time operating system
1. Hard real-time 2. Soft real-time
Applications:
1. Flight Control System 2. Simulations
3. Industrial control 4. Military applications
2) Explain any 4 services provided by OS.?
Ans :
1. File Management:
The OS manages files by organizing, storing, retrieving, and deleting them on
storage devices.
2. Process Management:
It handles the execution of processes, including multitasking, scheduling, and
termination.
3. Memory Management:
The OS allocates and manages memory for processes, ensuring efficient use of
RAM.
4. Device Management:
It controls and coordinates the use of input/output devices like printers,
keyboards, and monitors.
 3) Draw process state diagram.?
Ans :

1
Created By Mayur Gaikwad
 4) Explain any four scheduling criteria.?
Ans :
1. CPU Utilization
o It measures how much the CPU is kept busy.
o The usage can range from 0% (idle) to 100% (fully utilized).
2. Throughput
o It is the number of processes completed per unit of time.
o Faster process execution increases throughput.
3. Turnaround Time
o It is the time from process submission to its completion.
o Includes waiting, ready queue, CPU execution, and I/O time.
4. Waiting Time
o It is the time a process spends in the ready queue.
o A process waits until the CPU is assigned to it.
5) Define virtual memory ?
Ans :
1. Virtual memory helps manage limited physical memory.
2. It uses software and hardware to temporarily move data from RAM to disk.
3. This allows the system to handle more tasks than the available RAM.
4. It is useful when there is not enough RAM to run all programs.
 6) Write syntax for following commands:

2
Created By Mayur Gaikwad
i)Sleep ii)Kill ?
Ans :
i)kill
Syntax: kill pid
Kill command is used to stop execution of particular process by sending an interrupt
signal to the process
ii)Sleep
Syntax: sleep NUMBER[SUFFIX]
The sleep command pauses the execution for specified time in command.

7) Describe any four file attributes ?


Ans:
1. Name
o The file has a human-readable name.
o It helps users identify the file easily.
2. Identifier
o Each file gets a unique number or tag.
o This number is used internally by the system.
3. Type
o Shows what kind of file it is (e.g., text, image).
o Useful for systems that handle different file types.
4. Location
o Indicates where the file is stored on the device.
o Helps the system quickly find the file.
5. Size
o Shows the current size of the file in bytes or blocks.
o May include the maximum allowed size of the file.
6. Protection
o Defines who can read, write, or execute the file.
3
Created By Mayur Gaikwad
o Ensures the file's security and controlled access.
7. Time, Date, and User identification
o Records when the file was created or last modified.
o Tracks the user for security and usage monitoring.

[Q2] 4 MARKS
1) Enlist types of operating system. Explain multiprogramming OS in detail. ?
Ans :
Types of operating system
1.Batch Systems 2.Multiprogramming
3.Multitasking 4.Time-Sharing Systems
5.Desktop Systems 6.Distributed system
7.Clustered system 8.Real Time system:
Multiprogramming:
1. In multiprogramming, multiple programs are stored in memory.
2. The scheduler selects jobs to be placed in the ready queue.
3. The ready queue is in memory, allowing multiple programs in main memory.
4. Only one processor is available, so programs run one at a time.

 2) List components of OS. Explain process management in detail.?


Ans:
List of System Components:

4
Created By Mayur Gaikwad
1. Process Management 2. Main Memory Management
3. File Management 4. I/O System Management
5. Secondary Storage Management

1. Process Management
o Manages process creation, scheduling, and termination.
o Allocates CPU time and ensures efficient execution of processes.
o Example: Managing programs like a web browser or text editor.
2. Main Memory Management
o Allocates and deallocates memory for processes and data.
o Keeps track of memory usage to prevent overlap and optimize utilization.
o Example: Allocating memory for apps like Word or Chrome
3. File Management
o Manages file creation, deletion, and access permissions.
o Organizes files into directories for efficient data retrieval.
o Example: Storing and organizing files in folders.
4. I/O System Management
o Controls interactions between processes and input/output devices.
o Manages device drivers and ensures smooth communication with
hardware.
o Example: Managing data transfer between the computer and devices like
keyboard or printer.
5. Secondary Storage Management
o Handles storage allocation and retrieval in secondary devices like hard
drives.
o Maintains data organization and ensures efficient storage access.
6.
o Example: Storing files on a hard drive or SSD.

5
Created By Mayur Gaikwad
 3) With neat diagram explain inter process communication model.?
Ans :
Inter-process communication:
i. Cooperating processes require an Inter- process communication (IPC)
mechanism that will allow them to exchange data and information.
ii. It helps processes share information and coordinate actions.
iii. IPC can be done using methods like messages, signals, or shared memory.
There are two models of IPC
1. Shared memory
2. Message Passing

1. Shared memory ;
1. Shared memory allows multiple processes to communicate by accessing a common
memory space.
2. One process writes data into the shared memory, and another process reads it.

3. It is fast because data doesn’t need to be copied between processes.


4. Synchronization tools like semaphores are used to avoid data conflicts.

6
Created By Mayur Gaikwad
2. Message Passing :
1. Communication occurs by exchanging messages between processes.
2. Processes can communicate without sharing the same memory space.
3. It is useful in distributed systems where processes are on different computers.
4. Messages are sent and received through the kernel.
5. Each pair of communicating processes has one communication link.

 4) Describe I/O Burst and CPU Burst cycle with neat diagram. ?
Ans :
CPU burst cycle:
i. It is a time period when process is busy with CPU
ii. It is the time when a process uses the CPU for execution.

7
Created By Mayur Gaikwad
iii. CPU bursts occur during computation or processing tasks.
I/O burst cycle:
i. It is a time period when process is busy in working with I/O resources.

ii. It is the time when a process performs input/output operations.


iii. I/O bursts occur while waiting for data from devices like disk or network.

[Q3] 4 MARKS

1) Explain ‘PS’ command with any four options. ?


Ans :
ps command :
1. The ps command shows information about running processes.
2. When used without options, it lists processes for a user at the current terminal.

8
Created By Mayur Gaikwad
OPTIONS :
1. -f option:
o Provides a full listing of process attributes.
o Displays details like UID (user ID), PPID (parent process ID), C (CPU time
used), and STIME (start time of the process).

2. -u:
Shows the activities of any specified user at any time.
Example: $ ps -u abc

3. -a:
It shows the processes of all users.
Example: $ ps -a

4. -e:
It displays processes including user and system processes.
example: $ ps -e

9
Created By Mayur Gaikwad
 2) Explain deadlock? What are necessary conditions for deadlock?
Ans :
DeadLock :
i. A deadlock occurs in a system when two or more processes are unable to
proceed because each is waiting for resources that the other processes are
holding. This results in a situation where none of the processes can continue
execution.
ii. Conditions: Deadlock requires four conditions: mutual exclusion, hold and wait,
no preemption, and circular wait.

Conditions Necessary for Deadlock


1. Mutual Exclusion
 At least one resource is non-shareable.
 Only one process can use the resource at a time
2. Hold and Wait
o A process holds one resource and waits for another.
o The other resource is held by another process.
3 .No Preemption
o Resources cannot be forcibly taken from a process.
o A process must release the resource voluntarily.
4. Circular Wait
o Processes form a circular chain, each waiting for a resource.
 Each process depends on the next process in the chain

10
Created By Mayur Gaikwad
 3) Explain partitioning and its types. ?
Ans :
1. Partitioning
 It is the process of dividing a computer's memory or disk into smaller
sections for better management.
 Helps organize data, improve performance, and efficiently allocate
resources.

Types of partitioning

 Fixed partitioning i.e. static partitioning


 Variable partitioning i.e. dynamic partitioning

 Fixed partitioning i.e. static partitioning :


i. Memory is divided into number of fixed size partitions, which is called as fixed or static
memory partitioning.
ii. Each partition contains exactly one process.
iii. The number of programs to be executed depends on number of partitions.
iv. A free memory partition is assigned to a process from the input queue when available.

11
Created By Mayur Gaikwad
Variable partitioning :
1. Memory is divided into parts based on what each process needs. The number
and size of these parts can change.
2. The system gives each process exactly the memory it needs and leaves the rest
free for other processes.
3. The operating system keeps a table to track which parts of memory are in use
and which are free.
4. Over time, small gaps can appear in memory as processes start and finish.

12
Created By Mayur Gaikwad
4) Describe sequential and direct access method ?
Ans :
Sequential Access Method
1. Data is accessed in a fixed order, starting from the beginning.
2. You must access one data item at a time, in sequence.
3. Commonly used in applications like tape storage.
4. Example is reading a book page by page without skipping.

Direct Access Method


1. Data can be accessed randomly from any location.
2. No need to go through other data items to access one.
3. Used in applications needing fast access, like hard drives.
4. Example is searching for a word in a document and jumping directly to it.

13
Created By Mayur Gaikwad
[4] 4 MARKS
1) Write Unix command for following:
i)create a folder OSY ii) create a file FIRST in OSY folder
iii) List/display all files and directories. iv) Write command to clear the screen
Ans :
i) create a folder OSY:
$mkdir OSY
ii)create a file FIRST in OSY folder:
$cd
OSY $cat>FIRST or $ touch FIRST
iii) List/display all files and directories:
$ls
iv) to clear screen:
$clear
2) What is purpose of system call? State two system calls with their functions. ?
Ans :
System Calls
1. Process Control
o Manages process operations like creation, execution, and termination.
o Includes operations for process synchronization and scheduling.
Example :
 fork(): Creates a new process.
 exec(): Replaces a process's memory with a new program.
 exit(): Terminates a process.
wait(): Waits for a child process to finish execution
2. File Management
o Handles file-related tasks like creating, opening, reading, writing, and
deleting files.

14
Created By Mayur Gaikwad
o Also manages file attributes and directory structures.
Example :
o open(): Opens a file for use.
o read(): Reads data from a file.
o write(): Writes data to a file.
o close(): Closes an open file.
o unlink(): Deletes a file.

3. Device Management
o Manages devices by requesting, allocating, and releasing them.
o Ensures proper interaction between processes and hardware devices.
Example :
 ioctl(): Sends control commands to a device.
 read(): Reads data from a device.
 write(): Writes data to a device

4. Information Maintenance
o Retrieves or modifies system information like process details and system
time.
o Helps monitor and maintain system operations effectively.
Example :
 getpid(): Retrieves the process ID of the current process.
 alarm(): Sets a timer for a process.
 sleep(): Suspends a process for a specific duration.
 gettimeofday(): Gets the current system time.
5. Communication
o Enables processes to exchange data and coordinate activities.

15
Created By Mayur Gaikwad
o Includes methods for interprocess communication like shared memory and
messaging.
Example :
 pipe(): Establishes a communication channel between processes.
 msgsend(): Sends a message to another process.
 msgrcv(): Receives a message from another process.
 shmget(): Allocates shared memory.
 shmat(): Attaches shared memory to a process.

3) State and describe types of scheduler. ?


Ans :
There are three types of scheduler:
 Long term scheduler  Short term scheduler  Medium term scheduler
Long-term Scheduler (Job Scheduler)
 Decides which processes are admitted into the ready queue.
 Controls the degree of multiprogramming (how many processes are in memory).
 Runs less frequently as it decides the overall process flow.
 Example: Decides when to load a program into memory.

16
Created By Mayur Gaikwad
Short-term Scheduler (CPU Scheduler)
 Decides which process from the ready queue gets CPU time next.
 Runs frequently, often many times per second.
 Makes quick decisions about process execution.
 Example: Decides which process runs next on the CPU.

Medium-term Scheduler
 Controls the swapping of processes between the main memory and secondary
storage (e.g., disk).
 Decides which processes should be swapped in or out of memory.
 Helps improve memory utilization by controlling which processes are in memory.
 Example: Moves a process from memory to disk when there is not enough
space.

17
Created By Mayur Gaikwad
4) Explain Round Robin algorithm with suitable example. ?
Ans :
Round Robin (RR) Algorithm
1. Definition
o Round Robin is a CPU scheduling algorithm where each process is
assigned a fixed time slice or quantum.
o If a process does not finish within its time slice, it is moved to the back of
the ready queue.
o The CPU scheduler then picks the next process in the queue for
execution.
o This continues until all processes are completed.
2. Example
o Consider three processes with burst times:
 Process P1 = 4 units
 Process P2 = 3 units
 Process P3 = 5 units
o Time quantum = 2 units.
o The processes are executed in turns, with each process getting up to 2
units of CPU time before moving to the next one.
3. Execution
o P1 runs for 2 units, then P2 runs for 2 units, and P3 runs for 2 units.
o The cycle repeats with each process getting a fixed time slice until they
finish.
4. Final Completion Order
o P1 → P2 → P3 (each process finishes after its allocated time slices).
Diagram

Time: 0 2 4 6 8 9 11
Process: P1 → P2 → P3 → P1 → P2 →
P3

18
Created By Mayur Gaikwad
 5) Explain PCB with diagram. ?
Ans :
Process:
i. A process is defined as, a program under execution, which competes for the
CPU time and other resources. A process is a program in execution. Process is
also called as job, task and unit of work
ii. It uses system resources like memory, CPU time, and I/O devices.
iii. It represents the basic unit of work managed by the operating system.

Information in Process Control Block


1. Pointer
o Stores the stack pointer during process switching.
o Helps retain the current position of the process.
2. Process State
o Records the current state of the process (e.g., ready, running).
o Ensures proper scheduling and state management.
3. Process Number

19
Created By Mayur Gaikwad
o Assigns a unique Process ID (PID) to each process.
o Helps in process identification and management.
4. Program Counter
o Holds the address of the next instruction to execute.
o Ensures continuity of the process during execution.
5. Registers
o Saves process-specific register values during swaps.
o Restores register values when the process resumes.
6. Memory Limits
o Stores information about memory usage, like page tables.
o Ensures proper memory allocation and management.
7. List of Open Files
o Contains details of files currently open for the process.
 Tracks file usage for smooth process execution

[Q5] 6 MARKS
1) Enlist the operating system tools. Explain any two in detail. ?
Ans :
Following are the operating tools:
 User Management  Security policy
 Device Management  Performance Monitor  Task Scheduler

1. User Management
 Manages user accounts and permissions.
 Creates, deletes, and modifies user profiles.
 Controls access to system resources.
 Example: Windows User Accounts settings.
2. Security Policy

20
Created By Mayur Gaikwad
 Sets rules for system security.
 Manages passwords, login attempts, and access control.
 Configures encryption and firewall settings.
 Example: Windows Local Security Policy settings.
3. Device Management
 Manages hardware devices and drivers.
 Installs, updates, and removes device drivers.
 Resolves device conflicts and allocates resources.
 Example: Windows Device Manager.
4. Performance Monitor
 Monitors system performance (CPU, memory, disk).
 Tracks resource usage and generates reports.
 Helps identify performance issues.
 Example: Windows Task Manager and Resource Monitor.
5. Task Scheduler
 Automates tasks to run at specific times.
 Schedules backups, scans, and other repetitive tasks.
 Allows running tasks with specific privileges.
 Example: Windows Task Scheduler.

2) Explain multithreading model in detail. ?


Ans:
Multithreading :
1. Multithreading allows multiple tasks to run simultaneously in a program.
2. Each task is executed by a separate thread that shares the same resources.
3. It enhances program performance by better utilizing CPU power.
4. Threads run independently but are managed within the same process.

21
Created By Mayur Gaikwad
One-to-One Model
1. Each user thread is mapped to a kernel thread.
2. Allows better concurrency than the many-to-one model, as other threads can run
when one is blocked.
3. Supports parallel execution on multiprocessors.
4. Most systems limit the number of threads to avoid performance issues.
5. Examples include Linux and Windows operating systems.
Advantages
1. Better concurrency and parallelism.
2. Threads can run simultaneously on multiple processors.
3. More efficient handling of blocking system calls.
Disadvantages
1. High overhead because each user thread needs a kernel thread.
2. Limits the number of threads due to kernel thread creation cost.
3. Increased system resource usage.

Many-to-Many Model
1. Many user-level threads are mapped to a smaller or equal number of kernel
threads.
2. The number of kernel threads can vary based on the application or the machine
type (more on multiprocessors).

22
Created By Mayur Gaikwad
3. Kernel can schedule another thread when one performs a blocking system call.
4. Supports parallel execution on multiprocessors, improving performance.
Advantages
1. No limit on the number of user threads.
2. Can run multiple threads in parallel on multiprocessors.
3. More efficient in handling blocking system calls.
Disadvantages
1. Complex implementation compared to the other models.
2. The overhead of managing multiple kernel threads.
3. May require more system resources than simpler models.

Many-to-One Model
1. Many user-level threads are mapped to a single kernel thread.
2. Thread management is handled by the user-level thread library, which makes it
efficient.
3. If one thread makes a blocking system call, the whole process gets blocked.
4. An example is Green threads, a thread library available for Solaris.

1. Advantages
o Thread management is quick and efficient in user space.
o Threads use less memory and resources.
o Easy to implement on single-core processors.

23
Created By Mayur Gaikwad
2. Disadvantages
o If one thread is blocked, the whole process is blocked.
o Can’t use multiple processors or cores.
o Limited performance on multi-core systems.

[Q6] 6 MARKS
 1) List free space management techniques? Describe any one in detail. ?
Ans :
Bitmap Free Space Management
1. In bitmap free space management, the memory is represented by a bit array
where each bit corresponds to a block of memory.
2. A bit of 1 means the block is free, and a bit of 0 means the block is occupied.
3. The bitmap allows quick identification of free or used memory blocks.

24
Created By Mayur Gaikwad
4. It is simple and easy to implement for managing free space.

Advantages
1. Fast to find free blocks using bit operations.
2. Simple and easy to implement.
3. Efficient for managing large memory areas.
4. Works well with fixed-sized memory blocks.
Disadvantages
1. Requires extra memory to store the bitmap.
2. Searching for a large number of free blocks can be time-consuming.
3. Fragmentation may occur.
4. Managing memory with different sizes is inefficient.

Linked List Free Space Management


1. In linked list free space management, free memory blocks are linked together in
a list.
2. Each free block points to the next free block, making it easy to track and allocate
free space.
3. The system can easily allocate and deallocate memory by adding or removing
blocks from the list.
4. It’s effective for managing memory of different sizes.
Advantages

25
Created By Mayur Gaikwad
1. Efficient for allocating and deallocating memory.
2. Handles different block sizes well.
3. Avoids fragmentation by linking free blocks together.
4. Easy to implement and maintain for dynamic memory.
Disadvantages
1. Searching for free blocks can be slower.
2. Requires pointers for each block, which can increase memory usage.
3. Can cause fragmentation if blocks are not allocated efficiently.
4. The linked list can grow large, affecting performance.

 2) Enlist different file allocation methods? Explain contiguous allocation method


in detail
Ans :
File allocation :

1. File allocation refers to how files are stored on a disk and organized for easy
access.

26
Created By Mayur Gaikwad
2. It determines where and how file data is placed in disk storage, affecting speed
and efficiency
Three major methods of allocating disk space are in wide use:

 Contiguous
 Linked

 Indexed
Contiguous File Allocation :
1. File Allocation: A file occupies a set of contiguous blocks on the disk. If a file is
'n' blocks long and starts at block 'b', it occupies blocks from b to b+n-1.
2. Directory Entry: The directory stores the starting block and the length of the
allocated space for each file.
3. Access Types: Supports both sequential and direct access. For direct access to
block 'i', the block can be found at b+i.
4. Space Finding Issue: The challenge is finding 'n' contiguous free blocks for a
new file, which requires searching for enough free space.

Advantages
1. Fast access to files because the data is stored in consecutive blocks.
2. Simple to implement and manage.
Disadvantages
1. Can lead to fragmentation over time as free space gets scattered.
2. May require large contiguous free space, limiting flexibility.

27
Created By Mayur Gaikwad

You might also like